use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class EntryEventDataCacheTest method parameters.
@Parameterized.Parameters(name = "{0}")
public static Collection<Object[]> parameters() {
// setup mock MapServiceContext & NodeEngine, required by FilteringStrategy's
MapServiceContext mapServiceContext = mock(MapServiceContext.class);
NodeEngine mockNodeEngine = mock(NodeEngine.class);
when(mockNodeEngine.getThisAddress()).thenReturn(ADDRESS);
when(mapServiceContext.toData(anyObject())).thenReturn(new HeapData());
when(mapServiceContext.getNodeEngine()).thenReturn(mockNodeEngine);
return Arrays.asList(new Object[][] { { new DefaultEntryEventFilteringStrategy(null, mapServiceContext) }, { new QueryCacheNaturalFilteringStrategy(null, mapServiceContext) } });
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class BasicCompletableFutureTest method basicCompletableFuture.
private static <V> BasicCompletableFuture<V> basicCompletableFuture(Future<V> future) {
NodeEngine engine = mock(NodeEngine.class);
when(engine.getLogger(BasicCompletableFuture.class)).thenReturn(mock(ILogger.class));
ExecutionService executionService = mock(ExecutionService.class);
when(engine.getExecutionService()).thenReturn(executionService);
when(executionService.getExecutor(anyString())).thenReturn(new TestCurrentThreadExecutor());
return new BasicCompletableFuture<V>(future, engine);
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class TransactionImplTest method setup.
@Before
public void setup() {
HazelcastInstance hz = createHazelcastInstance();
operationService = getOperationService(hz);
logger = mock(ILogger.class);
txManagerService = mock(TransactionManagerServiceImpl.class);
nodeEngine = mock(NodeEngine.class);
when(nodeEngine.getOperationService()).thenReturn(operationService);
when(nodeEngine.getLocalMember()).thenReturn(new MemberImpl());
when(nodeEngine.getLogger(TransactionImpl.class)).thenReturn(logger);
options = new TransactionOptions().setTransactionType(ONE_PHASE);
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class CachedExecutorServiceDelegateTest method setup.
@Before
public void setup() {
cachedExecutorService = new NamedThreadPoolExecutor("test", 0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), Executors.defaultThreadFactory());
ExecutionService executionService = mock(ExecutionService.class);
when(executionService.getExecutor(ExecutionService.ASYNC_EXECUTOR)).thenReturn(cachedExecutorService);
nodeEngine = mock(NodeEngine.class);
when(nodeEngine.getExecutionService()).thenReturn(executionService);
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class TransactionLogTest method prepare_partitionSpecificRecord.
@Test
public void prepare_partitionSpecificRecord() throws Exception {
OperationService operationService = mock(OperationService.class);
NodeEngine nodeEngine = mock(NodeEngine.class);
when(nodeEngine.getOperationService()).thenReturn(operationService);
TransactionLog log = new TransactionLog();
TransactionLogRecord partitionRecord = mock(TransactionLogRecord.class);
Operation partitionOperation = new DummyPartitionOperation();
when(partitionRecord.newPrepareOperation()).thenReturn(partitionOperation);
log.add(partitionRecord);
log.prepare(nodeEngine);
verify(operationService, times(1)).invokeOnPartition(partitionOperation.getServiceName(), partitionOperation, partitionOperation.getPartitionId());
}
Aggregations