本文整理汇总了Java中com.github.springtestdbunit.annotation.DatabaseOperation类的典型用法代码示例。如果您正苦于以下问题:Java DatabaseOperation类的具体用法?Java DatabaseOperation怎么用?Java DatabaseOperation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DatabaseOperation类属于com.github.springtestdbunit.annotation包,在下文中一共展示了DatabaseOperation类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFindWidgetsBundlesByTenantId
import com.github.springtestdbunit.annotation.DatabaseOperation; //导入依赖的package包/类
@Test
@DatabaseSetup(value = "classpath:dbunit/widgets_bundle.xml", type= DatabaseOperation.DELETE_ALL)
public void testFindWidgetsBundlesByTenantId() {
UUID tenantId1 = UUIDs.timeBased();
UUID tenantId2 = UUIDs.timeBased();
// Create a bunch of widgetBundles
for (int i= 0; i < 10; i++) {
createWidgetBundles(3, tenantId1, "WB1_");
createWidgetBundles(5, tenantId2, "WB2_");
createSystemWidgetBundles(10, "WB_SYS_");
}
assertEquals(180, widgetsBundleDao.find().size());
TextPageLink textPageLink1 = new TextPageLink(40, "WB");
List<WidgetsBundle> widgetsBundles1 = widgetsBundleDao.findTenantWidgetsBundlesByTenantId(tenantId1, textPageLink1);
assertEquals(30, widgetsBundles1.size());
TextPageLink textPageLink2 = new TextPageLink(40, "WB");
List<WidgetsBundle> widgetsBundles2 = widgetsBundleDao.findTenantWidgetsBundlesByTenantId(tenantId2, textPageLink2);
assertEquals(40, widgetsBundles2.size());
TextPageLink textPageLink3 = new TextPageLink(40, "WB",
widgetsBundles2.get(39).getId().getId(), null);
List<WidgetsBundle> widgetsBundles3 = widgetsBundleDao.findTenantWidgetsBundlesByTenantId(tenantId2, textPageLink3);
assertEquals(10, widgetsBundles3.size());
}
示例2: get
import com.github.springtestdbunit.annotation.DatabaseOperation; //导入依赖的package包/类
@Override
public org.dbunit.operation.DatabaseOperation get(DatabaseOperation databaseOperation) {
if (databaseOperation == DatabaseOperation.TRUNCATE_TABLE) {
return SEQUENCE_RESETTER;
}
return new DefaultDatabaseOperationLookup().get(databaseOperation);
}
示例3: findByUser
import com.github.springtestdbunit.annotation.DatabaseOperation; //导入依赖的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));
}
示例4: testFindWidgetsBundleByTenantIdAndAlias
import com.github.springtestdbunit.annotation.DatabaseOperation; //导入依赖的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());
}
示例5: testFindSystemWidgetsBundles
import com.github.springtestdbunit.annotation.DatabaseOperation; //导入依赖的package包/类
@Test
@DatabaseSetup(value = "classpath:dbunit/widgets_bundle.xml", type= DatabaseOperation.DELETE_ALL)
public void testFindSystemWidgetsBundles() {
createSystemWidgetBundles(30, "WB_");
assertEquals(30, widgetsBundleDao.find().size());
// Get first page
TextPageLink textPageLink1 = new TextPageLink(10, "WB");
List<WidgetsBundle> widgetsBundles1 = widgetsBundleDao.findSystemWidgetsBundles(textPageLink1);
assertEquals(10, widgetsBundles1.size());
// Get next page
TextPageLink textPageLink2 = new TextPageLink(10, "WB", widgetsBundles1.get(9).getId().getId(), null);
List<WidgetsBundle> widgetsBundles2 = widgetsBundleDao.findSystemWidgetsBundles(textPageLink2);
assertEquals(10, widgetsBundles2.size());
}
示例6: testFindAllWidgetsBundlesByTenantId
import com.github.springtestdbunit.annotation.DatabaseOperation; //导入依赖的package包/类
@Test
@DatabaseSetup(value = "classpath:dbunit/widgets_bundle.xml", type= DatabaseOperation.DELETE_ALL)
public void testFindAllWidgetsBundlesByTenantId() {
UUID tenantId1 = UUIDs.timeBased();
UUID tenantId2 = UUIDs.timeBased();
// Create a bunch of widgetBundles
for (int i= 0; i < 10; i++) {
createWidgetBundles( 5, tenantId1,"WB1_");
createWidgetBundles(3, tenantId2, "WB2_");
createSystemWidgetBundles(2, "WB_SYS_");
}
TextPageLink textPageLink1 = new TextPageLink(30, "WB");
List<WidgetsBundle> widgetsBundles1 = widgetsBundleDao.findAllTenantWidgetsBundlesByTenantId(tenantId1, textPageLink1);
assertEquals(30, widgetsBundles1.size());
TextPageLink textPageLink2 = new TextPageLink(30, "WB",
widgetsBundles1.get(29).getId().getId(), null);
List<WidgetsBundle> widgetsBundles2 = widgetsBundleDao.findAllTenantWidgetsBundlesByTenantId(tenantId1, textPageLink2);
assertEquals(30, widgetsBundles2.size());
TextPageLink textPageLink3 = new TextPageLink(30, "WB",
widgetsBundles2.get(29).getId().getId(), null);
List<WidgetsBundle> widgetsBundles3 = widgetsBundleDao.findAllTenantWidgetsBundlesByTenantId(tenantId1, textPageLink3);
assertEquals(10, widgetsBundles3.size());
TextPageLink textPageLink4 = new TextPageLink(30, "WB",
widgetsBundles3.get(9).getId().getId(), null);
List<WidgetsBundle> widgetsBundles4 = widgetsBundleDao.findAllTenantWidgetsBundlesByTenantId(tenantId1, textPageLink4);
assertEquals(0, widgetsBundles4.size());
}
示例7: testSearchTextNotFound
import com.github.springtestdbunit.annotation.DatabaseOperation; //导入依赖的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());
}
示例8: testAddPhone
import com.github.springtestdbunit.annotation.DatabaseOperation; //导入依赖的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");
}
示例9: testFindAll
import com.github.springtestdbunit.annotation.DatabaseOperation; //导入依赖的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());
}