use of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler in project spring-boot-admin by codecentric.
the class RegistrationApplicationListenerTest method should_not_deregister_when_not_autoDeregister.
@Test
public void should_not_deregister_when_not_autoDeregister() {
ApplicationRegistrator registrator = mock(ApplicationRegistrator.class);
ThreadPoolTaskScheduler scheduler = mock(ThreadPoolTaskScheduler.class);
RegistrationApplicationListener listener = new RegistrationApplicationListener(registrator, scheduler);
listener.onClosedContext(new ContextClosedEvent(mock(WebApplicationContext.class)));
verify(registrator, never()).deregister();
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler in project spring-boot-admin by codecentric.
the class RegistrationApplicationListenerTest method should_not_deregister_when_autoDeregister_and_not_root.
@Test
public void should_not_deregister_when_autoDeregister_and_not_root() {
ApplicationRegistrator registrator = mock(ApplicationRegistrator.class);
ThreadPoolTaskScheduler scheduler = mock(ThreadPoolTaskScheduler.class);
RegistrationApplicationListener listener = new RegistrationApplicationListener(registrator, scheduler);
listener.setAutoDeregister(true);
ApplicationContext mockContext = mock(ApplicationContext.class);
when(mockContext.getParent()).thenReturn(mock(ApplicationContext.class));
listener.onClosedContext(new ContextClosedEvent(mockContext));
verify(registrator, never()).deregister();
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler in project spring-boot-admin by codecentric.
the class RegistrationApplicationListenerTest method should_deregister_when_autoDeregister.
@Test
public void should_deregister_when_autoDeregister() {
ApplicationRegistrator registrator = mock(ApplicationRegistrator.class);
ThreadPoolTaskScheduler scheduler = mock(ThreadPoolTaskScheduler.class);
RegistrationApplicationListener listener = new RegistrationApplicationListener(registrator, scheduler);
listener.setAutoDeregister(true);
listener.onClosedContext(new ContextClosedEvent(mock(ApplicationContext.class)));
verify(registrator).deregister();
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler in project spring-boot-admin by codecentric.
the class RegistrationApplicationListenerTest method should_init_and_shutdown_taskScheduler.
@Test
public void should_init_and_shutdown_taskScheduler() {
ApplicationRegistrator registrator = mock(ApplicationRegistrator.class);
ThreadPoolTaskScheduler scheduler = mock(ThreadPoolTaskScheduler.class);
RegistrationApplicationListener listener = new RegistrationApplicationListener(registrator, scheduler);
listener.afterPropertiesSet();
verify(scheduler, times(1)).afterPropertiesSet();
listener.destroy();
verify(scheduler, times(1)).destroy();
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler in project spring-framework by spring-projects.
the class WebSocketConfigurationSupport method initDefaultSockJsScheduler.
private ThreadPoolTaskScheduler initDefaultSockJsScheduler() {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setThreadNamePrefix("SockJS-");
scheduler.setPoolSize(Runtime.getRuntime().availableProcessors());
scheduler.setRemoveOnCancelPolicy(true);
return scheduler;
}
Aggregations