Search in sources :

Example 46 with ExecutionService

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);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) HazelcastInstance(com.hazelcast.core.HazelcastInstance) LoggingService(com.hazelcast.logging.LoggingService) MetricsRegistryImpl(com.hazelcast.internal.metrics.impl.MetricsRegistryImpl) ILogger(com.hazelcast.logging.ILogger) ExecutionService(com.hazelcast.spi.impl.executionservice.ExecutionService) Properties(java.util.Properties) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) Before(org.junit.Before)

Aggregations

ExecutionService (com.hazelcast.spi.impl.executionservice.ExecutionService)46 ILogger (com.hazelcast.logging.ILogger)10 ManagementCenterService (com.hazelcast.internal.management.ManagementCenterService)7 CALLER_RUNS (com.hazelcast.internal.util.ConcurrencyUtil.CALLER_RUNS)7 ExceptionUtil.peel (com.hazelcast.internal.util.ExceptionUtil.peel)7 ExceptionUtil.withTryCatch (com.hazelcast.internal.util.ExceptionUtil.withTryCatch)7 HazelcastProperties (com.hazelcast.spi.properties.HazelcastProperties)7 Future (java.util.concurrent.Future)7 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)6 QuickTest (com.hazelcast.test.annotation.QuickTest)6 Test (org.junit.Test)6 CountDownLatch (java.util.concurrent.CountDownLatch)5 IExecutorService (com.hazelcast.core.IExecutorService)4 AbstractLocalOperation (com.hazelcast.spi.impl.operationservice.AbstractLocalOperation)4 HazelcastInstance (com.hazelcast.core.HazelcastInstance)3 Node (com.hazelcast.instance.impl.Node)3 NodeEngine (com.hazelcast.spi.impl.NodeEngine)3 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)3 ExecutorService (java.util.concurrent.ExecutorService)3 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)2