use of org.apache.geode.cache.client.internal.ClientMetadataService in project geode by apache.
the class FixedPRSinglehopDUnitTest method verifyMetadata.
private void verifyMetadata(final int totalBuckets, int currentRedundancy) {
ClientMetadataService cms = ((GemFireCacheImpl) cache).getClientMetadataService();
final Map<String, ClientPartitionAdvisor> regionMetaData = cms.getClientPRMetadata_TEST_ONLY();
WaitCriterion wc = new WaitCriterion() {
public boolean done() {
return (regionMetaData.size() == 1);
}
public String description() {
return "expected no metadata to be refreshed";
}
};
Wait.waitForCriterion(wc, 60000, 1000, true);
assertTrue(regionMetaData.containsKey(region.getFullPath()));
final ClientPartitionAdvisor prMetaData = regionMetaData.get(region.getFullPath());
wc = new WaitCriterion() {
public boolean done() {
return (prMetaData.getBucketServerLocationsMap_TEST_ONLY().size() == totalBuckets);
}
public String description() {
return "expected no metadata to be refreshed. Expected " + totalBuckets + " entries but found " + prMetaData.getBucketServerLocationsMap_TEST_ONLY();
}
};
Wait.waitForCriterion(wc, 60000, 1000, true);
System.out.println("metadata is " + prMetaData);
System.out.println("metadata bucket locations map is " + prMetaData.getBucketServerLocationsMap_TEST_ONLY());
for (Map.Entry entry : prMetaData.getBucketServerLocationsMap_TEST_ONLY().entrySet()) {
assertEquals("list has wrong contents: " + entry.getValue(), currentRedundancy, ((List) entry.getValue()).size());
}
}
use of org.apache.geode.cache.client.internal.ClientMetadataService in project geode by apache.
the class FixedPRSinglehopDUnitTest method updateIntoSinglePR.
public static void updateIntoSinglePR(boolean assertNoMetadataRefreshes) {
ClientMetadataService cms = ((GemFireCacheImpl) cache).getClientMetadataService();
cms.satisfyRefreshMetadata_TEST_ONLY(false);
region.put(q1dateJan1, "update0");
if (assertNoMetadataRefreshes) {
assertFalse(cms.isRefreshMetadataTestOnly());
}
region.put(q1dateFeb1, "update00");
if (assertNoMetadataRefreshes) {
assertFalse(cms.isRefreshMetadataTestOnly());
}
region.put(q1dateMar1, "update000");
if (assertNoMetadataRefreshes) {
assertFalse(cms.isRefreshMetadataTestOnly());
}
region.put(q2dateApr1, "update1");
if (assertNoMetadataRefreshes) {
assertFalse(cms.isRefreshMetadataTestOnly());
}
region.put(q2dateMay1, "update11");
if (assertNoMetadataRefreshes) {
assertFalse(cms.isRefreshMetadataTestOnly());
}
region.put(q2dateJun1, "update111");
if (assertNoMetadataRefreshes) {
assertFalse(cms.isRefreshMetadataTestOnly());
}
region.put(q3dateJuly1, "update2");
if (assertNoMetadataRefreshes) {
assertFalse(cms.isRefreshMetadataTestOnly());
}
region.put(q3dateAug1, "update22");
if (assertNoMetadataRefreshes) {
assertFalse(cms.isRefreshMetadataTestOnly());
}
region.put(q3dateSep1, "update2222");
if (assertNoMetadataRefreshes) {
assertFalse(cms.isRefreshMetadataTestOnly());
}
region.put(q4dateOct1, "update3");
if (assertNoMetadataRefreshes) {
assertFalse(cms.isRefreshMetadataTestOnly());
}
region.put(q4dateNov1, "update33");
if (assertNoMetadataRefreshes) {
assertFalse(cms.isRefreshMetadataTestOnly());
}
region.put(q4dateDec1, "update3333");
if (assertNoMetadataRefreshes) {
assertFalse(cms.isRefreshMetadataTestOnly());
}
}
use of org.apache.geode.cache.client.internal.ClientMetadataService in project geode by apache.
the class FixedPRSinglehopDUnitTest method updateIntoSinglePRFor3Qs.
public static void updateIntoSinglePRFor3Qs() {
ClientMetadataService cms = ((GemFireCacheImpl) cache).getClientMetadataService();
cms.satisfyRefreshMetadata_TEST_ONLY(false);
region.put(q1dateJan1, "update0");
assertEquals(false, cms.isRefreshMetadataTestOnly());
region.put(q1dateFeb1, "update00");
assertEquals(false, cms.isRefreshMetadataTestOnly());
region.put(q1dateMar1, "update000");
assertEquals(false, cms.isRefreshMetadataTestOnly());
region.put(q2dateApr1, "update1");
assertEquals(false, cms.isRefreshMetadataTestOnly());
region.put(q2dateMay1, "update11");
assertEquals(false, cms.isRefreshMetadataTestOnly());
region.put(q2dateJun1, "update111");
assertEquals(false, cms.isRefreshMetadataTestOnly());
region.put(q3dateJuly1, "update2");
assertEquals(false, cms.isRefreshMetadataTestOnly());
region.put(q3dateAug1, "update22");
assertEquals(false, cms.isRefreshMetadataTestOnly());
region.put(q3dateSep1, "update2222");
assertEquals(false, cms.isRefreshMetadataTestOnly());
}
use of org.apache.geode.cache.client.internal.ClientMetadataService in project geode by apache.
the class SingleHopStatsDUnitTest method createdColocatedPRData.
private void createdColocatedPRData(GemFireCacheImpl cache) {
Region customerRegion = cache.getRegion(CUSTOMER_REGION_NAME);
Region orderRegion = cache.getRegion(ORDER_REGION_NAME);
Region shipmentRegion = cache.getRegion(SHIPMENT_REGION_NAME);
for (int i = 0; i <= 20; i++) {
CustId custid = new CustId(i);
Customer customer = new Customer("name" + i, "Address" + i);
customerRegion.put(custid, customer);
for (int j = 1; j <= 10; j++) {
int oid = (i * 10) + j;
OrderId orderId = new OrderId(oid, custid);
Order order = new Order(ORDER_REGION_NAME + oid);
orderRegion.put(orderId, order);
for (int k = 1; k <= 10; k++) {
int sid = (oid * 10) + k;
ShipmentId shipmentId = new ShipmentId(sid, orderId);
Shipment shipment = new Shipment("Shipment" + sid);
shipmentRegion.put(shipmentId, shipment);
}
}
}
ClientMetadataService cms = cache.getClientMetadataService();
Map<String, ClientPartitionAdvisor> regionMetaData = cms.getClientPRMetadata_TEST_ONLY();
assertEquals(3, regionMetaData.size());
assertTrue(regionMetaData.containsKey(customerRegion.getFullPath()));
regionMetaData.get(customerRegion.getFullPath());
metaDataRefreshCount_Customer = ((LocalRegion) customerRegion).getCachePerfStats().getMetaDataRefreshCount();
// hops are not predictable
assertTrue(metaDataRefreshCount_Customer != 0);
regionMetaData.get(orderRegion.getFullPath());
metaDataRefreshCount_Order = ((LocalRegion) orderRegion).getCachePerfStats().getMetaDataRefreshCount();
assertTrue(metaDataRefreshCount_Order == 0);
regionMetaData.get(shipmentRegion.getFullPath());
metaDataRefreshCount_Shipment = ((LocalRegion) shipmentRegion).getCachePerfStats().getMetaDataRefreshCount();
assertTrue(metaDataRefreshCount_Shipment == 0);
}
use of org.apache.geode.cache.client.internal.ClientMetadataService in project geode by apache.
the class SingleHopGetAllPutAllDUnitTest method verifyMetadata.
private static void verifyMetadata() {
Region region = cache.getRegion(PartitionedRegionName);
ClientMetadataService cms = ((GemFireCacheImpl) cache).getClientMetadataService();
cms.getClientPRMetadata((LocalRegion) region);
final Map<String, ClientPartitionAdvisor> regionMetaData = cms.getClientPRMetadata_TEST_ONLY();
WaitCriterion wc = new WaitCriterion() {
public boolean done() {
return (regionMetaData.size() == 1);
}
public String description() {
return "Region metadat size is not 1. Exisitng size of regionMetaData is " + regionMetaData.size();
}
};
Wait.waitForCriterion(wc, 5000, 200, true);
assertTrue(regionMetaData.containsKey(region.getFullPath()));
final ClientPartitionAdvisor prMetaData = regionMetaData.get(region.getFullPath());
wc = new WaitCriterion() {
public boolean done() {
return (prMetaData.getBucketServerLocationsMap_TEST_ONLY().size() == 13);
}
public String description() {
return "Bucket server location map size is not 13. Exisitng size is :" + prMetaData.getBucketServerLocationsMap_TEST_ONLY().size();
}
};
Wait.waitForCriterion(wc, 5000, 200, true);
for (Entry entry : prMetaData.getBucketServerLocationsMap_TEST_ONLY().entrySet()) {
assertEquals(2, ((List) entry.getValue()).size());
}
}
Aggregations