Search in sources :

Example 1 with ProgressStep

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");
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) ProgressStep(uk.ac.bbsrc.tgac.miso.core.data.workflow.ProgressStep)

Example 2 with ProgressStep

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;
}
Also used : ProgressImpl(uk.ac.bbsrc.tgac.miso.core.data.workflow.impl.ProgressImpl) Progress(uk.ac.bbsrc.tgac.miso.core.data.workflow.Progress) SampleProgressStep(uk.ac.bbsrc.tgac.miso.core.data.workflow.impl.SampleProgressStep) ProgressStep(uk.ac.bbsrc.tgac.miso.core.data.workflow.ProgressStep) PoolProgressStep(uk.ac.bbsrc.tgac.miso.core.data.workflow.impl.PoolProgressStep)

Example 3 with ProgressStep

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());
}
Also used : ArrayList(java.util.ArrayList) ProgressStep(uk.ac.bbsrc.tgac.miso.core.data.workflow.ProgressStep) Test(org.junit.Test)

Example 4 with ProgressStep

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());
}
Also used : ArrayList(java.util.ArrayList) ProgressStep(uk.ac.bbsrc.tgac.miso.core.data.workflow.ProgressStep) Test(org.junit.Test)

Example 5 with ProgressStep

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)));
}
Also used : Progress(uk.ac.bbsrc.tgac.miso.core.data.workflow.Progress) SampleProgressStep(uk.ac.bbsrc.tgac.miso.core.data.workflow.impl.SampleProgressStep) ProgressStep(uk.ac.bbsrc.tgac.miso.core.data.workflow.ProgressStep) PoolProgressStep(uk.ac.bbsrc.tgac.miso.core.data.workflow.impl.PoolProgressStep) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Aggregations

ProgressStep (uk.ac.bbsrc.tgac.miso.core.data.workflow.ProgressStep)5 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 Progress (uk.ac.bbsrc.tgac.miso.core.data.workflow.Progress)2 PoolProgressStep (uk.ac.bbsrc.tgac.miso.core.data.workflow.impl.PoolProgressStep)2 SampleProgressStep (uk.ac.bbsrc.tgac.miso.core.data.workflow.impl.SampleProgressStep)2 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)1 ProgressImpl (uk.ac.bbsrc.tgac.miso.core.data.workflow.impl.ProgressImpl)1