Search in sources :

Example 6 with LoginLogSource2

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

the class AccountTypeHandlerTest method testAccountTypeHandler.

/* 测试AccountTypeHandler的功能 */
// @Test
@DatabaseSetups({ @DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/accountTypeHandlerTest/testAccountTypeHandler.datasource.xml"), @DatabaseSetup(connection = "dataSource2", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/accountTypeHandlerTest/testAccountTypeHandler.datasource2.xml") })
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/accountTypeHandlerTest/testAccountTypeHandler.datasource.result.xml"), @ExpectedDatabase(connection = "dataSource2", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/accountTypeHandlerTest/testAccountTypeHandler.datasource2.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/accountTypeHandlerTest/testAccountTypeHandler.datasource.result.xml"), @DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/accountTypeHandlerTest/testAccountTypeHandler.datasource2.result.xml") })
public void testAccountTypeHandler() {
    LoginLogSource2 longinLogSource0 = loginLogSource2Service.selectWithoutAccount(22);
    Assert.assertNull(longinLogSource0.getAccount());
    LoginLogSource2 longinLogSource = loginLogSource2Service.select(22);
    Assert.assertNotNull(longinLogSource);
    Assert.assertNotNull(longinLogSource.getAccount());
    Assert.assertEquals("ann@live.cn", longinLogSource.getAccount().getEmail());
    Account_ ac = new Account_();
    ac.setId(1L);
    LoginLogSource2 l2c = new LoginLogSource2();
    l2c.setAccount(ac);
    Collection<LoginLogSource2> loginLogSource2C = loginLogSource2Service.selectAll(l2c);
    Assert.assertEquals(2, loginLogSource2C.size());
    for (LoginLogSource2 e : loginLogSource2C) {
        Assert.assertEquals("ann@live.cn", e.getAccount().getEmail());
    }
    LoginLogSource2 loginLogSource2 = loginLogSource2Service.select(24);
    Assert.assertNull(loginLogSource2.getAccount());
    LoginLogSource2 loginLogSource3 = loginLogSource2Service.select(25);
    Assert.assertNull(loginLogSource3.getAccount());
    Account_ ac2 = new Account_();
    ac2.setId(2L);
    LoginLogSource2 l2c2 = new LoginLogSource2();
    l2c2.setAccount(ac2);
    LoginLogSource2 loginLogSource4 = loginLogSource2Service.selectOne(l2c2);
    loginLogSource4 = loginLogSource2Service.selectOne(l2c2);
    loginLogSource4 = loginLogSource2Service.selectOne(l2c2);
    loginLogSource4 = loginLogSource2Service.selectOne(l2c2);
    loginLogSource4 = loginLogSource2Service.selectOne(l2c2);
    Assert.assertEquals("bob@live.cn", loginLogSource4.getAccount().getEmail());
    Account_ ac3 = new Account_();
    ac3.setId(1L);
    LoginLogSource2 l2c3 = new LoginLogSource2();
    l2c3.setAccount(ac3);
    l2c3.setLoginIP("ip1");
    int i = loginLogSource2Service.count(l2c3);
    Assert.assertEquals(1, i);
    Account_ account2 = accountService.select(2);
    loginLogSource2.setAccount(account2);
    loginLogSource2Service.update(loginLogSource2);
    loginLogSource4.setAccount(null);
    loginLogSource2Service.updatePersistent(loginLogSource4);
    Account_ account = accountService.select(1);
    loginLogSource2Service.loadAccount(account, new LoginLogSource2());
    Assert.assertEquals(2, account.getLoginLogSource2().size());
}
Also used : LoginLogSource2(indi.mybatis.flying.pojo.LoginLogSource2) Account_(indi.mybatis.flying.pojo.Account_) DatabaseSetups(com.github.springtestdbunit.annotation.DatabaseSetups) ExpectedDatabases(com.github.springtestdbunit.annotation.ExpectedDatabases) DatabaseTearDowns(com.github.springtestdbunit.annotation.DatabaseTearDowns)

Example 7 with LoginLogSource2

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

the class IgnoreInsertAndUpdateTest method testUpdate.

@Test
@DatabaseSetups({ @DatabaseSetup(connection = "dataSource2", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/ignoreInsertAndUpdateTest/testUpdate.datasource2.xml") })
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource2", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED, value = "/indi/mybatis/flying/test/ignoreInsertAndUpdateTest/testUpdate.datasource2.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/ignoreInsertAndUpdateTest/testUpdate.datasource2.result.xml") })
public void testUpdate() {
    Detail2_ detail = detail2Service.select(1);
    detail.setName("n1New");
    detail.setDetail("dNew");
    LoginLogSource2 log = loginLogSource2Service.select(12);
    detail.setLoginLogSource2(log);
    detail2Service.updateWithoutName(detail);
    Detail2_ detail2 = detail2Service.select(2);
    detail2.setName(null);
    detail2.setNumber(null);
    detail2.setLoginLogSource2(null);
    detail2Service.updatePersistentWithoutName(detail2);
}
Also used : Detail2_(indi.mybatis.flying.pojo.Detail2_) LoginLogSource2(indi.mybatis.flying.pojo.LoginLogSource2) DatabaseSetups(com.github.springtestdbunit.annotation.DatabaseSetups) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) ExpectedDatabases(com.github.springtestdbunit.annotation.ExpectedDatabases) DatabaseTearDowns(com.github.springtestdbunit.annotation.DatabaseTearDowns)

Aggregations

DatabaseSetups (com.github.springtestdbunit.annotation.DatabaseSetups)7 DatabaseTearDowns (com.github.springtestdbunit.annotation.DatabaseTearDowns)7 ExpectedDatabases (com.github.springtestdbunit.annotation.ExpectedDatabases)7 LoginLogSource2 (indi.mybatis.flying.pojo.LoginLogSource2)7 Test (org.junit.Test)6 Account_ (indi.mybatis.flying.pojo.Account_)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 Detail2_ (indi.mybatis.flying.pojo.Detail2_)3 LoginLog_ (indi.mybatis.flying.pojo.LoginLog_)3 Role_ (indi.mybatis.flying.pojo.Role_)2 IfProfileValue (org.springframework.test.annotation.IfProfileValue)2 Account2_ (indi.mybatis.flying.pojo.Account2_)1 Role2_ (indi.mybatis.flying.pojo.Role2_)1 ArrayList (java.util.ArrayList)1