use of indi.mybatis.flying.pojo.Account22 in project mybatis.flying by limeng32.
the class CacheTest method testNPlusOne2.
/* 一个展示n+1问题的测试用例 */
@Test
@IfProfileValue(name = "CACHE", value = "true")
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource1", assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED, value = "/indi/mybatis/flying/test/cacheTest/testNPlusOne2.datasource1.result.xml"), @ExpectedDatabase(connection = "dataSource2", assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED, value = "/indi/mybatis/flying/test/cacheTest/testNPlusOne2.datasource2.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/cacheTest/testNPlusOne2.datasource1.result.xml"), @DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/cacheTest/testNPlusOne2.datasource2.result.xml") })
public void testNPlusOne2() {
Role2_ r = new Role2_();
r.setId(1);
r.setName("root");
role2Service.insert(r);
Role2_ r2 = new Role2_();
r2.setId(2);
r2.setName("user");
role2Service.insert(r2);
Account22 a = new Account22();
a.setId(21);
a.setEmail("10");
a.setRole(r);
account22Service.insert(a);
Account22 a2 = new Account22();
a2.setId(22);
a2.setEmail("11");
a2.setRole(r);
account22Service.insert(a2);
Collection<Account22> accounts = account22Service.selectAll(new Account22());
Assert.assertEquals(2, accounts.size());
Collection<Account22> accounts2 = account22Service.selectAll(new Account22());
Collection<Account22> accounts3 = account22Service.selectAll(new Account22());
}
use of indi.mybatis.flying.pojo.Account22 in project mybatis.flying by limeng32.
the class CacheTest1 method testNPlusOne2.
/* 一个展示n+1问题的测试用例 */
@Test
@IfProfileValue(name = "CACHE", value = "true")
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource1", assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED, value = "/indi/mybatis/flying/test/cacheTest/testNPlusOne2.datasource1.result.xml"), @ExpectedDatabase(connection = "dataSource2", assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED, value = "/indi/mybatis/flying/test/cacheTest/testNPlusOne2.datasource2.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/cacheTest/testNPlusOne2.datasource1.result.xml"), @DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/cacheTest/testNPlusOne2.datasource2.result.xml") })
public void testNPlusOne2() {
Role2_ r = new Role2_();
r.setId(1);
r.setName("root");
role2Service.insert(r);
Role2_ r2 = new Role2_();
r2.setId(2);
r2.setName("user");
role2Service.insert(r2);
Account22 a = new Account22();
a.setId(21);
a.setEmail("10");
a.setRole(r);
account22Service.insert(a);
Account22 a2 = new Account22();
a2.setId(22);
a2.setEmail("11");
a2.setRole(r);
account22Service.insert(a2);
Collection<Account22> accounts = account22Service.selectAll(new Account22());
Assert.assertEquals(2, accounts.size());
Collection<Account22> accounts2 = account22Service.selectAll(new Account22());
Collection<Account22> accounts3 = account22Service.selectAll(new Account22());
}
use of indi.mybatis.flying.pojo.Account22 in project mybatis.flying by limeng32.
the class NoApplicationContextProviderTest method testNormal.
@Test
@IfProfileValue(name = "NO_PROVIDER", value = "true")
@DatabaseSetups({ @DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/noApplicationContextProviderTest/testNormal.datasource.xml"), @DatabaseSetup(connection = "dataSource2", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/noApplicationContextProviderTest/testNormal.datasource2.xml") })
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/noApplicationContextProviderTest/testNormal.datasource.result.xml"), @ExpectedDatabase(connection = "dataSource2", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/noApplicationContextProviderTest/testNormal.datasource2.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/noApplicationContextProviderTest/testNormal.datasource.result.xml"), @DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/noApplicationContextProviderTest/testNormal.datasource2.result.xml") })
public void testNormal() {
Account_ a = accountService.selectWithoutCache(1);
assertEquals("r", a.getRole().getName());
Role_ r = roleService.selectWithoutCache(51);
assertEquals("r", r.getName());
try {
Account22 account22 = account22Service.select(11);
fail("Expected an Exception to be thrown");
} catch (Exception e) {
assertEquals("Can not find the ApplicationContextProvider bean in the context", e.getCause().getCause().getMessage());
}
}
Aggregations