public SendMediatorSerializationTest() { factory = new SendMediatorFactory(); serializer = new SendMediatorSerializer(); }
public void testBuildMessageBeforeSentSerialization() { String sendConfig = "<send buildmessage=\"true\" xmlns=\"http://ws.apache.org/ns/synapse\" />"; OMElement config1 = createOMElement(sendConfig); SendMediator send1 = (SendMediator) factory.createMediator(config1, new Properties()); OMElement config2 = serializer.serializeMediator(null, send1); SendMediator send2 = (SendMediator) factory.createMediator(config2, new Properties()); assertEquals( "buildmessage attribute is not serialized properly", send1.isBuildMessage(), send2.isBuildMessage()); }
public Mediator createSpecificMediator(OMElement elem, Properties properties) { SendMediator sm = new SendMediator(); // after successfully creating the mediator // set its common attributes such as tracing etc processAuditStatus(sm,elem); OMElement epElement = elem.getFirstChildWithName(ENDPOINT_Q); if (epElement != null) { // create the endpoint and set it in the send mediator Endpoint endpoint = EndpointFactory.getEndpointFromElement(epElement, true, properties); if (endpoint != null) { sm.setEndpoint(endpoint); } } String receivingSequence = elem.getAttributeValue(RECEIVING_SEQUENCE); if (receivingSequence != null) { ValueFactory valueFactory = new ValueFactory(); Value value = valueFactory.createValue(XMLConfigConstants.RECEIVE, elem); sm.setReceivingSequence(value); } return sm; }
public Mediator createSpecificMediator(OMElement elem, Properties properties) { SendMediator sm = new SendMediator(); // after successfully creating the mediator // set its common attributes such as tracing etc processAuditStatus(sm,elem); OMElement epElement = elem.getFirstChildWithName(ENDPOINT_Q); if (epElement != null) { // create the endpoint and set it in the send mediator Endpoint endpoint = EndpointFactory.getEndpointFromElement(epElement, true, properties); if (endpoint != null) { sm.setEndpoint(endpoint); } } String receivingSequence = elem.getAttributeValue(RECEIVING_SEQUENCE); if (receivingSequence != null) { ValueFactory valueFactory = new ValueFactory(); Value value = valueFactory.createValue(XMLConfigConstants.RECEIVE, elem); sm.setReceivingSequence(value); } String buildMessage = elem.getAttributeValue(BUILD_MESSAGE); if ("true".equals(buildMessage)) { sm.setBuildMessage(true); } return sm; }
SendMediator send1 = (SendMediator) factory.createMediator(config1, new Properties()); SendMediator send2 = (SendMediator) factory.createMediator(config2, new Properties());
SendMediator send1 = (SendMediator) factory.createMediator(config1, new Properties()); SendMediator send2 = (SendMediator) factory.createMediator(config2, new Properties());
SendMediator send1 = (SendMediator) factory.createMediator(config1, new Properties()); SendMediator send2 = (SendMediator) factory.createMediator(config2, new Properties());
public void testAddressEndpointSerialization() { String sendConfig = "<send xmlns=\"http://ws.apache.org/ns/synapse\">" + "<endpoint>" + "<address uri='http://localhost:9000/services/MyService1'>" + "<enableAddressing/>" + "<timeout>" + "<duration>60</duration>" + "<responseAction>discard</responseAction>" + "</timeout>" + "</address>" + "</endpoint>" + "</send>"; OMElement config1 = createOMElement(sendConfig); SendMediator send1 = (SendMediator) factory.createMediator(config1, new Properties()); OMElement config2 = serializer.serializeMediator(null, send1); SendMediator send2 = (SendMediator) factory.createMediator(config2, new Properties()); assertTrue("Top level endpoint should be a address endpoint.", send1.getEndpoint() instanceof AddressEndpoint); AddressEndpoint ep1 = (AddressEndpoint) send1.getEndpoint(); assertTrue("Top level endpoint should be a WSDL endpoint.", send2.getEndpoint() instanceof AddressEndpoint); AddressEndpoint ep2 = (AddressEndpoint) send2.getEndpoint(); assertEquals("Address URI is not serialized properly", ep1.getDefinition().getAddress(), ep2.getDefinition().getAddress()); assertEquals( "Addressing information is not serialized properly", ep1.getDefinition().isAddressingOn(), ep2.getDefinition().isAddressingOn()); }
public void testWSDLEndpointSerialization() { String sendConfig = "<send xmlns=\"http://ws.apache.org/ns/synapse\">" + "<endpoint>" + "<wsdl uri='file:src/test/resources/esbservice.wsdl' service='esbservice' port='esbserviceSOAP11port_http'>" + "<enableAddressing/>" + "</wsdl>" + "</endpoint>" + "</send>"; OMElement config1 = createOMElement(sendConfig); SendMediator send1 = (SendMediator) factory.createMediator(config1, new Properties()); OMElement config2 = serializer.serializeMediator(null, send1); SendMediator send2 = (SendMediator) factory.createMediator(config2, new Properties()); assertTrue("Top level endpoint should be a WSDL endpoint.", send1.getEndpoint() instanceof WSDLEndpoint); WSDLEndpoint ep1 = (WSDLEndpoint) send1.getEndpoint(); assertTrue("Top level endpoint should be a WSDL endpoint.", send2.getEndpoint() instanceof WSDLEndpoint); WSDLEndpoint ep2 = (WSDLEndpoint) send2.getEndpoint(); assertEquals("Service name is not serialized properly.", ep1.getServiceName(), ep2.getServiceName()); assertEquals("Port name is not serialized properly", ep1.getPortName(), ep2.getPortName()); assertEquals("WSDL URI is not serialized properly", ep1.getWsdlURI(), ep2.getWsdlURI()); assertEquals( "Addressing information is not serialized properly", ep1.getDefinition().isAddressingOn(), ep2.getDefinition().isAddressingOn()); }