Search in sources :

Example 11 with TestMediator

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

the class DebugManagerTest method testDebugManagerProcessCommandSetSkipTemplate.

public void testDebugManagerProcessCommandSetSkipTemplate() throws Exception {
    TestMediator t1 = new TestMediator();
    TestMediator t2 = new TestMediator();
    TestMediator t3 = new TestMediator();
    TemplateMediator temp = new TemplateMediator();
    temp.addChild(t1);
    temp.addChild(t2);
    temp.addChild(t3);
    temp.setName("test_sequence_template_3");
    synConfig.addSequenceTemplate(temp.getName(), temp);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"skip\"," + "\"mediation-component\":\"template\",\"template\":{\"template-key\":\"test_sequence_template_3\"," + "\"mediator-position\": \"0\"}}";
    dm.processDebugCommand(debug_command);
    assertTrue(((AbstractMediator) temp.getChild(0)).isSkipEnabled());
}
Also used : TemplateMediator(org.apache.synapse.mediators.template.TemplateMediator) TestMediator(org.apache.synapse.mediators.TestMediator)

Example 12 with TestMediator

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

the class DebugManagerTest method testDebugManagerProcessCommandClearBreakPointProxyOutSequence.

public void testDebugManagerProcessCommandClearBreakPointProxyOutSequence() throws Exception {
    ProxyService ps = new ProxyService("test_proxy_4");
    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_4\",\"sequence-type\":\"proxy_outseq\"," + "\"mediator-position\":\"0\"}}}";
    dm.processDebugCommand(debug_command);
    debug_command = "{\"command\":\"clear\",\"command-argument\":\"breakpoint\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"proxy\":{\"proxy-key\":\"test_proxy_4\",\"sequence-type\":\"proxy_outseq\"," + "\"mediator-position\":\"0\"}}}";
    dm.processDebugCommand(debug_command);
    assertTrue(!((AbstractMediator) ps.getTargetInLineOutSequence().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 13 with TestMediator

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

the class DebugManagerTest method testDebugManagerProcessCommandSetBreakPointTemplate.

public void testDebugManagerProcessCommandSetBreakPointTemplate() throws Exception {
    TestMediator t1 = new TestMediator();
    TestMediator t2 = new TestMediator();
    TestMediator t3 = new TestMediator();
    TemplateMediator temp = new TemplateMediator();
    temp.addChild(t1);
    temp.addChild(t2);
    temp.addChild(t3);
    temp.setName("test_sequence_template_1");
    synConfig.addSequenceTemplate(temp.getName(), temp);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"breakpoint\"," + "\"mediation-component\":\"template\",\"template\":{\"template-key\":\"test_sequence_template_1\"," + "\"mediator-position\": \"0\"}}";
    dm.processDebugCommand(debug_command);
    assertTrue(((AbstractMediator) temp.getChild(0)).isBreakPoint());
}
Also used : TemplateMediator(org.apache.synapse.mediators.template.TemplateMediator) TestMediator(org.apache.synapse.mediators.TestMediator)

Example 14 with TestMediator

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

the class DebugManagerTest method testDebugManagerProcessCommandSetBreakPointProxyInSequence.

public void testDebugManagerProcessCommandSetBreakPointProxyInSequence() throws Exception {
    ProxyService ps = new ProxyService("test_proxy_1");
    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_1\",\"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)

Example 15 with TestMediator

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

the class DebugManagerTest method testDebugManagerProcessCommandSetBreakPointInboundSequence.

public void testDebugManagerProcessCommandSetBreakPointInboundSequence() throws Exception {
    InboundEndpoint inboundEndpoint = new InboundEndpoint();
    inboundEndpoint.setName("test_inbound_1");
    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", dispatchSeq);
    inboundEndpoint.setInjectingSeq("dispatch");
    synConfig.addSequence("error", errorSeq);
    inboundEndpoint.setOnErrorSeq("error");
    synConfig.addInboundEndpoint(inboundEndpoint.getName(), inboundEndpoint);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"breakpoint\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"inbound\":{\"inbound-key\":\"test_inbound_1\",\"sequence-type\":\"inbound_seq\",\"mediator-position\":\"0\"}}}";
    dm.processDebugCommand(debug_command);
    assertTrue(((AbstractMediator) dispatchSeq.getChild(0)).isBreakPoint());
}
Also used : InboundEndpoint(org.apache.synapse.inbound.InboundEndpoint) TestMediator(org.apache.synapse.mediators.TestMediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator)

Aggregations

TestMediator (org.apache.synapse.mediators.TestMediator)29 SequenceMediator (org.apache.synapse.mediators.base.SequenceMediator)18 MessageContext (org.apache.synapse.MessageContext)9 TestMediateHandler (org.apache.synapse.mediators.TestMediateHandler)9 ProxyService (org.apache.synapse.core.axis2.ProxyService)8 AbstractMediator (org.apache.synapse.mediators.AbstractMediator)8 TemplateMediator (org.apache.synapse.mediators.template.TemplateMediator)6 InboundEndpoint (org.apache.synapse.inbound.InboundEndpoint)4 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)3 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)3 MutableInt (org.apache.commons.lang.mutable.MutableInt)1 Mediator (org.apache.synapse.Mediator)1 SynapseException (org.apache.synapse.SynapseException)1 SynapseConfiguration (org.apache.synapse.config.SynapseConfiguration)1 AnonymousListMediator (org.apache.synapse.config.xml.AnonymousListMediator)1 SwitchCase (org.apache.synapse.config.xml.SwitchCase)1 Axis2SynapseEnvironment (org.apache.synapse.core.axis2.Axis2SynapseEnvironment)1 SynapseMessageReceiver (org.apache.synapse.core.axis2.SynapseMessageReceiver)1 SynapseXPath (org.apache.synapse.util.xpath.SynapseXPath)1