Package org.servicemix.ws.notification.impl

Examples of org.servicemix.ws.notification.impl.ActiveMQNotificationBroker


* @version $Revision: 468 $
*/
public class ActiveMQNotificationBrokerTest extends TestSupport {

    public void testGetRequiresRegistrationProperty() throws Exception {
        ActiveMQNotificationBroker broker = new ActiveMQNotificationBroker();
       
        GetResourcePropertyDocument request = GetResourcePropertyDocument.Factory.newInstance();
        QName property = new QName("http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BrokeredNotification-1.2-draft-01.xsd", "RequiresRegistration");
        request.setGetResourceProperty( property );
        System.out.println(request);
        GetResourcePropertyResponseDocument response = broker.getResourceProperty(null, request);
        System.out.println(response);
        assertNotNull(response);
        XmlCursor cursor = response.newCursor();
        cursor.toChild(property);
        cursor.toFirstContentToken();
View Full Code Here


        assertEquals("false", cursor.getTextValue());
    }
   
    public void XtestSendNotify() throws Exception {
       
        ActiveMQNotificationBroker broker = new ActiveMQNotificationBroker();
        ActiveMQConnection connection = broker.getConnection();
        Session session = connection.createSession(false, 0);
        ActiveMQTopic topic = new ActiveMQTopic("Test");
        MessageConsumer consumer = session.createConsumer(topic);
       
        NotifyDocument request = NotifyDocument.Factory.newInstance();
        Notify notify = request.addNewNotify();
        NotificationMessageHolderType messageHolder = notify.addNewNotificationMessage();
        messageHolder.setTopic( TopicExpressionConverter.toTopicExpression(topic) );
        XmlObject o = createMessage();
        messageHolder.setMessage(o);
       
        System.out.println(request);
        broker.notify(request);
       
        Message message = consumer.receive(3000);
        assertNotNull(message);
    }
View Full Code Here

    }

    public void testSubscribe() throws JMSException, InterruptedException {

        final Slot result = new Slot();
        ActiveMQNotificationBroker broker = new ActiveMQNotificationBroker() {
            protected org.servicemix.ws.notification.NotificationConsumer createNotificationConsumer(EndpointReferenceType consumerReference) {
                return new StubNotificationConsumer(result);
            }
        };
View Full Code Here


    public void testSubscriptionPauseResume() throws JMSException, InterruptedException {

        final Slot result = new Slot();
        ActiveMQNotificationBroker broker = new ActiveMQNotificationBroker() {
            protected org.servicemix.ws.notification.NotificationConsumer createNotificationConsumer(EndpointReferenceType consumerReference) {
                return new StubNotificationConsumer(result);
            }
        };

        EndpointReferenceType subRef = addSubscription(broker);
       
        // The sub should be running and we should be getting notifed now.
        sendNotification(broker);
        NotifyDocument subNotifyDoc = (NotifyDocument) result.poll(2000);
        assertNotNull(subNotifyDoc);
       
        // Pause the subscription.
        PauseSubscriptionDocument pauseRequest = PauseSubscriptionDocument.Factory.newInstance();
        pauseRequest.addNewPauseSubscription();
        broker.getSubscriptionManager().pauseSubcription(pauseRequest, subRef);       
       
        // The sub should be stopped and we should not be getting notifed now.
        sendNotification(broker);
        subNotifyDoc = (NotifyDocument) result.poll(2000);
        assertNull(subNotifyDoc);
       
        // Resume the subscription.
        ResumeSubscriptionDocument resumeRequest = ResumeSubscriptionDocument.Factory.newInstance();
        resumeRequest.addNewResumeSubscription();
        broker.getSubscriptionManager().resumeSubscription(resumeRequest, subRef);       
       
        // We should now get the message that was previously sent since the sub is now running.
        subNotifyDoc = (NotifyDocument) result.poll(2000);
        assertNotNull(subNotifyDoc);
    }
View Full Code Here

        registry.registerService(service);

        final SoapService serverSide = new SoapService(registry);
        serverSide.setRepairingNamespace(true);

        ActiveMQNotificationBroker broker = new ActiveMQNotificationBroker() {
            protected org.servicemix.ws.notification.NotificationConsumer createNotificationConsumer(EndpointReferenceType consumerReference) {
                return ActiveSOAPNotificationConsumer.newSoapInstance(new LocalTransportClient(serverSide));
            }
        };
View Full Code Here

TOP

Related Classes of org.servicemix.ws.notification.impl.ActiveMQNotificationBroker

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.