use of com.github.springtestdbunit.annotation.DatabaseTearDowns 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());
}
}
use of com.github.springtestdbunit.annotation.DatabaseTearDowns in project mybatis.flying by limeng32.
the class OrTest method testOrMashup.
/* 一个在缓存状态下或逻辑查询的测试用例 */
/* 需要同时涉及同库外键和跨库外键 */
@Test
@DatabaseSetups({ @DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/orTest/testOrMashup.dataSource1.xml"), @DatabaseSetup(connection = "dataSource2", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/orTest/testOrMashup.dataSource2.xml") })
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED, value = "/indi/mybatis/flying/test/orTest/testOrMashup.dataSource1.result.xml"), @ExpectedDatabase(connection = "dataSource2", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED, value = "/indi/mybatis/flying/test/orTest/testOrMashup.dataSource2.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/orTest/testOrMashup.dataSource1.result.xml"), @DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/orTest/testOrMashup.dataSource2.result.xml") })
public void testOrMashup() {
LoginLogSource2Condition l2c = new LoginLogSource2Condition();
l2c.setAccountEqualsOr2(1L, 2L, "23453");
int i1 = loginLogSource2Service.count(l2c);
Assert.assertEquals(3, i1);
LoginLogSource2Condition l2c2 = new LoginLogSource2Condition();
l2c2.setAccountEqualsOr3(1L, 2L, "23453", "d4");
Detail2_ d2c = new Detail2_();
d2c.setLoginLogSource2(l2c2);
int i2 = detail2Service.count(d2c);
Assert.assertEquals(4, i2);
}
Aggregations