コード例 #1
0
ファイル: MonitorRegistryTest.java プロジェクト: UOM-CS-RV/rv
  @Before
  public void setup() {
    recipientListRouter = mock(CustomRecipientListRouter.class);

    configurableApplicationContext = mock(ConfigurableApplicationContext.class);
    beanFactory = mock(ConfigurableListableBeanFactory.class);
    when(configurableApplicationContext.getBeanFactory()).thenReturn(beanFactory);

    TaskScheduler taskScheduler = mock(TaskScheduler.class);
    Executor executor = mock(Executor.class);

    monitorRegistry = new MonitorRegistry();
    monitorRegistry.setRecipientListRouter(recipientListRouter);
    monitorRegistry.setConfigurableApplicationContext(configurableApplicationContext);
    monitorRegistry.setExecutor(executor);
    monitorRegistry.setTaskScheduler(taskScheduler);
  }
コード例 #2
0
ファイル: MonitorRegistryTest.java プロジェクト: UOM-CS-RV/rv
  @Test
  public void testRegisterNewMonitor() {

    Monitor monitor = mock(Monitor.class);

    monitorRegistry.registerNewMonitor(monitor);

    verify(recipientListRouter, times(1))
        .addRecipient(any(MessageChannel.class), any(MonitorEventSelector.class));

    verify(configurableApplicationContext, times(3)).getBeanFactory();

    verify(beanFactory, times(2)).registerSingleton(any(String.class), any());
  }