use of indi.mybatis.flying.pojo.Account_ in project mybatis.flying by limeng32.
the class ConditionTest method testMultiLikeOR.
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionTest/testMultiLikeOR.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionTest/testMultiLikeOR.xml")
public void testMultiLikeOR() {
Account_Condition ac = new Account_Condition();
ac.setName("ann");
ac.setEmailLike("as");
List<String> multi = new ArrayList<>();
multi.add(null);
multi.add(null);
multi.add(null);
multi.add(null);
ac.setMultiLikeOR(multi);
Collection<Account_> c = accountService.selectAll(ac);
Assert.assertEquals(1, c.size());
int count = accountService.count(ac);
Assert.assertEquals(1, count);
Account_Condition ac2 = new Account_Condition();
ac2.setName("ann");
ac2.setEmailLike("as");
List<String> multi2 = new ArrayList<>();
multi2.add(null);
multi2.add("a");
multi2.add("sd");
multi2.add("z");
ac2.setMultiLikeOR(multi2);
Collection<Account_> c2 = accountService.selectAll(ac2);
Assert.assertEquals(1, c2.size());
LoginLog_ lc = new LoginLog_();
Account_Condition ac3 = new Account_Condition();
List<String> multi3 = new ArrayList<>();
multi3.add(null);
multi3.add("a");
multi3.add("sd");
multi3.add("z");
ac3.setMultiLikeOR(multi3);
lc.setAccount(ac3);
Collection<LoginLog_> c3 = loginLogService.selectAll(lc);
Assert.assertEquals(1, c3.size());
}
use of indi.mybatis.flying.pojo.Account_ in project mybatis.flying by limeng32.
the class ConditionTest method testConditionHeadLike.
/**
* 测试condition:headLike功能
*/
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionTest/testConditionHeadLike.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionTest/testConditionHeadLike.xml")
public void testConditionHeadLike() {
Account_Condition ac = new Account_Condition();
ac.setEmailHeadLike("ann");
Collection<Account_> c = accountService.selectAll(ac);
Account_[] accounts = c.toArray(new Account_[c.size()]);
Assert.assertEquals(1, accounts.length);
Assert.assertEquals("ann@live.cn2", accounts[0].getEmail());
Account_Condition3 ac2 = new Account_Condition3();
ac2.setEmailHeadLike("1");
Collection<Account_> c2 = accountService.selectAll(ac2);
Account_[] accounts2 = c2.toArray(new Account_[c2.size()]);
Assert.assertEquals(1, accounts2.length);
Assert.assertEquals("_ann@live.cn1", accounts2[0].getEmail());
}
use of indi.mybatis.flying.pojo.Account_ in project mybatis.flying by limeng32.
the class ConditionTest method testConditionTailLike.
/**
* 测试condition:tailLike功能
*/
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionTest/testConditionTailLike.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionTest/testConditionTailLike.xml")
public void testConditionTailLike() {
Account_Condition ac = new Account_Condition();
ac.setEmailTailLike("live.cn");
Collection<Account_> c = accountService.selectAll(ac);
Account_[] accounts = c.toArray(new Account_[c.size()]);
Assert.assertEquals(1, accounts.length);
Assert.assertEquals("ann@live.cn", accounts[0].getEmail());
}
use of indi.mybatis.flying.pojo.Account_ in project mybatis.flying by limeng32.
the class DirectSqlTest method testDirectSelect.
/**
* flying托管与非托管共存的情况
*/
@Test
@DatabaseSetups({ @DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/directSqlTest/testDirectSelect.xml") })
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/directSqlTest/testDirectSelect.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/directSqlTest/testDirectSelect.result.xml") })
public void testDirectSelect() {
Account_ account1 = accountService.selectDirect(1);
Assert.assertEquals("ann", account1.getName());
Assert.assertEquals("5a690d842935c51f26f473e025c1b97a", account1.getPassword());
Account_ account2 = accountService.select(1);
Assert.assertNull(account2.getPassword());
Account_ account3 = accountService.selectEverything(1);
Assert.assertEquals("5a690d842935c51f26f473e025c1b97a", account3.getPassword());
Map<String, Object> map = new HashMap<>(4);
map.put("name", "bob");
map.put("email", "bob@live.cn");
Collection<Account_> c1 = accountService.selectAllDirect(map);
for (Account_ t : c1) {
Assert.assertEquals("5a690d842935c51f26f473e025c1b97b", t.getPassword());
}
Account_ a1 = new Account_();
a1.setName("bob");
a1.setEmail("bob@live.cn");
Collection<Account_> c2 = accountService.selectAll(a1);
for (Account_ t : c2) {
Assert.assertNull(t.getPassword());
}
Collection<Account_> c3 = accountService.selectAllEverything(a1);
for (Account_ t : c3) {
Assert.assertEquals("5a690d842935c51f26f473e025c1b97b", t.getPassword());
}
}
use of indi.mybatis.flying.pojo.Account_ 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