Search in sources :

Example 41 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class DiagnosticsTest method newDiagnostics.

private Diagnostics newDiagnostics(Config config) {
    HazelcastInstance hz = createHazelcastInstance(config);
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(hz);
    Member localMember = nodeEngineImpl.getLocalMember();
    Address address = localMember.getAddress();
    String addressString = address.getHost().replace(":", "_") + "#" + address.getPort();
    String name = "diagnostics-" + addressString + "-" + currentTimeMillis();
    return new Diagnostics(name, Logger.getLogger(Diagnostics.class), nodeEngineImpl.getNode().getHazelcastThreadGroup(), nodeEngineImpl.getNode().getProperties());
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Address(com.hazelcast.nio.Address) Member(com.hazelcast.core.Member)

Example 42 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class MetricsPluginTest method setup.

@Before
public void setup() {
    Config config = new Config().setProperty(Diagnostics.ENABLED.getName(), "true").setProperty(MetricsPlugin.PERIOD_SECONDS.getName(), "1");
    HazelcastInstance hz = createHazelcastInstance(config);
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(hz);
    metricsRegistry = nodeEngineImpl.getMetricsRegistry();
    plugin = new MetricsPlugin(nodeEngineImpl);
    plugin.onStart();
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) Before(org.junit.Before)

Example 43 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class QueryCacheIMapEventHandlingTest method executeMergeOperation.

private void executeMergeOperation(HazelcastInstance member, String mapName, int key, int mergedValue) throws Exception {
    Node node = getNode(member);
    NodeEngineImpl nodeEngine = node.nodeEngine;
    OperationServiceImpl operationService = (OperationServiceImpl) nodeEngine.getOperationService();
    SerializationService serializationService = getSerializationService(member);
    Data keyData = serializationService.toData(key);
    Data valueData = serializationService.toData(mergedValue);
    EntryView<Data, Data> entryView = createSimpleEntryView(keyData, valueData, Mockito.mock(Record.class));
    MergeOperation mergeOperation = new MergeOperation(mapName, keyData, entryView, new PassThroughMergePolicy());
    int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
    Future<Object> future = operationService.invokeOnPartition(SERVICE_NAME, mergeOperation, partitionId);
    future.get();
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) MergeOperation(com.hazelcast.map.impl.operation.MergeOperation) PassThroughMergePolicy(com.hazelcast.map.merge.PassThroughMergePolicy) Node(com.hazelcast.instance.Node) SerializationService(com.hazelcast.spi.serialization.SerializationService) Data(com.hazelcast.nio.serialization.Data) Record(com.hazelcast.map.impl.record.Record) OperationServiceImpl(com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl)

Example 44 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class NodeQueryCacheContextTest method setUp.

@Before
public void setUp() {
    HazelcastInstance hz = createHazelcastInstance();
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(hz);
    MapService mapService = nodeEngineImpl.getService(MapService.SERVICE_NAME);
    context = mapService.getMapServiceContext().getQueryCacheContext();
    partitionCount = nodeEngineImpl.getPartitionService().getPartitionCount();
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapService(com.hazelcast.map.impl.MapService) Before(org.junit.Before)

Example 45 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class NodeIOServiceTest method setUp.

@Before
public void setUp() {
    Node mockNode = mock(Node.class);
    NodeEngineImpl mockNodeEngine = mock(NodeEngineImpl.class);
    ioService = new NodeIOService(mockNode, mockNodeEngine);
    Config config = new Config();
    networkConfig = config.getNetworkConfig();
    when(mockNode.getConfig()).thenReturn(config);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Config(com.hazelcast.config.Config) NetworkConfig(com.hazelcast.config.NetworkConfig) Node(com.hazelcast.instance.Node) Before(org.junit.Before)

Aggregations

NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)112 HazelcastInstance (com.hazelcast.core.HazelcastInstance)39 Test (org.junit.Test)32 ParallelTest (com.hazelcast.test.annotation.ParallelTest)31 QuickTest (com.hazelcast.test.annotation.QuickTest)31 Node (com.hazelcast.instance.Node)21 MapService (com.hazelcast.map.impl.MapService)20 Config (com.hazelcast.config.Config)19 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)19 InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)16 MetaDataGenerator (com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator)14 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)14 ILogger (com.hazelcast.logging.ILogger)11 AssertTask (com.hazelcast.test.AssertTask)11 Invalidator (com.hazelcast.internal.nearcache.impl.invalidation.Invalidator)10 MapNearCacheManager (com.hazelcast.map.impl.nearcache.MapNearCacheManager)10 Address (com.hazelcast.nio.Address)10 Data (com.hazelcast.nio.serialization.Data)10 Before (org.junit.Before)10 Operation (com.hazelcast.spi.Operation)9