Search in sources :

Example 56 with Node

use of com.hazelcast.instance.Node in project hazelcast by hazelcast.

the class NodeIOServiceTest method setUp.

@Before
public void setUp() {
    Node mockNode = mock(Node.class);
    NodeEngineImpl mockNodeEngine = mock(NodeEngineImpl.class);
    ioService = new NodeIOService(mockNode, mockNodeEngine);
    Config config = new Config();
    networkConfig = config.getNetworkConfig();
    when(mockNode.getConfig()).thenReturn(config);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Config(com.hazelcast.config.Config) NetworkConfig(com.hazelcast.config.NetworkConfig) Node(com.hazelcast.instance.Node) Before(org.junit.Before)

Example 57 with Node

use of com.hazelcast.instance.Node in project hazelcast by hazelcast.

the class PartitionedCluster method splitCluster.

private void splitCluster() {
    Node n1 = getNode(h1);
    Node n2 = getNode(h2);
    Node n3 = getNode(h3);
    Node n4 = getNode(h4);
    Node n5 = getNode(h5);
    FirewallingMockConnectionManager cm1 = getConnectionManager(n1);
    FirewallingMockConnectionManager cm2 = getConnectionManager(n2);
    FirewallingMockConnectionManager cm3 = getConnectionManager(n3);
    FirewallingMockConnectionManager cm4 = getConnectionManager(n4);
    FirewallingMockConnectionManager cm5 = getConnectionManager(n5);
    cm1.block(n4.address);
    cm2.block(n4.address);
    cm3.block(n4.address);
    cm1.block(n5.address);
    cm2.block(n5.address);
    cm3.block(n5.address);
    cm4.block(n1.address);
    cm4.block(n2.address);
    cm4.block(n3.address);
    cm5.block(n1.address);
    cm5.block(n2.address);
    cm5.block(n3.address);
    n4.clusterService.removeAddress(n1.address, null);
    n4.clusterService.removeAddress(n2.address, null);
    n4.clusterService.removeAddress(n3.address, null);
    n5.clusterService.removeAddress(n1.address, null);
    n5.clusterService.removeAddress(n2.address, null);
    n5.clusterService.removeAddress(n3.address, null);
    n1.clusterService.removeAddress(n4.address, null);
    n2.clusterService.removeAddress(n4.address, null);
    n3.clusterService.removeAddress(n4.address, null);
    n1.clusterService.removeAddress(n5.address, null);
    n2.clusterService.removeAddress(n5.address, null);
    n3.clusterService.removeAddress(n5.address, null);
}
Also used : Node(com.hazelcast.instance.Node) HazelcastTestSupport.getNode(com.hazelcast.test.HazelcastTestSupport.getNode) FirewallingMockConnectionManager(com.hazelcast.nio.tcp.FirewallingMockConnectionManager)

Example 58 with Node

use of com.hazelcast.instance.Node in project hazelcast by hazelcast.

the class PhoneHomeTest method testPhoneHomeParameters.

@Test
public void testPhoneHomeParameters() throws Exception {
    Node node1 = TestUtil.getNode(hz1);
    PhoneHome phoneHome = new PhoneHome();
    sleepAtLeastMillis(1);
    Map<String, String> parameters = phoneHome.phoneHome(node1, "test_version", false);
    RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
    OperatingSystemMXBean osMxBean = ManagementFactory.getOperatingSystemMXBean();
    assertEquals(parameters.get("version"), "test_version");
    assertEquals(parameters.get("m"), node1.getLocalMember().getUuid());
    assertEquals(parameters.get("e"), "false");
    assertEquals(parameters.get("l"), "NULL");
    assertEquals(parameters.get("p"), "source");
    assertEquals(parameters.get("crsz"), "A");
    assertEquals(parameters.get("cssz"), "A");
    assertEquals(parameters.get("hdgb"), "0");
    assertEquals(parameters.get("ccpp"), "0");
    assertEquals(parameters.get("cdn"), "0");
    assertEquals(parameters.get("cjv"), "0");
    assertEquals(parameters.get("cnjs"), "0");
    assertEquals(parameters.get("cpy"), "0");
    assertEquals(parameters.get("jetv"), "");
    assertFalse(Integer.parseInt(parameters.get("cuptm")) < 0);
    assertNotEquals(parameters.get("nuptm"), "0");
    assertNotEquals(parameters.get("nuptm"), parameters.get("cuptm"));
    assertEquals(parameters.get("osn"), osMxBean.getName());
    assertEquals(parameters.get("osa"), osMxBean.getArch());
    assertEquals(parameters.get("osv"), osMxBean.getVersion());
    assertEquals(parameters.get("jvmn"), runtimeMxBean.getVmName());
    assertEquals(parameters.get("jvmv"), System.getProperty("java.version"));
}
Also used : Node(com.hazelcast.instance.Node) RuntimeMXBean(java.lang.management.RuntimeMXBean) OperatingSystemMXBean(java.lang.management.OperatingSystemMXBean) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 59 with Node

use of com.hazelcast.instance.Node in project orientdb by orientechnologies.

the class ServerRun method terminateServer.

public void terminateServer() {
    if (server != null) {
        try {
            HazelcastInstance hz = ((OHazelcastPlugin) server.getDistributedManager()).getHazelcastInstance();
            final Node node = getHazelcastNode(hz);
            node.getConnectionManager().shutdown();
            node.shutdown(true);
            hz.getLifecycleService().terminate();
        } catch (Exception e) {
        // IGNORE IT
        }
        try {
            server.shutdown();
        } catch (Exception e) {
        // IGNORE IT
        }
    }
    closeStorages();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Node(com.hazelcast.instance.Node) OHazelcastPlugin(com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin) IOException(java.io.IOException)

Example 60 with Node

use of com.hazelcast.instance.Node in project orientdb by orientechnologies.

the class ServerRun method rejoin.

public void rejoin(final ServerRun... serverIds) {
    final Node currentNode = getHazelcastNode(((OHazelcastPlugin) server.getDistributedManager()).getHazelcastInstance());
    for (ServerRun s : serverIds) {
        final Node otherNode = getHazelcastNode(((OHazelcastPlugin) s.server.getDistributedManager()).getHazelcastInstance());
        final ClusterServiceImpl clusterService = currentNode.getClusterService();
        clusterService.merge(otherNode.address);
    }
}
Also used : Node(com.hazelcast.instance.Node) ClusterServiceImpl(com.hazelcast.cluster.impl.ClusterServiceImpl)

Aggregations

Node (com.hazelcast.instance.Node)131 HazelcastInstance (com.hazelcast.core.HazelcastInstance)60 Test (org.junit.Test)50 QuickTest (com.hazelcast.test.annotation.QuickTest)45 ParallelTest (com.hazelcast.test.annotation.ParallelTest)42 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)21 ClientEventRegistration (com.hazelcast.client.spi.impl.listener.ClientEventRegistration)18 Address (com.hazelcast.nio.Address)17 Config (com.hazelcast.config.Config)14 ClusterServiceImpl (com.hazelcast.internal.cluster.impl.ClusterServiceImpl)13 ILogger (com.hazelcast.logging.ILogger)10 Data (com.hazelcast.nio.serialization.Data)10 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)10 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)9 StringUtil.bytesToString (com.hazelcast.util.StringUtil.bytesToString)8 CountDownLatch (java.util.concurrent.CountDownLatch)8 ClusterService (com.hazelcast.internal.cluster.ClusterService)7 SerializationService (com.hazelcast.spi.serialization.SerializationService)7 ItemListener (com.hazelcast.core.ItemListener)6 Operation (com.hazelcast.spi.Operation)6