Search in sources :

Example 11 with SequenceMediator

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

the class DebugManagerTest method testDebugManagerProcessCommandSetBreakPointSequence.

public void testDebugManagerProcessCommandSetBreakPointSequence() 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_1", seq);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"breakpoint\"," + "\"mediation-component\":\"sequence\",\"sequence\":{\"sequence-key\":\"test_sequence_1\"," + "\"sequence-type\": \"named\",\"mediator-position\": \"0\"}}";
    dm.processDebugCommand(debug_command);
    assertTrue(((AbstractMediator) seq.getChild(0)).isBreakPoint());
}
Also used : TestMediator(org.apache.synapse.mediators.TestMediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator)

Example 12 with SequenceMediator

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

the class DebugManagerTest method testDebugManagerProcessCommandClearBreakPointSequence.

public void testDebugManagerProcessCommandClearBreakPointSequence() 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_2", seq);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"breakpoint\"," + "\"mediation-component\":\"sequence\",\"sequence\":{\"sequence-key\":\"test_sequence_2\"," + "\"sequence-type\": \"named\",\"mediator-position\": \"0\"}}";
    dm.processDebugCommand(debug_command);
    debug_command = "{\"command\":\"clear\",\"command-argument\":\"breakpoint\"," + "\"mediation-component\":\"sequence\",\"sequence\":{\"sequence-key\":\"test_sequence_2\"," + "\"sequence-type\": \"named\",\"mediator-position\": \"0\"}}";
    dm.processDebugCommand(debug_command);
    assertTrue(!((AbstractMediator) seq.getChild(0)).isBreakPoint());
}
Also used : TestMediator(org.apache.synapse.mediators.TestMediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator) AbstractMediator(org.apache.synapse.mediators.AbstractMediator)

Example 13 with SequenceMediator

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

the class DebugManagerTest method testDebugManagerProcessCommandClearSkipSequence.

public void testDebugManagerProcessCommandClearSkipSequence() 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_4", seq);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"skip\"," + "\"mediation-component\":\"sequence\",\"sequence\":{\"sequence-key\":\"test_sequence_4\"," + "\"sequence-type\": \"named\",\"mediator-position\": \"0\"}}";
    dm.processDebugCommand(debug_command);
    debug_command = "{\"command\":\"clear\",\"command-argument\":\"skip\"," + "\"mediation-component\":\"sequence\",\"sequence\":{\"sequence-key\":\"test_sequence_4\"," + "\"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) AbstractMediator(org.apache.synapse.mediators.AbstractMediator)

Example 14 with SequenceMediator

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

the class DebugManagerTest method testDebugManagerProcessCommandSetBreakPointInboundErrorSequence.

public void testDebugManagerProcessCommandSetBreakPointInboundErrorSequence() throws Exception {
    InboundEndpoint inboundEndpoint = new InboundEndpoint();
    inboundEndpoint.setName("test_inbound_2");
    TestMediator in1 = new TestMediator();
    TestMediator in2 = new TestMediator();
    TestMediator in3 = new TestMediator();
    SequenceMediator dispatchSeq = new SequenceMediator();
    dispatchSeq.addChild(in1);
    dispatchSeq.addChild(in2);
    dispatchSeq.addChild(in3);
    TestMediator out1 = new TestMediator();
    TestMediator out2 = new TestMediator();
    TestMediator out3 = new TestMediator();
    SequenceMediator errorSeq = new SequenceMediator();
    errorSeq.addChild(out1);
    errorSeq.addChild(out2);
    errorSeq.addChild(out3);
    synConfig.addSequence("dispatch_1", dispatchSeq);
    inboundEndpoint.setInjectingSeq("dispatch_1");
    synConfig.addSequence("error_1", errorSeq);
    inboundEndpoint.setOnErrorSeq("error_1");
    synConfig.addInboundEndpoint(inboundEndpoint.getName(), inboundEndpoint);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"breakpoint\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"inbound\":{\"inbound-key\":\"test_inbound_2\",\"sequence-type\":\"inbound_faultseq\",\"mediator-position\":\"0\"}}}";
    dm.processDebugCommand(debug_command);
    assertTrue(((AbstractMediator) errorSeq.getChild(0)).isBreakPoint());
}
Also used : InboundEndpoint(org.apache.synapse.inbound.InboundEndpoint) TestMediator(org.apache.synapse.mediators.TestMediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator)

Example 15 with SequenceMediator

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

the class DebugManagerTest method testDebugManagerProcessCommandSetSkipInboundSequence.

public void testDebugManagerProcessCommandSetSkipInboundSequence() throws Exception {
    InboundEndpoint inboundEndpoint = new InboundEndpoint();
    inboundEndpoint.setName("test_inbound_3");
    TestMediator in1 = new TestMediator();
    TestMediator in2 = new TestMediator();
    TestMediator in3 = new TestMediator();
    SequenceMediator dispatchSeq = new SequenceMediator();
    dispatchSeq.addChild(in1);
    dispatchSeq.addChild(in2);
    dispatchSeq.addChild(in3);
    TestMediator out1 = new TestMediator();
    TestMediator out2 = new TestMediator();
    TestMediator out3 = new TestMediator();
    SequenceMediator errorSeq = new SequenceMediator();
    errorSeq.addChild(out1);
    errorSeq.addChild(out2);
    errorSeq.addChild(out3);
    synConfig.addSequence("dispatch_3", dispatchSeq);
    inboundEndpoint.setInjectingSeq("dispatch_3");
    synConfig.addSequence("error_3", errorSeq);
    inboundEndpoint.setOnErrorSeq("error_3");
    synConfig.addInboundEndpoint(inboundEndpoint.getName(), inboundEndpoint);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"skip\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"inbound\":{\"inbound-key\":\"test_inbound_3\",\"sequence-type\":\"inbound_seq\",\"mediator-position\":\"0\"}}}";
    dm.processDebugCommand(debug_command);
    assertTrue(((AbstractMediator) dispatchSeq.getChild(0)).isSkipEnabled());
}
Also used : InboundEndpoint(org.apache.synapse.inbound.InboundEndpoint) TestMediator(org.apache.synapse.mediators.TestMediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator)

Aggregations

SequenceMediator (org.apache.synapse.mediators.base.SequenceMediator)70 TestMediator (org.apache.synapse.mediators.TestMediator)18 OMElement (org.apache.axiom.om.OMElement)12 ProxyService (org.apache.synapse.core.axis2.ProxyService)12 Endpoint (org.apache.synapse.endpoints.Endpoint)12 Mediator (org.apache.synapse.Mediator)11 AbstractMediator (org.apache.synapse.mediators.AbstractMediator)11 MessageContext (org.apache.synapse.MessageContext)9 TemplateMediator (org.apache.synapse.mediators.template.TemplateMediator)8 SynapseConfiguration (org.apache.synapse.config.SynapseConfiguration)7 InboundEndpoint (org.apache.synapse.inbound.InboundEndpoint)7 OMAttribute (org.apache.axiom.om.OMAttribute)6 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)6 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)6 File (java.io.File)4 ManagedLifecycle (org.apache.synapse.ManagedLifecycle)4 SynapseException (org.apache.synapse.SynapseException)4 SynapseLog (org.apache.synapse.SynapseLog)4 QName (javax.xml.namespace.QName)3 OMNode (org.apache.axiom.om.OMNode)3