use of com.hazelcast.instance.impl.HazelcastInstanceImpl in project hazelcast by hazelcast.
the class OperationServiceImpl_BasicTest method testPropagateSerializationErrorOnResponseToCallerGithubIssue2559.
@Test(expected = ExecutionException.class)
public void testPropagateSerializationErrorOnResponseToCallerGithubIssue2559() throws Exception {
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
HazelcastInstance hz1 = factory.newHazelcastInstance();
HazelcastInstance hz2 = factory.newHazelcastInstance();
Field original = HazelcastInstanceProxy.class.getDeclaredField("original");
original.setAccessible(true);
HazelcastInstanceImpl impl = (HazelcastInstanceImpl) original.get(hz1);
OperationService operationService = impl.node.nodeEngine.getOperationService();
Address address = hz2.getCluster().getLocalMember().getAddress();
Operation operation = new GithubIssue2559Operation();
String serviceName = DistributedExecutorService.SERVICE_NAME;
InvocationBuilder invocationBuilder = operationService.createInvocationBuilder(serviceName, operation, address);
invocationBuilder.invoke().get();
}
use of com.hazelcast.instance.impl.HazelcastInstanceImpl in project hazelcast by hazelcast.
the class CacheSerializationTest method test_CacheReplicationOperation_serialization.
@Test
public void test_CacheReplicationOperation_serialization() throws Exception {
TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
HazelcastInstance hazelcastInstance = factory.newHazelcastInstance();
try {
CachingProvider provider = createServerCachingProvider(hazelcastInstance);
CacheManager manager = provider.getCacheManager();
CompleteConfiguration configuration = new MutableConfiguration();
Cache cache1 = manager.createCache("cache1", configuration);
Cache cache2 = manager.createCache("cache2", configuration);
Cache cache3 = manager.createCache("cache3", configuration);
for (int i = 0; i < 1000; i++) {
cache1.put("key" + i, i);
cache2.put("key" + i, i);
cache3.put("key" + i, i);
}
HazelcastInstanceProxy proxy = (HazelcastInstanceProxy) hazelcastInstance;
Field original = HazelcastInstanceProxy.class.getDeclaredField("original");
original.setAccessible(true);
HazelcastInstanceImpl impl = (HazelcastInstanceImpl) original.get(proxy);
NodeEngineImpl nodeEngine = impl.node.nodeEngine;
CacheService cacheService = nodeEngine.getService(CacheService.SERVICE_NAME);
int partitionCount = nodeEngine.getPartitionService().getPartitionCount();
for (int partitionId = 0; partitionId < partitionCount; partitionId++) {
CachePartitionSegment segment = cacheService.getSegment(partitionId);
int replicaIndex = 1;
Collection<ServiceNamespace> namespaces = segment.getAllNamespaces(replicaIndex);
if (CollectionUtil.isEmpty(namespaces)) {
continue;
}
CacheReplicationOperation operation = new CacheReplicationOperation();
operation.prepare(segment, namespaces, replicaIndex);
Data serialized = service.toData(operation);
try {
service.toObject(serialized);
} catch (Exception e) {
throw new Exception("Partition: " + partitionId, e);
}
}
} finally {
factory.shutdownAll();
}
}
use of com.hazelcast.instance.impl.HazelcastInstanceImpl in project hazelcast by hazelcast.
the class CacheEntryProcessorTest method setUpInternal.
private static void setUpInternal() throws NoSuchFieldException, IllegalAccessException {
factory = new TestHazelcastInstanceFactory(2);
node1 = factory.newHazelcastInstance();
node2 = factory.newHazelcastInstance();
Field original = HazelcastInstanceProxy.class.getDeclaredField("original");
original.setAccessible(true);
HazelcastInstanceImpl impl1 = (HazelcastInstanceImpl) original.get(node1);
HazelcastInstanceImpl impl2 = (HazelcastInstanceImpl) original.get(node2);
cacheServiceOnNode1 = impl1.node.getNodeEngine().getService(CacheService.SERVICE_NAME);
cacheServiceOnNode2 = impl2.node.getNodeEngine().getService(CacheService.SERVICE_NAME);
serializationService = impl1.node.getNodeEngine().getSerializationService();
}
use of com.hazelcast.instance.impl.HazelcastInstanceImpl in project hazelcast by hazelcast.
the class CacheEventListenerSplitBrainTest method getCacheManager.
protected CacheManager getCacheManager(HazelcastInstance instance) {
HazelcastInstanceImpl hazelcastInstanceImpl = TestUtil.getHazelcastInstanceImpl(instance);
HazelcastServerCachingProvider cachingProvider = createServerCachingProvider(hazelcastInstanceImpl);
return cachingProvider.getCacheManager();
}
Aggregations