use of com.hazelcast.instance.impl.DefaultNodeExtension in project hazelcast by hazelcast.
the class SetLicenseOperation method run.
@Override
public void run() throws Exception {
DefaultNodeExtension nodeExtension = (DefaultNodeExtension) ((NodeEngineImpl) getNodeEngine()).getNode().getNodeExtension();
nodeExtension.setLicenseKey(licenseKey);
LicenseKey licenseKeyObject = new LicenseKey(licenseKey);
ConfigurationService configurationService = getNodeEngine().getService(ClusterWideConfigurationService.SERVICE_NAME);
configurationService.persist(licenseKeyObject);
}
use of com.hazelcast.instance.impl.DefaultNodeExtension in project hazelcast by hazelcast.
the class ClientAuthenticationTest method testAuthentication_with_mcModeEnabled_when_clusterStart_isNotComplete.
@Test
public void testAuthentication_with_mcModeEnabled_when_clusterStart_isNotComplete() {
HazelcastInstanceFactory.newHazelcastInstance(new Config(), randomName(), new MockNodeContext(hazelcastFactory.getRegistry(), hazelcastFactory.nextAddress()) {
@Override
public NodeExtension createNodeExtension(Node node) {
return new DefaultNodeExtension(node) {
@Override
public boolean isStartCompleted() {
return false;
}
};
}
});
ClientConfig clientConfig = new ClientConfig();
clientConfig.setProperty(MC_CLIENT_MODE_PROP.getName(), "true");
// if the client is able to connect, it's a pass
hazelcastFactory.newHazelcastClient(clientConfig);
}
use of com.hazelcast.instance.impl.DefaultNodeExtension in project hazelcast by hazelcast.
the class InternalPartitionServiceImplTest method setup.
@Before
public void setup() {
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory();
NodeContext nodeContext = new MockNodeContext(factory.getRegistry(), factory.nextAddress()) {
@Override
public NodeExtension createNodeExtension(Node node) {
return new DefaultNodeExtension(node) {
@Override
public boolean isStartCompleted() {
return startupDone.get();
}
};
}
};
instance = HazelcastInstanceFactory.newHazelcastInstance(new Config(), randomName(), nodeContext);
partitionService = (InternalPartitionServiceImpl) getPartitionService(instance);
localMember = getClusterService(instance).getLocalMember();
partitionCount = partitionService.getPartitionCount();
}
use of com.hazelcast.instance.impl.DefaultNodeExtension in project hazelcast by hazelcast.
the class AdvancedClusterStateTest method changeClusterState_shouldFail_whenStartupIsNotCompleted.
@Test
public void changeClusterState_shouldFail_whenStartupIsNotCompleted() throws Exception {
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory();
AtomicBoolean startupDone = new AtomicBoolean(false);
HazelcastInstance instance = HazelcastInstanceFactory.newHazelcastInstance(new Config(), randomName(), new MockNodeContext(factory.getRegistry(), new Address("127.0.0.1", 5555)) {
@Override
public NodeExtension createNodeExtension(Node node) {
return new DefaultNodeExtension(node) {
@Override
public boolean isStartCompleted() {
return startupDone.get() && super.isStartCompleted();
}
};
}
});
try {
instance.getCluster().changeClusterState(ClusterState.FROZEN);
fail("Should not be able to change cluster state when startup is not completed yet!");
} catch (IllegalStateException expected) {
}
startupDone.set(true);
instance.getCluster().changeClusterState(ClusterState.FROZEN);
}
use of com.hazelcast.instance.impl.DefaultNodeExtension in project hazelcast by hazelcast.
the class OperationExecutorImpl_AbstractTest method setup.
@Before
public void setup() throws Exception {
loggingService = new LoggingServiceImpl("foo", "jdk", new BuildInfo("1", "1", "1", 1, false, (byte) 1, "1"), true, null);
serializationService = new DefaultSerializationServiceBuilder().build();
config = smallInstanceConfig();
thisAddress = new Address("localhost", 5701);
Node node = Mockito.mock(Node.class);
when(node.getConfig()).thenReturn(config);
when(node.getProperties()).thenReturn(new HazelcastProperties(config));
when(node.getVersion()).thenReturn(new MemberVersion(0, 0, 0));
nodeExtension = new DefaultNodeExtension(node);
handlerFactory = new DummyOperationRunnerFactory();
responsePacketConsumer = new DummyResponsePacketConsumer();
}
Aggregations