Search in sources :

Example 56 with Node

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

the class PhoneHomeClientsTest method testMultipleClients_withMultipleMembers_whenTheClientsAreShutdown.

@Test
@Category(SlowTest.class)
public void testMultipleClients_withMultipleMembers_whenTheClientsAreShutdown() throws IOException {
    HazelcastInstance instance = factory.newHazelcastInstance(smallInstanceConfig());
    Node node1 = getNode(instance);
    addClientListener(node);
    addClientListener(node1);
    TestUtil.DummyClient client = clientFactory.newClient(getClientType(), "4.0.1");
    TestUtil.DummyClient client1 = clientFactory.newClient(getClientType(), "4.1");
    TestUtil.DummyConnection connection = client.connectTo(node);
    TestUtil.DummyConnection connection1 = client.connectTo(node1);
    TestUtil.DummyConnection connection2 = client1.connectTo(node);
    TestUtil.DummyConnection connection3 = client1.connectTo(node1);
    sleepAtLeastMillis(110);
    connection.close();
    connection1.close();
    connection2.close();
    connection3.close();
    assertEqualsEventually(4, disconnectedClientCount);
    assertParameters(node, 0, 2, 2, 2 * 110, "4.0.1", "4.1");
    assertParameters(node1, 0, 2, 2, 2 * 110, "4.0.1", "4.1");
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) TestUtil.getNode(com.hazelcast.internal.util.phonehome.TestUtil.getNode) Node(com.hazelcast.instance.impl.Node) Category(org.junit.experimental.categories.Category) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Example 57 with Node

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

the class PhoneHomeClientsTest method testSingleClient_withMultipleMembers_whenTheClientIsShutdown.

@Test
@Category(SlowTest.class)
public void testSingleClient_withMultipleMembers_whenTheClientIsShutdown() throws IOException {
    HazelcastInstance instance = factory.newHazelcastInstance(smallInstanceConfig());
    Node node1 = getNode(instance);
    addClientListener(node);
    addClientListener(node1);
    TestUtil.DummyClient client = clientFactory.newClient(getClientType(), "v4.0");
    TestUtil.DummyConnection connection = client.connectTo(node);
    TestUtil.DummyConnection connection1 = client.connectTo(node1);
    sleepAtLeastMillis(100);
    connection.close();
    connection1.close();
    assertEqualsEventually(2, disconnectedClientCount);
    assertParameters(node, 0, 1, 1, 100, "v4.0");
    assertParameters(node1, 0, 1, 1, 100, "v4.0");
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) TestUtil.getNode(com.hazelcast.internal.util.phonehome.TestUtil.getNode) Node(com.hazelcast.instance.impl.Node) Category(org.junit.experimental.categories.Category) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Example 58 with Node

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

the class PhoneHomeClientsTest method testMultipleClients_withMultipleMembers_whenTheClientsAreActive.

@Test
@Category(SlowTest.class)
public void testMultipleClients_withMultipleMembers_whenTheClientsAreActive() throws IOException {
    HazelcastInstance instance = factory.newHazelcastInstance(smallInstanceConfig());
    Node node1 = getNode(instance);
    TestUtil.DummyClient client = clientFactory.newClient(getClientType(), "4.1");
    TestUtil.DummyClient client1 = clientFactory.newClient(getClientType(), "4.1");
    client.connectTo(node);
    client.connectTo(node1);
    client1.connectTo(node);
    client1.connectTo(node1);
    sleepAtLeastMillis(90);
    assertParameters(node, 2, 2, 0, 2 * 90, "4.1");
    assertParameters(node1, 2, 2, 0, 2 * 90, "4.1");
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) TestUtil.getNode(com.hazelcast.internal.util.phonehome.TestUtil.getNode) Node(com.hazelcast.instance.impl.Node) Category(org.junit.experimental.categories.Category) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Example 59 with Node

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

the class PhoneHomeDifferentConfigTest method testTieredStorage.

@Test
public void testTieredStorage() {
    MapConfig mapConfig = new MapConfig().setName("ts-map").setTieredStoreConfig(new TieredStoreConfig().setEnabled(true));
    Config config = new Config().addMapConfig(mapConfig);
    HazelcastInstance hazelcastInstance = createHazelcastInstance(config);
    Node node = getNode(hazelcastInstance);
    PhoneHome phoneHome = new PhoneHome(node);
    Map<String, String> parameters = phoneHome.phoneHome(true);
    assertThat(parameters.get(PhoneHomeMetrics.TIERED_STORAGE_ENABLED.getRequestParameterName())).isEqualTo("true");
    assertThat(parameters.get(PhoneHomeMetrics.HD_MEMORY_ENABLED.getRequestParameterName())).isEqualTo("false");
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) TieredStoreConfig(com.hazelcast.config.TieredStoreConfig) MapConfig(com.hazelcast.config.MapConfig) TieredStoreConfig(com.hazelcast.config.TieredStoreConfig) Config(com.hazelcast.config.Config) JetConfig(com.hazelcast.jet.config.JetConfig) NativeMemoryConfig(com.hazelcast.config.NativeMemoryConfig) Accessors.getNode(com.hazelcast.test.Accessors.getNode) Node(com.hazelcast.instance.impl.Node) MapConfig(com.hazelcast.config.MapConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 60 with Node

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

the class PhoneHomeDifferentConfigTest method testScheduling_whenPhoneHomeIsDisabled.

@Test
public void testScheduling_whenPhoneHomeIsDisabled() {
    Config config = new Config().setProperty(ClusterProperty.PHONE_HOME_ENABLED.getName(), "false");
    HazelcastInstance hz = createHazelcastInstance(config);
    Node node = getNode(hz);
    PhoneHome phoneHome = new PhoneHome(node);
    phoneHome.check();
    assertNull(phoneHome.phoneHomeFuture);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapConfig(com.hazelcast.config.MapConfig) TieredStoreConfig(com.hazelcast.config.TieredStoreConfig) Config(com.hazelcast.config.Config) JetConfig(com.hazelcast.jet.config.JetConfig) NativeMemoryConfig(com.hazelcast.config.NativeMemoryConfig) Accessors.getNode(com.hazelcast.test.Accessors.getNode) Node(com.hazelcast.instance.impl.Node) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

Node (com.hazelcast.instance.impl.Node)144 Accessors.getNode (com.hazelcast.test.Accessors.getNode)84 HazelcastInstance (com.hazelcast.core.HazelcastInstance)68 Test (org.junit.Test)60 QuickTest (com.hazelcast.test.annotation.QuickTest)57 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)44 Config (com.hazelcast.config.Config)22 Address (com.hazelcast.cluster.Address)20 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)19 ClusterServiceImpl (com.hazelcast.internal.cluster.impl.ClusterServiceImpl)13 UUID (java.util.UUID)13 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)12 SerializationService (com.hazelcast.internal.serialization.SerializationService)12 ILogger (com.hazelcast.logging.ILogger)10 MapService (com.hazelcast.map.impl.MapService)10 ClientConnectionRegistration (com.hazelcast.client.impl.spi.impl.listener.ClientConnectionRegistration)9 Operation (com.hazelcast.spi.impl.operationservice.Operation)9 HashMap (java.util.HashMap)9 Data (com.hazelcast.internal.serialization.Data)8 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)8