Package org.rioproject.impl.watch

Examples of org.rioproject.impl.watch.Watch


    @Test
    public void testUsingWatch() throws Exception {
        BasicEventConsumer consumer = new BasicEventConsumer(getEventDescriptor());
        WatchDataSourceRegistry watchRegistry = new WatchDataSourceRegistry();
        Watch watch = consumer.createWatch(watchRegistry);
        Assert.assertNotNull(watch);
        Assert.assertNotNull("Check Watch accessor", consumer.getWatch());
        Assert.assertTrue("Only one watch should be created, calling createWatch twice should return the same watch",
                          watch.equals(consumer.createWatch(watchRegistry)));
        Listener listener = new Listener();
        consumer.register(listener);
        Producer p = new Producer();
        p.createDEH();
        ServiceItem serviceItem = createServiceItem(p);
        EventRegistration eventRegistration = consumer.register(serviceItem);
        Assert.assertNotNull(eventRegistration);
        p.fire();
        p.fire();
        Assert.assertTrue("Should have gotten 2, got "+watch.getCalculables().values().size(),
                          watch.getCalculables().values().size()==2);
        Calculable[] calculables = watch.getWatchDataSource().getCalculable();
        Assert.assertTrue("Should have gotten 2, got "+calculables.length, calculables.length==2);
        for (Calculable calculable : calculables)
            System.out.println("==> " + calculable.getValue());

    }
View Full Code Here

TOP

Related Classes of org.rioproject.impl.watch.Watch

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.