Package org.rioproject.impl.event

Examples of org.rioproject.impl.event.BasicEventConsumer


        ServiceWatcher watcher = new ServiceWatcher();

        ProvisionClientEventConsumer provisionClientEventConsumer = new ProvisionClientEventConsumer();

        clientEventConsumer = new BasicEventConsumer(ProvisionMonitorEvent.getEventDescriptor(),
                                                     provisionClientEventConsumer,
                                                     config);
        monitorCache = sdm.createLookupCache(monitors, null, watcher);
        sdm.createLookupCache(cybernodes, null, watcher);
        sdm.createLookupCache(eventCollectors, null, watcher);
View Full Code Here


        java.util.Random rand = new java.util.Random(System.currentTimeMillis());
        long randomNumber = rand.nextLong();
        myPeerInfo = new ProvisionMonitor.PeerInfo(getServiceProxy(),
                                                   randomNumber,
                                                   computeResource.getAddress().getHostAddress());
        eventConsumer = new BasicEventConsumer(new EventDescriptor(ProvisionMonitorEvent.class,
                                                                   ProvisionMonitorEvent.ID),
                                               this,
                                               config);
        template = new ServiceTemplate(null, new Class[] {ProvisionMonitor.class}, null);
        new Thread(this).start();
View Full Code Here

        testManager.undeployAll(monitor);
    }

    private void doVerifyLogging(ServiceItem[] items, Simple simple, int expected) {
        EC ec = new EC();
        BasicEventConsumer bec = null;

        try {
            bec = new BasicEventConsumer(ServiceLogEvent.getEventDescriptor(), ec);
        } catch (Exception e) {
            e.printStackTrace();
        }
        Assert.assertNotNull(bec);
        for(ServiceItem item : items)
            bec.register(item);

        Throwable thrown = null;
        try {
            simple.hello(null);
            Thread.sleep(500);
View Full Code Here

                                    "opstring"+File.separator+
                                    "outofmemory_test.groovy");
        OperationalStringManager mgr = testManager.deploy(opstring);
        OutOfMemory outOfMemory = (OutOfMemory)testManager.waitForService(OutOfMemory.class);
        try {
            BasicEventConsumer eventConsumer = new BasicEventConsumer(ProvisionMonitorEvent.getEventDescriptor(), l);
            eventConsumer.register(items[0]);
        } catch (Exception e) {
            thrown = e;
            e.printStackTrace();
        }
        Assert.assertNull(thrown);
View Full Code Here

                                                    opStringName,
                                                    Boolean.TRUE.toString(),
                                                    Boolean.FALSE.toString(),
                                                    1);
        PFEListener listener = new PFEListener();
        BasicEventConsumer eventConsumer = new BasicEventConsumer(ProvisionFailureEvent.getEventDescriptor(), listener);
        eventConsumer.register(monitorItems[0]);

        OpString opString = new OpString(opStringName, null);
        opString.addService(element);
        Assert.assertNotNull(monitor);
        testManager.deploy(opString, monitor);
        for(int i=0; i<10; i++) {
            if(listener.failed!=null) {
                break;
            }
            Thread.sleep(500);
        }
        Assert.assertNotNull(listener.failed);
        ServiceBeanInstance[] instances = cybernode.getServiceBeanInstances(element);
        Assert.assertEquals(0, instances.length);
        eventConsumer.terminate();
    }
View Full Code Here

        OperationalStringManager manager = testManager.deploy(opString, monitor);
        Assert.assertNotNull(manager);
        testManager.waitForDeployment(manager);

        PMEListener listener = new PMEListener(ProvisionMonitorEvent.Action.SERVICE_BEAN_DECREMENTED);
        BasicEventConsumer eventConsumer = new BasicEventConsumer(ProvisionMonitorEvent.getEventDescriptor(), listener);
        eventConsumer.register(monitorItems[0]);

        manager.removeServiceElement(element2, true);

        for(int i=0; i<10; i++) {
            if(listener.event!=null &&
               listener.event.getAction().equals(ProvisionMonitorEvent.Action.SERVICE_BEAN_DECREMENTED)) {
                break;
            }
            Thread.sleep(500);
        }
        eventConsumer.terminate();
        Assert.assertNotNull(listener.event);
        Assert.assertEquals(ProvisionMonitorEvent.Action.SERVICE_BEAN_DECREMENTED, listener.event.getAction());
        Assert.assertEquals(element1, listener.event.getServiceElement());

        OperationalString operationalString = manager.getOperationalString();
View Full Code Here

            Thread.sleep(500);
        }
        Assert.assertEquals(1, instances.length);
        manager.increment(element2, true, null);
        PMEListener listener = new PMEListener(ProvisionMonitorEvent.Action.SERVICE_BEAN_DECREMENTED);
        BasicEventConsumer eventConsumer = new BasicEventConsumer(ProvisionMonitorEvent.getEventDescriptor(), listener);
        eventConsumer.register(monitorItems[0]);

        testManager.waitForService("DependsOn");
        for(int i=0; i<10; i++) {
            if(listener.event!=null &&
               listener.event.getAction().equals(ProvisionMonitorEvent.Action.SERVICE_BEAN_DECREMENTED)) {
                break;
            }
            Thread.sleep(500);
        }
        eventConsumer.terminate();
        Assert.assertNotNull(listener.event);
        Assert.assertEquals(ProvisionMonitorEvent.Action.SERVICE_BEAN_DECREMENTED, listener.event.getAction());
        instances = cybernode.getServiceBeanInstances(element1);
        Assert.assertEquals(0, instances.length);
        instances = manager.getServiceBeanInstances(element1);
View Full Code Here

    @Test
    public void testIdleService() throws Exception {
        ServiceItem[] items = testManager.getServiceItems(ProvisionMonitor.class);
        Assert.assertEquals(1, items.length);
        ProvisionClientEventConsumer eventConsumer = new ProvisionClientEventConsumer();
        BasicEventConsumer clientEventConsumer = new BasicEventConsumer(ProvisionMonitorEvent.getEventDescriptor(),
                                                     eventConsumer);
        clientEventConsumer.register(items[0]);
        testManager.deploy();
        int wait = 0;
        long t0 = System.currentTimeMillis();
        while(!eventConsumer.undeployed && wait < 150) {
            Thread.sleep(500);
View Full Code Here

    }

    @Test
    public void testCreateBasicEventConsumerWithNullEventDescriptor() throws Exception {
        /* Expect that we should be able to create a BEC with a null EventDescriptor */
        new BasicEventConsumer((EventDescriptor) null);
    }
View Full Code Here

    }

    @Test
    public void testCreateBasicEventConsumerWithNullRemoteServiceEventListener() throws Exception {
        /* Expect that we should be able to create a BEC with a null RemoteServiceEventListener */
        new BasicEventConsumer((RemoteServiceEventListener) null);
    }
View Full Code Here

TOP

Related Classes of org.rioproject.impl.event.BasicEventConsumer

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.