@Test public void testGetPartitions() { String key = "Key"; PartitionService clientPartitionService = client.getPartitionService(); Set<Partition> clientPartitions = clientPartitionService.getPartitions(); PartitionService serverPartitionService = server.getPartitionService(); Set<Partition> serverPartitions = serverPartitionService.getPartitions(); assertEquals(clientPartitions.size(), serverPartitions.size()); }
public static void warmUpPartitions(HazelcastInstance... instances) throws InterruptedException { for (HazelcastInstance instance : instances) { final PartitionService ps = instance.getPartitionService(); for (Partition partition : ps.getPartitions()) { while (partition.getOwner() == null) { Thread.sleep(10); } } } }
private static void warmUpPartitions(HazelcastInstance... instances) { for (HazelcastInstance instance : instances) { PartitionService partitionService = instance.getPartitionService(); for (Partition partition : partitionService.getPartitions()) { while (partition.getOwner() == null) { sleepSeconds(1); } } } }
@Setup public void setup(TestContext testContext) throws Exception { this.testContext = testContext; targetInstance = testContext.getTargetInstance(); testId = testContext.getTestId(); integrityMap = targetInstance.getMap(basename + "Integrity"); stressMap = targetInstance.getMap(basename + "Stress"); integrityThreads = new MapIntegrityThread[mapIntegrityThreadCount]; value = new byte[valueSize]; Random random = new Random(); random.nextBytes(value); if (mapLoad && isMemberNode(targetInstance)) { PartitionService partitionService = targetInstance.getPartitionService(); final Set<Partition> partitionSet = partitionService.getPartitions(); for (Partition partition : partitionSet) { while (partition.getOwner() == null) { Thread.sleep(1000); } } LOGGER.info(testId + ": " + partitionSet.size() + " partitions"); Member localMember = targetInstance.getCluster().getLocalMember(); for (int i = 0; i < totalIntegrityKeys; i++) { Partition partition = partitionService.getPartition(i); if (localMember.equals(partition.getOwner())) { integrityMap.put(i, value); } } LOGGER.info( testId + ": integrityMap=" + integrityMap.getName() + " size=" + integrityMap.size()); Config config = targetInstance.getConfig(); MapConfig mapConfig = config.getMapConfig(integrityMap.getName()); LOGGER.info(testId + ": " + mapConfig); } }