use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput in project irida by phac-nml.
the class AnalysisControllerTest method testGetAnalysisDetailsTree.
@Test
public void testGetAnalysisDetailsTree() throws IOException, IridaWorkflowNotFoundException {
Long submissionId = 1L;
ExtendedModelMap model = new ExtendedModelMap();
Locale locale = Locale.ENGLISH;
final IridaWorkflowInput input = new IridaWorkflowInput("single", "paired", "reference", true);
AnalysisSubmission submission = TestDataFactory.constructAnalysisSubmission();
IridaWorkflowDescription description = new IridaWorkflowDescription(submission.getWorkflowId(), "My Workflow", "V1", AnalysisType.PHYLOGENOMICS, input, Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList());
IridaWorkflow iridaWorkflow = new IridaWorkflow(description, null);
submission.setAnalysisState(AnalysisState.COMPLETED);
when(analysisSubmissionServiceMock.read(submissionId)).thenReturn(submission);
when(iridaWorkflowsServiceMock.getIridaWorkflow(submission.getWorkflowId())).thenReturn(iridaWorkflow);
String detailsPage = analysisController.getDetailsPage(submissionId, model, locale);
assertEquals("should be details page", AnalysisController.PAGE_DETAILS_DIRECTORY + "tree", detailsPage);
assertEquals("Tree preview should be set", "tree", model.get("preview"));
assertEquals("submission should be in model", submission, model.get("analysisSubmission"));
assertEquals("submission reference file should be in model.", submission.getReferenceFile().get(), model.get("referenceFile"));
}
use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput in project irida by phac-nml.
the class IridaWorkflowTestBuilder method buildTestDescription.
/**
* Builds a {@link IridaWorkflowDescription} with the following information.
*
* @param id
* The id of the workflow.
* @param name
* The name of the workflow.
* @param version
* The version of the workflow.
* @param analysisType
* The {@link AnalysisType} of the workflow.
* @param reference
* The reference label for the workflow.
* @param requiresSingleSample
* Whether or not this workflow requires a single sample.
* @return An {@link IridaWorkflowDescription} with the given information.
* @throws MalformedURLException
*/
public static IridaWorkflowDescription buildTestDescription(UUID id, String name, String version, AnalysisType analysisType, Input input, String reference, boolean requiresSingleSample) throws MalformedURLException {
List<IridaWorkflowOutput> outputs = new LinkedList<>();
outputs.add(new IridaWorkflowOutput("output1", "output1.txt"));
outputs.add(new IridaWorkflowOutput("output2", "output2.txt"));
List<IridaWorkflowToolRepository> tools = new LinkedList<>();
IridaWorkflowToolRepository workflowTool = new IridaWorkflowToolRepository("sam_to_bam", "devteam", new URL("http://toolshed.g2.bx.psu.edu/"), "8176b2575aa1");
tools.add(workflowTool);
IridaWorkflowInput workflowInput = null;
switch(input) {
case SINGLE:
workflowInput = new IridaWorkflowInput("sequence_reads", null, reference, requiresSingleSample);
break;
case PAIRED:
workflowInput = new IridaWorkflowInput(null, "sequence_reads_paired", reference, requiresSingleSample);
break;
case SINGLE_PAIRED:
workflowInput = new IridaWorkflowInput("sequence_reads", "sequence_reads_paired", reference, requiresSingleSample);
break;
}
List<IridaWorkflowParameter> parameters = new LinkedList<>();
IridaToolParameter tool1 = new IridaToolParameter("irida.corefacility.ca/galaxy-shed/repos/irida/test-tool/0.1", "a");
IridaToolParameter tool2 = new IridaToolParameter("irida.corefacility.ca/galaxy-shed/repos/irida/test-tool/0.1", "b");
IridaWorkflowParameter parameter1 = new IridaWorkflowParameter("test-parameter", "1", Lists.newArrayList(tool1, tool2));
parameters.add(parameter1);
IridaWorkflowDescription iridaWorkflow = new IridaWorkflowDescription(id, name, version, analysisType, workflowInput, outputs, tools, parameters);
return iridaWorkflow;
}
use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput in project irida by phac-nml.
the class AnalysisControllerTest method testGetAnalysisDetailsNotCompleted.
@Test
public void testGetAnalysisDetailsNotCompleted() throws IOException, IridaWorkflowNotFoundException {
Long submissionId = 1L;
ExtendedModelMap model = new ExtendedModelMap();
Locale locale = Locale.ENGLISH;
final IridaWorkflowInput input = new IridaWorkflowInput("single", "paired", "reference", true);
AnalysisSubmission submission = TestDataFactory.constructAnalysisSubmission();
IridaWorkflowDescription description = new IridaWorkflowDescription(submission.getWorkflowId(), "My Workflow", "V1", AnalysisType.PHYLOGENOMICS, input, Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList());
IridaWorkflow iridaWorkflow = new IridaWorkflow(description, null);
submission.setAnalysisState(AnalysisState.RUNNING);
when(analysisSubmissionServiceMock.read(submissionId)).thenReturn(submission);
when(iridaWorkflowsServiceMock.getIridaWorkflow(submission.getWorkflowId())).thenReturn(iridaWorkflow);
String detailsPage = analysisController.getDetailsPage(submissionId, model, locale);
assertEquals("should be details page", AnalysisController.PAGE_DETAILS_DIRECTORY + "tree", detailsPage);
assertFalse("No preview should be available", model.containsAttribute("preview"));
assertEquals("submission should be in model", submission, model.get("analysisSubmission"));
}
use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput in project irida by phac-nml.
the class TestDataFactory method getIridaWorkflow.
public static IridaWorkflow getIridaWorkflow(UUID id) {
IridaWorkflowInput input = new IridaWorkflowInput();
List<IridaWorkflowOutput> outputs = ImmutableList.of(new IridaWorkflowOutput());
List<IridaWorkflowToolRepository> tools = ImmutableList.of();
List<IridaWorkflowParameter> parameters = ImmutableList.of();
IridaWorkflowDescription description = new IridaWorkflowDescription(id, "My Workflow", "V1", AnalysisType.DEFAULT, input, outputs, tools, parameters);
IridaWorkflowStructure structure = new IridaWorkflowStructure(null);
return new IridaWorkflow(description, structure);
}
use of ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowInput in project irida by phac-nml.
the class IridaWorkflowLoaderServiceIT method buildTestDescription.
private IridaWorkflowDescription buildTestDescription(UUID id, String name, String version, String sequenceReadsSingle, String sequenceReadsPaired, boolean requiresSingleSample) throws MalformedURLException {
List<IridaWorkflowOutput> outputs = new LinkedList<>();
outputs.add(new IridaWorkflowOutput("output1", "output1.txt"));
outputs.add(new IridaWorkflowOutput("output2", "output2.txt"));
List<IridaWorkflowToolRepository> tools = new LinkedList<>();
IridaWorkflowToolRepository workflowTool = new IridaWorkflowToolRepository("sam_to_bam", "devteam", new URL("http://toolshed.g2.bx.psu.edu/"), "8176b2575aa1");
tools.add(workflowTool);
List<IridaWorkflowParameter> parameters = new LinkedList<>();
IridaToolParameter tool1 = new IridaToolParameter("irida.corefacility.ca/galaxy-shed/repos/irida/test-tool/0.1", "a");
IridaToolParameter tool2 = new IridaToolParameter("irida.corefacility.ca/galaxy-shed/repos/irida/test-tool/0.1", "b");
IridaWorkflowParameter parameter1 = new IridaWorkflowParameter("test-parameter", "1", Lists.newArrayList(tool1, tool2));
parameters.add(parameter1);
IridaWorkflowDescription iridaWorkflow = new IridaWorkflowDescription(id, name, version, AnalysisType.DEFAULT, new IridaWorkflowInput(sequenceReadsSingle, sequenceReadsPaired, "reference", requiresSingleSample), outputs, tools, parameters);
return iridaWorkflow;
}
Aggregations