use of com.github.springtestdbunit.annotation.DatabaseSetup in project thingsboard by thingsboard.
the class JpaBaseRuleDaoTest method testFindAllTenantRulesByTenantId.
@Test
@DatabaseSetup("classpath:dbunit/empty_dataset.xml")
public void testFindAllTenantRulesByTenantId() {
UUID tenantId1 = UUIDs.timeBased();
UUID tenantId2 = UUIDs.timeBased();
createTenantsAndSystemRules(tenantId1, tenantId2, "name_", "token");
List<RuleMetaData> rules1 = ruleDao.findAllTenantRulesByTenantId(tenantId1, new TextPageLink(40, "name_"));
assertEquals(40, rules1.size());
List<RuleMetaData> rules2 = ruleDao.findAllTenantRulesByTenantId(tenantId1, new TextPageLink(40, "name_", rules1.get(19).getId().getId(), null));
assertEquals(20, rules2.size());
List<RuleMetaData> rules3 = ruleDao.findAllTenantRulesByTenantId(tenantId1, new TextPageLink(40, "name_", rules2.get(19).getId().getId(), null));
assertEquals(0, rules3.size());
}
use of com.github.springtestdbunit.annotation.DatabaseSetup in project mybatis.flying by limeng32.
the class WhiteListTest method testWhiteListInsert.
@Test
@DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/whiteListTest/testWhiteListInsert.xml")
@ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/whiteListTest/testWhiteListInsert.result.xml")
@DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/whiteListTest/testWhiteListInsert.result.xml")
public void testWhiteListInsert() {
Account_ account = new Account_();
account.setName("name");
account.setEmail("email");
account.setPassword("aaa");
Role_ role = new Role_();
role.setId(11);
account.setRole(role);
Permission permission = new Permission();
permission.setId(22);
account.setPermission(permission);
accountService.insertSimpleNoName(account);
}
use of com.github.springtestdbunit.annotation.DatabaseSetup in project mybatis.flying by limeng32.
the class WhiteListTest method testWhiteListUpdatePersistent.
@Test
@DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/whiteListTest/testWhiteListUpdatePersistent.xml")
@ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/whiteListTest/testWhiteListUpdatePersistent.result.xml")
@DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/whiteListTest/testWhiteListUpdatePersistent.result.xml")
public void testWhiteListUpdatePersistent() {
Account_ account = accountService.select(1);
account.setName("bob");
account.setEmail("bob@live.cn");
account.setPassword("bbb");
account.setStatus(StoryStatus_.PUBLISH);
account.setActivateValue(null);
Role_ role = new Role_();
role.setId(33);
account.setRole(role);
accountService.updatePersistentSimpleNoName(account);
}
use of com.github.springtestdbunit.annotation.DatabaseSetup in project mybatis.flying by limeng32.
the class WhiteListTest method testWhiteListInsertBatch.
@Test
@DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/whiteListTest/testWhiteListInsertBatch.xml")
@ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/whiteListTest/testWhiteListInsertBatch.result.xml")
@DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/whiteListTest/testWhiteListInsertBatch.result.xml")
public void testWhiteListInsertBatch() {
Account_ account = new Account_();
account.setName("name");
account.setEmail("email");
account.setPassword("aaa");
Role_ role = new Role_();
role.setId(11);
account.setRole(role);
Permission permission = new Permission();
permission.setId(22);
account.setPermission(permission);
Collection<Account_> ac = new ArrayList<>();
ac.add(account);
accountService.insertBatchSimpleNoName(ac);
}
use of com.github.springtestdbunit.annotation.DatabaseSetup in project mybatis.flying by limeng32.
the class WhiteListTest method testWhiteList.
@Test
@DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/whiteListTest/testWhiteList.xml")
@ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/whiteListTest/testWhiteList.result.xml")
@DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/whiteListTest/testWhiteList.result.xml")
public void testWhiteList() {
Account_ account = accountService.selectSimple(1);
Assert.assertNull(account.getEmail());
Assert.assertNull(account.getPassword());
Assert.assertNull(account.getPermission().getName());
Assert.assertNull(account.getPermission().getFakeId());
LoginLog_ l = new LoginLog_();
l.setLoginIP("ip1");
LoginLog_ loginLog = loginLogService.selectOneSimple(l);
Assert.assertNull(loginLog.getLoginIP2());
Assert.assertNull(loginLog.getAccount().getEmail());
Assert.assertNull(loginLog.getAccount().getPassword());
Assert.assertNull(loginLog.getAccount().getPermission().getName());
Assert.assertNull(loginLog.getAccount().getPermission().getFakeId());
}
Aggregations