factory.createOMElement(EventingConstants.WSE_EN_EXPIRES, eventingNamespace); factory.createOMText(expiresElement, ConverterUtil.convertToString(subscription.getExpires())); renewResponseElement.addChild(expiresElement); message.getBody().addChild(renewResponseElement);
factory.createOMElement(EventingConstants.WSE_EN_EXPIRES, eventingNamespace); factory.createOMText(expiresElement, ConverterUtil.convertToString(subscription.getExpires())); renewResponseElement.addChild(expiresElement); message.getBody().addChild(renewResponseElement);
public void renewTest() { Date date = new Date(System.currentTimeMillis() + 3600000 * 2); Calendar cal = Calendar.getInstance(); cal.setTime(date); String message = "<wse:Renew xmlns:wse=\"http://schemas.xmlsoap.org/ws/2004/08/eventing\">\n" + " <wse:Expires>" + ConverterUtil.convertToString(cal) + "</wse:Expires>\n" + "</wse:Renew>"; try { MessageContext msgCtx = createMessageContext(message, EventingConstants.WSE_RENEW); QName qname = new QName(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EN_IDENTIFIER, "wse"); TestUtils.addSOAPHeaderBlock(msgCtx, qname, id); source.receive(msgCtx); } catch (Exception ignored) { } try { assertEquals(1, subMan.getSubscriptions().size()); SynapseSubscription s = (SynapseSubscription) subMan.getSubscription(this.id); assertEquals(SUB_MAN_URL, s.getSubManUrl()); assertEquals(ADDR_URL, s.getAddressUrl()); assertEquals(FILTER_DIALECT, s.getFilterDialect()); assertEquals(FILTER, s.getFilterValue()); assertEquals(date, s.getExpires().getTime()); } catch (EventException e) { fail("Eventing exception occured while accessing the subscription manager"); } }
public void testSubscriptionMessageBuilderScenarioThree() { String addressUrl = "http://synapse.test.com/eventing/subscriptions"; Date date = new Date(System.currentTimeMillis() + 3600000); Calendar cal = Calendar.getInstance(); cal.setTime(date); String message = "<wse:Renew xmlns:wse=\"http://schemas.xmlsoap.org/ws/2004/08/eventing\">\n" + " <wse:Expires>" + ConverterUtil.convertToString(cal) + "</wse:Expires>\n" + "</wse:Renew>"; try { MessageContext msgCtx = TestUtils.getAxis2MessageContext(message, null). getAxis2MessageContext(); msgCtx.setTo(new EndpointReference(addressUrl)); String id = addIdentifierHeader(msgCtx); SubscriptionMessageBuilder.resetErrorInfo(); SynapseSubscription sub = SubscriptionMessageBuilder. createRenewSubscribeMessage(msgCtx); assertEquals(id, sub.getId()); assertEquals(addressUrl, sub.getAddressUrl()); assertEquals(date, sub.getExpires().getTime()); assertNull(SubscriptionMessageBuilder.getErrorCode()); assertNull(SubscriptionMessageBuilder.getErrorReason()); assertNull(SubscriptionMessageBuilder.getErrorSubCode()); } catch (Exception e) { e.printStackTrace(); fail("Error while constructing the sample subscription request: " + e.getMessage()); } }
assertEquals(FILTER_DIALECT, s.getFilterDialect()); assertEquals(FILTER, s.getFilterValue()); assertEquals(date, s.getExpires().getTime()); id = s.getId(); } catch (EventException e) {
assertEquals(filterDialect, sub.getFilterDialect()); assertEquals(filter, sub.getFilterValue()); assertEquals(date, sub.getExpires().getTime()); assertNull(SubscriptionMessageBuilder.getErrorCode()); assertNull(SubscriptionMessageBuilder.getErrorReason());