Search in sources :

Example 51 with AnalysisSubmission

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

the class AnalysisSubmissionServiceImplIT method testRemoveAnalysisSubmissionFromProject.

@Test
@WithMockUser(username = "aaron", roles = "USER")
public void testRemoveAnalysisSubmissionFromProject() {
    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 52 with AnalysisSubmission

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

the class AnalysisSubmissionServiceImplIT method testCreateSubmissionWithUnsavedNamedParameters.

@Test(expected = UnsupportedOperationException.class)
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testCreateSubmissionWithUnsavedNamedParameters() {
    final SingleEndSequenceFile sequencingObject = (SingleEndSequenceFile) sequencingObjectRepository.findOne(1L);
    final IridaWorkflowNamedParameters params = new IridaWorkflowNamedParameters("named parameters.", workflowId, ImmutableMap.of("named", "parameter"));
    final AnalysisSubmission submission = AnalysisSubmission.builder(workflowId).inputFiles(Sets.newHashSet(sequencingObject)).withNamedParameters(params).build();
    analysisSubmissionService.create(submission);
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) IridaWorkflowNamedParameters(ca.corefacility.bioinformatics.irida.model.workflow.submission.IridaWorkflowNamedParameters) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 53 with AnalysisSubmission

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

the class AnalysisSubmissionServiceImplIT method searchAnalyses.

@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void searchAnalyses() {
    Page<AnalysisSubmission> paged = analysisSubmissionService.listAllSubmissions(null, null, null, null, new PageRequest(0, 10, new Sort(Direction.ASC, "createdDate")));
    assertEquals(10, paged.getContent().size());
    // Try filtering a by names
    String name = "My";
    paged = analysisSubmissionService.listAllSubmissions(null, name, null, null, new PageRequest(0, 10, new Sort(Direction.ASC, "createdDate")));
    assertEquals(8, paged.getContent().size());
    // Add a state filter
    AnalysisState state = AnalysisState.COMPLETED;
    paged = analysisSubmissionService.listAllSubmissions(null, name, state, null, new PageRequest(0, 10, new Sort(Direction.ASC, "createdDate")));
    assertEquals(2, paged.getContent().size());
}
Also used : PageRequest(org.springframework.data.domain.PageRequest) AnalysisState(ca.corefacility.bioinformatics.irida.model.enums.AnalysisState) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) Sort(org.springframework.data.domain.Sort) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 54 with AnalysisSubmission

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

the class AnalysisSubmissionServiceImplIT method testGetAnalysisSubmissionsForUserAsAdminUser.

/**
 * Tests getting a set of submissions as an admin user for a different user.
 */
@Test
@WithMockUser(username = "otheraaron", roles = "ADMIN")
public void testGetAnalysisSubmissionsForUserAsAdminUser() {
    User user = userRepository.findOne(1L);
    Set<AnalysisSubmission> submissions = analysisSubmissionService.getAnalysisSubmissionsForUser(user);
    assertNotNull("should get submissions for the user", submissions);
    assertEquals("submissions should have correct number", 9, submissions.size());
}
Also used : WithMockUser(org.springframework.security.test.context.support.WithMockUser) User(ca.corefacility.bioinformatics.irida.model.user.User) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 55 with AnalysisSubmission

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

the class AnalysisSubmissionServiceImplIT method testCreateSubmissionWithNamedParameters.

@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testCreateSubmissionWithNamedParameters() {
    final SingleEndSequenceFile sequencingObject = (SingleEndSequenceFile) sequencingObjectRepository.findOne(1L);
    final IridaWorkflowNamedParameters params = parametersRepository.findOne(1L);
    final AnalysisSubmission submission = AnalysisSubmission.builder(workflowId).inputFiles(Sets.newHashSet(sequencingObject)).withNamedParameters(params).build();
    analysisSubmissionService.create(submission);
    assertNotNull("Should have saved and created an id for the submission", submission.getId());
    assertNotNull("Submission should have a map of parameters", submission.getInputParameters());
    assertEquals("Submission parameters should be the same as the named parameters", params.getInputParameters(), submission.getInputParameters());
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) IridaWorkflowNamedParameters(ca.corefacility.bioinformatics.irida.model.workflow.submission.IridaWorkflowNamedParameters) 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