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

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


        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 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

        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("1-1", "1-2", "1-3", "1-1", "1-2", "1-3");
    }

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

        PipelineInvocationHandle handle = assertInvoke(pipeline, true);

        try {
            handle.invoke();
View Full Code Here

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

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

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

        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);

        try {
            pipeline.newInvocation().invoke();
            fail();
        } catch (PipelineException e) {
            assertThat(
                    e,
                    exception(IllegalArgumentException.class, "Failed to invoke Valve[#2/3, level 3]",
                              "invalid break levels: 3, should be in range of [0, 3)"));
        }

        // break levels=-1
        p3.getValves()[1] = new LogAndBreakValve(-1);

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

        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);
        assertLog("1-1", "1-2", "2-1", "2-2", "3-1", "3-2"/* break */);

        // break levels=1
        p3.getValves()[1] = new LogAndBreakValve(1);
        assertInvoke(pipeline, false);
        assertLog("1-1", "1-2", "2-1", "2-2", "3-1", "3-2"/* break */, "1-3");

        // break levels=0
        p3.getValves()[1] = new LogAndBreakValve(0);
        assertInvoke(pipeline, false);
        assertLog("1-1", "1-2", "2-1", "2-2", "3-1", "3-2"/* break */, "2-3", "1-3");
    }
View Full Code Here

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

    @Test
    public void break_label_empty() throws Exception {
        pipeline = createPipeline(new LogAndBreakValve("  "));

        try {
            pipeline.newInvocation().invoke();
            fail();
        } catch (PipelineException e) {
            assertThat(e, exception(IllegalArgumentException.class, "no label"));
        }

        pipeline = createPipeline(new LogAndBreakValve(null));

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

        }
    }

    @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");
View Full Code Here

        }
    }

    @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");
View Full Code Here

TOP

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

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.