use of org.wso2.eventing.exceptions.EventException in project wso2-synapse by wso2.
the class SynapseEventSourceTest method renewTest.
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");
}
}
use of org.wso2.eventing.exceptions.EventException in project wso2-synapse by wso2.
the class SynapseEventSourceTest method unsubscribeTest.
public void unsubscribeTest() {
String message = "<wse:Unsubscribe xmlns:wse=\"http://schemas.xmlsoap.org/ws/2004/08/eventing\"/>";
try {
MessageContext msgCtx = createMessageContext(message, EventingConstants.WSE_UNSUBSCRIBE);
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(0, subMan.getSubscriptions().size());
} catch (EventException e) {
fail("Eventing exception occured while accessing the subscription manager");
}
}
use of org.wso2.eventing.exceptions.EventException in project wso2-synapse by wso2.
the class SynapseEventSourceTest method subscribeTest.
private void subscribeTest() {
Date date = new Date(System.currentTimeMillis() + 3600000);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
String message = "<wse:Subscribe xmlns:wse=\"http://schemas.xmlsoap.org/ws/2004/08/eventing\" " + " xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\" " + " xmlns:ew=\"http://www.example.com/warnings\">\n" + " <wse:EndTo>\n" + " <wsa:Address>http://www.example.com/MyEventSink</wsa:Address>\n" + " <wsa:ReferenceProperties>\n" + " <ew:MySubscription>2597</ew:MySubscription>\n" + " </wsa:ReferenceProperties>\n" + " </wse:EndTo>\n" + " <wse:Delivery>\n" + " <wse:NotifyTo>\n" + " <wsa:Address>" + ADDR_URL + "</wsa:Address>\n" + " <wsa:ReferenceProperties>\n" + " <ew:MySubscription>2597</ew:MySubscription>\n" + " </wsa:ReferenceProperties>\n" + " </wse:NotifyTo>\n" + " </wse:Delivery>\n" + " <wse:Expires>" + ConverterUtil.convertToString(cal) + "</wse:Expires>\n" + " <wse:Filter xmlns:ow=\"http://www.example.org/oceanwatch\"\n" + " Dialect=\"" + FILTER_DIALECT + "\" >" + FILTER + "</wse:Filter>\n" + "</wse:Subscribe>";
try {
MessageContext msgCtx = createMessageContext(message, EventingConstants.WSE_SUBSCRIBE);
source.receive(msgCtx);
} catch (Exception ignored) {
}
try {
assertEquals(1, subMan.getSubscriptions().size());
SynapseSubscription s = (SynapseSubscription) subMan.getSubscriptions().get(0);
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());
id = s.getId();
} catch (EventException e) {
fail("Eventing exception occured while accessing the subscription manager");
}
}
Aggregations