use of com.github.springtestdbunit.annotation.DatabaseSetups in project mybatis.flying by limeng32.
the class BatchProcessTest method testUpdateBatch3.
@Test
@DatabaseSetups({ @DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/batchProcessTest/testUpdateBatch.datasource.xml") })
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/batchProcessTest/testUpdateBatch3.datasource.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/batchProcessTest/testUpdateBatch.datasource.result.xml") })
public void testUpdateBatch3() {
List<Account_> l = new LinkedList<>();
Account_ a1 = new Account_();
Account_ a2 = new Account_();
Account_ a3 = new Account_();
a1.setId(1L);
a1.setName("ann1");
l.add(a1);
a2.setId(2L);
a2.setName("bob2");
a2.setPassword("b");
a2.setStatus(StoryStatus_.CANCEL);
Role_ r1 = new Role_();
r1.setId(11);
a2.setRole(r1);
l.add(a2);
a3.setId(3L);
a3.setName("carl3");
Role_ r2 = new Role_();
r2.setId(24);
a3.setRole(r2);
l.add(a3);
int i = accountService.updateBatch(l);
System.out.println("::" + i);
}
use of com.github.springtestdbunit.annotation.DatabaseSetups in project mybatis.flying by limeng32.
the class BatchProcessTest method testUpdateBatch.
@Test
@DatabaseSetups({ @DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/batchProcessTest/testUpdateBatch.datasource.xml") })
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/batchProcessTest/testUpdateBatch.datasource.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/batchProcessTest/testUpdateBatch.datasource.result.xml") })
public void testUpdateBatch() {
List<Account_> l = new LinkedList<>();
Account_ a1 = new Account_();
Account_ a2 = new Account_();
Account_ a3 = new Account_();
a1.setId(1L);
a1.setName("ann1");
l.add(a1);
a2.setId(2L);
a2.setName("bob2");
a2.setPassword("b");
a2.setStatus(StoryStatus_.CANCEL);
Role_ r1 = new Role_();
r1.setId(11);
a2.setRole(r1);
l.add(a2);
a3.setId(3L);
a3.setName("carl3");
a3.setDelegateRoleId(24L);
l.add(a3);
int i = accountService.updateBatch(l);
System.out.println("::" + i);
}
use of com.github.springtestdbunit.annotation.DatabaseSetups in project mybatis.flying by limeng32.
the class GroupByTest method test1.
@Test
@DatabaseSetups({ @DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/groupByTest/test1.datasource.xml") })
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/groupByTest/test1.datasource.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/groupByTest/test1.datasource.xml") })
public void test1() {
List<Map<String, Object>> m = accountMapper.selectGroupBy2();
System.out.println("::" + m);
Account_ a = new Account_();
a.setName("ann");
List<Map<String, Object>> m2 = accountMapper.selectGroupBy(a);
System.out.println("::" + m2);
}
use of com.github.springtestdbunit.annotation.DatabaseSetups in project mybatis.flying by limeng32.
the class IgnoreInsertAndUpdateTest method testInsert.
@Test
@DatabaseSetups({ @DatabaseSetup(connection = "dataSource2", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/ignoreInsertAndUpdateTest/testInsert.datasource2.xml") })
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource2", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/ignoreInsertAndUpdateTest/testInsert.datasource2.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/ignoreInsertAndUpdateTest/testInsert.datasource2.result.xml") })
public void testInsert() {
Detail2_ d = new Detail2_(), d2 = new Detail2_();
d.setName("n");
d.setNumber(123);
d.setDetail("d");
d.setCreatetime(Calendar.getInstance().getTime());
detail2Service.insertWithoutName(d);
d2.setName("n2");
d2.setNumber(234);
d2.setDetail("d2");
d2.setCreatetime(Calendar.getInstance().getTime());
LoginLogSource2 loginLog2 = new LoginLogSource2();
loginLog2.setId(22);
d2.setLoginLogSource2(loginLog2);
detail2Service.insertWithoutFoo(d2);
}
use of com.github.springtestdbunit.annotation.DatabaseSetups in project mybatis.flying by limeng32.
the class IgnoreInsertAndUpdateTest method testInsertBatch.
@Test
@DatabaseSetups({ @DatabaseSetup(connection = "dataSource2", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/ignoreInsertAndUpdateTest/testInsertBatch.datasource2.xml") })
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource2", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/ignoreInsertAndUpdateTest/testInsertBatch.datasource2.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/ignoreInsertAndUpdateTest/testInsertBatch.datasource2.result.xml") })
public void testInsertBatch() {
Collection<Detail2_> dc = new ArrayList<>();
Detail2_ d1 = new Detail2_();
d1.setCreatetime(Calendar.getInstance().getTime());
d1.setName("n1");
d1.setNumber(123);
d1.setDetail("d");
LoginLogSource2 loginLog21 = new LoginLogSource2();
loginLog21.setId(11);
d1.setLoginLogSource2(loginLog21);
dc.add(d1);
Detail2_ d2 = new Detail2_();
d2.setCreatetime(Calendar.getInstance().getTime());
d2.setName("n2");
d2.setNumber(456);
d2.setDetail("e");
LoginLogSource2 loginLog22 = new LoginLogSource2();
loginLog22.setId(22);
d2.setLoginLogSource2(loginLog22);
dc.add(d2);
detail2Service.insertBatchWithoutName(dc);
}
Aggregations