Package org.wso2.carbon.event.core.subscription

Examples of org.wso2.carbon.event.core.subscription.Subscription


        /*assertEquals("Invalid response for the get status request", RESPONSE_PAYLOAD_SOAP12,
                payload.toString());*/
    }

    public void testSubscriptionToSOAP11Envelope() throws Exception {
        Subscription subscription = new Subscription();
        MessageContext mc = CommandBuilderTestUtils.getMCWithSOAP11Envelope();
        UnSubscribeCommandBuilder builder = new  UnSubscribeCommandBuilder(mc);

        OMElement payload = builder.fromSubscription(subscription);
        System.out.println("[TODO] The UnSubscribe Response is not compatible with the WS-Eventing " +
View Full Code Here


            if (userRegistry.resourceExists(subscriptionsPath)) {
                Collection collection = (Collection) userRegistry.get(subscriptionsPath);
                for (String subscriptionPath : collection.getChildren()) {
                    Resource subscriptionResource = userRegistry.get(subscriptionPath);
                    Subscription subscription = JavaUtil.getSubscription(subscriptionResource);
                    subscription.setTopicName(removeResourcePath(resourcePath));

                    if (subscriptionPath.endsWith("/")) {
                        subscriptionPath = subscriptionsPath.substring(0, subscriptionPath.lastIndexOf("/"));
                    }
                    subscription.setId(subscriptionPath.substring(subscriptionPath.lastIndexOf("/") + 1));
                    subscriptions.add(subscription);
                }
            }

            // add child subscriptions
View Full Code Here

    public void testSOAP12EnvelopeToSubscription() throws Exception {
        MessageContext mc = CommandBuilderTestUtils.getMCWithSOAP12Envelope();
        SubscribeCommandBuilder builder = new SubscribeCommandBuilder(mc);

        Subscription subscription = builder.toSubscription(
                CommandBuilderTestUtils.payloadToSOAP12Envelope(REQUEST_PAYLOAD_SOAP12));
        subscription.setId("uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa");

        assertNotNull("The subscription object is null", subscription);
        assertNotNull("The subscription id is null", subscription.getId());
        assertEquals("Invalid expiration time", 2034968820000L,
                subscription.getExpires().getTimeInMillis() +
                        TimeZone.getTimeZone("GMT-08:00").getOffset(0));
        assertEquals("Invalid time zone offset", TimeZone.getDefault().getOffset(0),
                subscription.getExpires().getTimeZone().getOffset(0));
        assertEquals("Invalid endpoint url", "http://www.other.example.com/OnStormWarning",
                        subscription.getEventSinkURL());

        Exception expected = null;
        try {
            builder.toSubscription(
                    CommandBuilderTestUtils.payloadToSOAP12Envelope(REQUEST_PAYLOAD_SOAP12_EXPIRED));
View Full Code Here

    public void testSOAP11EnvelopeToSubscription() throws Exception {
        MessageContext mc = CommandBuilderTestUtils.getMCWithSOAP11Envelope();
        SubscribeCommandBuilder builder = new SubscribeCommandBuilder(mc);

        Subscription subscription = builder.toSubscription(
                CommandBuilderTestUtils.payloadToSOAP11Envelope(REQUEST_PAYLOAD_SOAP11));
        subscription.setId("uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa");      

        assertNotNull("The subscription object is null", subscription);
        assertNotNull("The subscription id is null", subscription.getId());
        assertEquals("Invalid expiration time", 2034968820000L,
                subscription.getExpires().getTimeInMillis() +
                        TimeZone.getTimeZone("GMT-08:00").getOffset(0));
        assertEquals("Invalid time zone offset", TimeZone.getDefault().getOffset(0),
                subscription.getExpires().getTimeZone().getOffset(0));
        assertEquals("Invalid endpoint url", "http://www.other.example.com/OnStormWarning",
                        subscription.getEventSinkURL());


        Exception expected = null;
        try {
            builder.toSubscription(
View Full Code Here

        assertTrue("Invalid exception generated for expired renew request",
                expected instanceof InvalidExpirationTimeException);
    }

    public void testSubscriptionToSOAP12Envelope() throws Exception {
        Subscription subscription = new Subscription();
        subscription.setId("uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa");
        subscription.setEventSinkURL("http://www.example.org/oceanwatch/SubscriptionManager");
        MessageContext mc = CommandBuilderTestUtils.getMCWithSOAP12Envelope();
        SubscribeCommandBuilder builder = new  SubscribeCommandBuilder(mc);

        OMElement payload = builder.fromSubscription(subscription);
View Full Code Here

        assertEquals("Invalid response for the get status request", RESPONSE_PAYLOAD_SOAP12,
                payload.toString());
    }

    public void testSubscriptionToSOAP11Envelope() throws Exception {
        Subscription subscription = new Subscription();
        subscription.setId("uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa");
        subscription.setEventSinkURL("http://www.example.org/oceanwatch/SubscriptionManager");
        MessageContext mc = CommandBuilderTestUtils.getMCWithSOAP11Envelope();
        SubscribeCommandBuilder builder = new  SubscribeCommandBuilder(mc);

        OMElement payload = builder.fromSubscription(subscription);
View Full Code Here

        assertEquals("Invalid response for the get status request", RESPONSE_PAYLOAD_SOAP11,
                payload.toString());
    }

    public void testSubscriptionToSOAP12EnvelopeWithExpiry() throws Exception {
        Subscription subscription = new Subscription();
        subscription.setId("uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa");
        subscription.setEventSinkURL("http://www.example.org/oceanwatch/SubscriptionManager");
        MessageContext mc = CommandBuilderTestUtils.getMCWithSOAP12Envelope();
        SubscribeCommandBuilder builder = new  SubscribeCommandBuilder(mc);
        Calendar calendar = Calendar.getInstance();
        TimeZone tz = TimeZone.getTimeZone("GMT-08:00");
        calendar.setTimeZone(tz);
        calendar.setTimeInMillis(2034968820000L - TimeZone.getTimeZone("GMT-08:00").getOffset(0));
        subscription.setExpires(calendar);
        OMElement payload = builder.fromSubscription(subscription);

        assertEquals("Invalid response for the get status request", RESPONSE_PAYLOAD_SOAP12_WITH_EXPIRY,
                payload.toString());
    }
View Full Code Here

        assertEquals("Invalid response for the get status request", RESPONSE_PAYLOAD_SOAP12_WITH_EXPIRY,
                payload.toString());
    }

    public void testSubscriptionToSOAP11EnvelopeWithExpiry() throws Exception {
        Subscription subscription = new Subscription();
        subscription.setId("uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa");
        subscription.setEventSinkURL("http://www.example.org/oceanwatch/SubscriptionManager");
        MessageContext mc = CommandBuilderTestUtils.getMCWithSOAP11Envelope();
        SubscribeCommandBuilder builder = new  SubscribeCommandBuilder(mc);
        Calendar calendar = Calendar.getInstance();
        TimeZone tz = TimeZone.getTimeZone("GMT-08:00");
        calendar.setTimeZone(tz);
        calendar.setTimeInMillis(2034968820000L - TimeZone.getTimeZone("GMT-08:00").getOffset(0));
        subscription.setExpires(calendar);
        OMElement payload = builder.fromSubscription(subscription);

        assertEquals("Invalid response for the get status request", RESPONSE_PAYLOAD_SOAP11_WITH_EXPIRY,
                payload.toString());
    }
View Full Code Here

        assertEquals("Invalid response for the get status request", RESPONSE_PAYLOAD_SOAP11_WITH_EXPIRY,
                payload.toString());
    }

    public void testCarbonSubscriptionToSOAP12Envelope() throws Exception {
        Subscription subscription = new Subscription();
        subscription.setId("uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa");
        subscription.setEventSinkURL("http://www.example.org/oceanwatch/SubscriptionManager");
        String id = subscription.getId();
        MessageContext mc = CommandBuilderTestUtils.getMCWithSOAP12Envelope();
        SubscribeCommandBuilder builder = new  SubscribeCommandBuilder(mc);

        OMElement payload = builder.fromSubscription(subscription);
View Full Code Here

        assertEquals("Invalid response for the get status request", expectPayload,
                payload.toString());
    }

    public void testCarbonSubscriptionToSOAP11Envelope() throws Exception {
        Subscription subscription = new Subscription();
        subscription.setId("uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa");
        subscription.setEventSinkURL("http://www.example.org/oceanwatch/SubscriptionManager");       
        String id = subscription.getId();
        MessageContext mc = CommandBuilderTestUtils.getMCWithSOAP11Envelope();
        SubscribeCommandBuilder builder = new  SubscribeCommandBuilder(mc);

        OMElement payload = builder.fromSubscription(subscription);
View Full Code Here

TOP

Related Classes of org.wso2.carbon.event.core.subscription.Subscription

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.