Examples of EventBrokerService


Examples of org.wso2.carbon.eventing.broker.services.EventBrokerService

import org.wso2.eventing.NotificationManager;

public class CarbonEventBrokerTest extends TestCase {

    public void testGetDefaultInstance() throws Exception {
        EventBrokerService broker1 = CarbonEventBroker.getInstance();
        EventBrokerService broker2 = CarbonEventBroker.getInstance();

        assertSame("The instance is not unique", broker1,  broker2);
    }
View Full Code Here

Examples of org.wso2.carbon.eventing.broker.services.EventBrokerService

        assertSame("The instance is not unique", broker1,  broker2);
    }

    public void testGetNamedInstance() throws Exception {
        EventBrokerService broker1 = CarbonEventBroker.getInstance("instance1");
        EventBrokerService broker2 = CarbonEventBroker.getInstance("instance1");

        assertSame("The instance is not unique", broker1,  broker2);

        EventBrokerService broker3 = CarbonEventBroker.getInstance();
        EventBrokerService broker4 = CarbonEventBroker.getInstance("instance2");

        assertNotSame("The instance is not unique", broker1,  broker3);
        assertNotSame("The instance is not unique", broker1,  broker4);
    }
View Full Code Here

Examples of org.wso2.carbon.eventing.broker.services.EventBrokerService

        assertNotSame("The instance is not unique", broker1,  broker3);
        assertNotSame("The instance is not unique", broker1,  broker4);
    }

    public void testRegisterNotificationDispatcher() throws Exception {
        EventBrokerService broker = CarbonEventBroker.getInstance("instance3");
        NotificationManager notificationManager = new TestNotificationManager();
        ((CarbonEventBroker)broker).registerNotificationManager(notificationManager);

        assertNotNull("Notification Manager is not set", broker.getNotificationManager());
        assertSame("Invalid notification manager", notificationManager,
                broker.getNotificationManager());
        broker.registerEventDispatcher(new CarbonEventDispatcher());

        assertTrue("Invalid dispatcher registration",
                ((TestNotificationManager)notificationManager).isEventDispatcherRegistered());
    }
View Full Code Here

Examples of org.wso2.carbon.eventing.broker.services.EventBrokerService

        assertTrue("Invalid dispatcher registration",
                ((TestNotificationManager)notificationManager).isEventDispatcherRegistered());
    }

    public void testEventPublish() throws Exception {
        EventBrokerService broker = CarbonEventBroker.getInstance("instance4");
        NotificationManager notificationManager = new TestNotificationManager();
        ((CarbonEventBroker)broker).registerNotificationManager(notificationManager);

        assertNotNull("Notification Manager is not set", broker.getNotificationManager());
        assertSame("Invalid notification manager", notificationManager,
                broker.getNotificationManager());
        broker.publishEvent(new Event());

        assertTrue("Invalid event published status",
                ((TestNotificationManager)notificationManager).isEventPublished());
    }
View Full Code Here

Examples of org.wso2.carbon.eventing.broker.services.EventBrokerService

            Iterator<OMElement> configIterator =
                    configElement.getChildrenWithName(new QName(
                            BROKER_CONFIG_NAMESPACE, LOCAL_NAME_EVENT_STREAM_CONFIG));
            while(configIterator.hasNext()) {
                OMElement element = configIterator.next();
                EventBrokerService service = null;
                try {
                    service = buildEventSource(element);
                } catch (ClassNotFoundException ignore) {
                    log.error("Unable to build Event Source.");
                    service = null;
View Full Code Here

Examples of org.wso2.carbon.eventing.broker.services.EventBrokerService

     */
    public static EventBrokerService getInstance(String name) {
        if (name == null) {
            return getInstance();
        }
        EventBrokerService namedInstance = namedInstances.get(name);
        if (namedInstance != null) {
            return namedInstance;
        }
        namedInstance = new CarbonEventBroker();
        try {
            namedInstance.init();
        } catch (EventException e) {
            log.error("Event Broker Initialization Failed", e);
        }
        setInstance(name, namedInstance);
        return namedInstance;
View Full Code Here

Examples of org.wso2.event.EventBrokerService

   

    public String defineSecureTopic(String topicName, String[] accessibleUsers,
            String[] acessibleRoles) throws AxisFault {
        try {
            EventBrokerService broker = CarbonEventBroker.getInstance();
            broker.getSubscriptionManager().defineSecureTopic(topicName);
           
//            //TODO extend the message receiver abstract Admin
//            UserRegistry systemRegistry = EventBrokerServiceComponent.getConfigurationRegistry();
//            //make sure storage location is available
//            if(!systemRegistry.resourceExists(SECURE_TOPIC_STORAGE)){
View Full Code Here

Examples of org.wso2.event.EventBrokerService

        }
    }
   
    public String deleteSecureTopic(String topicName) throws AxisFault{
        try {
            EventBrokerService broker = CarbonEventBroker.getInstance();
            broker.getSubscriptionManager().deleteSecureTopic(topicName);
           
//            UserRegistry systemRegistry = EventBrokerServiceComponent.getConfigurationRegistry();
//           
            UserRealm userRealm = AdminServicesUtil.getUserRealm();
            AuthorizationManager authorizationManager = userRealm.getAuthorizationManager();
View Full Code Here

Examples of org.wso2.event.EventBrokerService

//            String topicPath = getSecureTopicRegistryPath(topicName);
//            if(!systemRegistry.resourceExists(topicPath)){
//                throw new AxisFault("Permission denied " +getLoggedInUserName() + " cannot access "+ topicName);
//            }
//            Resource resource = systemRegistry.get(topicPath);
            EventBrokerService broker = CarbonEventBroker.getInstance();
            TopicDetails topicDetails = broker.getSubscriptionManager().getTopicDetails(topicName);
            String owner = topicDetails.getOwner();
            if(!owner.equals(getLoggedInUserName())){
                throw new AxisFault("Permission denied " +getLoggedInUserName() + " cannot access "+ topicName);
            }
View Full Code Here

Examples of org.wso2.event.EventBrokerService

    }

    public String revokeATopic(String topicName, String[] accessibleUsers, String[] acessibleRoles) throws AxisFault {
        try {
            EventBrokerService broker = CarbonEventBroker.getInstance();
            TopicDetails topicDetails = broker.getSubscriptionManager().getTopicDetails(topicName);
            String owner = topicDetails.getOwner();

            if(!owner.equals(getLoggedInUserName())){
                throw new AxisFault("Permission denied " +getLoggedInUserName() + " cannot access "+ topicName);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.