use of com.github.springtestdbunit.annotation.ExpectedDatabases in project ArachneCentralAPI by OHDSI.
the class AnalysisControllerTests method testGetAnalysis.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetups({ @DatabaseSetup("/data/study-with-contributor.xml"), @DatabaseSetup("/data/analysis/analysis-after-title-updating.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study-with-contributor.xml", assertionMode = NON_STRICT), @ExpectedDatabase(value = "/data/analysis/analysis-after-title-updating.xml", assertionMode = NON_STRICT) })
public void testGetAnalysis() throws Exception {
MvcResult mvcResult = mvc.perform(get("/api/v1/analysis-management/analyses/" + ANALYSIS_ID)).andExpect(OK_STATUS).andExpect(NO_ERROR_CODE).andReturn();
JSONAssert.assertEquals(UPDATED_ANALYSIS_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
use of com.github.springtestdbunit.annotation.ExpectedDatabases in project ArachneCentralAPI by OHDSI.
the class AnalysisControllerTests method testUpdateAnalysisType.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetups({ @DatabaseSetup("/data/study-with-contributor.xml"), @DatabaseSetup("/data/analysis/analysis-before-updating.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study-with-contributor.xml", assertionMode = NON_STRICT), @ExpectedDatabase(value = "/data/analysis/analysis-after-type-updating.xml", assertionMode = NON_STRICT) })
public void testUpdateAnalysisType() throws Exception {
AnalysisUpdateDTO analysisDTO = new AnalysisUpdateDTO();
analysisDTO.setTypeId(CommonAnalysisType.COHORT_CHARACTERIZATION.name());
testUpdate(analysisDTO, UPDATED_ANALYSIS_TYPE_JSON_OBJECT, "Cohort Characterization");
}
use of com.github.springtestdbunit.annotation.ExpectedDatabases in project ArachneCentralAPI by OHDSI.
the class AnalysisLockingControllerTests method testLockAnalysis.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetups({ @DatabaseSetup("/data/users.xml"), @DatabaseSetup("/data/study-with-contributor.xml"), @DatabaseSetup("/data/analysis/analysis-list.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/users.xml", assertionMode = NON_STRICT), @ExpectedDatabase(value = "/data/study-with-contributor.xml", assertionMode = NON_STRICT), @ExpectedDatabase(value = "/data/analysis/analysis-after-locking.xml", assertionMode = NON_STRICT) })
public void testLockAnalysis() throws Exception {
AnalysisLockDTO lockFileDTO = new AnalysisLockDTO();
lockFileDTO.setLocked(TRUE);
mvc.perform(post("/api/v1/analysis-management/analyses/{analysisId}/lock", ANALYSIS_ID).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(lockFileDTO))).andExpect(NO_ERROR_CODE);
}
use of com.github.springtestdbunit.annotation.ExpectedDatabases in project ArachneCentralAPI by OHDSI.
the class AnalysisLockingControllerTests method testProcessUnlockRequest.
@Test
@WithUserDetails(value = "user@mail.com")
@DatabaseSetups({ @DatabaseSetup("/data/study/study-participant-with-contributor-and-leader-before.xml"), @DatabaseSetup("/data/analysis/analysis-after-locking.xml"), @DatabaseSetup("/data/analysis/analysis-unlock-requests-before-processing.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-participant-with-contributor-and-leader-before.xml", assertionMode = NON_STRICT), @ExpectedDatabase(value = "/data/analysis/analysis-list.xml", assertionMode = NON_STRICT), @ExpectedDatabase(value = "/data/analysis/analysis-unlock-requests-after-processing.xml", assertionMode = NON_STRICT) })
public void testProcessUnlockRequest() throws Exception {
InvitationActionDTO actionDTO = new InvitationActionDTO();
actionDTO.setAccepted(true);
actionDTO.setId(30L);
actionDTO.setType(InvitationType.UNLOCK_ANALYSIS);
mvc.perform(post("/api/v1/user-management/users/invitations").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(actionDTO))).andExpect(NO_ERROR_CODE);
}
use of com.github.springtestdbunit.annotation.ExpectedDatabases in project ArachneCentralAPI by OHDSI.
the class AnalysisSubmissionControllerTests method testDeleteSubmissionResult.
// @Test
// @WithUserDetails(DATA_NODE_ONWER)
// @DatabaseSetups({
// @DatabaseSetup("/data/analysis/submission/submission-published-with-added-files.xml"),
// })
// @ExpectedDatabases({
// @ExpectedDatabase(value = "/data/analysis/submission/submission-published-with-added-files.xml", assertionMode = NON_STRICT),
//
// })
// public void testGetUploadingSubmissionResult() throws Exception {
//
// prepareResultFile(1L);
// }
@Test
@WithUserDetails(DATA_NODE_ONWER)
@DatabaseSetups({ @DatabaseSetup("/data/analysis/submission/submission-in-progress.xml"), @DatabaseSetup("/data/analysis/submission/result-file.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/analysis/submission/submission-in-progress.xml", assertionMode = NON_STRICT), @ExpectedDatabase(value = "/data/analysis/submission/result/empty-result-file.xml", assertionMode = NON_STRICT) })
public void testDeleteSubmissionResult() throws Exception {
Long submissionId = 1L;
ArachneFileMeta fileMeta = prepareResultFile(1L);
String fileUuid = fileMeta.getUuid();
mvc.perform(delete("/api/v1/analysis-management/submissions/{submissionId}/result/{fileUuid}", submissionId, fileUuid)).andExpect(NO_ERROR_CODE);
if (checkFileExists(getResultFilePath(submissionId))) {
throw new Exception("JCR file was not deleted");
}
}
Aggregations