Search in sources :

Example 96 with AnalysisSubmission

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

the class AnalysisSubmissionSampleProcessorImplIT method testUpdateFailPermissionNonSampleOwner.

@Test(expected = AccessDeniedException.class)
@WithMockUser(username = "fbristow", roles = "USER")
public void testUpdateFailPermissionNonSampleOwner() throws PostProcessingException {
    AnalysisSubmission a = analysisSubmissionRepository.findOne(2L);
    analysisSubmissionSampleProcessorImpl.updateSamples(a);
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 97 with AnalysisSubmission

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

the class AnalysisSubmissionSampleProcessorImplIT method testUpdateSamplesSuccess.

@Test
@WithMockUser(username = "fbristow", roles = "USER")
public void testUpdateSamplesSuccess() throws PostProcessingException {
    AnalysisSubmission a = analysisSubmissionRepository.findOne(1L);
    assertEquals("Should be no join between sample and assembly", 0, sampleGenomeAssemblyJoinRepository.count());
    analysisSubmissionSampleProcessorImpl.updateSamples(a);
    assertEquals("Should exist a join between sample and assembly", 1, sampleGenomeAssemblyJoinRepository.count());
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 98 with AnalysisSubmission

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

the class AnalysisSubmissionSampleProcessorImplIT method testUpdateFailPermissionNonProjectOwner.

@Test(expected = AccessDeniedException.class)
@WithMockUser(username = "dr-evil", roles = "USER")
public void testUpdateFailPermissionNonProjectOwner() throws PostProcessingException {
    AnalysisSubmission a = analysisSubmissionRepository.findOne(2L);
    analysisSubmissionSampleProcessorImpl.updateSamples(a);
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 99 with AnalysisSubmission

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

the class AssemblySampleUpdaterIT method testUpdateFailMultipleSamples.

@Test(expected = IllegalArgumentException.class)
@WithMockUser(username = "fbristow", roles = "USER")
public void testUpdateFailMultipleSamples() {
    AnalysisSubmission a = analysisSubmissionRepository.findOne(1L);
    Sample s1 = sampleRepository.findOne(1L);
    Sample s2 = sampleRepository.findOne(2L);
    assemblySampleUpdater.update(Sets.newHashSet(s1, s2), a);
}
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 100 with AnalysisSubmission

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

the class RESTAnalysisSubmissionController method getAnalysisOutputFileContents.

/**
 * Get the actual file contents for an analysis output file.
 *
 * @param submissionId
 *            The {@link AnalysisSubmission} id
 * @param fileType
 *            The {@link AnalysisOutputFile} type as defined in the
 *            {@link Analysis} subclass
 * @return a {@link FileSystemResource} containing the contents of the
 *         {@link AnalysisOutputFile}.
 */
@RequestMapping(value = "/{submissionId}/analysis/file/{fileType}", produces = MediaType.TEXT_PLAIN_VALUE)
@ResponseBody
public FileSystemResource getAnalysisOutputFileContents(@PathVariable Long submissionId, @PathVariable String fileType) {
    AnalysisSubmission read = analysisSubmissionService.read(submissionId);
    if (read.getAnalysisState() != AnalysisState.COMPLETED) {
        throw new EntityNotFoundException("Analysis is not completed");
    }
    AnalysisOutputFile analysisOutputFile = read.getAnalysis().getAnalysisOutputFile(fileType);
    return new FileSystemResource(analysisOutputFile.getFile().toFile());
}
Also used : AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) EntityNotFoundException(ca.corefacility.bioinformatics.irida.exceptions.EntityNotFoundException) FileSystemResource(org.springframework.core.io.FileSystemResource) AnalysisOutputFile(ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisOutputFile) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

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