Package com.alibaba.citrus.service.pipeline.valve

Examples of com.alibaba.citrus.service.pipeline.valve.LogValve


        assertArrayEquals(new Valve[0], pipeline.getValves());
    }

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

        try {
            pipeline.newInvocation(null);
            fail();
        } catch (IllegalArgumentException e) {
View Full Code Here


        // no valves
        assertEquals("Pipeline[]", pipeline.toString());

        // with valves
        pipeline = createPipeline(new LogValve(), new LogValve(), new LogValve());

        str = "";
        str += "Pipeline [\n";
        str += "  [1/3] LogValve\n";
        str += "  [2/3] LogValve\n";
        str += "  [3/3] LogValve\n";
        str += "]";

        assertEquals(str, pipeline.toString());

        pipeline = createPipeline(new LogValve(), new LogAndBreakValve(), new LogValve());

        str = "";
        str += "Pipeline [\n";
        str += "  [1/3] LogValve\n";
        str += "  [2/3] LogAndBreakValve[<null>, 0]\n";
View Full Code Here

    }

    @Test
    public void pipeline_init() throws Exception {
        try {
            createPipeline(new LogValve(), null, new LogValve());
            fail();
        } catch (IllegalArgumentException e) {
            assertThat(e, exception("valves[1] == null"));
        }
    }
View Full Code Here

        }
    }

    @Test
    public void handle_getAttribute() throws Exception {
        pipeline = createPipeline(new LogValve(), new LogAndBreakValve(), new LogValve());
        PipelineInvocationHandle handle = assertInvoke(pipeline, true);

        // init is null
        assertNull(getFieldValue(handle, "attributes", null));
View Full Code Here

        assertEquals(3, c3.getAttribute("count"));
    }

    @Test
    public void handle_toString() {
        pipeline = createPipeline(new LogValve(), new LogValve(), new LogValve());

        PipelineInvocationHandle handle = pipeline.newInvocation();
        assertEquals("Executing Pipeline Valve[#0/3, level 1]", handle.toString());
    }
View Full Code Here

        assertEquals("Executing Pipeline Valve[#0/3, level 1]", handle.toString());
    }

    @Test
    public void handle_status() {
        pipeline = createPipeline(new LogValve(), new LogValve(), new LogValve());

        // init status
        PipelineInvocationHandle handle = pipeline.newInvocation();
        assertFalse(handle.isBroken());
        assertFalse(handle.isFinished());

        // finish status
        handle.invoke();
        assertFalse(handle.isBroken());
        assertTrue(handle.isFinished());

        // broken status
        pipeline = createPipeline(new LogValve(), new LogAndBreakValve(), new LogValve());
        handle = pipeline.newInvocation();

        handle.invoke();
        assertTrue(handle.isBroken());
        assertFalse(handle.isFinished());
View Full Code Here

        assertLog();
    }

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

        assertInvoke(pipeline, false);
        assertLog("1-1", "1-2", "1-3");
    }
View Full Code Here

                // invoke 3rd times, throws out PipelineException
                pipelineContext.invokeNext();
            }
        }

        pipeline = createPipeline(new LogValve(), new InvokeMultipleTimes(), new LogValve());

        try {
            pipeline.newInvocation().invoke();
            fail();
        } catch (PipelineException e) {
View Full Code Here

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

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

        // invoke
        assertInvoke(pipeline, false);
        assertLog("1-1", "1-2", "2-1", "2-2", "3-1", "3-2", "3-3", "2-3", "1-3");
    }
View Full Code Here

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

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

        PipelineInvocationHandle handle = pipeline.newInvocation();

        handle.invoke();
        handle.invoke(); // again
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.service.pipeline.valve.LogValve

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.