use of com.hazelcast.internal.partition.PartitionTableView in project hazelcast by hazelcast.
the class FrozenPartitionTableTest method testPartitionTableIsHealedWhenClusterStateIsActiveAfter.
private void testPartitionTableIsHealedWhenClusterStateIsActiveAfter(final ClusterState clusterState) {
final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(3);
HazelcastInstance[] instances = factory.newInstances();
warmUpPartitions(instances);
changeClusterStateEventually(instances[0], clusterState);
List<HazelcastInstance> instancesList = new ArrayList<HazelcastInstance>(asList(instances));
Collections.shuffle(instancesList);
final HazelcastInstance instanceToShutdown = instancesList.remove(0);
final Address addressToShutdown = getNode(instanceToShutdown).getThisAddress();
instanceToShutdown.shutdown();
for (HazelcastInstance instance : instancesList) {
assertClusterSizeEventually(2, instance);
}
changeClusterStateEventually(instancesList.get(0), ClusterState.ACTIVE);
waitAllForSafeState(instancesList);
for (HazelcastInstance instance : instancesList) {
PartitionTableView partitionTable = getPartitionTable(instance);
for (int i = 0; i < partitionTable.length(); i++) {
for (PartitionReplica replica : partitionTable.getReplicas(i)) {
if (replica == null) {
continue;
}
assertNotEquals(addressToShutdown, replica.address());
}
}
}
}
use of com.hazelcast.internal.partition.PartitionTableView 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());
}
Aggregations