Package org.apache.cxf.ws.eventing

Examples of org.apache.cxf.ws.eventing.Subscribe


     * Tests the Renew operation, while specifying an xs:duration in the renew request,
     * eg. the subscriber requests to prolong the subscription by a specific amount of time.
     */
    @Test
    public void renewWithDuration() throws IOException {
        Subscribe subscribe = new Subscribe();
        ExpirationType exp = new ExpirationType();
        exp.setValue(DurationAndDateUtil
                .convertToXMLString(DurationAndDateUtil.parseDurationOrTimestamp("PT5M0S")))// 5 minutes
        subscribe.setExpires(exp);
        DeliveryType delivery = new DeliveryType();
        subscribe.setDelivery(delivery);
        subscribe.getDelivery().getContent().add(createDummyNotifyTo());
        SubscribeResponse resp = eventSourceClient.subscribeOp(subscribe);

        SubscriptionManagerEndpoint client = createSubscriptionManagerClient(
                resp.getSubscriptionManager().getReferenceParameters());
        GetStatusResponse response = client.getStatusOp(new GetStatus());
View Full Code Here


    static final String NOTIFICATION_TEST_PORT = allocatePort(NotificationTest.class);

    @Test
    public void basicReceptionOfEvents() throws IOException {
        NotificatorService service = createNotificatorService();
        Subscribe subscribe = new Subscribe();
        ExpirationType exp = new ExpirationType();
        exp.setValue(
                DurationAndDateUtil.convertToXMLString(DurationAndDateUtil.parseDurationOrTimestamp("PT0S")));
        subscribe.setExpires(exp);

        EndpointReferenceType eventSinkERT = new EndpointReferenceType();

        AttributedURIType eventSinkAddr = new AttributedURIType();
        String url = TestUtil.generateRandomURLWithHttpTransport(NOTIFICATION_TEST_PORT);
        eventSinkAddr.setValue(url);
        eventSinkERT.setAddress(eventSinkAddr);
        subscribe.setDelivery(new DeliveryType());
        subscribe.getDelivery().getContent()
            .add(new ObjectFactory().createNotifyTo(eventSinkERT));


        eventSourceClient.subscribeOp(subscribe);
        eventSourceClient.subscribeOp(subscribe);
View Full Code Here

    }
   
    @Test
    public void basicReceptionOfWrappedEvents() throws IOException {
        NotificatorService service = createNotificatorService();
        Subscribe subscribe = new Subscribe();
        ExpirationType exp = new ExpirationType();
        exp.setValue(
                DurationAndDateUtil.convertToXMLString(DurationAndDateUtil.parseDurationOrTimestamp("PT0S")));
        subscribe.setExpires(exp);

        EndpointReferenceType eventSinkERT = new EndpointReferenceType();

        AttributedURIType eventSinkAddr = new AttributedURIType();
        String url = TestUtil.generateRandomURLWithHttpTransport(NOTIFICATION_TEST_PORT);
        eventSinkAddr.setValue(url);
        eventSinkERT.setAddress(eventSinkAddr);
        subscribe.setDelivery(new DeliveryType());
        subscribe.getDelivery().getContent().add(new ObjectFactory().createNotifyTo(eventSinkERT));
        FormatType formatType = new FormatType();
        formatType.setName(EventingConstants.DELIVERY_FORMAT_WRAPPED);
        subscribe.setFormat(formatType);

        eventSourceClient.subscribeOp(subscribe);
        eventSourceClient.subscribeOp(subscribe);
        eventSourceClient.subscribeOp(subscribe);
View Full Code Here

    }

    @Test
    public void withWSAAction() throws Exception {
        NotificatorService service = createNotificatorService();
        Subscribe subscribe = new Subscribe();
        ExpirationType exp = new ExpirationType();
        exp.setValue(
                DurationAndDateUtil.convertToXMLString(DurationAndDateUtil.parseDurationOrTimestamp("PT0S")));
        subscribe.setExpires(exp);

        EndpointReferenceType eventSinkERT = new EndpointReferenceType();

        AttributedURIType eventSinkAddr = new AttributedURIType();
        String url = TestUtil.generateRandomURLWithHttpTransport(NOTIFICATION_TEST_PORT);
        eventSinkAddr.setValue(url);
        eventSinkERT.setAddress(eventSinkAddr);
        subscribe.setDelivery(new DeliveryType());
        subscribe.getDelivery().getContent().add(new ObjectFactory().createNotifyTo(eventSinkERT));

        eventSourceClient.subscribeOp(subscribe);

        Server eventSinkServer = createEventSinkWithWSAActionAssertion(url, "http://www.fire.com");
        TestingEventSinkImpl.RECEIVED_FIRES.set(0);
View Full Code Here

    }

    @Test
    public void withReferenceParameters() throws Exception {
        NotificatorService service = createNotificatorService();
        Subscribe subscribe = new Subscribe();
        ExpirationType exp = new ExpirationType();
        exp.setValue(
                DurationAndDateUtil.convertToXMLString(DurationAndDateUtil.parseDurationOrTimestamp("PT0S")));
        subscribe.setExpires(exp);

        EndpointReferenceType eventSinkERT = new EndpointReferenceType();

        JAXBElement<String> idqn
            = new JAXBElement<String>(new QName("http://www.example.org", "MyReferenceParameter"),
                String.class,
                "380");
        JAXBElement<String> idqn2
            = new JAXBElement<String>(new QName("http://www.example.org", "MyReferenceParameter2"),
                String.class,
                "381");
        eventSinkERT.setReferenceParameters(new ReferenceParametersType());
        eventSinkERT.getReferenceParameters().getAny().add(idqn);
        eventSinkERT.getReferenceParameters().getAny().add(idqn2);
        AttributedURIType eventSinkAddr = new AttributedURIType();
        String url = TestUtil.generateRandomURLWithHttpTransport(NOTIFICATION_TEST_PORT);
        eventSinkAddr.setValue(url);
        eventSinkERT.setAddress(eventSinkAddr);
        subscribe.setDelivery(new DeliveryType());
        subscribe.getDelivery().getContent().add(new ObjectFactory().createNotifyTo(eventSinkERT));

        eventSourceClient.subscribeOp(subscribe);

        Server eventSinkServer = createEventSinkWithReferenceParametersAssertion(url,
                eventSinkERT.getReferenceParameters());
View Full Code Here

     * this notification.
     */
    @Test
    public void withFilter() throws IOException {
        NotificatorService service = createNotificatorService();
        Subscribe subscribe = new Subscribe();
        ExpirationType exp = new ExpirationType();
        exp.setValue(
                DurationAndDateUtil.convertToXMLString(DurationAndDateUtil.parseDurationOrTimestamp("PT0S")));
        subscribe.setExpires(exp);

        EndpointReferenceType eventSinkERT = new EndpointReferenceType();

        AttributedURIType eventSinkAddr = new AttributedURIType();
        String url = TestUtil.generateRandomURLWithHttpTransport(NOTIFICATION_TEST_PORT);
        eventSinkAddr.setValue(url);
        eventSinkERT.setAddress(eventSinkAddr);
        subscribe.setDelivery(new DeliveryType());
        subscribe.getDelivery().getContent().add(new ObjectFactory().createNotifyTo(eventSinkERT));
       
        subscribe.setFilter(new FilterType());
        subscribe.getFilter().getContent().add("//*[local-name()='fire' and "
                + "namespace-uri()='http://www.events.com']/location[text()='Canada']");


        eventSourceClient.subscribeOp(subscribe);

View Full Code Here

     * this notification.
     */
    @Test
    public void withFilterNegative() throws IOException {
        NotificatorService service = createNotificatorService();
        Subscribe subscribe = new Subscribe();
        ExpirationType exp = new ExpirationType();
        exp.setValue(
                DurationAndDateUtil.convertToXMLString(DurationAndDateUtil.parseDurationOrTimestamp("PT0S")));
        subscribe.setExpires(exp);

        EndpointReferenceType eventSinkERT = new EndpointReferenceType();

        AttributedURIType eventSinkAddr = new AttributedURIType();
        String url = TestUtil.generateRandomURLWithHttpTransport(NOTIFICATION_TEST_PORT);
        eventSinkAddr.setValue(url);
        eventSinkERT.setAddress(eventSinkAddr);
        subscribe.setDelivery(new DeliveryType());
        subscribe.getDelivery().getContent().add(new ObjectFactory().createNotifyTo(eventSinkERT));

        subscribe.setFilter(new FilterType());
        subscribe.getFilter().getContent().add("/*[local-name()='fire']/location[text()='Russia']");


        eventSourceClient.subscribeOp(subscribe);

        Server eventSinkServer = createEventSink(url);
View Full Code Here

     * receive only one notification.
     */
    @Test
    public void withFilter2() throws IOException {
        NotificatorService service = createNotificatorService();
        Subscribe subscribe = new Subscribe();
        ExpirationType exp = new ExpirationType();
        exp.setValue(
                DurationAndDateUtil.convertToXMLString(DurationAndDateUtil.parseDurationOrTimestamp("PT0S")));
        subscribe.setExpires(exp);

        EndpointReferenceType eventSinkERT = new EndpointReferenceType();

        AttributedURIType eventSinkAddr = new AttributedURIType();
        String url = TestUtil.generateRandomURLWithHttpTransport(NOTIFICATION_TEST_PORT);
        eventSinkAddr.setValue(url);
        eventSinkERT.setAddress(eventSinkAddr);
        subscribe.setDelivery(new DeliveryType());
        subscribe.getDelivery().getContent().add(new ObjectFactory().createNotifyTo(eventSinkERT));

        subscribe.setFilter(new FilterType());
        subscribe.getFilter().getContent()
                .add("//*[local-name()='earthquake']/location[text()='Russia']/"
                        + "../richterScale[contains(text(),'3.5')]");

        eventSourceClient.subscribeOp(subscribe);

View Full Code Here

     * @throws IOException
     */
    @Test
    public void expiration() throws IOException {
        NotificatorService service = createNotificatorService();
        Subscribe subscribe = new Subscribe();
        ExpirationType exp = new ExpirationType();
        exp.setValue(
                DurationAndDateUtil.convertToXMLString(DurationAndDateUtil.parseDurationOrTimestamp("PT1S")));
        subscribe.setExpires(exp);

        EndpointReferenceType eventSinkERT = new EndpointReferenceType();

        AttributedURIType eventSinkAddr = new AttributedURIType();
        String url = TestUtil.generateRandomURLWithHttpTransport(NOTIFICATION_TEST_PORT);
        eventSinkAddr.setValue(url);
        eventSinkERT.setAddress(eventSinkAddr);
        subscribe.setDelivery(new DeliveryType());
        subscribe.getDelivery().getContent().add(new ObjectFactory().createNotifyTo(eventSinkERT));

        eventSourceClient.subscribeOp(subscribe);

        Server eventSinkServer = createEventSink(url);
        TestingEventSinkImpl.RECEIVED_FIRES.set(0);
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.eventing.Subscribe

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.