use of com.hazelcast.test.starter.constructor.InternalPartitionImplConstructor in project hazelcast by hazelcast.
the class InternalPartitionImplConstructorTest method testConstructor.
@Test
public void testConstructor() throws Exception {
PartitionReplica local = new PartitionReplica(new Address("172.16.16.1", 4223), UuidUtil.newUnsecureUUID());
PartitionReplica[] replicas = new PartitionReplica[] { new PartitionReplica(new Address("127.0.0.1", 2342), UuidUtil.newUnsecureUUID()) };
InternalPartition partition = new InternalPartitionImpl(42, local, replicas, 1, null);
InternalPartitionImplConstructor constructor = new InternalPartitionImplConstructor(InternalPartitionImpl.class);
InternalPartition clonedPartition = (InternalPartition) constructor.createNew(partition);
assertEquals(partition.getPartitionId(), clonedPartition.getPartitionId());
assertEquals(partition.version(), clonedPartition.version());
assertEquals(partition.getOwnerOrNull(), clonedPartition.getOwnerOrNull());
assertEquals(partition.getReplicaAddress(0), clonedPartition.getReplicaAddress(0));
assertEquals(partition.getReplica(0), clonedPartition.getReplica(0));
assertEquals(partition.getReplicaIndex(replicas[0]), clonedPartition.getReplicaIndex(replicas[0]));
}
Aggregations