messageBuilder.genRenewSubscriptionResponse(subscription); dispatchResponse(soapEnvelope, EventingConstants.WSE_RENEW_RESPONSE, mc, false);
messageBuilder.genRenewSubscriptionResponse(subscription); dispatchResponse(soapEnvelope, EventingConstants.WSE_RENEW_RESPONSE, mc, false);
public void testRenewResponse() { String id = UIDGenerator.generateURNString(); String addressUrl = "http://synapse.test.com/eventing/sunscriptions"; Date date = new Date(System.currentTimeMillis() + 3600000); Calendar cal = Calendar.getInstance(); cal.setTime(date); SynapseSubscription sub = new SynapseSubscription(); sub.setId(id); sub.setSubManUrl(addressUrl); sub.setExpires(cal); String expected = "<wse:RenewResponse xmlns:wse=\"http://schemas.xmlsoap.org/ws/2004/08/eventing\">" + "<wse:Expires>" + ConverterUtil.convertToString(cal) + "</wse:Expires>" + "</wse:RenewResponse>"; try { MessageContext msgCtx = TestUtils.getAxis2MessageContext("<empty/>", null). getAxis2MessageContext(); ResponseMessageBuilder builder = new ResponseMessageBuilder(msgCtx); SOAPEnvelope env = builder.genRenewSubscriptionResponse(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()); } }