com.github.springtestdbunit.annotation.ExpectedDatabase Java Examples
The following examples show how to use
com.github.springtestdbunit.annotation.ExpectedDatabase.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WhiteListTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@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); }
Example #2
Source File: SelectOneTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
/** 测试selectOne2 */ @Test @DatabaseSetup(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne2.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne2.result.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne2.result.xml") public void testSelectOne2() { Account_ a1 = new Account_(); a1.setName("ann"); a1.setEmail("[email protected]"); accountService.insert(a1); Account_ a2 = new Account_(); a2.setName("ann"); a2.setEmail("[email protected]"); accountService.insert(a2); Account_Condition ac = new Account_Condition(); ac.setLimiter(new PageParam(1, 2)); ac.setSorter(new SortParam(new Order("id", Sequence.ASC))); ac.setName("ann"); Account_ account = accountService.selectOne(ac); Assert.assertEquals("[email protected]", account.getEmail()); Assert.assertNull(ac.getLimiter()); }
Example #3
Source File: ConditionInTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
/** 测试无外键情况下condition:in功能且变量类型为时间的情况 */ @Test @DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn4.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn4.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn4.xml") public void testConditionIn4() { LoginLog_Condition lc = new LoginLog_Condition(); List<Date> timeC = new ArrayList<>(); Calendar c = Calendar.getInstance(), c2 = Calendar.getInstance(); c.clear(); c2.clear(); c.set(1970, 0, 1, 8, 0, 0); c2.set(1970, 0, 1, 8, 0, 1); timeC.add(c.getTime()); timeC.add(c2.getTime()); lc.setLoginTimeIn(timeC); int count = loginLogService.count(lc); Assert.assertEquals(2, count); }
Example #4
Source File: SelectOneTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
/** 测试selectOne1 */ @Test @DatabaseSetup(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne1.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne1.result.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne1.result.xml") public void testSelectOne1() { Account_ a1 = new Account_(); a1.setName("ann"); a1.setEmail("[email protected]"); accountService.insert(a1); Account_ a2 = new Account_(); a2.setName("bob"); a2.setEmail("[email protected]"); accountService.insert(a2); accountService.update(a2); accountService.updatePersistent(a2); Account_ account_ = accountService.select(a2.getId()); Account_ ac = new Account_(); ac.setName("bob"); ac.setEmail("[email protected]"); Account_ account = accountService.selectOne(ac); Assert.assertEquals("[email protected]", account.getEmail()); }
Example #5
Source File: ConditionTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
/** 测试多重外键情况下sorter是否能正确发挥作用 */ @Test @DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionTest/testSorterWithMultiAssociation.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/conditionTest/testSorterWithMultiAssociation.result.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionTest/testSorterWithMultiAssociation.xml") public void testSorterWithMultiAssociation() { Role_Condition rc1 = new Role_Condition(); rc1.setName("role1"); Role_Condition rc2 = new Role_Condition(); rc2.setName("role2"); Account_Condition ac = new Account_Condition(); ac.setRole(rc1); ac.setRoleDeputy(rc2); ac.setSorter(new SortParam(new Order("name", Sequence.ASC))); Collection<Account_> accountC = accountService.selectAll(ac); Account_[] accounts = accountC.toArray(new Account_[accountC.size()]); Assert.assertEquals(3, accounts.length); Assert.assertEquals("bob", accounts[0].getName()); }
Example #6
Source File: OrTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@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); }
Example #7
Source File: OrTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@Test @DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/orTest/testOr6.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/orTest/testOr6.result.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/orTest/testOr6.result.xml") public void testOr6() { LoginLog_Condition lc = new LoginLog_Condition(); lc.setAccount(new Account_Condition()); lc.getAccount().setRole(new Role_Condition()); ((Role_Condition) lc.getAccount().getRole()).setAccountNameEquals("ann"); int i = loginLogService.count(lc); Assert.assertEquals(2, i); LoginLog_Condition lc2 = new LoginLog_Condition(); lc2.setAccount(new Account_Condition()); lc2.getAccount().setRole(new Role_Condition()); ((Role_Condition) lc2.getAccount().getRole()).setNameEquals("admin"); int i2 = loginLogService.count(lc2); Assert.assertEquals(4, i2); }
Example #8
Source File: IgnoreInsertAndUpdateTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@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); }
Example #9
Source File: SelectOneTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
/** 测试selectOne3,缓存测试 */ @Test @DatabaseSetup(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne3.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne3.result.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/selectOneTest/testSelectOne3.result.xml") public void testSelectOne3() { Account_ a1 = new Account_(); a1.setName("ann"); accountService.insert(a1); Account_ a2 = new Account_(); a2.setName("bob"); accountService.insert(a2); Account_ ac = new Account_(); Account_ account1 = accountService.selectOne(ac); Assert.assertEquals("ann", account1.getName()); Collection<Account_> accountC = accountService.selectAll(ac); Assert.assertEquals(2, accountC.size()); }
Example #10
Source File: OrTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@Test @DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/orTest/testOr5.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/orTest/testOr5.result.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/orTest/testOr5.result.xml") public void testOr5() { LoginLog_Condition lc = new LoginLog_Condition(); lc.setAccount(new Account_Condition()); lc.getAccount().setRole(new Role_Condition()); lc.getAccount().setRoleDeputy(new Role_Condition()); ((Role_Condition) lc.getAccount().getRole()).setNameEqualsOrAccountNameEquals("user", "bob"); ((Role_Condition) lc.getAccount().getRoleDeputy()).setNameEqualsOrAccountNameEquals("silver", "bob"); Collection<LoginLog_> loginLogC = loginLogService.selectAll(lc); Assert.assertEquals(2, loginLogC.size()); Collection<LoginLog_> loginLogC2 = loginLogService.selectAllPrefix(lc); Assert.assertEquals(2, loginLogC2.size()); }
Example #11
Source File: CacheTest1.java From mybatis.flying with Apache License 2.0 | 6 votes |
@Test @IfProfileValue(name = "CACHE", value = "true") @ExpectedDatabase(connection = "dataSource1", assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED, value = "/indi/mybatis/flying/test/cacheTest/testInsertSnowFlakeCache.result.xml") @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/cacheTest/testInsertSnowFlakeCache.result.xml") public void testInsertSnowFlakeCache() { Account_ account = new Account_(); account.setName("ann"); accountService.insert(account); int i = accountService.count(new Account_()); Assert.assertEquals(1, i); Account_ account2 = new Account_(); account2.setName("bob"); accountService.insertSnowFlake(account2); int i2 = accountService.count(new Account_()); Assert.assertEquals(2, i2); }
Example #12
Source File: IgnoreInsertAndUpdateTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@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()); LoginLogSource2 loginLog2 = new LoginLogSource2(); loginLog2.setId(22); d2.setLoginLogSource2(loginLog2); detail2Service.insertWithoutFoo(d2); }
Example #13
Source File: CacheTest1.java From mybatis.flying with Apache License 2.0 | 6 votes |
@IfProfileValue(name = "CACHE", value = "true") @ExpectedDatabase(connection = "dataSource1", assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/cacheTest/testUpdateDirect.result.xml") @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/cacheTest/testUpdateDirect.result.xml") public void testUpdateDirect() { Role_ r = new Role_(); r.setId(1); r.setName("ann"); roleService.insert(r); Account_ a = new Account_(); a.setId(1L); a.setRole(r); a.setEmail("email"); accountService.insert(a); Account_ account = accountService.select(1); Assert.assertEquals("ann", account.getRole().getName()); Map<String, Object> m = new HashMap<>(4); m.put("id", 1); m.put("name", "bob"); roleService.updateDirect(m); Account_ account2 = accountService.select(1); Assert.assertEquals("ann", account2.getRole().getName()); }
Example #14
Source File: JpaTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@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()); }
Example #15
Source File: WhiteListTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@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("[email protected]"); account.setPassword("bbb"); account.setStatus(StoryStatus_.p); account.setActivateValue(null); Role_ role = new Role_(); role.setId(33); account.setRole(role); accountService.updatePersistentSimpleNoName(account); }
Example #16
Source File: WhiteListTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@Test @DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/whiteListTest/testWhiteListUpdate.xml") @ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/whiteListTest/testWhiteListUpdate.result.xml") @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/whiteListTest/testWhiteListUpdate.result.xml") public void testWhiteListUpdate() { Account_ account = accountService.select(1); account.setName("bob"); account.setEmail("[email protected]"); account.setPassword("bbb"); account.setStatus(StoryStatus_.p); account.setActivateValue("bv"); Role_ role = new Role_(); role.setId(2); account.setRole(role); Permission permission = new Permission(); permission.setId(22); account.setPermission(permission); accountService.updateSimpleNoName(account); }
Example #17
Source File: WhiteListTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@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); }
Example #18
Source File: WhiteListTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@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()); }
Example #19
Source File: IndexTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@Test @DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/indexTest/testIndex.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/indexTest/testIndex.result.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/indexTest/testIndex.result.xml") public void testIndex() { Account_ account = accountService.selectWithIndex(2); Assert.assertEquals("bob", account.getName()); Account_ ac = new Account_(); ac.setName("bob"); Account_ account2 = accountService.selectOne(ac); Assert.assertEquals("[email protected]", account2.getEmail()); Account_Condition ac2 = new Account_Condition(); ac2.setNameNotEqual("carl"); int c = accountService.count(ac2); Assert.assertEquals(2, c); }
Example #20
Source File: BatchProcessTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@Test @DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/batchProcessTest/testBatchUpdate10.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/batchProcessTest/testBatchUpdate10.result.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/batchProcessTest/testBatchUpdate10.xml") public void testBatchUpdate10() { Account_Condition ac = new Account_Condition(); ac.setEmail("[email protected]"); ac.setNameIsNull(true); accountService.update(ac); Account_Condition ac2 = new Account_Condition(); ac2.setEmail("[email protected]"); ac2.setNameIsNull(false); ac2.setActivateValueEqual("aaa"); accountService.update(ac2); }
Example #21
Source File: BatchProcessTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@Test @DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/batchProcessTest/testBatchUpdate11.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/batchProcessTest/testBatchUpdate11.result.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/batchProcessTest/testBatchUpdate11.xml") public void testBatchUpdate11() { List<String> nameC = new ArrayList<>(); nameC.add("a2"); nameC.add("b"); Account_Condition ac = new Account_Condition(); ac.setEmail("[email protected]"); ac.setNameIn(nameC); accountService.update(ac); Account_Condition ac2 = new Account_Condition(); ac2.setEmail("[email protected]"); ac2.setNameIn(new ArrayList<String>()); accountService.update(ac2); }
Example #22
Source File: BatchProcessTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@Test @DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/batchProcessTest/testBatchUpdate12.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED, value = "/indi/mybatis/flying/test/batchProcessTest/testBatchUpdate12.result.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/batchProcessTest/testBatchUpdate12.xml") public void testBatchUpdate12() { List<String> nameC = new ArrayList<>(); nameC.add("a2"); nameC.add("b"); Account_Condition ac = new Account_Condition(); ac.setEmail("[email protected]"); ac.setNameNotIn(nameC); accountService.update(ac); Account_ a2 = new Account_(); a2.setId(2L); a2.setPassword("aaa"); // wrong opLock a2.setOpLock(10); accountService.update(a2); }
Example #23
Source File: AccountTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
/** 测试deputyRole */ @Test @DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/accountTest/testDeputy.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/accountTest/testDeputy.result.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/accountTest/testDeputy.xml") public void testDeputy() { Account_ account = accountService.select(1); Assert.assertEquals("role1", account.getRole().getName()); Assert.assertEquals("role2", account.getRoleDeputy().getName()); Role_ rc = new Role_(); rc.setName("role1"); Role_ rdc = new Role_(); rdc.setName("role2"); Account_ ac = new Account_(); ac.setRole(rc); ac.setRoleDeputy(rdc); Collection<Account_> accountC = accountService.selectAll(ac); Assert.assertEquals(1, accountC.size()); int count = accountService.count(ac); Assert.assertEquals(1, count); }
Example #24
Source File: AccountTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
/** 测试CostumizeStatus功能 */ @Test @DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/accountTest/testCostumizeStatus.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/accountTest/testCostumizeStatus.result.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/accountTest/testCostumizeStatus.xml") public void testCostumizeStatus() { Account_ a = accountService.select(1); Assert.assertEquals("发布", a.getStatus().text()); Account_ ac = new Account_(); ac.setStatus(StoryStatus_.p); Collection<Account_> c = accountService.selectAll(ac); Assert.assertEquals(1, c.size()); Account_ a2 = accountService.select(2); Assert.assertEquals(StoryStatus_.s, a2.getStatus()); a2.setStatus(StoryStatus_.c); accountService.update(a2); Account_ a3 = accountService.select(3); Assert.assertNull(a3.getStatus()); a3.setPassword("5a690d842935c51f26f473e025c1b97a"); accountService.updatePersistent(a3); Account_ a4 = accountService.select(3); Assert.assertNull(a4.getStatus()); }
Example #25
Source File: Account2Test.java From mybatis.flying with Apache License 2.0 | 6 votes |
/** 测试insert功能(有乐观锁) */ @Test @DatabaseSetups({ @DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/accountTest2/testCondition.datasource.xml"), @DatabaseSetup(connection = "dataSource2", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/accountTest2/testCondition.datasource2.xml") }) @ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/accountTest2/testCondition.datasource.result.xml"), @ExpectedDatabase(connection = "dataSource2", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/accountTest2/testCondition.datasource2.result.xml") }) @DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/accountTest2/testCondition.datasource.result.xml"), @DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/accountTest2/testCondition.datasource2.result.xml") }) public void testCondition() { LoginLog_Condition lc1 = new LoginLog_Condition(); lc1.setIpLikeFilter("5"); int i1 = loginLogService.count(lc1); Assert.assertEquals(1, i1); LoginLogSource2Condition lc2 = new LoginLogSource2Condition(); lc2.setIpLikeFilter("2"); int i2 = loginLogSource2Service.count(lc2); Assert.assertEquals(1, i2); }
Example #26
Source File: AccountTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@Test @DatabaseSetups({ @DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/accountTest/testTransactive3.datasource.xml"), @DatabaseSetup(connection = "dataSource2", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/accountTest/testTransactive3.datasource2.xml") }) @ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/accountTest/testTransactive3.datasource.result.xml"), @ExpectedDatabase(connection = "dataSource2", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/accountTest/testTransactive3.datasource2.result.xml") }) @DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/accountTest/testTransactive3.datasource.result.xml"), @DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/accountTest/testTransactive3.datasource2.result.xml") }) public void testTransactive3() { try { transactiveService4.testTransactive(); } catch (ConfigurerException e) { e.printStackTrace(); } }
Example #27
Source File: DelegateTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@Test @DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/delegateTest/testDelegateUpdate.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/delegateTest/testDelegateUpdate.result.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/delegateTest/testDelegateUpdate.xml") public void testDelegateUpdate() { LoginLog_ loginLog = loginLogService.select(1); loginLog.setAccount(null); loginLog.setDelegateAccountId(2L); loginLogService.update(loginLog); // 当login.getAccount()不为null时,修改accountId不起作用 LoginLog_ loginLog2 = loginLogService.select(1); loginLog2.setDelegateAccountId(11L); loginLogService.update(loginLog2); }
Example #28
Source File: AccountTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@Test @DatabaseSetups({ @DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/accountTest/testTransactive2.datasource.xml"), @DatabaseSetup(connection = "dataSource2", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/accountTest/testTransactive2.datasource2.xml") }) @ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/accountTest/testTransactive2.datasource.result.xml"), @ExpectedDatabase(connection = "dataSource2", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/accountTest/testTransactive2.datasource2.result.xml") }) @DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/accountTest/testTransactive2.datasource.result.xml"), @DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/accountTest/testTransactive2.datasource2.result.xml") }) public void testTransactive2() { try { transactiveService.addAccountTransactive(); } catch (ConfigurerException e) { e.printStackTrace(); } }
Example #29
Source File: DelegateTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@Test @DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/delegateTest/testDelegateInsertBatch.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED, value = "/indi/mybatis/flying/test/delegateTest/testDelegateInsertBatch.result.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/delegateTest/testDelegateInsertBatch.xml") public void testDelegateInsertBatch() { Collection<LoginLog_> c = new LinkedList<>(); LoginLog_ l1 = new LoginLog_(); l1.setLoginIP("0.0.0.1"); l1.setDelegateAccountId(1L); c.add(l1); LoginLog_ l2 = new LoginLog_(); l2.setLoginIP("0.0.0.2"); l2.setDelegateAccountId(2L); c.add(l2); loginLogService.insertBatch(c); }
Example #30
Source File: DelegateTest.java From mybatis.flying with Apache License 2.0 | 6 votes |
@Test @DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/delegateTest/testDelegateCondition.xml") @ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED, value = "/indi/mybatis/flying/test/delegateTest/testDelegateCondition.result.xml") @DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/delegateTest/testDelegateCondition.xml") public void testDelegateCondition() { LoginLog_Condition lc = new LoginLog_Condition(); lc.setIpLikeFilter("0.1"); Account_ a = new Account_(); a.setName("ann"); a.setDelegateRoleId(3L); lc.setAccount(a); LoginLog_ loginLog = loginLogService.selectOne(lc); Assert.assertEquals("0.0.0.1", loginLog.getLoginIP()); a.setDelegateRoleId(4L); loginLog = loginLogService.selectOne(lc); Assert.assertNull(loginLog); }