Search in sources :

Example 26 with LoginLog_

use of indi.mybatis.flying.pojo.LoginLog_ in project mybatis.flying by limeng32.

the class DelegateTest method testDelegateUpdatePersistent.

@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/delegateTest/testDelegateUpdatePersistent.xml")
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/delegateTest/testDelegateUpdatePersistent.result.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/delegateTest/testDelegateUpdatePersistent.xml")
public void testDelegateUpdatePersistent() {
    LoginLog_ loginLog = loginLogService.select(1);
    loginLog.setAccount(null);
    loginLog.setDelegateAccountId(2L);
    loginLog.setLoginIP(null);
    loginLogService.updatePersistent(loginLog);
}
Also used : LoginLog_(indi.mybatis.flying.pojo.LoginLog_) ExpectedDatabase(com.github.springtestdbunit.annotation.ExpectedDatabase) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup) DatabaseTearDown(com.github.springtestdbunit.annotation.DatabaseTearDown)

Example 27 with LoginLog_

use of indi.mybatis.flying.pojo.LoginLog_ in project mybatis.flying by limeng32.

the class NotEqualConditionTest method testConditionGreaterThan.

/**
 * 测试condition:greaterThan功能
 */
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/notEqualConditionTest/testConditionGreaterThan.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/notEqualConditionTest/testConditionGreaterThan.xml")
public void testConditionGreaterThan() {
    LoginLog_Condition lc = new LoginLog_Condition(), lc2 = new LoginLog_Condition(), lc3 = new LoginLog_Condition(), lc4 = new LoginLog_Condition();
    lc.setLoginTimeGreaterThan(new Date(1));
    lc.setIdGreaterThan(0);
    Collection<LoginLog_> c = loginLogService.selectAll(lc);
    Assert.assertEquals(1, c.size());
    LoginLog_[] loginlogs = c.toArray(new LoginLog_[c.size()]);
    Assert.assertEquals("0.0.0.1", loginlogs[0].getLoginIP());
    Collection<LoginLog_> c11 = loginLogService.selectAllPrefix(lc);
    Assert.assertEquals(1, c11.size());
    LoginLog_[] loginlogs11 = c11.toArray(new LoginLog_[c11.size()]);
    Assert.assertEquals("0.0.0.1", loginlogs11[0].getLoginIP());
    lc2.setLoginTimeGreaterThan(new Date());
    Collection<LoginLog_> c2 = loginLogService.selectAll(lc2);
    Assert.assertEquals(0, c2.size());
    Collection<LoginLog_> c12 = loginLogService.selectAllPrefix(lc2);
    Assert.assertEquals(0, c12.size());
    lc3.setIdGreaterThan(10);
    int count3 = loginLogService.count(lc3);
    Assert.assertEquals(0, count3);
    lc3.setIdGreaterThan(null);
    lc3.setIdGreaterOrEqual(10);
    count3 = loginLogService.count(lc3);
    Assert.assertEquals(1, count3);
    lc3.setIdGreaterOrEqual(null);
    lc3.setLoginTime(loginlogs[0].getLoginTime());
    count3 = loginLogService.count(lc3);
    Assert.assertEquals(1, count3);
    lc3.setLoginTime(null);
    lc3.setLoginTimeNotEqual(loginlogs[0].getLoginTime());
    count3 = loginLogService.count(lc3);
    Assert.assertEquals(0, count3);
    lc4.setIdGreaterThan(9);
    int count4 = loginLogService.count(lc4);
    Assert.assertEquals(1, count4);
    lc4.setIdGreaterThan(null);
    lc4.setIdLessThan(11);
    count4 = loginLogService.count(lc4);
    Assert.assertEquals(1, count4);
    lc4.setIdLessThan(10);
    count4 = loginLogService.count(lc4);
    Assert.assertEquals(0, count4);
    lc4.setIdLessThan(null);
    lc4.setIdLessOrEqual(10);
    count4 = loginLogService.count(lc4);
    Assert.assertEquals(1, count4);
    lc4.setIdLessOrEqual(null);
    lc4.setIdNotEqual(10);
    count4 = loginLogService.count(lc4);
    Assert.assertEquals(0, count4);
}
Also used : LoginLog_(indi.mybatis.flying.pojo.LoginLog_) LoginLog_Condition(indi.mybatis.flying.pojo.condition.LoginLog_Condition) Date(java.util.Date) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup) DatabaseTearDown(com.github.springtestdbunit.annotation.DatabaseTearDown)

Example 28 with LoginLog_

use of indi.mybatis.flying.pojo.LoginLog_ in project mybatis.flying by limeng32.

the class OrTest method testOr1.

@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/orTest/testOr1.xml")
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/orTest/testOr1.result.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/orTest/testOr1.result.xml")
public void testOr1() {
    LoginLog_Condition lc1 = new LoginLog_Condition();
    lc1.setLoginIPHeadLikeOr("a", "b");
    lc1.setIpLikeFilter("1");
    Collection<LoginLog_> LoginLogC = loginLogService.selectAll(lc1);
    Assert.assertEquals(2, LoginLogC.size());
    Collection<LoginLog_> LoginLogC11 = loginLogService.selectAllPrefix(lc1);
    Assert.assertEquals(2, LoginLogC11.size());
    LoginLog_Condition lc2 = new LoginLog_Condition();
    lc2.setLoginIPLikeOr("b1", "c1");
    Collection<LoginLog_> LoginLogC2 = loginLogService.selectAll(lc2);
    Assert.assertEquals(2, LoginLogC2.size());
    Collection<LoginLog_> LoginLogC12 = loginLogService.selectAllPrefix(lc2);
    Assert.assertEquals(2, LoginLogC12.size());
    int c2 = loginLogService.count(lc2);
    Assert.assertEquals(2, c2);
    LoginLog_Condition lc3 = new LoginLog_Condition();
    lc3.setLoginIPHeadLikeOrTailLike("a", "2");
    int c3 = loginLogService.count(lc3);
    Assert.assertEquals(2, c3);
    LoginLog_Condition lc4 = new LoginLog_Condition();
    lc4.setLoginIPEqualsOr("a1", "z3");
    int c4 = loginLogService.count(lc4);
    Assert.assertEquals(2, c4);
    LoginLog_Condition lc5 = new LoginLog_Condition();
    lc5.setLoginIPLikeOr("a1", "b1");
    lc5.setLoginIPEqualsOr("b1", "c1");
    int c5 = loginLogService.count(lc5);
    Assert.assertEquals(1, c5);
    LoginLog_Condition lc6 = new LoginLog_Condition();
    lc6.setNumEqualsOr(1, 2);
    int c6 = loginLogService.count(lc6);
    Assert.assertEquals(2, c6);
    LoginLog_Condition lc7 = new LoginLog_Condition();
    lc7.setNumEqualsOrLoginIPLike(1, "b1");
    Collection<LoginLog_> LoginLogC7 = loginLogService.selectAll(lc7);
    Assert.assertEquals(2, LoginLogC7.size());
    Collection<LoginLog_> LoginLogC17 = loginLogService.selectAllPrefix(lc7);
    Assert.assertEquals(2, LoginLogC17.size());
    LoginLog_ l1 = new LoginLog_();
    l1.setLoginIP("a1");
    LoginLog_ loginLog_1 = loginLogService.selectOne(l1);
    LoginLog_ l2 = new LoginLog_();
    l2.setLoginIP("b1");
    LoginLog_ loginLog_2 = loginLogService.selectOne(l2);
    LoginLog_Condition lc8 = new LoginLog_Condition();
    lc8.setLoginTimeEqualsOr(loginLog_1.getLoginTime(), loginLog_2.getLoginTime());
    int c8 = loginLogService.count(lc8);
    Assert.assertEquals(2, c8);
    LoginLog_Condition lc9 = new LoginLog_Condition();
    lc9.setStatusEqualsOr(LogStatus.b, LogStatus.t);
    int c9 = loginLogService.count(lc9);
    Assert.assertEquals(2, c9);
    LoginLog_Condition lc10 = new LoginLog_Condition();
    lc10.setLoginIPNotEqualsOr("z2", "z3");
    int c10 = loginLogService.count(lc10);
    Assert.assertEquals(6, c10);
    LoginLog_Condition lc11 = new LoginLog_Condition();
    lc11.setNumGtOrLt(5, 2);
    int c11 = loginLogService.count(lc11);
    Assert.assertEquals(2, c11);
    LoginLog_Condition lc12 = new LoginLog_Condition();
    lc12.setNumGeOrLe(5, 2);
    int c12 = loginLogService.count(lc12);
    Assert.assertEquals(4, c12);
    LoginLog_Condition lc13 = new LoginLog_Condition();
    Object[] o13 = { 5, 2 };
    lc13.setNumGtOrLe(o13);
    int c13 = loginLogService.count(lc13);
    Assert.assertEquals(3, c13);
    LoginLog_Condition lc14 = new LoginLog_Condition();
    lc14.setNumGeOrLt(5, 2);
    int c14 = loginLogService.count(lc14);
    Assert.assertEquals(3, c14);
    LoginLog_Condition lc15 = new LoginLog_Condition();
    Object[] o15 = { true, false };
    lc15.setStatusIsNullOr(o15);
    int c15 = loginLogService.count(lc15);
    Assert.assertEquals(6, c15);
    LoginLog_Condition lc16 = new LoginLog_Condition();
    // 最后一个参数无意义
    lc16.setStatusIsNullOrLoginIPEquals(false, "a1", "b1", "c1");
    int c16 = loginLogService.count(lc16);
    Assert.assertEquals(4, c16);
}
Also used : LoginLog_(indi.mybatis.flying.pojo.LoginLog_) LoginLog_Condition(indi.mybatis.flying.pojo.condition.LoginLog_Condition) ExpectedDatabase(com.github.springtestdbunit.annotation.ExpectedDatabase) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup) DatabaseTearDown(com.github.springtestdbunit.annotation.DatabaseTearDown)

Aggregations

LoginLog_ (indi.mybatis.flying.pojo.LoginLog_)28 Test (org.junit.Test)28 DatabaseSetup (com.github.springtestdbunit.annotation.DatabaseSetup)25 DatabaseTearDown (com.github.springtestdbunit.annotation.DatabaseTearDown)25 ExpectedDatabase (com.github.springtestdbunit.annotation.ExpectedDatabase)20 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)20 Account_ (indi.mybatis.flying.pojo.Account_)17 IfProfileValue (org.springframework.test.annotation.IfProfileValue)8 Role_ (indi.mybatis.flying.pojo.Role_)7 LoginLog_Condition (indi.mybatis.flying.pojo.condition.LoginLog_Condition)7 Account_Condition (indi.mybatis.flying.pojo.condition.Account_Condition)6 ArrayList (java.util.ArrayList)5 DatabaseSetups (com.github.springtestdbunit.annotation.DatabaseSetups)3 DatabaseTearDowns (com.github.springtestdbunit.annotation.DatabaseTearDowns)3 ExpectedDatabases (com.github.springtestdbunit.annotation.ExpectedDatabases)3 Detail_ (indi.mybatis.flying.pojo.Detail_)3 LoginLogSource2 (indi.mybatis.flying.pojo.LoginLogSource2)3 Role_Condition (indi.mybatis.flying.pojo.condition.Role_Condition)2 LinkedList (java.util.LinkedList)2 Page (indi.mybatis.flying.pagination.Page)1