Search in sources :

Example 46 with AnalysisSubmission

use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.

the class AnalysisSubmissionServiceImplIT method testUpdateAdminUser.

/**
 * Tests updating the analysis as the admin user.
 */
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testUpdateAdminUser() {
    AnalysisSubmission submission = analysisSubmissionService.read(1L);
    submission.setAnalysisState(AnalysisState.COMPLETED);
    assertNotNull("submission should be updated", analysisSubmissionService.update(submission));
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 47 with AnalysisSubmission

use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.

the class AnalysisSubmissionServiceImplIT method testReadSharedAnalysis.

/**
 * Tests whether a user can read an analysis when they are not the submitter
 * but they are on a project where the analysis is shared
 */
@Test
@WithMockUser(username = "otheraaron", roles = "USER")
public void testReadSharedAnalysis() {
    AnalysisSubmission read = analysisSubmissionService.read(3L);
    assertEquals("id should be 3", new Long(3), read.getId());
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 48 with AnalysisSubmission

use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.

the class AnalysisSubmissionServiceImplIT method shareAnalysisSubmissionWithProjectFail.

@Test(expected = AccessDeniedException.class)
@WithMockUser(username = "otheraaron", roles = "USER")
public void shareAnalysisSubmissionWithProjectFail() {
    AnalysisSubmission read = analysisSubmissionService.read(3L);
    Project project2 = projectService.read(2L);
    analysisSubmissionService.shareAnalysisSubmissionWithProject(read, project2);
}
Also used : Project(ca.corefacility.bioinformatics.irida.model.project.Project) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 49 with AnalysisSubmission

use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.

the class AnalysisSubmissionServiceImplIT method testRemoveAnalysisSubmissionFromProjectFail.

@Test(expected = AccessDeniedException.class)
@WithMockUser(username = "otheraaron", roles = "USER")
public void testRemoveAnalysisSubmissionFromProjectFail() {
    AnalysisSubmission read = analysisSubmissionService.read(3L);
    Project project2 = projectService.read(1L);
    analysisSubmissionService.removeAnalysisProjectShare(read, project2);
}
Also used : Project(ca.corefacility.bioinformatics.irida.model.project.Project) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 50 with AnalysisSubmission

use of ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission in project irida by phac-nml.

the class AnalysisSubmissionServiceImplIT method testCreateRegularUser.

/**
 * Tests creating a submission as a regular user.
 */
@Test
@WithMockUser(username = "aaron", roles = "USER")
public void testCreateRegularUser() {
    SingleEndSequenceFile sequencingObject = (SingleEndSequenceFile) sequencingObjectRepository.findOne(1L);
    AnalysisSubmission submission = AnalysisSubmission.builder(workflowId).name("test").inputFiles(Sets.newHashSet(sequencingObject)).build();
    AnalysisSubmission createdSubmission = analysisSubmissionService.create(submission);
    assertNotNull("Submission should have been created", createdSubmission);
    assertEquals("submitter should be set properly", Long.valueOf(1L), createdSubmission.getSubmitter().getId());
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Aggregations

AnalysisSubmission (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)183 Test (org.junit.Test)121 WithMockUser (org.springframework.security.test.context.support.WithMockUser)95 IridaWorkflow (ca.corefacility.bioinformatics.irida.model.workflow.IridaWorkflow)30 Analysis (ca.corefacility.bioinformatics.irida.model.workflow.analysis.Analysis)30 Path (java.nio.file.Path)25 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)23 HistoriesClient (com.github.jmchilton.blend4j.galaxy.HistoriesClient)20 Project (ca.corefacility.bioinformatics.irida.model.project.Project)19 History (com.github.jmchilton.blend4j.galaxy.beans.History)19 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)18 AnalysisOutputFile (ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisOutputFile)18 WorkflowsClient (com.github.jmchilton.blend4j.galaxy.WorkflowsClient)18 Workflow (com.github.jmchilton.blend4j.galaxy.beans.Workflow)18 Sample (ca.corefacility.bioinformatics.irida.model.sample.Sample)15 User (ca.corefacility.bioinformatics.irida.model.user.User)15 EntityNotFoundException (ca.corefacility.bioinformatics.irida.exceptions.EntityNotFoundException)12 ExecutionManagerException (ca.corefacility.bioinformatics.irida.exceptions.ExecutionManagerException)12 ProjectAnalysisSubmissionJoin (ca.corefacility.bioinformatics.irida.model.workflow.submission.ProjectAnalysisSubmissionJoin)12 ToolExecution (ca.corefacility.bioinformatics.irida.model.workflow.analysis.ToolExecution)11