use of com.hazelcast.spi.impl.executionservice.ExecutionService in project hazelcast by hazelcast.
the class TaskletExecutionServiceTest method before.
@Before
public void before() {
executor = Executors.newCachedThreadPool();
NodeEngineImpl neMock = mock(NodeEngineImpl.class);
HazelcastInstance hzMock = mock(HazelcastInstance.class);
when(neMock.getHazelcastInstance()).thenReturn(hzMock);
when(hzMock.getName()).thenReturn("test-hz-instance");
ExecutionService es = mock(ExecutionService.class);
when(neMock.getExecutionService()).thenReturn(es);
when(es.submit(eq(TASKLET_INIT_CLOSE_EXECUTOR_NAME), any(Runnable.class))).then(invocationOnMock -> executor.submit(invocationOnMock.<Runnable>getArgument(1)));
LoggingService loggingService = mock(LoggingService.class);
when(neMock.getLoggingService()).thenReturn(loggingService);
when(loggingService.getLogger(TaskletExecutionService.class)).thenReturn(Logger.getLogger(TaskletExecutionService.class));
MetricsRegistryImpl metricsRegistry = new MetricsRegistryImpl(mock(ILogger.class), ProbeLevel.INFO);
when(neMock.getMetricsRegistry()).thenReturn(metricsRegistry);
HazelcastProperties properties = new HazelcastProperties(new Properties());
tes = new TaskletExecutionService(neMock, THREAD_COUNT, properties);
classLoaderMock = mock(ClassLoader.class);
}
Aggregations