messageBuilder.genSubscriptionResponse(subscription); dispatchResponse(soapEnvelope, EventingConstants.WSE_SUbSCRIBE_RESPONSE, mc, false);
messageBuilder.genSubscriptionResponse(subscription); dispatchResponse(soapEnvelope, EventingConstants.WSE_SUbSCRIBE_RESPONSE, mc, false);
public void testSubscriptionResponse() { String id = UIDGenerator.generateURNString(); String addressUrl = "http://synapse.test.com/eventing/sunscriptions"; SynapseSubscription sub = new SynapseSubscription(); sub.setId(id); sub.setSubManUrl(addressUrl); String expected = "<wse:SubscribeResponse xmlns:wse=\"http://schemas.xmlsoap.org/ws/2004/08/eventing\">" + "<wse:SubscriptionManager>" + "<wsa:Address xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">" + addressUrl + "</wsa:Address>" + "<wsa:ReferenceParameters xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">" + "<wse:Identifier>" + id + "</wse:Identifier>" + "</wsa:ReferenceParameters>" + "</wse:SubscriptionManager>" + "</wse:SubscribeResponse>"; try { MessageContext msgCtx = TestUtils.getAxis2MessageContext("<empty/>", null). getAxis2MessageContext(); ResponseMessageBuilder builder = new ResponseMessageBuilder(msgCtx); SOAPEnvelope env = builder.genSubscriptionResponse(sub); OMElement resultOm = env.getBody().getFirstElement(); OMElement expectedOm = AXIOMUtil.stringToOM(expected); assertTrue(compare(expectedOm, resultOm)); } catch (Exception e) { fail("Error while constructing the test message context: " + e.getMessage()); } }