Search in sources :

Example 1 with PartitionReplicaConstructor

use of com.hazelcast.test.starter.constructor.PartitionReplicaConstructor in project hazelcast by hazelcast.

the class PartitionReplicaConstructorTest method testConstructor.

@Test
public void testConstructor() {
    HazelcastInstance hz = createHazelcastInstance();
    warmUpPartitions(hz);
    InternalPartitionService partitionService = getNode(hz).getPartitionService();
    InternalPartition[] partitions = partitionService.getInternalPartitions();
    InternalPartitionImpl partition = (InternalPartitionImpl) partitions[0];
    PartitionReplica replica = partition.getReplica(0);
    PartitionReplicaConstructor constructor = new PartitionReplicaConstructor(PartitionReplica.class);
    PartitionReplica clonedReplica = (PartitionReplica) constructor.createNew(replica);
    assertEquals(replica.address(), clonedReplica.address());
    assertEquals(replica.uuid(), clonedReplica.uuid());
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) PartitionReplica(com.hazelcast.internal.partition.PartitionReplica) PartitionReplicaConstructor(com.hazelcast.test.starter.constructor.PartitionReplicaConstructor) InternalPartitionImpl(com.hazelcast.internal.partition.impl.InternalPartitionImpl) InternalPartition(com.hazelcast.internal.partition.InternalPartition) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 InternalPartition (com.hazelcast.internal.partition.InternalPartition)1 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)1 PartitionReplica (com.hazelcast.internal.partition.PartitionReplica)1 InternalPartitionImpl (com.hazelcast.internal.partition.impl.InternalPartitionImpl)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 PartitionReplicaConstructor (com.hazelcast.test.starter.constructor.PartitionReplicaConstructor)1 Test (org.junit.Test)1