Search in sources :

Example 26 with ClusterState

use of com.hazelcast.cluster.ClusterState in project hazelcast by hazelcast.

the class NodeStateImplTest method toJson.

@Test
public void toJson() throws Exception {
    ClusterState clusterState = ClusterState.ACTIVE;
    com.hazelcast.instance.NodeState nodeState = com.hazelcast.instance.NodeState.PASSIVE;
    Version clusterVersion = Version.of("3.8");
    MemberVersion memberVersion = MemberVersion.of("3.9.0");
    NodeState state = new NodeStateImpl(clusterState, nodeState, clusterVersion, memberVersion);
    NodeState deserialized = new NodeStateImpl();
    deserialized.fromJson(state.toJson());
    assertEquals(clusterState, deserialized.getClusterState());
    assertEquals(nodeState, deserialized.getNodeState());
    assertEquals(clusterVersion, deserialized.getClusterVersion());
    assertEquals(memberVersion, deserialized.getMemberVersion());
}
Also used : ClusterState(com.hazelcast.cluster.ClusterState) NodeState(com.hazelcast.monitor.NodeState) MemberVersion(com.hazelcast.version.MemberVersion) Version(com.hazelcast.version.Version) MemberVersion(com.hazelcast.version.MemberVersion) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

ClusterState (com.hazelcast.cluster.ClusterState)26 ClusterServiceImpl (com.hazelcast.internal.cluster.impl.ClusterServiceImpl)6 Address (com.hazelcast.nio.Address)6 Node (com.hazelcast.instance.Node)4 ParallelTest (com.hazelcast.test.annotation.ParallelTest)4 QuickTest (com.hazelcast.test.annotation.QuickTest)4 Test (org.junit.Test)4 InternalPartition (com.hazelcast.internal.partition.InternalPartition)3 Version (com.hazelcast.version.Version)3 JsonObject (com.eclipsesource.json.JsonObject)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 HazelcastInstanceNotActiveException (com.hazelcast.core.HazelcastInstanceNotActiveException)2 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)2 ILogger (com.hazelcast.logging.ILogger)2 NodeState (com.hazelcast.monitor.NodeState)2 TargetNotMemberException (com.hazelcast.spi.exception.TargetNotMemberException)2 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)2 TransactionException (com.hazelcast.transaction.TransactionException)2 MemberVersion (com.hazelcast.version.MemberVersion)2 ExecutionException (java.util.concurrent.ExecutionException)2