Search in sources :

Example 1 with NodeExtension

use of com.hazelcast.instance.impl.NodeExtension 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 2 with NodeExtension

use of com.hazelcast.instance.impl.NodeExtension in project hazelcast by hazelcast.

the class InterceptorRegistryTest method getPartitionOperationThread.

private PartitionOperationThread getPartitionOperationThread(OperationQueue queue) {
    NodeExtension nodeExtension = mock(NodeExtension.class);
    OperationRunner operationRunner = mock(OperationRunner.class);
    OperationRunner[] operationRunners = new OperationRunner[] { operationRunner };
    return new PartitionOperationThread("threadName", 0, queue, LOGGER, nodeExtension, operationRunners, getClass().getClassLoader());
}
Also used : PartitionOperationThread(com.hazelcast.spi.impl.operationexecutor.impl.PartitionOperationThread) OperationRunner(com.hazelcast.spi.impl.operationexecutor.OperationRunner) NodeExtension(com.hazelcast.instance.impl.NodeExtension)

Example 3 with NodeExtension

use of com.hazelcast.instance.impl.NodeExtension in project hazelcast by hazelcast.

the class MockNodeContext method constructSamplingNodeExtension.

/**
 * @return {@code NodeExtension} suitable for sampling serialized objects in OSS or EE environment
 */
@SuppressWarnings("unchecked")
private static NodeExtension constructSamplingNodeExtension(Node node) {
    if (BuildInfoProvider.getBuildInfo().isEnterprise()) {
        try {
            Class<? extends NodeExtension> klass = (Class<? extends NodeExtension>) Class.forName("com.hazelcast.test.compatibility.SamplingEnterpriseNodeExtension");
            Constructor<? extends NodeExtension> constructor = klass.getConstructor(Node.class);
            return constructor.newInstance(node);
        } catch (Exception e) {
            throw rethrow(e);
        }
    } else {
        NodeExtension wrapped = NodeExtensionFactory.create(node, DefaultNodeContext.EXTENSION_PRIORITY_LIST);
        return new SamplingNodeExtension(wrapped);
    }
}
Also used : NodeExtension(com.hazelcast.instance.impl.NodeExtension) SamplingNodeExtension(com.hazelcast.test.compatibility.SamplingNodeExtension) SamplingNodeExtension(com.hazelcast.test.compatibility.SamplingNodeExtension)

Example 4 with NodeExtension

use of com.hazelcast.instance.impl.NodeExtension in project hazelcast by hazelcast.

the class HazelcastTestSupport method assertNodeStarted.

public static void assertNodeStarted(HazelcastInstance instance) {
    NodeExtension nodeExtension = Accessors.getNode(instance).getNodeExtension();
    assertTrue(nodeExtension.isStartCompleted());
}
Also used : NodeExtension(com.hazelcast.instance.impl.NodeExtension)

Example 5 with NodeExtension

use of com.hazelcast.instance.impl.NodeExtension in project hazelcast by hazelcast.

the class ServiceManagerImpl method registerExtensionServices.

private void registerExtensionServices() {
    logger.finest("Registering extension services...");
    NodeExtension nodeExtension = nodeEngine.getNode().getNodeExtension();
    Map<String, Object> services = nodeExtension.createExtensionServices();
    for (Map.Entry<String, Object> entry : services.entrySet()) {
        registerService(entry.getKey(), entry.getValue());
    }
}
Also used : NodeExtension(com.hazelcast.instance.impl.NodeExtension) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap)

Aggregations

NodeExtension (com.hazelcast.instance.impl.NodeExtension)8 Node (com.hazelcast.instance.impl.Node)3 Config (com.hazelcast.config.Config)2 DefaultNodeExtension (com.hazelcast.instance.impl.DefaultNodeExtension)2 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)2 MockNodeContext (com.hazelcast.test.mocknetwork.MockNodeContext)2 Test (org.junit.Test)2 ClientConfig (com.hazelcast.client.config.ClientConfig)1 Address (com.hazelcast.cluster.Address)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 ILogger (com.hazelcast.logging.ILogger)1 OperationRunner (com.hazelcast.spi.impl.operationexecutor.OperationRunner)1 PartitionOperationThread (com.hazelcast.spi.impl.operationexecutor.impl.PartitionOperationThread)1 Accessors.getAddress (com.hazelcast.test.Accessors.getAddress)1 Accessors.getNode (com.hazelcast.test.Accessors.getNode)1 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 SlowTest (com.hazelcast.test.annotation.SlowTest)1 SamplingNodeExtension (com.hazelcast.test.compatibility.SamplingNodeExtension)1 MemberVersion (com.hazelcast.version.MemberVersion)1