use of org.springframework.messaging.simp.broker.BrokerAvailabilityEvent in project spring-framework by spring-projects.
the class UserRegistryMessageHandlerTests method brokerUnavailableEvent.
@SuppressWarnings("unchecked")
@Test
public void brokerUnavailableEvent() throws Exception {
ScheduledFuture future = Mockito.mock(ScheduledFuture.class);
when(this.taskScheduler.scheduleWithFixedDelay(any(Runnable.class), any(Long.class))).thenReturn(future);
BrokerAvailabilityEvent event = new BrokerAvailabilityEvent(true, this);
this.handler.onApplicationEvent(event);
verifyNoMoreInteractions(future);
event = new BrokerAvailabilityEvent(false, this);
this.handler.onApplicationEvent(event);
verify(future).cancel(true);
}
use of org.springframework.messaging.simp.broker.BrokerAvailabilityEvent in project spring-framework by spring-projects.
the class UserRegistryMessageHandlerTests method getUserRegistryTask.
private Runnable getUserRegistryTask() {
BrokerAvailabilityEvent event = new BrokerAvailabilityEvent(true, this);
this.handler.onApplicationEvent(event);
ArgumentCaptor<? extends Runnable> captor = ArgumentCaptor.forClass(Runnable.class);
verify(this.taskScheduler).scheduleWithFixedDelay(captor.capture(), eq(10000L));
return captor.getValue();
}
Aggregations