Search in sources :

Example 71 with SequenceMediator

use of org.apache.synapse.mediators.base.SequenceMediator in project wso2-synapse by wso2.

the class DebugManagerTest method testDebugManagerProcessCommandSetSkipSequence.

public void testDebugManagerProcessCommandSetSkipSequence() throws Exception {
    TestMediator t1 = new TestMediator();
    TestMediator t2 = new TestMediator();
    TestMediator t3 = new TestMediator();
    SequenceMediator seq = new SequenceMediator();
    seq.addChild(t1);
    seq.addChild(t2);
    seq.addChild(t3);
    synConfig.addSequence("test_sequence_3", seq);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"skip\"," + "\"mediation-component\":\"sequence\",\"sequence\":{\"sequence-key\":\"test_sequence_3\"," + "\"sequence-type\": \"named\",\"mediator-position\": \"0\"}}";
    dm.processDebugCommand(debug_command);
    assertTrue(((AbstractMediator) seq.getChild(0)).isSkipEnabled());
}
Also used : TestMediator(org.apache.synapse.mediators.TestMediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator)

Example 72 with SequenceMediator

use of org.apache.synapse.mediators.base.SequenceMediator in project wso2-synapse by wso2.

the class DebugManagerTest method testDebugManagerProcessCommandClearBreakPointProxyInSequence.

public void testDebugManagerProcessCommandClearBreakPointProxyInSequence() throws Exception {
    ProxyService ps = new ProxyService("test_proxy_3");
    TestMediator in1 = new TestMediator();
    TestMediator in2 = new TestMediator();
    TestMediator in3 = new TestMediator();
    SequenceMediator inSeq = new SequenceMediator();
    inSeq.addChild(in1);
    inSeq.addChild(in2);
    inSeq.addChild(in3);
    TestMediator out1 = new TestMediator();
    TestMediator out2 = new TestMediator();
    TestMediator out3 = new TestMediator();
    SequenceMediator outSeq = new SequenceMediator();
    outSeq.addChild(out1);
    outSeq.addChild(out2);
    outSeq.addChild(out3);
    ps.setTargetInLineInSequence(inSeq);
    ps.setTargetInLineOutSequence(inSeq);
    synConfig.addProxyService(ps.getName(), ps);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"breakpoint\"," + "\"mediation-component\":\"sequence\",\"sequence\":{\"proxy\":{\"proxy-key\":\"test_proxy_3\"," + "\"sequence-type\":\"proxy_inseq\",\"mediator-position\":\"0\"}}}";
    dm.processDebugCommand(debug_command);
    debug_command = "{\"command\":\"clear\",\"command-argument\":\"breakpoint\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"proxy\":{\"proxy-key\":\"test_proxy_3\"," + "\"sequence-type\":\"proxy_inseq\",\"mediator-position\":\"0\"}}}";
    dm.processDebugCommand(debug_command);
    assertTrue(!((AbstractMediator) ps.getTargetInLineInSequence().getChild(0)).isBreakPoint());
}
Also used : ProxyService(org.apache.synapse.core.axis2.ProxyService) TestMediator(org.apache.synapse.mediators.TestMediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator) AbstractMediator(org.apache.synapse.mediators.AbstractMediator)

Example 73 with SequenceMediator

use of org.apache.synapse.mediators.base.SequenceMediator in project wso2-synapse by wso2.

the class DebugManagerTest method testDebugManagerProcessCommandSetSkipProxyInSequence.

public void testDebugManagerProcessCommandSetSkipProxyInSequence() throws Exception {
    ProxyService ps = new ProxyService("test_proxy_5");
    TestMediator in1 = new TestMediator();
    TestMediator in2 = new TestMediator();
    TestMediator in3 = new TestMediator();
    SequenceMediator inSeq = new SequenceMediator();
    inSeq.addChild(in1);
    inSeq.addChild(in2);
    inSeq.addChild(in3);
    TestMediator out1 = new TestMediator();
    TestMediator out2 = new TestMediator();
    TestMediator out3 = new TestMediator();
    SequenceMediator outSeq = new SequenceMediator();
    outSeq.addChild(out1);
    outSeq.addChild(out2);
    outSeq.addChild(out3);
    ps.setTargetInLineInSequence(inSeq);
    ps.setTargetInLineOutSequence(inSeq);
    synConfig.addProxyService(ps.getName(), ps);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"skip\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"proxy\":{\"proxy-key\":\"test_proxy_5\",\"sequence-type\":\"proxy_inseq\"," + "\"mediator-position\":\"0\"}}}";
    dm.processDebugCommand(debug_command);
    assertTrue(((AbstractMediator) ps.getTargetInLineInSequence().getChild(0)).isSkipEnabled());
}
Also used : ProxyService(org.apache.synapse.core.axis2.ProxyService) TestMediator(org.apache.synapse.mediators.TestMediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator)

Example 74 with SequenceMediator

use of org.apache.synapse.mediators.base.SequenceMediator in project wso2-synapse by wso2.

the class DebugManagerTest method testBreakPointSequence.

public void testBreakPointSequence() throws Exception {
    TestMediator t1 = new TestMediator();
    t1.setHandler(new TestMediateHandler() {

        public void handle(MessageContext synCtx) {
            result.append("T1.");
        }
    });
    TestMediator t2 = new TestMediator();
    t2.setHandler(new TestMediateHandler() {

        public void handle(MessageContext synCtx) {
            result.append("T2.");
        }
    });
    TestMediator t3 = new TestMediator();
    t3.setHandler(new TestMediateHandler() {

        public void handle(MessageContext synCtx) {
            result.append("T3");
        }
    });
    SequenceMediator seq = new SequenceMediator();
    seq.addChild(t1);
    seq.addChild(t2);
    seq.addChild(t3);
    synConfig.addSequence("test_sequence_6", seq);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"breakpoint\"," + "\"mediation-component\":\"sequence\",\"sequence\":{\"sequence-key\":\"test_sequence_6\"," + "\"sequence-type\": \"named\",\"mediator-position\": \"0\"}}";
    dm.processDebugCommand(debug_command);
    debug_command = "{\"command\":\"set\",\"command-argument\":\"breakpoint\"," + "\"mediation-component\":\"sequence\",\"sequence\":{\"sequence-key\":\"test_sequence_6\"," + "\"sequence-type\": \"named\",\"mediator-position\": \"1\"}}";
    dm.processDebugCommand(debug_command);
    MessageContext synCtx = TestUtils.getTestContext("<empty/>");
    seq.mediate(synCtx);
    assertTrue("T1.T2.T3".equals(result.toString()));
}
Also used : TestMediateHandler(org.apache.synapse.mediators.TestMediateHandler) TestMediator(org.apache.synapse.mediators.TestMediator) MessageContext(org.apache.synapse.MessageContext) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator)

Example 75 with SequenceMediator

use of org.apache.synapse.mediators.base.SequenceMediator in project wso2-synapse by wso2.

the class DebugManagerTest method testDebugManagerProcessCommandSetSkipProxyOutSequence.

public void testDebugManagerProcessCommandSetSkipProxyOutSequence() throws Exception {
    ProxyService ps = new ProxyService("test_proxy_6");
    TestMediator in1 = new TestMediator();
    TestMediator in2 = new TestMediator();
    TestMediator in3 = new TestMediator();
    SequenceMediator inSeq = new SequenceMediator();
    inSeq.addChild(in1);
    inSeq.addChild(in2);
    inSeq.addChild(in3);
    TestMediator out1 = new TestMediator();
    TestMediator out2 = new TestMediator();
    TestMediator out3 = new TestMediator();
    SequenceMediator outSeq = new SequenceMediator();
    outSeq.addChild(out1);
    outSeq.addChild(out2);
    outSeq.addChild(out3);
    ps.setTargetInLineInSequence(inSeq);
    ps.setTargetInLineOutSequence(inSeq);
    synConfig.addProxyService(ps.getName(), ps);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"skip\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"proxy\":{\"proxy-key\":\"test_proxy_6\",\"sequence-type\":\"proxy_outseq\"," + "\"mediator-position\":\"0\"}}}";
    dm.processDebugCommand(debug_command);
    assertTrue(((AbstractMediator) ps.getTargetInLineOutSequence().getChild(0)).isSkipEnabled());
}
Also used : ProxyService(org.apache.synapse.core.axis2.ProxyService) TestMediator(org.apache.synapse.mediators.TestMediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator)

Aggregations

SequenceMediator (org.apache.synapse.mediators.base.SequenceMediator)84 Mediator (org.apache.synapse.Mediator)24 MessageContext (org.apache.synapse.MessageContext)21 SynapseConfiguration (org.apache.synapse.config.SynapseConfiguration)19 TestMediator (org.apache.synapse.mediators.TestMediator)18 Axis2MessageContext (org.apache.synapse.core.axis2.Axis2MessageContext)16 Test (org.junit.Test)14 Map (java.util.Map)13 ProxyService (org.apache.synapse.core.axis2.ProxyService)13 OMElement (org.apache.axiom.om.OMElement)12 Endpoint (org.apache.synapse.endpoints.Endpoint)12 EndpointReference (org.apache.axis2.addressing.EndpointReference)11 AbstractMediator (org.apache.synapse.mediators.AbstractMediator)11 Options (org.apache.axis2.client.Options)9 InboundEndpoint (org.apache.synapse.inbound.InboundEndpoint)8 TemplateMediator (org.apache.synapse.mediators.template.TemplateMediator)8 OMAttribute (org.apache.axiom.om.OMAttribute)6 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)6 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)5 File (java.io.File)4