Search in sources :

Example 6 with ApproveDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO in project ArachneCentralAPI by OHDSI.

the class AnalysisSubmissionControllerTests method testDeclineSubmissionByOwner.

@Test
@WithUserDetails(DATA_NODE_ONWER)
@DatabaseSetups({ @DatabaseSetup("/data/analysis/submission/submission-pending.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/analysis/submission/result/submission-datasource2-declined.xml", assertionMode = NON_STRICT) })
public void testDeclineSubmissionByOwner() throws Exception {
    ApproveDTO approveDTO = new ApproveDTO(SUBMISSION_ID, false, null, "comment");
    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(NO_ERROR_CODE);
}
Also used : ApproveDTO(com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO) DatabaseSetups(com.github.springtestdbunit.annotation.DatabaseSetups) Test(org.junit.Test) WithUserDetails(org.springframework.security.test.context.support.WithUserDetails) ExpectedDatabases(com.github.springtestdbunit.annotation.ExpectedDatabases)

Example 7 with ApproveDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO in project ArachneCentralAPI by OHDSI.

the class AnalysisSubmissionControllerTests method testDeclineSubmissionResultByNonOwner.

@Test
@WithUserDetails(DATA_NODE_USER)
@DatabaseSetups({ @DatabaseSetup("/data/analysis/submission/submission-executed.xml") })
@ExpectedDatabase(value = "/data/analysis/submission/submission-executed.xml", assertionMode = NON_STRICT)
public void testDeclineSubmissionResultByNonOwner() throws Exception {
    ApproveDTO approveDTO = new ApproveDTO(SUBMISSION_ID, false, null, "comment");
    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);
}
Also used : ApproveDTO(com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO) ExpectedDatabase(com.github.springtestdbunit.annotation.ExpectedDatabase) DatabaseSetups(com.github.springtestdbunit.annotation.DatabaseSetups) Test(org.junit.Test) WithUserDetails(org.springframework.security.test.context.support.WithUserDetails)

Example 8 with ApproveDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO in project ArachneCentralAPI by OHDSI.

the class AnalysisSubmissionControllerTests method testDeclineSubmissionResultByOwner.

@Test
@WithUserDetails(DATA_NODE_ONWER)
@DatabaseSetups({ @DatabaseSetup("/data/analysis/submission/submission-executed.xml") })
@ExpectedDatabase(value = "/data/analysis/submission/result/submission-datasource2-result-declined.xml", assertionMode = NON_STRICT)
public void testDeclineSubmissionResultByOwner() throws Exception {
    ApproveDTO approveDTO = new ApproveDTO(SUBMISSION_ID, false, null, "comment");
    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(NO_ERROR_CODE);
}
Also used : ApproveDTO(com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO) ExpectedDatabase(com.github.springtestdbunit.annotation.ExpectedDatabase) DatabaseSetups(com.github.springtestdbunit.annotation.DatabaseSetups) Test(org.junit.Test) WithUserDetails(org.springframework.security.test.context.support.WithUserDetails)

Example 9 with ApproveDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO in project ArachneCentralAPI by OHDSI.

the class AnalysisSubmissionControllerTests method testDeclineSubmissionByNonOwner.

@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 testDeclineSubmissionByNonOwner() throws Exception {
    ApproveDTO approveDTO = new ApproveDTO(SUBMISSION_ID, false, null, "comment");
    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);
}
Also used : ApproveDTO(com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO) ExpectedDatabase(com.github.springtestdbunit.annotation.ExpectedDatabase) DatabaseSetups(com.github.springtestdbunit.annotation.DatabaseSetups) Test(org.junit.Test) WithUserDetails(org.springframework.security.test.context.support.WithUserDetails)

Example 10 with ApproveDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO in project ArachneCentralAPI by OHDSI.

the class AnalysisSubmissionControllerTests method testApproveSubmissionByOwner.

@Test
@WithUserDetails(DATA_NODE_ONWER)
@DatabaseSetups({ @DatabaseSetup("/data/analysis/submission/submission-pending.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/analysis/submission/result/submission-datasource2-approved.xml", assertionMode = NON_STRICT) })
public void testApproveSubmissionByOwner() throws Exception {
    ApproveDTO approveDTO = new ApproveDTO(SUBMISSION_ID, true, null, "string");
    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(NO_ERROR_CODE);
}
Also used : ApproveDTO(com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO) DatabaseSetups(com.github.springtestdbunit.annotation.DatabaseSetups) Test(org.junit.Test) WithUserDetails(org.springframework.security.test.context.support.WithUserDetails) ExpectedDatabases(com.github.springtestdbunit.annotation.ExpectedDatabases)

Aggregations

ApproveDTO (com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO)11 DatabaseSetups (com.github.springtestdbunit.annotation.DatabaseSetups)8 Test (org.junit.Test)8 WithUserDetails (org.springframework.security.test.context.support.WithUserDetails)8 ExpectedDatabase (com.github.springtestdbunit.annotation.ExpectedDatabase)6 JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)3 ExpectedDatabases (com.github.springtestdbunit.annotation.ExpectedDatabases)2 CommonAnalysisExecutionStatusDTO (com.odysseusinc.arachne.commons.api.v1.dto.CommonAnalysisExecutionStatusDTO)2 BaseSubmissionAndAnalysisTypeDTO (com.odysseusinc.arachne.portal.api.v1.dto.BaseSubmissionAndAnalysisTypeDTO)2 BaseSubmissionDTO (com.odysseusinc.arachne.portal.api.v1.dto.BaseSubmissionDTO)2 CreateSubmissionsDTO (com.odysseusinc.arachne.portal.api.v1.dto.CreateSubmissionsDTO)2 FileDTO (com.odysseusinc.arachne.portal.api.v1.dto.FileDTO)2 ResultFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.ResultFileDTO)2 SubmissionDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO)2 SubmissionFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionFileDTO)2 SubmissionStatusHistoryElementDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusHistoryElementDTO)2 UploadFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.UploadFileDTO)2 ApiOperation (io.swagger.annotations.ApiOperation)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)2 UserProfileDTO (com.odysseusinc.arachne.portal.api.v1.dto.UserProfileDTO)1