use of uk.ac.bbsrc.tgac.miso.core.data.workflow.ProgressStep in project miso-lims by miso-lims.
the class WorkflowTestUtils method assertEquivalent.
/**
* Match Progress objects based on workflowName, stepNumber, and input fields
*/
static void assertEquivalent(Progress expectedProgress, Progress actualProgress) {
assertEquals(expectedProgress.getWorkflowName(), actualProgress.getWorkflowName());
if (expectedProgress.getSteps() == null) {
assertNull(actualProgress.getSteps());
} else {
List<ProgressStep> expectedSteps = new ArrayList<>(expectedProgress.getSteps());
List<ProgressStep> actualSteps = new ArrayList<>(actualProgress.getSteps());
assertEquals(expectedSteps.size(), actualSteps.size());
for (int i = 0; i < expectedSteps.size(); ++i) {
ProgressStep expectedStep = expectedSteps.get(i);
ProgressStep actualStep = actualSteps.get(i);
assertEquals(expectedStep.getStepNumber(), actualStep.getStepNumber());
if (expectedStep instanceof IntegerProgressStep) {
assertEquals(((IntegerProgressStep) expectedStep).getInput(), ((IntegerProgressStep) actualStep).getInput());
} else if (expectedStep instanceof PoolProgressStep) {
assertEquals(((PoolProgressStep) expectedStep).getInput(), ((PoolProgressStep) actualStep).getInput());
} else if (expectedStep instanceof SequencerPartitionContainerProgressStep) {
assertEquals(((SequencerPartitionContainerProgressStep) expectedStep).getInput(), ((SequencerPartitionContainerProgressStep) actualStep).getInput());
} else if (expectedStep instanceof StringProgressStep) {
assertEquals(((StringProgressStep) expectedStep).getInput(), ((StringProgressStep) actualStep).getInput());
} else if (expectedStep instanceof SkipProgressStep) {
// All SkipProgressSteps are equivalent
} else if (expectedStep instanceof SequencingContainerModelProgressStep) {
assertEquals(((SequencingContainerModelProgressStep) expectedStep).getInput(), ((SequencingContainerModelProgressStep) actualStep).getInput());
} else {
fail("Unexpected ProgressStep type");
}
}
}
}
use of uk.ac.bbsrc.tgac.miso.core.data.workflow.ProgressStep in project miso-lims by miso-lims.
the class HibernateProgressDaoIT method makeProgress.
/**
* Similar to a Progress constructor. However, an ID is not set, as IDs are dynamically generated.
*/
private Progress makeProgress(WorkflowName workflowName, User user, Date creationTime, Date lastModified, List<ProgressStep> steps) {
Progress progress = new ProgressImpl();
progress.setWorkflowName(workflowName);
progress.setUser(user);
progress.setCreationTime(creationTime);
progress.setLastModified(lastModified);
progress.setSteps(steps);
for (ProgressStep step : steps) {
step.setProgress(progress);
}
return progress;
}
use of uk.ac.bbsrc.tgac.miso.core.data.workflow.ProgressStep in project miso-lims by miso-lims.
the class ProgressImplTest method testSetUnorderedStepsThroughGetter.
@Test
public void testSetUnorderedStepsThroughGetter() {
ProgressStep step1 = makePoolProgressStep(1);
ProgressStep step2 = makePoolProgressStep(2);
progress.getSteps().add(step2);
progress.getSteps().add(step1);
List<ProgressStep> steps = new ArrayList<>(progress.getSteps());
assertEquals(2, steps.size());
assertEquals(1, steps.get(0).getStepNumber());
assertEquals(2, steps.get(1).getStepNumber());
}
use of uk.ac.bbsrc.tgac.miso.core.data.workflow.ProgressStep in project miso-lims by miso-lims.
the class ProgressImplTest method testSetUnorderedSteps.
@Test
public void testSetUnorderedSteps() {
ProgressStep step1 = makePoolProgressStep(1);
ProgressStep step2 = makePoolProgressStep(2);
progress.setSteps(Arrays.asList(step2, step1));
List<ProgressStep> steps = new ArrayList<>(progress.getSteps());
assertEquals(2, steps.size());
assertEquals(1, steps.get(0).getStepNumber());
assertEquals(2, steps.get(1).getStepNumber());
}
use of uk.ac.bbsrc.tgac.miso.core.data.workflow.ProgressStep in project miso-lims by miso-lims.
the class HibernateProgressDaoIT method testSaveAddStep.
@Test
public void testSaveAddStep() {
Progress actual = dao.get(WORKFLOW_PROGRESS_ID_1);
ProgressStep step = makePoolProgressStep(POOL_ID, 1);
step.setProgress(actual);
actual.getSteps().add(step);
progress1.getSteps().add(step);
assertEquivalent(progress1, dao.get(save(actual)));
}
Aggregations