Search in sources :

Example 6 with ReadonlyInternalPartition

use of com.hazelcast.internal.partition.ReadonlyInternalPartition in project hazelcast by hazelcast.

the class InternalPartitionServiceImplTest method test_setInitialState.

@Test
public void test_setInitialState() {
    InternalPartition[] partitions = new InternalPartition[partitionCount];
    for (int i = 0; i < partitionCount; i++) {
        PartitionReplica[] replicas = new PartitionReplica[MAX_REPLICA_COUNT];
        replicas[0] = PartitionReplica.from(localMember);
        partitions[i] = new ReadonlyInternalPartition(replicas, i, RandomPicker.getInt(1, 10));
    }
    partitionService.setInitialState(new PartitionTableView(partitions));
    for (int i = 0; i < partitionCount; i++) {
        assertTrue(partitionService.isPartitionOwner(i));
    }
    assertNotEquals(0, partitionService.getPartitionStateStamp());
}
Also used : PartitionReplica(com.hazelcast.internal.partition.PartitionReplica) PartitionTableView(com.hazelcast.internal.partition.PartitionTableView) InternalPartition(com.hazelcast.internal.partition.InternalPartition) ReadonlyInternalPartition(com.hazelcast.internal.partition.ReadonlyInternalPartition) ReadonlyInternalPartition(com.hazelcast.internal.partition.ReadonlyInternalPartition) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

InternalPartition (com.hazelcast.internal.partition.InternalPartition)6 ReadonlyInternalPartition (com.hazelcast.internal.partition.ReadonlyInternalPartition)6 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)5 QuickTest (com.hazelcast.test.annotation.QuickTest)5 Test (org.junit.Test)5 PartitionReplica (com.hazelcast.internal.partition.PartitionReplica)3 PartitionTableView (com.hazelcast.internal.partition.PartitionTableView)2 Address (com.hazelcast.cluster.Address)1