Search in sources :

Example 6 with ProxyService

use of org.apache.synapse.core.axis2.ProxyService in project wso2-synapse by wso2.

the class DebugManagerTest method testDebugManagerProcessCommandSetBreakPointProxyOutSequence.

public void testDebugManagerProcessCommandSetBreakPointProxyOutSequence() throws Exception {
    ProxyService ps = new ProxyService("test_proxy_2");
    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_2\",\"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)

Example 7 with ProxyService

use of org.apache.synapse.core.axis2.ProxyService in project wso2-synapse by wso2.

the class ProxyServiceSerializationTest method testProxyServiceSerializationSenarioOne.

public void testProxyServiceSerializationSenarioOne() throws Exception {
    String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"name\" " + "startOnLoad=\"true\"  transports=\"http\"><description>description</description>" + "<target inSequence=\"inseqname\" outSequence=\"outseqname\" faultSequence=\"faultseqname\" />" + "<publishWSDL uri=\"http://uri\" ></publishWSDL><policy key=\"key\"/>" + "<parameter name=\"para\">text</parameter></proxy>";
    OMElement inputOM = createOMElement(inputXml);
    ProxyService proxy = ProxyServiceFactory.createProxy(inputOM, new Properties());
    OMElement resultOM = ProxyServiceSerializer.serializeProxy(null, proxy);
    assertTrue(compare(resultOM, inputOM));
}
Also used : ProxyService(org.apache.synapse.core.axis2.ProxyService) OMElement(org.apache.axiom.om.OMElement) Properties(java.util.Properties)

Example 8 with ProxyService

use of org.apache.synapse.core.axis2.ProxyService in project wso2-synapse by wso2.

the class ProxyServiceSerializationTest method testProxyServiceSerializationScenarioSix.

public void testProxyServiceSerializationScenarioSix() throws Exception {
    String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" startOnLoad=\"true\" " + "name=\"name\"  transports=\"http\"><description>description</description><target>" + "<endpoint><address uri=\"http://www.example.com/testepr\"/></endpoint><outSequence><send/>" + "</outSequence></target><publishWSDL endpoint=\"wsdl_ep\"></publishWSDL><policy key=\"key\"/>" + "<parameter name=\"para\">text</parameter></proxy>";
    OMElement inputOM = createOMElement(inputXml);
    ProxyService proxy = ProxyServiceFactory.createProxy(inputOM, new Properties());
    OMElement resultOM = ProxyServiceSerializer.serializeProxy(null, proxy);
    assertTrue(compare(resultOM, inputOM));
}
Also used : ProxyService(org.apache.synapse.core.axis2.ProxyService) OMElement(org.apache.axiom.om.OMElement) Properties(java.util.Properties)

Example 9 with ProxyService

use of org.apache.synapse.core.axis2.ProxyService in project wso2-synapse by wso2.

the class ProxyServiceSerializationTest method testProxyServiceSerializationSenarioFive.

public void testProxyServiceSerializationSenarioFive() throws Exception {
    String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" startOnLoad=\"true\" " + "name=\"name\"  transports=\"http\"><description>description</description><target>" + "<endpoint><address uri=\"http://www.example.com/testepr\"/></endpoint><outSequence><send/>" + "</outSequence></target><publishWSDL uri=\"http://uri\"></publishWSDL><policy key=\"key\"/>" + "<parameter name=\"para\">text</parameter></proxy>";
    OMElement inputOM = createOMElement(inputXml);
    ProxyService proxy = ProxyServiceFactory.createProxy(inputOM, new Properties());
    OMElement resultOM = ProxyServiceSerializer.serializeProxy(null, proxy);
    assertTrue(compare(resultOM, inputOM));
}
Also used : ProxyService(org.apache.synapse.core.axis2.ProxyService) OMElement(org.apache.axiom.om.OMElement) Properties(java.util.Properties)

Example 10 with ProxyService

use of org.apache.synapse.core.axis2.ProxyService in project wso2-synapse by wso2.

the class ProxyServiceSerializationTest method testProxyServiceSerializationWithResourceMap.

// public void testProxyServiceSerializationSenarioSix() throws Exception {
// String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" startOnLoad=\"true\" name=\"name\"  transports=\"http\"><description>description</description><target><endpoint address=\"http://www.example.com/testepr\" /></target><publish-wsdl uri=\"http://uri\" key=\"key\"></publish-wsdl><policy key=\"key\"/><parameter name=\"para\"><inline xmlns=\"http://customns\"><test/></inline></parameter></proxy>";
// OMElement inputOM = createOMElement(inputXml);
// ProxyService proxy = ProxyServiceFactory.createProxy(inputOM);
// OMElement resultOM = ProxyServiceSerializer.serializeProxy(null, proxy);
// assertTrue(comparator.compare(resultOM, inputOM));
// }
public void testProxyServiceSerializationWithResourceMap() throws Exception {
    String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"name\" " + "startOnLoad=\"true\"><target><endpoint><address uri=\"http://www.example.com/testepr\"/>" + "</endpoint><outSequence><send/></outSequence></target><publishWSDL uri=\"http://uri\">" + "<resource location=\"test1.xsd\" key=\"test-key1\"/><resource location=\"test2.xsd\"" + " key=\"test-key2\"/></publishWSDL></proxy>";
    OMElement inputOM = createOMElement(inputXml);
    ProxyService proxy = ProxyServiceFactory.createProxy(inputOM, new Properties());
    assertNotNull(proxy.getResourceMap());
    OMElement resultOM = ProxyServiceSerializer.serializeProxy(null, proxy);
    assertTrue(compare(resultOM, inputOM));
}
Also used : ProxyService(org.apache.synapse.core.axis2.ProxyService) OMElement(org.apache.axiom.om.OMElement) Properties(java.util.Properties)

Aggregations

ProxyService (org.apache.synapse.core.axis2.ProxyService)33 OMElement (org.apache.axiom.om.OMElement)13 SequenceMediator (org.apache.synapse.mediators.base.SequenceMediator)12 Properties (java.util.Properties)8 TestMediator (org.apache.synapse.mediators.TestMediator)8 AbstractMediator (org.apache.synapse.mediators.AbstractMediator)6 InboundEndpoint (org.apache.synapse.inbound.InboundEndpoint)5 TemplateMediator (org.apache.synapse.mediators.template.TemplateMediator)5 DeploymentException (org.apache.axis2.deployment.DeploymentException)4 PriorityExecutor (org.apache.synapse.commons.executors.PriorityExecutor)4 Endpoint (org.apache.synapse.endpoints.Endpoint)4 API (org.apache.synapse.rest.API)4 File (java.io.File)3 SynapseEventSource (org.apache.synapse.eventing.SynapseEventSource)3 MessageProcessor (org.apache.synapse.message.processor.MessageProcessor)3 MessageStore (org.apache.synapse.message.store.MessageStore)3 Test (org.junit.Test)3 Iterator (java.util.Iterator)2 AxisService (org.apache.axis2.description.AxisService)2 ManagedLifecycle (org.apache.synapse.ManagedLifecycle)2