@LifecycleHandlerType(LifecycleHandlerType.LifecycleLevel.INIT_SERVICE) public void initialize() throws NotificationQueueAlreadyExists { try { eventBus.register(invoiceListener); eventBus.register(tagHandler); } catch (PersistentBus.EventBusException e) { throw new RuntimeException("Unable to register to the EventBus!", e); } dateNotifier.initialize(); }
private void registerForBus() { try { busService.getBus().register(listener); } catch (final EventBusException e) { log.error("Problem encountered registering OverdueListener on the Event Bus", e); } }
@LifecycleHandlerType(LifecycleLevel.INIT_SERVICE) public void registerForNotifications() { try { eventBus.register(beatrixListener); } catch (PersistentBus.EventBusException e) { throw new RuntimeException("Unable to register to the EventBus!", e); } }
@LifecycleHandlerType(LifecycleLevel.INIT_SERVICE) public void initialize() throws NotificationQueueAlreadyExists { try { eventBus.register(invoiceHandler); eventBus.register(tagHandler); } catch (PersistentBus.EventBusException e) { log.error("Unable to register with the EventBus!", e); } failedRetryService.initialize(SERVICE_NAME); timedoutRetryService.initialize(SERVICE_NAME); autoPayoffRetryService.initialize(SERVICE_NAME); }
public void testSimple() { try { final int nbEvents = 5; final MyEventHandler handler = new MyEventHandler(nbEvents, 0); eventBus.register(handler); for (int i = 0; i < nbEvents; i++) { eventBus.post(new MyEvent("my-event", (long) i, "MY_EVENT_TYPE", 1L, 2L, UUID.randomUUID())); } final boolean completed = handler.waitForCompletion(10000); Assert.assertEquals(completed, true); } catch (Exception e) { Assert.fail("", e); } }
public void testSimpleWithExceptionAndRetrySuccess() { try { final MyEventHandler handler = new MyEventHandler(1, 1); eventBus.register(handler); eventBus.post(new MyEvent("my-event", 1L, "MY_EVENT_TYPE", 1L, 2L, UUID.randomUUID())); final boolean completed = handler.waitForCompletion(5000); Assert.assertEquals(completed, true); } catch (Exception ignored) { } }
public void testSimpleWithExceptionAndFail() { try { final MyEventHandler handler = new MyEventHandler(1, 4); eventBus.register(handler); eventBus.post(new MyEvent("my-event", 1L, "MY_EVENT_TYPE", 1L, 2L, UUID.randomUUID())); final boolean completed = handler.waitForCompletion(5000); Assert.assertEquals(completed, false); } catch (Exception ignored) { } }
private void startBusAndRegisterListener(final BusService busService, final TestApiListener testListener) throws Exception { busService.getBus().start(); busService.getBus().register(testListener); }
private void startBusAndRegisterListener(final BusService busService, final TestApiListener testListener) throws Exception { busService.getBus().start(); busService.getBus().register(testListener); }
public void testDifferentType() { try { final MyEventHandler handler = new MyEventHandler(1, 0); eventBus.register(handler); for (int i = 0; i < 5; i++) { eventBus.post(new MyOtherEvent("my-other-event", (double) i, "MY_EVENT_TYPE", 1L, 2L, UUID.randomUUID())); } eventBus.post(new MyEvent("my-event", 11l, "MY_EVENT_TYPE", 1L, 2L, UUID.randomUUID())); final boolean completed = handler.waitForCompletion(10000); Assert.assertEquals(completed, true); } catch (Exception e) { Assert.fail("", e); } } }
@BeforeMethod(groups = "slow") public void beforeMethod() throws Exception { super.beforeMethod(); cacheControllerDispatcher.clearAll(); bus.start(); bus.register(listener); service.initialize(); service.start(); }
@Override @BeforeMethod(groups = "slow") public void beforeMethod() throws Exception { super.beforeMethod(); resetTestListenerStatus(); eventsListener.reset(); eventBus.start(); eventBus.register(eventsListener); controlCacheDispatcher.clearAll(); // Make sure we start with a clean state assertListenerStatus(); }