use of com.github.springtestdbunit.annotation.DatabaseSetups in project ArachneCentralAPI by OHDSI.
the class AnalysisSubmissionControllerTests method testApproveSubmissionResultByNonOwner.
@Test
@WithUserDetails(STUDY_LEAD)
@DatabaseSetups({ @DatabaseSetup("/data/analysis/submission/submission-executed.xml") })
@ExpectedDatabase(value = "/data/analysis/submission/submission-executed.xml", assertionMode = NON_STRICT)
public void testApproveSubmissionResultByNonOwner() 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}/approveresult", 1).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(approveDTO))).andExpect(PERMISSION_DENIED_CODE);
}
use of com.github.springtestdbunit.annotation.DatabaseSetups 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");
}
}
use of com.github.springtestdbunit.annotation.DatabaseSetups 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.DatabaseSetups 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.DatabaseSetups in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateContributorRoleToDatasetOwner.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetups({ @DatabaseSetup("/data/study/study-participant-before-changing-role.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-participant-before-changing-role.xml", assertionMode = NON_STRICT) })
public void testUpdateContributorRoleToDatasetOwner() throws Exception {
UpdateParticipantDTO participantDTO = new UpdateParticipantDTO();
participantDTO.setRole(DATA_SET_OWNER.name());
mvc.perform(put("/api/v1/study-management/studies/" + STUDY_ID + "/participants/" + 2L).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(participantDTO))).andExpect(jsonPath("$.errorCode").value(VALIDATION_ERROR.getCode()));
}
Aggregations