Examples of PipelineImpl


Examples of com.alibaba.citrus.service.pipeline.impl.PipelineImpl

    @Test
    public void handle_getAttribute_withParents() throws Exception {
        final PipelineContext[] contexts = new PipelineContext[3];

        final PipelineImpl p3 = createPipeline(new Valve() {
            public void invoke(PipelineContext pipelineContext) throws Exception {
                contexts[2] = pipelineContext;
                pipelineContext.invokeNext();
            }
        });

        final PipelineImpl p2 = createPipeline(new Valve() {
            public void invoke(PipelineContext pipelineContext) throws Exception {
                contexts[1] = pipelineContext;
                p3.newInvocation(pipelineContext).invoke();
                pipelineContext.invokeNext();
            }
        });

        pipeline = createPipeline(new Valve() {
            public void invoke(PipelineContext pipelineContext) throws Exception {
                contexts[0] = pipelineContext;
                p2.newInvocation(pipelineContext).invoke();
                pipelineContext.invokeNext();
            }
        });

        assertInvoke(pipeline, false);
View Full Code Here

Examples of com.alibaba.citrus.service.pipeline.impl.PipelineImpl

    }

    @Test
    public void invoke_uninited() {
        try {
            new PipelineImpl().newInvocation().invoke();
            fail();
        } catch (IllegalStateException e) {
            assertThat(e, exception("has not been initialized"));
        }
    }
View Full Code Here

Examples of com.alibaba.citrus.service.pipeline.impl.PipelineImpl

        super.loop_withBreak();
    }

    @Test
    public void loop_conditionNotSatisfied() throws Exception {
        PipelineImpl pipeline = createPipeline(new LogValve(), valve, new LogValve());

        valve.setCondition(new JexlCondition("loopCount<=2"));
        valve.setLoopBody(createPipeline(new LogValve(), new LogValve(), new LogValve()));
        valve.afterPropertiesSet();

        assertInvoke(pipeline, false);
        assertLog("1-1", //
                  "2-1-loop-0", "2-2-loop-0", "2-3-loop-0", //
                  "2-1-loop-1", "2-2-loop-1", "2-3-loop-1", //
                  "2-1-loop-2", "2-2-loop-2", "2-3-loop-2", //
                  "1-3");

        // set maxLoopCount = 1
        valve.setMaxLoopCount(1);

        try {
            pipeline.newInvocation().invoke();
            fail();
        } catch (TooManyLoopsException e) {
            assertThat(e, exception("Too many loops: exceeds the maximum count: 1"));
        }
View Full Code Here

Examples of com.alibaba.citrus.service.pipeline.impl.PipelineImpl

        assertLog("1-1", "1-2");
    }

    @Test
    public void break_levels_outOfBounds() throws Exception {
        PipelineImpl p3 = createPipeline(new LogValve(), new LogValve(), new LogValve());
        PipelineImpl p2 = createPipeline(new LogValve(), new LogAndInvokeSubValve(p3), new LogValve());
        pipeline = createPipeline(new LogValve(), new LogAndInvokeSubValve(p2), new LogValve());

        // break levels=3
        p3.getValves()[1] = new LogAndBreakValve(3);
View Full Code Here

Examples of com.alibaba.citrus.service.pipeline.impl.PipelineImpl

        }
    }

    @Test
    public void break_levels() throws Exception {
        PipelineImpl p3 = createPipeline(new LogValve(), new LogValve(), new LogValve());
        PipelineImpl p2 = createPipeline(new LogValve(), new LogAndInvokeSubValve(p3), new LogValve());
        pipeline = createPipeline(new LogValve(), new LogAndInvokeSubValve(p2), new LogValve());

        // break levels=2
        p3.getValves()[1] = new LogAndBreakValve(2);
        assertInvoke(pipeline, true);
View Full Code Here

Examples of com.alibaba.citrus.service.pipeline.impl.PipelineImpl

        }
    }

    @Test
    public void break_label_NotFound() throws Exception {
        PipelineImpl p3 = createPipeline(new LogValve(), new LogAndBreakValve(" mylabel "), new LogValve());
        PipelineImpl p2 = createPipeline(new LogValve(), new LogAndInvokeSubValve(p3), new LogValve());
        pipeline = createPipeline(new LogValve(), new LogAndInvokeSubValve(p2), new LogValve());

        pipeline.setLabel("mylabel2");

        // invoke
View Full Code Here

Examples of com.alibaba.citrus.service.pipeline.impl.PipelineImpl

        }
    }

    @Test
    public void break_label() throws Exception {
        PipelineImpl p3 = createPipeline(new LogValve(), new LogAndBreakValve(" mylabel "), new LogValve());
        PipelineImpl p2 = createPipeline(new LogValve(), new LogAndInvokeSubValve(p3), new LogValve());
        pipeline = createPipeline(new LogValve(), new LogAndInvokeSubValve(p2), new LogValve());

        // levels = 2
        pipeline.setLabel("mylabel");
        assertInvoke(pipeline, true);
        assertLog("1-1", "1-2", "2-1", "2-2", "3-1", "3-2"/* break */);

        // levels = 1
        p2.setLabel("mylabel");
        assertInvoke(pipeline, false);
        assertLog("1-1", "1-2", "2-1", "2-2", "3-1", "3-2"/* break */, "1-3");

        // levels = 0
        p3.setLabel("mylabel");
View Full Code Here

Examples of com.alibaba.citrus.service.pipeline.impl.PipelineImpl

        assertLog("1-1", "1-2", "2-1", "2-2", "3-1", "3-2"/* break */, "2-3", "1-3");
    }

    @Test
    public void break_toTop() throws Exception {
        PipelineImpl p3 = createPipeline(new LogValve(), new LogAndBreakValve(" #TOP "), new LogValve());
        PipelineImpl p2 = createPipeline(new LogValve(), new LogAndInvokeSubValve(p3), new LogValve());
        pipeline = createPipeline(new LogValve(), new LogAndInvokeSubValve(p2), new LogValve());

        // levels = 2
        assertInvoke(pipeline, true);
        assertLog("1-1", "1-2", "2-1", "2-2", "3-1", "3-2"/* break */);
 
View Full Code Here

Examples of com.alibaba.citrus.service.pipeline.impl.PipelineImpl

    protected final PipelineImpl getPipelineImplFromFactory(String beanName) {
        return (PipelineImpl) factory.getBean(beanName);
    }

    protected final PipelineImpl createPipeline(Valve... valves) {
        PipelineImpl pipeline = new PipelineImpl();
        pipeline.setValves(valves);

        try {
            pipeline.afterPropertiesSet();
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new AssertionError(e);
        }
View Full Code Here

Examples of com.alibaba.citrus.service.pipeline.impl.PipelineImpl

        }
    }

    @Test
    public void loop_notInited() throws Exception {
        PipelineImpl pipeline = createPipeline(new LogValve(), valve, new LogValve());

        try {
            pipeline.newInvocation().invoke();
            fail();
        } catch (PipelineException e) {
            assertThat(e, exception(IllegalStateException.class, "not been initialized yet"));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.