Search in sources :

Example 81 with NodeEngine

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) } });
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) HeapData(com.hazelcast.internal.serialization.impl.HeapData) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 82 with NodeEngine

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);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) ILogger(com.hazelcast.logging.ILogger) ExecutionService(com.hazelcast.spi.ExecutionService)

Example 83 with NodeEngine

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);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) HazelcastInstance(com.hazelcast.core.HazelcastInstance) MemberImpl(com.hazelcast.instance.MemberImpl) TransactionOptions(com.hazelcast.transaction.TransactionOptions) ILogger(com.hazelcast.logging.ILogger) Before(org.junit.Before)

Example 84 with NodeEngine

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);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) SynchronousQueue(java.util.concurrent.SynchronousQueue) ExecutionService(com.hazelcast.spi.ExecutionService) Before(org.junit.Before)

Example 85 with NodeEngine

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());
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) OperationService(com.hazelcast.spi.OperationService) Operation(com.hazelcast.spi.Operation) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

NodeEngine (com.hazelcast.spi.NodeEngine)163 Data (com.hazelcast.nio.serialization.Data)50 OperationService (com.hazelcast.spi.OperationService)30 Address (com.hazelcast.nio.Address)25 ILogger (com.hazelcast.logging.ILogger)20 Operation (com.hazelcast.spi.Operation)14 IPartitionService (com.hazelcast.spi.partition.IPartitionService)14 Member (com.hazelcast.core.Member)12 Future (java.util.concurrent.Future)12 InternalCompletableFuture (com.hazelcast.spi.InternalCompletableFuture)11 Test (org.junit.Test)10 InitializingObject (com.hazelcast.spi.InitializingObject)9 ParallelTest (com.hazelcast.test.annotation.ParallelTest)9 QuickTest (com.hazelcast.test.annotation.QuickTest)9 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)8 AbstractDistributedObject (com.hazelcast.spi.AbstractDistributedObject)8 ArrayList (java.util.ArrayList)8 Map (java.util.Map)8 HazelcastInstance (com.hazelcast.core.HazelcastInstance)7 InternalPartitionServiceImpl (com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl)7