Package com.netflix.eventbus.spi

Examples of com.netflix.eventbus.spi.EventBus.publish()


            .withEventBus(eventBus)
            .withEventType(String.class)
            .withExpectedCount(1)
            .build();
       
        eventBus.publish(new String("Foo"));
        Assert.assertTrue(bridge.await(3,  TimeUnit.SECONDS));       
        Assert.assertEquals(1, bridge.getConsumeCount());
        Assert.assertEquals(0, bridge.getConsumeErrorCount());
    }  
   
View Full Code Here


            .withEventBus(eventBus)
            .withEventType(String.class)
            .build();

        bridge.setError(e);
        eventBus.publish(new String("Foo"));
       
        TimeUnit.SECONDS.sleep(1);
        Assert.assertEquals(0, bridge.getConsumeCount());
        Assert.assertEquals(1, bridge.getConsumeErrorCount());
        Assert.assertEquals(e, bridge.getLastConsumeException());
View Full Code Here

            .withExpectedCount(2)
            .withEventBus(eventBus)
            .withEventType(String.class)
            .build();
       
        eventBus.publish(new String("Foo"));
        Assert.assertTrue(waitForConsumeCount(bridge, 1, 1, TimeUnit.SECONDS));
       
        bridge.pause();
        eventBus.publish(new String("Foo"));
        Assert.assertFalse(waitForConsumeCount(bridge, 2, 1, TimeUnit.SECONDS));
View Full Code Here

       
        eventBus.publish(new String("Foo"));
        Assert.assertTrue(waitForConsumeCount(bridge, 1, 1, TimeUnit.SECONDS));
       
        bridge.pause();
        eventBus.publish(new String("Foo"));
        Assert.assertFalse(waitForConsumeCount(bridge, 2, 1, TimeUnit.SECONDS));
       
        bridge.resume();
        eventBus.publish(new String("Foo"));
        Assert.assertTrue(waitForConsumeCount(bridge, 2, 1, TimeUnit.SECONDS));
View Full Code Here

        bridge.pause();
        eventBus.publish(new String("Foo"));
        Assert.assertFalse(waitForConsumeCount(bridge, 2, 1, TimeUnit.SECONDS));
       
        bridge.resume();
        eventBus.publish(new String("Foo"));
        Assert.assertTrue(waitForConsumeCount(bridge, 2, 1, TimeUnit.SECONDS));
    }
   
    public boolean waitForConsumeCount(DummyEventBusBridge bridge, long expected, long delay, TimeUnit units) throws Exception {
        long intervals = TimeUnit.MILLISECONDS.convert(delay, units)/100;
View Full Code Here

                    counter.countDown();
                }
            });
       
        for (long i = 0; i < 10; i++) {
            eventBus.publish(i);
        }
       
        Assert.assertTrue(counter.await(1, TimeUnit.SECONDS));
       
        sub.unsubscribe();
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.