Search in sources :

Example 1 with Detail2_

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

the class IgnoreInsertAndUpdateTest method testInsert.

@Test
@DatabaseSetups({ @DatabaseSetup(connection = "dataSource2", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/ignoreInsertAndUpdateTest/testInsert.datasource2.xml") })
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource2", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/ignoreInsertAndUpdateTest/testInsert.datasource2.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/ignoreInsertAndUpdateTest/testInsert.datasource2.result.xml") })
public void testInsert() {
    Detail2_ d = new Detail2_(), d2 = new Detail2_();
    d.setName("n");
    d.setNumber(123);
    d.setDetail("d");
    d.setCreatetime(Calendar.getInstance().getTime());
    detail2Service.insertWithoutName(d);
    d2.setName("n2");
    d2.setNumber(234);
    d2.setDetail("d2");
    d2.setCreatetime(Calendar.getInstance().getTime());
    detail2Service.insertWithoutFoo(d2);
}
Also used : Detail2_(indi.mybatis.flying.pojo.Detail2_) DatabaseSetups(com.github.springtestdbunit.annotation.DatabaseSetups) Test(org.junit.Test) ExpectedDatabases(com.github.springtestdbunit.annotation.ExpectedDatabases) DatabaseTearDowns(com.github.springtestdbunit.annotation.DatabaseTearDowns)

Example 2 with Detail2_

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

the class JpaTest method testDetail2.

@Test
@DatabaseSetups({ @DatabaseSetup(connection = "dataSource2", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/jpaTest/testDetail2.datasource2.xml") })
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource2", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/jpaTest/testDetail2.datasource2.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/jpaTest/testDetail2.datasource2.result.xml") })
public void testDetail2() {
    Detail2_ detail2 = detail2Service.select(1);
    Assert.assertEquals("n", detail2.getName());
    Assert.assertEquals(123, detail2.getNumber().intValue());
    Assert.assertEquals("l", detail2.getLoginLogSource2().getLoginIP());
    loginLogSource2Service.update(detail2.getLoginLogSource2());
    Detail2_ detail2_2 = new Detail2_();
    detail2_2.setName("name");
    detail2_2.setDetail("detail");
    detail2_2.setNumber(321);
    detail2Service.insert(detail2_2);
    Detail2_ detail2_c = new Detail2_();
    detail2_c.setName("name");
    detail2_c.setDetail("detail");
    Detail2_ detail2_3 = detail2Service.selectOne(detail2_c);
    Assert.assertEquals(detail2_2.getId(), detail2_3.getId());
}
Also used : Detail2_(indi.mybatis.flying.pojo.Detail2_) DatabaseSetups(com.github.springtestdbunit.annotation.DatabaseSetups) Test(org.junit.Test) ExpectedDatabases(com.github.springtestdbunit.annotation.ExpectedDatabases) DatabaseTearDowns(com.github.springtestdbunit.annotation.DatabaseTearDowns)

Example 3 with Detail2_

use of indi.mybatis.flying.pojo.Detail2_ 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) ExpectedDatabases(com.github.springtestdbunit.annotation.ExpectedDatabases) DatabaseTearDowns(com.github.springtestdbunit.annotation.DatabaseTearDowns)

Example 4 with Detail2_

use of indi.mybatis.flying.pojo.Detail2_ 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);
}
Also used : Detail2_(indi.mybatis.flying.pojo.Detail2_) LoginLogSource2Condition(indi.mybatis.flying.pojo.condition.LoginLogSource2Condition) DatabaseSetups(com.github.springtestdbunit.annotation.DatabaseSetups) Test(org.junit.Test) ExpectedDatabases(com.github.springtestdbunit.annotation.ExpectedDatabases) DatabaseTearDowns(com.github.springtestdbunit.annotation.DatabaseTearDowns)

Aggregations

DatabaseSetups (com.github.springtestdbunit.annotation.DatabaseSetups)4 DatabaseTearDowns (com.github.springtestdbunit.annotation.DatabaseTearDowns)4 ExpectedDatabases (com.github.springtestdbunit.annotation.ExpectedDatabases)4 Detail2_ (indi.mybatis.flying.pojo.Detail2_)4 Test (org.junit.Test)4 LoginLogSource2 (indi.mybatis.flying.pojo.LoginLogSource2)1 LoginLogSource2Condition (indi.mybatis.flying.pojo.condition.LoginLogSource2Condition)1