Search in sources :

Example 1 with DefaultNodeExtension

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);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) DefaultNodeExtension(com.hazelcast.instance.impl.DefaultNodeExtension) ConfigurationService(com.hazelcast.internal.dynamicconfig.ConfigurationService) ClusterWideConfigurationService(com.hazelcast.internal.dynamicconfig.ClusterWideConfigurationService) LicenseKey(com.hazelcast.internal.config.LicenseKey)

Example 2 with DefaultNodeExtension

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);
}
Also used : DefaultNodeExtension(com.hazelcast.instance.impl.DefaultNodeExtension) Config(com.hazelcast.config.Config) ClientConfig(com.hazelcast.client.config.ClientConfig) Node(com.hazelcast.instance.impl.Node) NodeExtension(com.hazelcast.instance.impl.NodeExtension) DefaultNodeExtension(com.hazelcast.instance.impl.DefaultNodeExtension) ClientConfig(com.hazelcast.client.config.ClientConfig) MockNodeContext(com.hazelcast.test.mocknetwork.MockNodeContext) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 3 with DefaultNodeExtension

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();
}
Also used : DefaultNodeExtension(com.hazelcast.instance.impl.DefaultNodeExtension) MockNodeContext(com.hazelcast.test.mocknetwork.MockNodeContext) NodeContext(com.hazelcast.instance.impl.NodeContext) Config(com.hazelcast.config.Config) Node(com.hazelcast.instance.impl.Node) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) MockNodeContext(com.hazelcast.test.mocknetwork.MockNodeContext) Before(org.junit.Before)

Example 4 with DefaultNodeExtension

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);
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) DefaultNodeExtension(com.hazelcast.instance.impl.DefaultNodeExtension) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Address(com.hazelcast.cluster.Address) Accessors.getAddress(com.hazelcast.test.Accessors.getAddress) Config(com.hazelcast.config.Config) Node(com.hazelcast.instance.impl.Node) Accessors.getNode(com.hazelcast.test.Accessors.getNode) NodeExtension(com.hazelcast.instance.impl.NodeExtension) DefaultNodeExtension(com.hazelcast.instance.impl.DefaultNodeExtension) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) MockNodeContext(com.hazelcast.test.mocknetwork.MockNodeContext) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Example 5 with DefaultNodeExtension

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();
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) DefaultNodeExtension(com.hazelcast.instance.impl.DefaultNodeExtension) Address(com.hazelcast.cluster.Address) LoggingServiceImpl(com.hazelcast.logging.impl.LoggingServiceImpl) BuildInfo(com.hazelcast.instance.BuildInfo) Node(com.hazelcast.instance.impl.Node) MemberVersion(com.hazelcast.version.MemberVersion) Before(org.junit.Before)

Aggregations

DefaultNodeExtension (com.hazelcast.instance.impl.DefaultNodeExtension)5 Node (com.hazelcast.instance.impl.Node)4 Config (com.hazelcast.config.Config)3 MockNodeContext (com.hazelcast.test.mocknetwork.MockNodeContext)3 Address (com.hazelcast.cluster.Address)2 NodeExtension (com.hazelcast.instance.impl.NodeExtension)2 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)2 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)2 Before (org.junit.Before)2 Test (org.junit.Test)2 ClientConfig (com.hazelcast.client.config.ClientConfig)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 BuildInfo (com.hazelcast.instance.BuildInfo)1 NodeContext (com.hazelcast.instance.impl.NodeContext)1 LicenseKey (com.hazelcast.internal.config.LicenseKey)1 ClusterWideConfigurationService (com.hazelcast.internal.dynamicconfig.ClusterWideConfigurationService)1 ConfigurationService (com.hazelcast.internal.dynamicconfig.ConfigurationService)1 DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)1 LoggingServiceImpl (com.hazelcast.logging.impl.LoggingServiceImpl)1 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)1