当前位置: 首页>>代码示例>>Java>>正文


Java DatabaseTearDown类代码示例

本文整理汇总了Java中com.github.springtestdbunit.annotation.DatabaseTearDown的典型用法代码示例。如果您正苦于以下问题:Java DatabaseTearDown类的具体用法?Java DatabaseTearDown怎么用?Java DatabaseTearDown使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DatabaseTearDown类属于com.github.springtestdbunit.annotation包,在下文中一共展示了DatabaseTearDown类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveNextPageGroupsRandomizationTest

import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("QuestionnaireDefinitionSectionRandomizationEnabled-dataset.xml")
@DatabaseTearDown("QuestionnaireDefinitionSectionRandomizationEnabled-dataset.xml")
public void resolveNextPageGroupsRandomizationTest() {
    List<Integer> visitedQuestionIds = new ArrayList<Integer>();

    List<Integer> allQuestionIds = Arrays.asList(13, 12, 29, 30, 31, 35, 39, 50);

    Integer questionnaireId = 58;
    Questionnaire questionnaire = questionnaireService.findOne(questionnaireId);
    PageStructure pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.ENTERING);

    visitedQuestionIds.addAll(pageStructure.getQuestionsId());

    pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.NEXT);
    visitedQuestionIds.addAll(pageStructure.getQuestionsId());

    pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.NEXT);
    visitedQuestionIds.addAll(pageStructure.getQuestionsId());

    assertThat(visitedQuestionIds).containsAll(allQuestionIds);

}
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:24,代码来源:SectionBySectionResolverTest.java

示例2: resolveNextPageGroupsRandomizationTest

import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("QuestionnaireDefinitionSectionRandomizationEnabled-dataset.xml")
@DatabaseTearDown("QuestionnaireDefinitionSectionRandomizationEnabled-dataset.xml")
public void resolveNextPageGroupsRandomizationTest() {
    Integer questionnaireId = 58;
    Questionnaire questionnaire = questionnaireService.findOne(questionnaireId);
    PageStructure pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.ENTERING);
    List<Section> sections = pageStructure.getSections();

    assertThat(sections).hasSize(3);
    List<Question> visitedQuestions = new ArrayList<>();

    List<Question> allQuestions = getAllQuestions();
    Section firstGroup = sections.get(0);
    for (Question question : firstGroup.getQuestions()) {
        visitedQuestions.add(question);
    }
    assertThat(allQuestions).containsAll(visitedQuestions);
    
    assertQuestionNumberPresent(sections);
}
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:22,代码来源:AllInOneResolverTest.java

示例3: resolveNextPageQuestionRandomizationStrategyTest

import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("QuestionnaireDefinitionQuestionRandomizationEnabled-dataset.xml")
@DatabaseTearDown("QuestionnaireDefinitionQuestionRandomizationEnabled-dataset.xml")
public void resolveNextPageQuestionRandomizationStrategyTest() {
    Integer questionnaireId = 58;
    Questionnaire questionnaire = questionnaireService.findOne(questionnaireId);
    PageStructure pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.ENTERING);
    List<Section> sections = pageStructure.getSections();
    assertThat(sections).hasSize(1);

    List<Question> visitedQuestions = new ArrayList<>();

    List<Question> allQuestions = getAllQuestions();

    for (Section section : sections) {
        for (Question question : section.getQuestions()) {
            visitedQuestions.add(question);
        }
    }
    assertThat(allQuestions).containsAll(visitedQuestions);
    
    assertQuestionNumberPresent(sections);
}
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:24,代码来源:AllInOneResolverTest.java

示例4: findByUser

import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup(DATA_SET)
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = DATA_SET)
public void findByUser() throws Exception {
  assertThat(((Collection) repository.findAll()).size(), is(13));

  assertThat(repository.findByUser("nik").size(), is(6));
  assertThat(repository.findByUser("not nik").size(), is(3));
  assertThat(repository.findByUser("nik not").size(), is(2));
  assertThat(repository.findByUser("java").size(), is(1));
}
 
开发者ID:electr0Nik,项目名称:spring-boot-in-action,代码行数:12,代码来源:ProcessRepositoryTest.java

示例5: testFindWidgetsBundleByTenantIdAndAlias

import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup(value = "classpath:dbunit/widgets_bundle.xml",type= DatabaseOperation.CLEAN_INSERT)
@DatabaseTearDown(value = "classpath:dbunit/widgets_bundle.xml", type= DatabaseOperation.DELETE_ALL)
public void testFindWidgetsBundleByTenantIdAndAlias() {
    WidgetsBundle widgetsBundle = widgetsBundleDao.findWidgetsBundleByTenantIdAndAlias(
            UUID.fromString("250aca8e-2825-11e7-93ae-92361f002671"), "WB3");
    assertEquals("44e6af4e-2825-11e7-93ae-92361f002671", widgetsBundle.getId().toString());
}
 
开发者ID:thingsboard,项目名称:thingsboard,代码行数:9,代码来源:JpaWidgetsBundleDaoTest.java

示例6: testSearchTextNotFound

import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("classpath:dbunit/empty_dataset.xml")
@DatabaseTearDown(value = "classpath:dbunit/empty_dataset.xml", type= DatabaseOperation.DELETE_ALL)
public void testSearchTextNotFound() {
    UUID tenantId = UUIDs.timeBased();
    createWidgetBundles(5, tenantId, "ABC_");
    createSystemWidgetBundles(5, "SYS_");

    TextPageLink textPageLink = new TextPageLink(30, "TEXT_NOT_FOUND");
    List<WidgetsBundle> widgetsBundles4 = widgetsBundleDao.findAllTenantWidgetsBundlesByTenantId(tenantId, textPageLink);
    assertEquals(0, widgetsBundles4.size());
}
 
开发者ID:thingsboard,项目名称:thingsboard,代码行数:13,代码来源:JpaWidgetsBundleDaoTest.java

示例7: testAddPhone

import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("/dbtest/setup/customSampleData.xml")
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/dbtest/expected/customService_testAddPhone.xml")
@DatabaseTearDown(type=DatabaseOperation.DELETE, value="/dbtest/expected/customService_testAddPhone.xml")
public void testAddPhone() {
  customService.addCustomerPhone("CLIKE", "555-1234");
  customService.addCustomerPhone("CLIKE", "02-3456");
}
 
开发者ID:frank780117,项目名称:dbunit-ext,代码行数:9,代码来源:CustomServiceTest.java

示例8: createForSectionNoRandomizationTest

import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@DatabaseSetup("PageMetadataCreatorTest-dataset.xml")
@DatabaseTearDown("PageMetadataCreatorTest-dataset.xml")
@Test
public void createForSectionNoRandomizationTest() {
    Breadcrumb breadcrumb = breadcrumbService.findOne(201);
    PageMetadataStructure metadata = pageMetadataCreator.create(RandomizationStrategy.NONE,
            RenderingMode.SECTION_BY_SECTION, breadcrumb);
    assertThat(metadata.getCount()).isEqualTo(3);
    assertThat(metadata.getNumber()).isEqualTo(3);
}
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:11,代码来源:PageMetadataCreatorTest.java

示例9: createRandomizationPerQuestionEnabledTest

import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("PageMetadataCreatorQuestionRandomizationStrategyTest-dataset.xml")
@DatabaseTearDown("PageMetadataCreatorQuestionRandomizationStrategyTest-dataset.xml")
public void createRandomizationPerQuestionEnabledTest() {
    Breadcrumb breadcrumb = breadcrumbService.findOne(103);
    PageMetadataStructure metadata = pageMetadataCreator.create(RandomizationStrategy.QUESTIONS_RANDOMIZATION,
            RenderingMode.SECTION_BY_SECTION, breadcrumb);
    assertThat(metadata.getCount()).isEqualTo(8);
    assertThat(metadata.getNumber()).isEqualTo(2);
}
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:11,代码来源:PageMetadataCreatorTest.java

示例10: resolveNextPageNoRandomizationTest

import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("QuestionnaireDefinitionNoRandomizationEnabled-dataset.xml")
@DatabaseTearDown("QuestionnaireDefinitionNoRandomizationEnabled-dataset.xml")
public void resolveNextPageNoRandomizationTest() {
    Integer questionnaireId = 58;
    Questionnaire questionnaire = questionnaireService.findOne(questionnaireId);
    PageStructure pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.ENTERING);
    List<Section> sections = pageStructure.getSections();

    assertThat(sections).hasSize(3);

    Section firstGroup = sections.get(0);
    assertThat(firstGroup.getId()).isEqualTo(9);
    assertThat(firstGroup.getQuestions()).isEqualTo(
            Arrays.asList(Question.with().id(13).build(), Question.with().id(12).build(), Question.with().id(29)
                    .build()));

    Section secondGroup = sections.get(1);
    assertThat(secondGroup.getId()).isEqualTo(10);
    assertThat(secondGroup.getQuestions()).isEqualTo(
            Arrays.asList(Question.with().id(30).build(), Question.with().id(31).build(), Question.with().id(35)
                    .build()));

    Section thirdGroup = sections.get(2);
    assertThat(thirdGroup.getId()).isEqualTo(11);

    assertThat(thirdGroup.getQuestions()).isEqualTo(
            Arrays.asList(Question.with().id(39).build(), Question.with().id(50).build()));
    
    assertQuestionNumberPresent(sections);
}
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:32,代码来源:AllInOneResolverTest.java

示例11: resolveNextPageNoRandomizationEnabledDirty

import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("QuestionnaireDefinitionNoRandomizationEnabledGroupByGroupStarted-dataset.xml")
@DatabaseTearDown("QuestionnaireDefinitionNoRandomizationEnabledGroupByGroupStarted-dataset.xml")
public void resolveNextPageNoRandomizationEnabledDirty() {
    Integer questionnaireId = 58;
    Questionnaire questionnaire = questionnaireService.findOne(questionnaireId);
    PageStructure pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.ENTERING);
    List<Section> sections = pageStructure.getSections();

    assertThat(sections).hasSize(3);

    Section firstGroup = sections.get(0);
    assertThat(firstGroup.getId()).isEqualTo(9);
    assertThat(firstGroup.getQuestions()).isEqualTo(
            Arrays.asList(Question.with().id(13).build(), Question.with().id(12).build(), Question.with().id(29)
                    .build()));

    Section secondGroup = sections.get(1);
    assertThat(secondGroup.getId()).isEqualTo(10);
    assertThat(secondGroup.getQuestions()).isEqualTo(
            Arrays.asList(Question.with().id(30).build(), Question.with().id(31).build(), Question.with().id(35)
                    .build()));

    Section thirdGroup = sections.get(2);
    assertThat(thirdGroup.getId()).isEqualTo(11);

    assertThat(thirdGroup.getQuestions()).isEqualTo(
            Arrays.asList(Question.with().id(39).build(), Question.with().id(50).build()));
    
    assertQuestionNumberPresent(sections);
}
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:32,代码来源:AllInOneResolverTest.java

示例12: resolveNextPageNoRandomizationEnabledStarted

import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("QuestionnaireDefinitionNoRandomizationEnabledAllInOneStarted-dataset.xml")
@DatabaseTearDown("QuestionnaireDefinitionNoRandomizationEnabledAllInOneStarted-dataset.xml")
public void resolveNextPageNoRandomizationEnabledStarted() {
    Integer questionnaireId = 58;
    Questionnaire questionnaire = questionnaireService.findOne(questionnaireId);
    PageStructure pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.ENTERING);
    List<Section> sections = pageStructure.getSections();

    assertThat(sections).hasSize(3);

    Section firstGroup = sections.get(0);
    assertThat(firstGroup.getId()).isEqualTo(9);
    assertThat(firstGroup.getQuestions()).isEqualTo(
            Arrays.asList(Question.with().id(13).build(), Question.with().id(12).build(), Question.with().id(29)
                    .build()));

    Section secondGroup = sections.get(1);
    assertThat(secondGroup.getId()).isEqualTo(10);
    assertThat(secondGroup.getQuestions()).isEqualTo(
            Arrays.asList(Question.with().id(30).build(), Question.with().id(31).build(), Question.with().id(35)
                    .build()));

    Section thirdGroup = sections.get(2);
    assertThat(thirdGroup.getId()).isEqualTo(11);

    assertThat(thirdGroup.getQuestions()).isEqualTo(
            Arrays.asList(Question.with().id(39).build(), Question.with().id(50).build()));
    
    assertQuestionNumberPresent(sections);
}
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:32,代码来源:AllInOneResolverTest.java

示例13: testFindAll

import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup(value = "classpath:dbunit/widgets_bundle.xml",type= DatabaseOperation.CLEAN_INSERT)
@DatabaseTearDown(value = "classpath:dbunit/widgets_bundle.xml", type= DatabaseOperation.DELETE_ALL)
public void testFindAll() {
    assertEquals(7, widgetsBundleDao.find().size());
}
 
开发者ID:thingsboard,项目名称:thingsboard,代码行数:7,代码来源:JpaWidgetsBundleDaoTest.java

示例14: resolveNextPageNoRandomizationTest

import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("QuestionnaireDefinitionNoRandomizationEnabled-dataset.xml")
@DatabaseTearDown("QuestionnaireDefinitionNoRandomizationEnabled-dataset.xml")
public void resolveNextPageNoRandomizationTest() {
    Integer questionnaireId = 58;
    int questionNumberCounter = 1;
    Questionnaire questionnaire = questionnaireService.findOne(questionnaireId);
    PageStructure pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.ENTERING);
    
    List<Integer> questionIds = pageStructure.getQuestionsId();
    assertThat(questionIds).containsExactly(13);
    assertThat(pageStructure.getSections().get(0).getQuestions().get(0).getNumber()).isEqualTo(questionNumberCounter++);

    // Testing out of range
    boolean exceptionThrown = false;
    try {
        pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.PREVIOUS);
    }catch(IllegalArgumentException e){
        exceptionThrown = true;
    }
    assertThat(exceptionThrown);

    pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.NEXT);
    questionIds = pageStructure.getQuestionsId();
    assertThat(questionIds).containsExactly(12);
    assertThat(pageStructure.getSections().get(0).getQuestions().get(0).getNumber()).isEqualTo(questionNumberCounter++);

    pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.NEXT);
    questionIds = pageStructure.getQuestionsId();
    assertThat(questionIds).containsExactly(29);
    assertThat(pageStructure.getSections().get(0).getQuestions().get(0).getNumber()).isEqualTo(questionNumberCounter++);

    pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.NEXT);
    questionIds = pageStructure.getQuestionsId();
    assertThat(questionIds).containsExactly(30);
    assertThat(pageStructure.getSections().get(0).getQuestions().get(0).getNumber()).isEqualTo(questionNumberCounter++);

    pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.NEXT);
    questionIds = pageStructure.getQuestionsId();
    assertThat(questionIds).containsExactly(31);
    assertThat(pageStructure.getSections().get(0).getQuestions().get(0).getNumber()).isEqualTo(questionNumberCounter++);

    pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.NEXT);
    questionIds = pageStructure.getQuestionsId();
    assertThat(questionIds).containsExactly(35);
    assertThat(pageStructure.getSections().get(0).getQuestions().get(0).getNumber()).isEqualTo(questionNumberCounter++);

}
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:49,代码来源:QuestionByQuestionResolverTest.java


注:本文中的com.github.springtestdbunit.annotation.DatabaseTearDown类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。