Search in sources :

Example 21 with Submission

use of com.odysseusinc.arachne.portal.model.Submission in project ArachneCentralAPI by OHDSI.

the class AnalysisHelperTest method createSubmission.

@Test
@WithUserDetails("admin@odysseusinc.com")
public void createSubmission() throws Exception {
    DataSource dataSource = prepareDataSource();
    when(dataSourceService.getByIdUnsecured(1L)).thenReturn(dataSource);
    IUser user = prepareUser();
    Study study = prepareStudy(user);
    Analysis analysis = prepareAnalysis(user, study);
    List<Submission> submissions = AnalysisHelper.createSubmission(submissionService, Collections.<Long>singletonList(1L), user, analysis);
    try {
        assertThat(submissions, is(not(empty())));
        assertThat(submissions, contains(hasProperty("status", notNullValue())));
        assertThat(submissions, contains(hasProperty("submissionGroup", notNullValue())));
    } finally {
        cleanup(submissions, analysis, study);
    }
}
Also used : Study(com.odysseusinc.arachne.portal.model.Study) Submission(com.odysseusinc.arachne.portal.model.Submission) Analysis(com.odysseusinc.arachne.portal.model.Analysis) IUser(com.odysseusinc.arachne.portal.model.IUser) DataSource(com.odysseusinc.arachne.portal.model.DataSource) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test) WithUserDetails(org.springframework.security.test.context.support.WithUserDetails)

Aggregations

Submission (com.odysseusinc.arachne.portal.model.Submission)21 LinkedList (java.util.LinkedList)8 List (java.util.List)8 ResultFile (com.odysseusinc.arachne.portal.model.ResultFile)7 ApiOperation (io.swagger.annotations.ApiOperation)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 Analysis (com.odysseusinc.arachne.portal.model.Analysis)6 IUser (com.odysseusinc.arachne.portal.model.IUser)6 Collectors (java.util.stream.Collectors)6 NotExistException (com.odysseusinc.arachne.portal.exception.NotExistException)5 SubmissionStatus (com.odysseusinc.arachne.portal.model.SubmissionStatus)5 Date (java.util.Date)5 Logger (org.slf4j.Logger)5 LoggerFactory (org.slf4j.LoggerFactory)5 JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)4 ApproveDTO (com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO)4 SubmissionDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO)4 SubmissionStatusHistoryElementDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusHistoryElementDTO)4 SubmissionStatusHistoryElement (com.odysseusinc.arachne.portal.model.SubmissionStatusHistoryElement)4 Path (java.nio.file.Path)4