Search in sources :

Example 6 with Role2_

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

the class TransactiveService2 method addAccount2Transactive2.

@Transactional(rollbackFor = { Configurer2Exception.class }, readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
public void addAccount2Transactive2() throws Configurer2Exception {
    Role_ role = new Role_();
    role.setName("role_");
    roleService.insert(role);
    Role2_ role2 = new Role2_();
    role2.setName("role2_");
    role2Service.insert(role2);
    throw new Configurer2Exception("zxc");
}
Also used : Configurer2Exception(indi.mybatis.flying.exceptions.Configurer2Exception) Role_(indi.mybatis.flying.pojo.Role_) Role2_(indi.mybatis.flying.pojo.Role2_) Transactional(org.springframework.transaction.annotation.Transactional)

Example 7 with Role2_

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

the class CacheTest method test22.

@Test
@IfProfileValue(name = "CACHE", value = "true")
@DatabaseSetups({ @DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/cacheTest2/test2.datasource1.xml"), @DatabaseSetup(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/cacheTest2/test2.datasource2.xml") })
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/cacheTest2/test2.datasource1.result.xml"), @ExpectedDatabase(connection = "dataSource2", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/cacheTest2/test2.datasource2.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/cacheTest2/test2.datasource1.result.xml"), @DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/cacheTest2/test2.datasource2.result.xml") })
public void test22() {
    String name = "ann";
    String roleName = "user";
    String newRoleName = "admin";
    Account_ a = new Account_();
    Role_ r = new Role_();
    r.setName(roleName);
    roleService.insert(r);
    a.setName(name);
    a.setRole(r);
    accountService.insert(a);
    Account_ account_ = accountService.select(a.getId());
    Assert.assertEquals(roleName, account_.getRole().getName());
    Role_ r12 = roleService.select(r.getId());
    r12.setName(newRoleName);
    roleService.update(r12);
    account_ = accountService.select(a.getId());
    Assert.assertEquals(newRoleName, account_.getRole().getName());
    Account2_ a2 = new Account2_();
    Role2_ r2 = new Role2_();
    r2.setName(roleName);
    role2Service.insert(r2);
    a2.setName(name);
    a2.setRole(r2);
    account2Service.insert(a2);
    Account2_ account2_ = account2Service.select(a2.getId());
    Assert.assertEquals(roleName, account2_.getRole().getName());
    Role2_ r22 = role2Service.select(r2.getId());
    r22.setName(newRoleName);
    role2Service.update(r22);
    account2_ = account2Service.select(a2.getId());
    Assert.assertEquals(newRoleName, account2_.getRole().getName());
}
Also used : Account2_(indi.mybatis.flying.pojo.Account2_) Account_(indi.mybatis.flying.pojo.Account_) Role_(indi.mybatis.flying.pojo.Role_) Role2_(indi.mybatis.flying.pojo.Role2_) DatabaseSetups(com.github.springtestdbunit.annotation.DatabaseSetups) Test(org.junit.Test) ExpectedDatabases(com.github.springtestdbunit.annotation.ExpectedDatabases) DatabaseTearDowns(com.github.springtestdbunit.annotation.DatabaseTearDowns) IfProfileValue(org.springframework.test.annotation.IfProfileValue)

Example 8 with Role2_

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

the class CacheTest method test21.

@Test
@IfProfileValue(name = "CACHE", value = "true")
@DatabaseSetup(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/cacheTest2/test.datasource2.xml")
@ExpectedDatabase(connection = "dataSource2", assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/cacheTest2/test.datasource2.result.xml")
@DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/cacheTest2/test.datasource2.result.xml")
public void test21() {
    String name = "ann";
    String roleName = "user";
    String newRoleName = "admin";
    Account2_ a = new Account2_();
    Role2_ r = new Role2_();
    r.setName(roleName);
    role2Service.insert(r);
    a.setName(name);
    a.setRole(r);
    account2Service.insert(a);
    Account2_ account2_ = account2Service.select(a.getId());
    Assert.assertEquals(roleName, account2_.getRole().getName());
    Role2_ r2 = role2Service.select(r.getId());
    r2.setName(newRoleName);
    role2Service.update(r2);
    account2_ = account2Service.select(a.getId());
    Assert.assertEquals(newRoleName, account2_.getRole().getName());
}
Also used : Account2_(indi.mybatis.flying.pojo.Account2_) Role2_(indi.mybatis.flying.pojo.Role2_) ExpectedDatabase(com.github.springtestdbunit.annotation.ExpectedDatabase) Test(org.junit.Test) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup) DatabaseTearDown(com.github.springtestdbunit.annotation.DatabaseTearDown) IfProfileValue(org.springframework.test.annotation.IfProfileValue)

Aggregations

Role2_ (indi.mybatis.flying.pojo.Role2_)8 Test (org.junit.Test)5 Account2_ (indi.mybatis.flying.pojo.Account2_)4 IfProfileValue (org.springframework.test.annotation.IfProfileValue)4 DatabaseTearDowns (com.github.springtestdbunit.annotation.DatabaseTearDowns)3 ExpectedDatabases (com.github.springtestdbunit.annotation.ExpectedDatabases)3 Transactional (org.springframework.transaction.annotation.Transactional)3 DatabaseSetups (com.github.springtestdbunit.annotation.DatabaseSetups)2 DatabaseTearDown (com.github.springtestdbunit.annotation.DatabaseTearDown)2 ExpectedDatabase (com.github.springtestdbunit.annotation.ExpectedDatabase)2 Configurer2Exception (indi.mybatis.flying.exceptions.Configurer2Exception)2 Account_ (indi.mybatis.flying.pojo.Account_)2 Role_ (indi.mybatis.flying.pojo.Role_)2 DatabaseSetup (com.github.springtestdbunit.annotation.DatabaseSetup)1 Account22 (indi.mybatis.flying.pojo.Account22)1 LoginLogSource2 (indi.mybatis.flying.pojo.LoginLogSource2)1 LoginLog_ (indi.mybatis.flying.pojo.LoginLog_)1