Package org.jenkinsci.plugins.workflow.test.steps

Examples of org.jenkinsci.plugins.workflow.test.steps.BlockSemaphoreStep


        assertTrue(exec.get().isComplete());
    }

    @Test public void blocks() throws Throwable {
        SemaphoreStep step = new SemaphoreStep();
        BlockSemaphoreStep block = new BlockSemaphoreStep();
        final AtomicReference<FlowExecution> exec = new AtomicReference<FlowExecution>();
        exec.set(new STMFlowDefinition(Arrays.<State>asList(new BlockState("block", STMExecution.END, block, "step"), new StepState("step", STMExecution.END, step))).create(new OwnerImpl(exec, tmp), Collections.<Action>emptyList()));
        SemaphoreListener l = new SemaphoreListener();
        exec.get().addListener(l);
        exec.get().start();
        FlowNode n = l.next();
        assertTrue(String.valueOf(n), n instanceof FlowStartNode);
        n = l.next();
        assertTrue(n instanceof BlockStartNode);
        n = l.next();
        assertTrue(n instanceof BlockStartNode);
        block.startBlock();
        step.success(null);
        n = l.next();
        assertTrue(n instanceof AtomNode);
        assertEquals(null, block.waitForBlock());
        block.finishSuccess(null);
        n = l.next();
        assertTrue(n instanceof BlockEndNode);
        n = l.next();
        assertTrue(n instanceof BlockEndNode);
        n = l.next();
View Full Code Here


    }

    @Ignore("TODO")
    @Test public void contextOverridesAndSerialization() throws Throwable {
        SemaphoreStep step = new SemaphoreStep();
        BlockSemaphoreStep block = new BlockSemaphoreStep();
        final AtomicReference<FlowExecution> exec = new AtomicReference<FlowExecution>();
        exec.set(new STMFlowDefinition(Arrays.<State>asList(new BlockState("block", STMExecution.END, block, "step"), new StepState("step", STMExecution.END, step))).create(new OwnerImpl(exec, tmp), Collections.<Action>emptyList()));
        exec.get().start();
        block.startBlock(new Thing(17));
        Thing t = step.getContext().get(Thing.class);
        assertNotNull(t);
        assertEquals(17, t.number);
        exec.set(reserialize(exec.get()));
        step = reserialize(step);
        block = reserialize(block);
        t = step.getContext().get(Thing.class);
        assertNotNull(t);
        assertEquals(17, t.number);
        step.success(null);
        assertEquals(null, block.waitForBlock());
        block.finishSuccess(null);
    }
View Full Code Here

TOP

Related Classes of org.jenkinsci.plugins.workflow.test.steps.BlockSemaphoreStep

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.