@Test public void test() { TransportContext ctx1 = TransportContext.builder().setBackendName("backend1").setExtras(null).build(); TransportContext ctx2 = TransportContext.builder() .setBackendName("backend1") .setExtras("e1".getBytes(Charset.defaultCharset())) .build(); when(mockStore.loadActiveContexts()).thenReturn(Arrays.asList(ctx1, ctx2)); initializer.ensureContextsScheduled(); verify(mockScheduler, times(1)).schedule(ctx1, 1); verify(mockScheduler, times(1)).schedule(ctx2, 1); }
public void ensureContextsScheduled() { executor.execute( () -> guard.runCriticalSection( () -> { for (TransportContext context : store.loadActiveContexts()) { scheduler.schedule(context, 1); } return null; })); }
WorkInitializer { public void ensureContextsScheduled() { executor.execute( () -> guard.runCriticalSection( () -> { for (TransportContext context : store.loadActiveContexts()) { scheduler.schedule(context, 1); } return null; })); } }
WorkInitializer { public void ensureContextsScheduled() { executor.execute( () -> guard.runCriticalSection( () -> { for (TransportContext context : store.loadActiveContexts()) { scheduler.schedule(context, 1); } return null; })); } @Inject  WorkInitializer(
      Executor executor, EventStore store, WorkScheduler scheduler, SynchronizationGuard guard); }
WorkInitializer { public void ensureContextsScheduled() { executor.execute( () -> guard.runCriticalSection( () -> { for (TransportContext context : store.loadActiveContexts()) { scheduler.schedule(context, 1); } return null; })); } @Inject  WorkInitializer(
      Executor executor, EventStore store, WorkScheduler scheduler, SynchronizationGuard guard); void ensureContextsScheduled(); }
WorkInitializer { public void ensureContextsScheduled() { executor.execute( () -> guard.runCriticalSection( () -> { for (TransportContext context : store.loadActiveContexts()) { scheduler.schedule(context, 1); } return null; })); } @Inject  WorkInitializer(
      Executor executor, EventStore store, WorkScheduler scheduler, SynchronizationGuard guard); void ensureContextsScheduled();  }