Package org.wso2.carbon.registry.social.impl.activity

Examples of org.wso2.carbon.registry.social.impl.activity.ActivityImpl


    }

    public void testCreateActivity() throws Exception {
        ActivityManagerImpl manager = new ActivityManagerImpl();
        manager.setRegistry(registry);
        Activity activity1 = new ActivityImpl();
        activity1.setUserId("admin");
        activity1.setId("1");
        activity1.setAppId("1");
        activity1.setTitle("Adding Gadget");
        //manager.saveActivity("admin", activity1);
        manager.createActivity("admin","self","1",null,activity1);
        Activity activity2 = manager.getActivity("admin", "self", "1", null, "1");
        assertNotNull(activity2);
        assertEquals("admin", activity2.getUserId());
        assertEquals("Adding Gadget", activity2.getTitle());
        assertEquals("1",activity2.getId());
        /* Checking the scenario - no activityId specified*/
        activity1 = new ActivityImpl();
        activity1.setUserId("admin");
        activity1.setAppId("99");
        activity1.setTitle("Adding GadgetXXX");
        manager.createActivity("admin","self","99",null,activity1);
        Activity activity3=new ActivityImpl();
        activity3.setUserId("admin");
        activity3.setAppId("99");
        activity3.setTitle("Adding GadgetYYY");
        manager.createActivity("admin","self","99",null,activity3);
        activity2 = manager.getActivity("admin", "self", "99", null, "1");
        assertNotNull(activity2);
        assertEquals("admin", activity2.getUserId());
        assertEquals("Adding GadgetYYY", activity2.getTitle());
View Full Code Here


    }

    public void testDeleteActivity() throws Exception {
        ActivityManagerImpl manager = new ActivityManagerImpl();
        manager.setRegistry(registry);
        Activity activity1 = new ActivityImpl();
        activity1.setUserId("user1");
        activity1.setId("1");
        activity1.setAppId("1");
        activity1.setTitle("Adding Gadget");
        manager.saveActivity("user1", activity1);
        Activity activity2 = manager.getActivity("user1", "self", "1", null, "1");
        assertNotNull(activity2);
        assertEquals("user1", activity2.getUserId());
        assertEquals("Adding Gadget", activity2.getTitle());
View Full Code Here

    }

    public void testUpdateActivity() throws Exception {
        ActivityManagerImpl manager = new ActivityManagerImpl();
        manager.setRegistry(registry);
        Activity activity1 = new ActivityImpl();
        activity1.setUserId("userX");
        activity1.setId("4");
        activity1.setAppId("5");
        activity1.setTitle("Adding Gadget");
        manager.saveActivity("userX", activity1);
        Activity activity2 = manager.getActivity("userX", "self", "5", null, "4");
        assertNotNull(activity2);
        assertEquals("userX", activity2.getUserId());
        assertEquals("Adding Gadget", activity2.getTitle());
        activity1.setTitle("New Comment added");
        manager.updateActivity("userX", activity1);
        activity2 = manager.getActivity("userX", "self", "5", null, "4");
        assertNotNull(activity2);
        assertEquals("userX", activity2.getUserId());
        assertEquals("New Comment added", activity2.getTitle());
View Full Code Here

    }

    public void testGetActivities() throws Exception {
        ActivityManagerImpl manager = new ActivityManagerImpl();
        manager.setRegistry(registry);
        Activity activity1 = new ActivityImpl();
        activity1.setUserId("userX");
        activity1.setId("4");
        activity1.setAppId("5");
        activity1.setTitle("Adding Gadget 1 ");
        manager.saveActivity("userX", activity1);
        Activity activity2 = new ActivityImpl();
        activity1.setUserId("userY");
        activity1.setId("8");
        activity1.setAppId("5");
        activity1.setTitle("Adding Gadget 2 ");
        manager.saveActivity("userY", activity1);
View Full Code Here


    public void testGetActivities2() throws Exception {
        ActivityManagerImpl manager = new ActivityManagerImpl();
        manager.setRegistry(registry);
        Activity activity1 = new ActivityImpl();
        activity1.setUserId("userX");
        activity1.setId("9");
        activity1.setAppId("5");
        activity1.setTitle("Adding Gadget 1 ");
        manager.saveActivity("userX", activity1);
        activity1.setUserId("userX");
        activity1.setId("10");
        activity1.setAppId("5");
        activity1.setTitle("Adding Gadget 2 ");
        manager.saveActivity("userX", activity1);
        activity1.setUserId("userX");
        activity1.setId("8");
        activity1.setAppId("5");
        activity1.setTitle("Adding Gadget 3 ");
        manager.saveActivity("userX", activity1);
        Activity[] activities = manager.getActivities("userX", "self", "5", null, new FilterOptionsImpl(), new String[]{"8", "9", "10"});
        assertEquals(3, activities.length);
        boolean test = false, test2 = false;
        for (Activity act : activities) {
View Full Code Here

    }

    public void testDeleteActivities() throws Exception {
        ActivityManagerImpl manager = new ActivityManagerImpl();
        manager.setRegistry(registry);
        Activity activity1 = new ActivityImpl();
        activity1.setUserId("userA");
        activity1.setId("19");
        activity1.setAppId("7");
        activity1.setTitle("Adding Gadget 1 ");
        manager.saveActivity("userA", activity1);
        activity1.setUserId("userA");
        activity1.setId("20");
        activity1.setAppId("7");
        activity1.setTitle("Adding Gadget 2 ");
        manager.saveActivity("userA", activity1);
        activity1.setUserId("userA");
        activity1.setId("18");
        activity1.setAppId("7");
        activity1.setTitle("Adding Gadget 3 ");
        manager.saveActivity("userA", activity1);
        Activity[] activities = manager.getActivities(new String[]{"userA"}, "self", "7", null, new FilterOptionsImpl());
        assertEquals(3, activities.length);
        Set<String> activityIds = new HashSet<String>();
View Full Code Here

        }

        public void run() {
            try {
                MessageContext msgCtx = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
                Event<MessageContext> event = new Event(msgCtx);
                subscriptions = subscriptionManager.getMatchingSubscriptions(event);
            } catch (EventException e) {
                handleException("Matching subscriptions fetching error", e);
            }
View Full Code Here

     * @throws EventException event
     */
    private void processGetStatusRequest(MessageContext mc,
                                         ResponseMessageBuilder messageBuilder)
            throws AxisFault, EventException {
        Subscription subscription =
                SubscriptionMessageBuilder.createGetStatusMessage(mc);
        if (log.isDebugEnabled()) {
            log.debug("GetStatus request recived for SynapseSubscription ID : " +
                    subscription.getId());
        }
        subscription = subscriptionManager.getSubscription(subscription.getId());
        if (subscription != null) {
            if (log.isDebugEnabled()) {
                log.debug("Sending GetStatus responce for SynapseSubscription ID : " +
                        subscription.getId());
            }
            //send the responce
            SOAPEnvelope soapEnvelope = messageBuilder.genGetStatusResponse(subscription);
            dispatchResponse(soapEnvelope, EventingConstants.WSE_GET_STATUS_RESPONSE,
                    mc, false);
View Full Code Here

            // Adding static subscriptions
            List<Subscription> staticSubscriptionList =
                    eventSource.getSubscriptionManager().getStaticSubscriptions();
            for (Iterator<Subscription> iterator = staticSubscriptionList.iterator();
                 iterator.hasNext();) {
                Subscription staticSubscription = iterator.next();
                OMElement staticSubElem =
                        fac.createOMElement("subscription", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                staticSubElem.addAttribute(
                        fac.createOMAttribute("id", nullNS, staticSubscription.getId()));
                OMElement filterElem =
                        fac.createOMElement("filter", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                filterElem.addAttribute(fac.createOMAttribute("source", nullNS,
                        (String) staticSubscription.getFilterValue()));
                filterElem.addAttribute(fac.createOMAttribute("dialect", nullNS,
                        (String) staticSubscription.getFilterDialect()));
                staticSubElem.addChild(filterElem);
                OMElement endpointElem =
                        fac.createOMElement("endpoint", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                OMElement addressElem =
                        fac.createOMElement("address", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                addressElem.addAttribute(
                        fac.createOMAttribute("uri", nullNS, staticSubscription.getEndpointUrl()));
                endpointElem.addChild(addressElem);
                staticSubElem.addChild(endpointElem);
                if (staticSubscription.getExpires() != null) {
                    OMElement expiresElem =
                            fac.createOMElement("expires", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                    fac.createOMText(expiresElem,
                            ConverterUtil.convertToString(staticSubscription.getExpires()));
                    staticSubElem.addChild(expiresElem);
                }
                evenSourceElem.addChild(staticSubElem);
            }
View Full Code Here


    public SynapseSubscription() {
        this.setId(UIDGenerator.generateURNString());
        this.setDeliveryMode(EventingConstants.WSE_DEFAULT_DELIVERY_MODE);
        SubscriptionData subscriptionData = new SubscriptionData();
        subscriptionData.setProperty(SynapseEventingConstants.STATIC_ENTRY, "false");
        this.setSubscriptionData(subscriptionData);
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.social.impl.activity.ActivityImpl

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.