Search in sources :

Example 21 with ProxyService

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

the class ProxyServiceSerializationTest method testProxyServiceSerializationSenarioThree.

public void testProxyServiceSerializationSenarioThree() throws Exception {
    String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" " + "name=\"name\" startOnLoad=\"true\"  transports=\"http\"><description>" + "description</description><target><inSequence onError=\"ref\"><description>Test documentation</description><send/></inSequence>" + "<outSequence><send/></outSequence></target><publishWSDL  key=\"key\"></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 22 with ProxyService

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

the class SynapseXMLConfigurationSerializerTest method testSerializeConfiguration4.

/**
 * Test serializeConfigurationMethod with proxyServices added for SynapseConfiguration and assert OMElement returned
 */
@Test
public void testSerializeConfiguration4() {
    SynapseXMLConfigurationSerializer serializer = new SynapseXMLConfigurationSerializer();
    SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
    ProxyService proxyService = new ProxyService("testProxyService");
    synapseConfiguration.addProxyService(proxyService.getName(), proxyService);
    OMElement element = serializer.serializeConfiguration(synapseConfiguration);
    Assert.assertNotNull("OMElement is not returned", element);
    Assert.assertEquals("definitions", element.getLocalName());
    Assert.assertTrue("ProxyService added is not serialized.", element.getChildren().next().toString().contains("name=\"testProxyService\""));
}
Also used : ProxyService(org.apache.synapse.core.axis2.ProxyService) OMElement(org.apache.axiom.om.OMElement) SynapseConfiguration(org.apache.synapse.config.SynapseConfiguration) Test(org.junit.Test)

Example 23 with ProxyService

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

the class ProxyServiceSerializationTest method testProxyServiceSerializationSenarioFour.

public void testProxyServiceSerializationSenarioFour() throws Exception {
    String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" " + "name=\"name\" startOnLoad=\"true\"  transports=\"http\"><description>" + "description</description><target><inSequence onError=\"ref\"><send/></inSequence>" + "<outSequence><send/></outSequence></target><enableAddressing/><publishWSDL  key=\"key\"></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 24 with ProxyService

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

the class ProxyServiceSerializationTest method testProxyServiceSerializationWithPreserveProxy.

/**
 * Serialization of 'preserveProxy' attribute in PublishWSDL
 *
 * @throws Exception
 */
public void testProxyServiceSerializationWithPreserveProxy() 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 preservePolicy=\"true\" 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 25 with ProxyService

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

the class ProxyServiceSerializationTest method testProxyServiceSerializationSenarioTwo.

public void testProxyServiceSerializationSenarioTwo() throws Exception {
    String inputXml = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" startOnLoad=\"true\" " + "name=\"name\"  transports=\"http\"><description>description</description>" + "<target endpoint=\"epr\" outSequence=\"out\"/><publishWSDL key=\"key\">" + "</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)

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