use of org.apache.geode.cache.client.internal.ClientMetadataService in project geode by apache.
the class Shipment method test_MetadataServiceCallAccuracy_FromGetOp.
@Test
public void test_MetadataServiceCallAccuracy_FromGetOp() {
Integer port0 = (Integer) member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer(0, 4));
Integer port1 = (Integer) member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer(0, 4));
member2.invoke(() -> PartitionedRegionSingleHopDUnitTest.createClient(port0));
createClient(port1);
member2.invoke(() -> PartitionedRegionSingleHopDUnitTest.putIntoSinglePR());
member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.printView());
member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.printView());
final ClientMetadataService cms = ((GemFireCacheImpl) cache).getClientMetadataService();
cms.satisfyRefreshMetadata_TEST_ONLY(false);
region.get(new Integer(0));
region.get(new Integer(1));
region.get(new Integer(2));
region.get(new Integer(3));
Awaitility.waitAtMost(60, TimeUnit.SECONDS).until(() -> cms.isRefreshMetadataTestOnly() == true);
printMetadata();
Wait.pause(5000);
cms.satisfyRefreshMetadata_TEST_ONLY(false);
region.get(new Integer(0));
region.get(new Integer(1));
region.get(new Integer(2));
region.get(new Integer(3));
Wait.pause(5000);
assertFalse(cms.isRefreshMetadataTestOnly());
}
use of org.apache.geode.cache.client.internal.ClientMetadataService in project geode by apache.
the class Shipment method verifyEmptyMetadata.
public static void verifyEmptyMetadata() {
ClientMetadataService cms = ((GemFireCacheImpl) cache).getClientMetadataService();
assertTrue(cms.getClientPRMetadata_TEST_ONLY().isEmpty());
}
use of org.apache.geode.cache.client.internal.ClientMetadataService in project geode by apache.
the class Shipment method fetchAndValidateMetadata.
private boolean fetchAndValidateMetadata() {
ClientMetadataService service = ((GemFireCacheImpl) this.cache).getClientMetadataService();
service.getClientPRMetadata((LocalRegion) this.region);
HashMap<ServerLocation, HashSet<Integer>> servers = service.groupByServerToAllBuckets(this.region, true);
if (servers == null) {
// + this.region.getFullPath());
return false;
} else if (servers.size() == 4) {
region.getCache().getLogger().fine("The client metadata contains the following " + servers.size() + " servers for region " + this.region.getFullPath() + ":");
for (Map.Entry entry : servers.entrySet()) {
region.getCache().getLogger().fine(entry.getKey() + "->" + entry.getValue());
}
if (servers.size() < 4) {
region.getCache().getLogger().info("Servers size is " + servers.size() + " less than expected 4.");
return false;
}
}
return true;
}
use of org.apache.geode.cache.client.internal.ClientMetadataService in project geode by apache.
the class Shipment method test_NoMetadataServiceCall.
@Test
public void test_NoMetadataServiceCall() {
Integer port0 = (Integer) member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer(1, 4));
Integer port1 = (Integer) member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer(1, 4));
member2.invoke(() -> PartitionedRegionSingleHopDUnitTest.createClientWithoutPRSingleHopEnabled(port0));
createClientWithoutPRSingleHopEnabled(port1);
member2.invoke(() -> PartitionedRegionSingleHopDUnitTest.putIntoSinglePR());
ClientMetadataService cms = ((GemFireCacheImpl) cache).getClientMetadataService();
cms.satisfyRefreshMetadata_TEST_ONLY(false);
member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.printView());
member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.printView());
region.put(new Integer(0), "create0");
final boolean metadataRefreshed_get1 = cms.isRefreshMetadataTestOnly();
cms.satisfyRefreshMetadata_TEST_ONLY(false);
region.put(new Integer(1), "create1");
final boolean metadataRefreshed_get2 = cms.isRefreshMetadataTestOnly();
cms.satisfyRefreshMetadata_TEST_ONLY(false);
region.put(new Integer(2), "create2");
final boolean metadataRefreshed_get3 = cms.isRefreshMetadataTestOnly();
cms.satisfyRefreshMetadata_TEST_ONLY(false);
region.put(new Integer(3), "create3");
final boolean metadataRefreshed_get4 = cms.isRefreshMetadataTestOnly();
Wait.pause(5000);
assertFalse(metadataRefreshed_get1 || metadataRefreshed_get2 || metadataRefreshed_get3 || metadataRefreshed_get4);
printMetadata();
cms.satisfyRefreshMetadata_TEST_ONLY(false);
region.put(new Integer(0), "create0");
region.put(new Integer(1), "create1");
region.put(new Integer(2), "create2");
region.put(new Integer(3), "create3");
Wait.pause(5000);
assertFalse(cms.isRefreshMetadataTestOnly());
}
use of org.apache.geode.cache.client.internal.ClientMetadataService in project geode by apache.
the class Shipment method verifyEmptyStaticData.
public static void verifyEmptyStaticData() {
ClientMetadataService cms = ((GemFireCacheImpl) cache).getClientMetadataService();
assertTrue(cms.getClientPartitionAttributesMap().isEmpty());
}
Aggregations