use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.
the class AnalysisSubmissionServiceImplIT method testCreateRegularUser2.
/**
* Tests creating a submission as a second regular user.
*/
@Test
@WithMockUser(username = "otheraaron", roles = "USER")
public void testCreateRegularUser2() {
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(2L), createdSubmission.getSubmitter().getId());
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile 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());
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile 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);
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile 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());
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.
the class AnalysisWorkspaceServiceGalaxyTest method testPrepareAnalysisFilesSingleSuccess.
/**
* Tests out successfully to preparing an analysis with single files.
*
* @throws ExecutionManagerException
* @throws IridaWorkflowException
*/
@SuppressWarnings("unchecked")
@Test
public void testPrepareAnalysisFilesSingleSuccess() throws ExecutionManagerException, IridaWorkflowException {
Set<SingleEndSequenceFile> singleFiles = Sets.newHashSet(sampleSingleSequenceFileMap.values());
submission = AnalysisSubmission.builder(workflowId).name("my analysis").inputFiles(Sets.newHashSet(singleFiles)).referenceFile(referenceFile).build();
submission.setRemoteAnalysisId(HISTORY_ID);
submission.setRemoteWorkflowId(WORKFLOW_ID);
when(sequencingObjectService.getSequencingObjectsOfTypeForAnalysisSubmission(submission, SingleEndSequenceFile.class)).thenReturn(singleFiles);
when(iridaWorkflowsService.getIridaWorkflow(workflowId)).thenReturn(iridaWorkflowSingle);
when(galaxyHistoriesService.findById(HISTORY_ID)).thenReturn(workflowHistory);
when(galaxyLibrariesService.buildEmptyLibrary(any(GalaxyProjectName.class))).thenReturn(workflowLibrary);
when(sequencingObjectService.getUniqueSamplesForSequencingObjects(singleFiles)).thenReturn(sampleSingleSequenceFileMap);
when(galaxyHistoriesService.fileToHistory(refFile, InputFileType.FASTA, workflowHistory)).thenReturn(refDataset);
when(galaxyWorkflowService.getWorkflowDetails(WORKFLOW_ID)).thenReturn(workflowDetails);
when(analysisParameterServiceGalaxy.prepareAnalysisParameters(any(Map.class), any(IridaWorkflow.class))).thenReturn(new WorkflowInputsGalaxy(new WorkflowInputs()));
when(galaxyWorkflowService.getWorkflowInputId(workflowDetails, SEQUENCE_FILE_SINGLE_LABEL)).thenReturn(SEQUENCE_FILE_SINGLE_ID);
when(galaxyWorkflowService.getWorkflowInputId(workflowDetails, REFERENCE_FILE_LABEL)).thenReturn(REFERENCE_FILE_ID);
when(analysisCollectionServiceGalaxy.uploadSequenceFilesSingleEnd(any(Map.class), eq(workflowHistory), eq(workflowLibrary))).thenReturn(collectionResponseSingle);
PreparedWorkflowGalaxy preparedWorkflow = workflowPreparation.prepareAnalysisFiles(submission);
assertEquals("preparedWorflow history id not equal to " + HISTORY_ID, HISTORY_ID, preparedWorkflow.getRemoteAnalysisId());
assertEquals("preparedWorkflow library is invalid", LIBRARY_ID, preparedWorkflow.getRemoteDataId());
assertNotNull("workflowInputs in preparedWorkflow is null", preparedWorkflow.getWorkflowInputs());
Map<String, WorkflowInput> workflowInputsMap = preparedWorkflow.getWorkflowInputs().getInputsObject().getInputs();
assertEquals("workflow inputs has invalid size", 2, workflowInputsMap.size());
assertTrue("workflow inputs should contain reference file entry", workflowInputsMap.containsKey(REFERENCE_FILE_ID));
assertTrue("workflow inputs should contain sequence file single entry", workflowInputsMap.containsKey(SEQUENCE_FILE_SINGLE_ID));
verify(analysisCollectionServiceGalaxy).uploadSequenceFilesSingleEnd(any(Map.class), any(History.class), any(Library.class));
verify(analysisCollectionServiceGalaxy, never()).uploadSequenceFilesPaired(any(Map.class), any(History.class), any(Library.class));
}
Aggregations