Search in sources :

Example 21 with AnalysisSubmission

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

the class GalaxyJobErrorsServiceIT method testSuccessfulAnalysisReturnsNoJobErrors.

/**
 * Test that a successfully completed Galaxy workflow analysis does not return any {@link JobError}s
 */
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testSuccessfulAnalysisReturnsNoJobErrors() throws Exception {
    databaseSetupGalaxyITService.setupSubmissionInDatabase(1L, sequenceFilePath, referenceFilePath, validIridaWorkflowId, false);
    AnalysisSubmission submission = runAnalysis();
    List<JobError> errors = galaxyJobErrorsService.createNewJobErrors(submission);
    assertTrue(errors.isEmpty());
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) JobError(ca.corefacility.bioinformatics.irida.model.workflow.analysis.JobError) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 22 with AnalysisSubmission

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

the class AnalysisSubmissionRepositoryIT method testCreateAnalysisSingleAndPairedAndReference.

/**
 * Tests creating an analysis with both single and paired files and a
 * reference genome.
 */
@Test
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testCreateAnalysisSingleAndPairedAndReference() {
    Set<SequencingObject> inputs = Sets.newHashSet(sequenceFilePair, singleEndFile);
    AnalysisSubmission analysisSubmissionPaired = AnalysisSubmission.builder(workflowId).name("submission paired 1").inputFiles(inputs).referenceFile(referenceFile).build();
    analysisSubmissionPaired.setSubmitter(submitter1);
    AnalysisSubmission savedSubmission = analysisSubmissionRepository.save(analysisSubmissionPaired);
    Set<SequencingObject> inputsSaved = objectRepository.findSequencingObjectsForAnalysisSubmission(savedSubmission);
    assertTrue("should have single end file in collection", inputsSaved.contains(singleEndFile));
    assertTrue("should have pair file in collection", inputsSaved.contains(sequenceFilePair));
    assertEquals(referenceFile, savedSubmission.getReferenceFile().get());
}
Also used : SequencingObject(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 23 with AnalysisSubmission

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

the class AnalysisSubmissionRepositoryIT method testCreateAnalysisNoSubmitterFail.

/**
 * Tests creating an analysis with no set submitter and failing.
 */
@Test(expected = DataIntegrityViolationException.class)
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testCreateAnalysisNoSubmitterFail() {
    AnalysisSubmission analysisSubmissionPaired = AnalysisSubmission.builder(workflowId).name("submission paired 1").inputFiles(Sets.newHashSet(sequenceFilePair)).build();
    analysisSubmissionRepository.save(analysisSubmissionPaired);
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 24 with AnalysisSubmission

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

the class SampleRepositoryIT method testFindSamplesForAnalysisSubmissionSingleSample.

@Test
@WithMockUser(username = "fbristow", roles = "ADMIN")
public void testFindSamplesForAnalysisSubmissionSingleSample() {
    AnalysisSubmission a = analysisSubmissionRepository.findOne(10L);
    Set<Sample> samples = sampleRepository.findSamplesForAnalysisSubmission(a);
    assertEquals("Sample ids are equal", Sets.newHashSet(11L), samples.stream().map(Sample::getId).collect(Collectors.toSet()));
}
Also used : Sample(ca.corefacility.bioinformatics.irida.model.sample.Sample) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 25 with AnalysisSubmission

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

the class AnalysisExecutionServiceGalaxyIT method testPrepareSubmissionFailInvalidGalaxyWorkflowFile.

/**
 * Tests out attempting to prepare a workflow with an invalid Galaxy
 * workflow file.
 *
 * @throws Throwable
 */
@Test(expected = WorkflowUploadException.class)
@WithMockUser(username = "aaron", roles = "ADMIN")
public void testPrepareSubmissionFailInvalidGalaxyWorkflowFile() throws Throwable {
    AnalysisSubmission analysisSubmission = analysisExecutionGalaxyITService.setupSubmissionInDatabase(1L, sequenceFilePath, referenceFilePath, iridaWorkflowIdInvalidWorkflowFile, AnalysisState.NEW, false);
    Future<AnalysisSubmission> analysisSubmissionFuture = analysisExecutionService.prepareSubmission(analysisSubmission);
    try {
        analysisSubmissionFuture.get();
    } catch (ExecutionException e) {
        logger.debug("Submission on exception=" + analysisSubmissionService.read(analysisSubmission.getId()));
        assertEquals(AnalysisState.ERROR, analysisSubmissionService.read(analysisSubmission.getId()).getAnalysisState());
        // pull out real exception
        throw e.getCause();
    }
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) ExecutionException(java.util.concurrent.ExecutionException) 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