Package org.rioproject.eventcollector.api

Examples of org.rioproject.eventcollector.api.EventCollectorRegistration


        Assert.assertTrue(eventCollectorImpl.getRegistrationSize()==0);
    }

    @Test
    public void testEventCollectorRegistration() throws LeaseDeniedException, IOException, UnknownLeaseException {
        EventCollectorRegistration registration1 = eventCollector.register(Lease.FOREVER);
        verifyRegistration(registration1);
        Assert.assertEquals(1, eventCollectorImpl.getRegistrationSize());
        EventCollectorRegistration registration2 = eventCollector.register(Lease.FOREVER);
        verifyRegistration(registration2);
        Assert.assertEquals(2, eventCollectorImpl.getRegistrationSize());
        registration1.getLease().cancel();
        Assert.assertEquals(1, eventCollectorImpl.getRegistrationSize());
        registration2.getLease().cancel();
        Assert.assertEquals(0, eventCollectorImpl.getRegistrationSize());
    }
View Full Code Here


        Assert.assertEquals(0, eventCollectorImpl.getRegistrationSize());
    }

    @Test
    public void testEventCollectorPersistedRegistration() throws Exception {
        EventCollectorRegistration registration = eventCollector.register(Lease.FOREVER);
        verifyRegistration(registration);
        Assert.assertEquals(1, eventCollectorImpl.getRegistrationSize());
        tearDownEventCollector();
        createEventCollector();
        BasicEventListener listener = new BasicEventListener();
        System.out.println("===> enableDelivery()");
        registration.enableDelivery(listener.export());
        System.out.println("===> getLease()");
        registration.getLease().cancel();
    }
View Full Code Here

        registration.getLease().cancel();
    }

    @Test(expected = UnknownEventCollectorRegistration.class)
    public void testEventCollectorRegistrationCanceled() throws Exception {
        EventCollectorRegistration registration = eventCollector.register(Lease.FOREVER);
        verifyRegistration(registration);
        Assert.assertEquals(1, eventCollectorImpl.getRegistrationSize());
        BasicEventListener listener = new BasicEventListener();
        registration.getLease().cancel();
        registration.enableDelivery(listener.export());
    }
View Full Code Here

        registration.enableDelivery(listener.export());
    }

    @Test(expected = UnknownEventCollectorRegistration.class)
    public void testUnknownEventCollectorRegistration() throws UnknownEventCollectorRegistration, IOException {
        EventCollectorRegistration unknownRegistration = new Registration(eventCollectorImpl,
                                                                          UuidFactory.generate(),
                                                                          null);
        unknownRegistration.enableDelivery(null);

    }
View Full Code Here

        } catch(Error e) {
            System.out.println("Factory already defined, move along");
        }
        EventCollector eventCollector = (EventCollector)testManager.waitForService(EventCollector.class);
        Assert.assertNotNull(eventCollector);
        EventCollectorRegistration registration1 = eventCollector.register(Lease.ANY);
        EventCollectorRegistration registration2 = eventCollector.register(Lease.ANY);

        BasicEventListener listener1 = new BasicEventListener();
        RemoteEventListener eventListener = listener1.export();
        registration1.enableDelivery(eventListener);

        try {
            logger.info("Deploy ....");
            testManager.deploy(new File("src/test/opstring/outrigger.groovy"));
            logger.info("Wait 3 seconds to get events.... ");
            Thread.sleep(1000*3);

            registration1.disableDelivery();
            Thread.sleep(1000*3);
            testManager.undeploy("Outrigger");

            logger.info("Wait 3 seconds to get events for next client.... ");
            Thread.sleep(1000*3);
            registration1.enableDelivery(eventListener);
            BasicEventListener listener2 = new BasicEventListener();
            registration2.enableDelivery(listener2.export());
            logger.info("Wait 3 seconds to clean up");
            Thread.sleep(1000 * 3);
            log(1, listener1);
            log(2, listener2);
            Assert.assertEquals(listener1.eventCollectionCount(), listener2.eventCollectionCount());
View Full Code Here

TOP

Related Classes of org.rioproject.eventcollector.api.EventCollectorRegistration

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.