use of com.hazelcast.instance.TestNodeContext in project hazelcast by hazelcast.
the class HazelcastInstanceFactoryTest method test_NewInstance_failed_afterNodeStart.
@Test(expected = ExpectedRuntimeException.class)
public void test_NewInstance_failed_afterNodeStart() throws Exception {
NodeContext context = new TestNodeContext() {
@Override
public NodeExtension createNodeExtension(Node node) {
NodeExtension nodeExtension = super.createNodeExtension(node);
doThrow(new ExpectedRuntimeException()).when(nodeExtension).afterStart();
return nodeExtension;
}
};
Config config = new Config();
config.getNetworkConfig().getJoin().getAutoDetectionConfig().setEnabled(false);
hazelcastInstance = HazelcastInstanceFactory.newHazelcastInstance(config, randomString(), context);
}
use of com.hazelcast.instance.TestNodeContext in project hazelcast by hazelcast.
the class HazelcastInstanceFactoryTest method test_NewInstance_terminateInstance_afterNodeStart.
@Test(expected = IllegalStateException.class)
public void test_NewInstance_terminateInstance_afterNodeStart() throws Exception {
NodeContext context = new TestNodeContext() {
@Override
public NodeExtension createNodeExtension(final Node node) {
NodeExtension nodeExtension = super.createNodeExtension(node);
doAnswer(invocation -> {
node.hazelcastInstance.shutdown();
return null;
}).when(nodeExtension).afterStart();
return nodeExtension;
}
};
Config config = new Config();
config.getNetworkConfig().getJoin().getAutoDetectionConfig().setEnabled(false);
hazelcastInstance = HazelcastInstanceFactory.newHazelcastInstance(config, randomString(), context);
}
Aggregations