use of org.springframework.core.task.TaskExecutor in project plugin-prov-azure by ligoj.
the class ProvAzurePluginResourceTest method checkStatusShudownFailed.
/**
* Authority is valid, but the token cannot be acquired
*/
@Test
public void checkStatusShudownFailed() throws Exception {
prepareMockAuth();
httpServer.start();
final TaskExecutor taskExecutor = Mockito.mock(TaskExecutor.class);
final ProvAzurePluginResource resource = newResource(new ExecutorServiceAdapter(taskExecutor) {
@Override
public void shutdown() {
throw new IllegalStateException();
}
});
Assertions.assertThrows(IllegalStateException.class, () -> {
resource.checkStatus(subscriptionResource.getParametersNoCheck(subscription));
});
}
use of org.springframework.core.task.TaskExecutor in project qpp-conversion-tool by CMSgov.
the class ConcurrencyConfigTest method testIsSync.
@Test
void testIsSync() {
TaskExecutor executor = new ConcurrencyConfig().taskExecutor();
assertThat(executor).isInstanceOf(SyncTaskExecutor.class);
}
use of org.springframework.core.task.TaskExecutor in project spring-framework by spring-projects.
the class ExecutorSubscribableChannelTests method sendWithExecutor.
@Test
public void sendWithExecutor() {
BeforeHandleInterceptor interceptor = new BeforeHandleInterceptor();
TaskExecutor executor = mock(TaskExecutor.class);
ExecutorSubscribableChannel testChannel = new ExecutorSubscribableChannel(executor);
testChannel.addInterceptor(interceptor);
testChannel.subscribe(this.handler);
testChannel.send(this.message);
verify(executor).execute(this.runnableCaptor.capture());
verify(this.handler, never()).handleMessage(this.message);
this.runnableCaptor.getValue().run();
verify(this.handler).handleMessage(this.message);
assertThat(interceptor.getCounter().get()).isEqualTo(1);
assertThat(interceptor.wasAfterHandledInvoked()).isTrue();
}
use of org.springframework.core.task.TaskExecutor in project spring-framework by spring-projects.
the class WebSocketMessageBrokerStatsTests method inboundAndOutboundChannelsWithMockedTaskExecutor.
@Test
void inboundAndOutboundChannelsWithMockedTaskExecutor() {
TaskExecutor executor = mock(TaskExecutor.class);
stats.setInboundChannelExecutor(executor);
stats.setOutboundChannelExecutor(executor);
assertThat(stats.getClientInboundExecutorStatsInfo()).as("inbound channel stats").isEqualTo("unknown");
assertThat(stats.getClientOutboundExecutorStatsInfo()).as("outbound channel stats").isEqualTo("unknown");
}
Aggregations