use of com.hazelcast.test.starter.answer.NodeAnswer in project hazelcast by hazelcast.
the class HazelcastStarter method getHazelcastInstanceImpl.
public static HazelcastInstanceImpl getHazelcastInstanceImpl(HazelcastInstance hz) {
try {
HazelcastAPIDelegatingClassloader classloader = getHazelcastAPIDelegatingClassloader(hz);
Object instance = getHazelcastInstanceImpl(hz, classloader);
Object node = getFieldValueReflectively(instance, "node");
HazelcastInstanceImpl proxy = mock(HazelcastInstanceImpl.class, new HazelcastInstanceImplAnswer(instance));
setFieldValueReflectively(proxy, "node", mock(Node.class, new NodeAnswer(node)));
return proxy;
} catch (HazelcastInstanceNotActiveException e) {
throw new IllegalArgumentException("The given HazelcastInstance is not an active HazelcastInstanceImpl: " + hz.getClass());
} catch (Exception e) {
throw rethrowGuardianException(e);
}
}
use of com.hazelcast.test.starter.answer.NodeAnswer in project hazelcast by hazelcast.
the class HazelcastStarter method getNode.
public static Node getNode(HazelcastInstance hz) {
try {
HazelcastAPIDelegatingClassloader classloader = getHazelcastAPIDelegatingClassloader(hz);
Object instance = getHazelcastInstanceImpl(hz, classloader);
Object node = getFieldValueReflectively(instance, "node");
return mock(Node.class, new NodeAnswer(node));
} catch (HazelcastInstanceNotActiveException e) {
throw new IllegalArgumentException("The given HazelcastInstance is not an active HazelcastInstanceImpl: " + hz.getClass());
} catch (Exception e) {
throw rethrowGuardianException(e);
}
}
Aggregations