Search in sources :

Example 6 with Account_Condition

use of indi.mybatis.flying.pojo.condition.Account_Condition in project mybatis.flying by limeng32.

the class ConditionInTest method testConditionIn3.

/**
 * 测试无外键情况下condition:in功能且变量类型为数字的情况
 */
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn3.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn3.xml")
public void testConditionIn3() {
    Account_Condition ac = new Account_Condition();
    List<Integer> opLockC = new ArrayList<>();
    opLockC.add(1);
    opLockC.add(2);
    ac.setOpLockIn(opLockC);
    int count = accountService.count(ac);
    Assert.assertEquals(2, count);
}
Also used : ArrayList(java.util.ArrayList) Account_Condition(indi.mybatis.flying.pojo.condition.Account_Condition) Test(org.junit.Test) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup) DatabaseTearDown(com.github.springtestdbunit.annotation.DatabaseTearDown)

Example 7 with Account_Condition

use of indi.mybatis.flying.pojo.condition.Account_Condition in project mybatis.flying by limeng32.

the class ConditionInTest method testConditionIn2.

/**
 * 测试有外键情况下condition:in功能
 */
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn2.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn2.xml")
public void testConditionIn2() {
    LoginLog_Condition lc = new LoginLog_Condition();
    List<String> loginIpC = new ArrayList<>();
    loginIpC.add("11");
    loginIpC.add("22");
    lc.setLoginIPIn(loginIpC);
    Account_Condition ac = new Account_Condition();
    List<String> nameC = new ArrayList<>();
    nameC.add("ann");
    nameC.add("bob");
    ac.setNameIn(nameC);
    lc.setAccount(ac);
    Collection<LoginLog_> c = loginLogService.selectAll(lc);
    Assert.assertEquals(2, c.size());
    int count = loginLogService.count(lc);
    Assert.assertEquals(2, count);
}
Also used : LoginLog_(indi.mybatis.flying.pojo.LoginLog_) ArrayList(java.util.ArrayList) LoginLog_Condition(indi.mybatis.flying.pojo.condition.LoginLog_Condition) Account_Condition(indi.mybatis.flying.pojo.condition.Account_Condition) Test(org.junit.Test) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup) DatabaseTearDown(com.github.springtestdbunit.annotation.DatabaseTearDown)

Example 8 with Account_Condition

use of indi.mybatis.flying.pojo.condition.Account_Condition in project mybatis.flying by limeng32.

the class ConditionNotInTest method testConditionNotIn2.

/**
 * 测试有外键情况下condition:notIn功能
 */
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionNotInTest/testConditionIn2.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionNotInTest/testConditionIn2.xml")
public void testConditionNotIn2() {
    LoginLog_Condition lc = new LoginLog_Condition();
    Account_Condition ac = new Account_Condition();
    List<String> nameC = new ArrayList<>();
    nameC.add("ann");
    nameC.add("bob");
    ac.setNameNotIn(nameC);
    lc.setAccount(ac);
    Collection<LoginLog_> c = loginLogService.selectAll(lc);
    Assert.assertEquals(0, c.size());
    int count = loginLogService.count(lc);
    Assert.assertEquals(0, count);
}
Also used : LoginLog_(indi.mybatis.flying.pojo.LoginLog_) ArrayList(java.util.ArrayList) LoginLog_Condition(indi.mybatis.flying.pojo.condition.LoginLog_Condition) Account_Condition(indi.mybatis.flying.pojo.condition.Account_Condition) Test(org.junit.Test) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup) DatabaseTearDown(com.github.springtestdbunit.annotation.DatabaseTearDown)

Example 9 with Account_Condition

use of indi.mybatis.flying.pojo.condition.Account_Condition in project mybatis.flying by limeng32.

the class ConditionTest method testMultiLikeAND.

@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionTest/testMultiLikeAND.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionTest/testMultiLikeAND.xml")
public void testMultiLikeAND() {
    Account_Condition ac = new Account_Condition();
    ac.setName("ann");
    ac.setEmailLike("as");
    List<String> multi = new ArrayList<>();
    multi.add("a");
    multi.add("s");
    multi.add("d");
    ac.setMultiLike(multi);
    Collection<Account_> c = accountService.selectAll(ac);
    Assert.assertEquals(1, c.size());
    int conut = accountService.count(ac);
    Assert.assertEquals(1, conut);
    Account_Condition ac2 = new Account_Condition();
    ac2.setName("ann");
    ac2.setEmailLike("as");
    List<String> multi2 = new LinkedList<>();
    ac2.setMultiLike(multi2);
    Collection<Account_> c2 = accountService.selectAll(ac2);
    Assert.assertEquals(1, c2.size());
    Account_Condition ac3 = new Account_Condition();
    List<String> multi3 = new ArrayList<>();
    multi3.add(null);
    multi3.add("a");
    multi3.add(null);
    ac3.setMultiLike(multi3);
    Collection<Account_> c3 = accountService.selectAll(ac3);
    Assert.assertEquals(1, c3.size());
    LoginLog_ lc = new LoginLog_();
    Account_Condition ac4 = new Account_Condition();
    List<String> multi4 = new ArrayList<>();
    multi4.add("a");
    ac4.setMultiLike(multi4);
    lc.setAccount(ac4);
    Collection<LoginLog_> c4 = loginLogService.selectAll(lc);
    Assert.assertEquals(1, c4.size());
}
Also used : LoginLog_(indi.mybatis.flying.pojo.LoginLog_) ArrayList(java.util.ArrayList) Account_Condition(indi.mybatis.flying.pojo.condition.Account_Condition) Account_(indi.mybatis.flying.pojo.Account_) LinkedList(java.util.LinkedList) Test(org.junit.Test) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup) DatabaseTearDown(com.github.springtestdbunit.annotation.DatabaseTearDown)

Example 10 with Account_Condition

use of indi.mybatis.flying.pojo.condition.Account_Condition in project mybatis.flying by limeng32.

the class OrTest method testOr5.

@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/orTest/testOr5.xml")
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/orTest/testOr5.result.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/orTest/testOr5.result.xml")
public void testOr5() {
    LoginLog_Condition lc = new LoginLog_Condition();
    lc.setAccount(new Account_Condition());
    lc.getAccount().setRole(new Role_Condition());
    lc.getAccount().setRoleDeputy(new Role_Condition());
    ((Role_Condition) lc.getAccount().getRole()).setNameEqualsOrAccountNameEquals("user", "bob");
    ((Role_Condition) lc.getAccount().getRoleDeputy()).setNameEqualsOrAccountNameEquals("silver", "bob");
    Collection<LoginLog_> loginLogC = loginLogService.selectAll(lc);
    Assert.assertEquals(2, loginLogC.size());
}
Also used : LoginLog_(indi.mybatis.flying.pojo.LoginLog_) Role_Condition(indi.mybatis.flying.pojo.condition.Role_Condition) LoginLog_Condition(indi.mybatis.flying.pojo.condition.LoginLog_Condition) Account_Condition(indi.mybatis.flying.pojo.condition.Account_Condition) ExpectedDatabase(com.github.springtestdbunit.annotation.ExpectedDatabase) Test(org.junit.Test) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup) DatabaseTearDown(com.github.springtestdbunit.annotation.DatabaseTearDown)

Aggregations

DatabaseTearDown (com.github.springtestdbunit.annotation.DatabaseTearDown)26 Account_Condition (indi.mybatis.flying.pojo.condition.Account_Condition)26 Test (org.junit.Test)24 DatabaseSetup (com.github.springtestdbunit.annotation.DatabaseSetup)22 Account_ (indi.mybatis.flying.pojo.Account_)18 ExpectedDatabase (com.github.springtestdbunit.annotation.ExpectedDatabase)11 ArrayList (java.util.ArrayList)8 PageParam (indi.mybatis.flying.pagination.PageParam)6 LoginLog_Condition (indi.mybatis.flying.pojo.condition.LoginLog_Condition)6 LoginLog_ (indi.mybatis.flying.pojo.LoginLog_)5 IfProfileValue (org.springframework.test.annotation.IfProfileValue)5 Order (indi.mybatis.flying.pagination.Order)4 SortParam (indi.mybatis.flying.pagination.SortParam)4 Role_ (indi.mybatis.flying.pojo.Role_)4 Role_Condition (indi.mybatis.flying.pojo.condition.Role_Condition)4 Page (indi.mybatis.flying.pagination.Page)2 HashMap (java.util.HashMap)2 Account_Condition3 (indi.mybatis.flying.pojo.condition.Account_Condition3)1 LinkedList (java.util.LinkedList)1