use of com.github.springtestdbunit.annotation.DatabaseSetups in project mybatis.flying by limeng32.
the class GroupTest method test1.
@Test
@DatabaseSetups({ @DatabaseSetup(connection = "dataSource1", type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/groupTest/test1.datasource.xml") })
@ExpectedDatabases({ @ExpectedDatabase(connection = "dataSource1", override = false, assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/groupTest/test1.datasource.result.xml") })
@DatabaseTearDowns({ @DatabaseTearDown(connection = "dataSource1", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/groupTest/test1.datasource.xml") })
public void test1() {
ProjRatio projRatio = projRatioMapper.select(1);
System.out.println("::" + JSONObject.toJSONString(projRatio));
EmpScore2 empScore = empScore2Mapper.select(1L);
System.out.println("::" + JSONObject.toJSONString(empScore));
Assert.assertEquals(1, empScore.getProjRatio().getId().intValue());
EmpScore2 e = new EmpScore2();
e.setId(3L);
List<EmpScore2> empScore2List = empScore2Mapper.selectAll(e);
Assert.assertEquals(1, empScore2List.size());
Assert.assertEquals(3, empScore2List.get(0).getProjRatio().getId().intValue());
ProjRatio p = new ProjRatio();
p.setId(2L);
e.setProjRatio(p);
List<EmpScore2> empScore2List2 = empScore2Mapper.selectAll(e);
Assert.assertEquals(1, empScore2List2.size());
Assert.assertEquals(2, empScore2List2.get(0).getProjRatio().getId().intValue());
EmpScore2 e2 = new EmpScore2();
e2.setId(3L);
int c = empScore2Mapper.count(e2);
Assert.assertEquals(4, c);
EmpScore2 e3 = new EmpScore2();
e3.setStaffId("111");
int c2 = empScore2Mapper.count(e3);
Assert.assertEquals(2, c2);
}
use of com.github.springtestdbunit.annotation.DatabaseSetups 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());
}
use of com.github.springtestdbunit.annotation.DatabaseSetups in project mybatis.flying by limeng32.
the class Account2Test method testCondition.
/**
* 测试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);
}
use of com.github.springtestdbunit.annotation.DatabaseSetups in project ArachneCentralAPI by OHDSI.
the class AnalysisSubmissionControllerTests method testManualUploadingSubmissionResult.
@Test
@WithUserDetails(DATA_NODE_ONWER)
@DatabaseSetups({ @DatabaseSetup("/data/analysis/submission/submission-in-progress.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/analysis/submission/result/submission-in-progress-with-added-file.xml", assertionMode = NON_STRICT) })
public void testManualUploadingSubmissionResult() throws Exception {
FileInputStream fileInputStream = new FileInputStream(this.getClass().getResource("/test.jpg").getPath());
MockMultipartFile multipartFile = new MockMultipartFile("file", "test.sql", "image/jpeg", fileInputStream);
mvc.perform(fileUpload("/api/v1/analysis-management/submissions/result/manualupload").file(multipartFile).contentType(MULTIPART_FORM_DATA).param("submissionId", "1").param("label", "test.sql")).andExpect(NO_ERROR_CODE);
}
use of com.github.springtestdbunit.annotation.DatabaseSetups in project ArachneCentralAPI by OHDSI.
the class AnalysisSubmissionControllerTests method testApproveSubmissionByNonOwner.
@Test
@WithUserDetails(DATA_NODE_USER)
@DatabaseSetups({ @DatabaseSetup("/data/analysis/submission/submission-pending.xml") })
@ExpectedDatabase(value = "/data/analysis/submission/submission-pending.xml", assertionMode = NON_STRICT)
public void testApproveSubmissionByNonOwner() throws Exception {
ApproveDTO approveDTO = new ApproveDTO(SUBMISSION_ID, true, null, null);
prepareAnalysisFile(STUDY_ID, ANALYSIS_ID);
prepareSubmissionGroupFile(STUDY_ID, ANALYSIS_ID, SUBMISSION_GROUP_ID);
mvc.perform(post("/api/v1/analysis-management/submissions/{submissionId}/approve", 1).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(approveDTO))).andExpect(PERMISSION_DENIED_CODE);
}
Aggregations