Search in sources :

Example 11 with ClientMetadataService

use of org.apache.geode.cache.client.internal.ClientMetadataService in project geode by apache.

the class Shipment method printMetadata.

public static void printMetadata() {
    if (cache != null) {
        ClientMetadataService cms = ((GemFireCacheImpl) cache).getClientMetadataService();
        cache.getLogger().info("Metadata is " + cms.getClientPRMetadata_TEST_ONLY());
    }
}
Also used : ClientMetadataService(org.apache.geode.cache.client.internal.ClientMetadataService)

Example 12 with ClientMetadataService

use of org.apache.geode.cache.client.internal.ClientMetadataService in project geode by apache.

the class Shipment method updateIntoSinglePR.

public static void updateIntoSinglePR() {
    ClientMetadataService cms = ((GemFireCacheImpl) cache).getClientMetadataService();
    cms.satisfyRefreshMetadata_TEST_ONLY(false);
    region.put(new Integer(0), "update0");
    assertEquals(false, cms.isRefreshMetadataTestOnly());
    region.put(new Integer(1), "update1");
    assertEquals(false, cms.isRefreshMetadataTestOnly());
    region.put(new Integer(2), "update2");
    assertEquals(false, cms.isRefreshMetadataTestOnly());
    region.put(new Integer(3), "update3");
    assertEquals(false, cms.isRefreshMetadataTestOnly());
    region.put(new Integer(0), "update00");
    assertEquals(false, cms.isRefreshMetadataTestOnly());
    region.put(new Integer(1), "update11");
    assertEquals(false, cms.isRefreshMetadataTestOnly());
    region.put(new Integer(2), "update22");
    assertEquals(false, cms.isRefreshMetadataTestOnly());
    region.put(new Integer(3), "update33");
    assertEquals(false, cms.isRefreshMetadataTestOnly());
}
Also used : ClientMetadataService(org.apache.geode.cache.client.internal.ClientMetadataService)

Example 13 with ClientMetadataService

use of org.apache.geode.cache.client.internal.ClientMetadataService in project geode by apache.

the class Shipment method testMetadataFetchOnlyThroughputAll.

@Test
public void testMetadataFetchOnlyThroughputAll() {
    Integer port0 = (Integer) member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer(3, 4));
    Integer port1 = (Integer) member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer(3, 4));
    Integer port2 = (Integer) member2.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer(3, 4));
    Integer port3 = (Integer) member3.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer(3, 4));
    createClient(port0, port1, port2, port3);
    putAll();
    ClientMetadataService cms = ((GemFireCacheImpl) cache).getClientMetadataService();
    final Map<String, ClientPartitionAdvisor> regionMetaData = cms.getClientPRMetadata_TEST_ONLY();
    Awaitility.waitAtMost(60, TimeUnit.SECONDS).until(() -> (regionMetaData.size() == 1));
    assertTrue(regionMetaData.containsKey(region.getFullPath()));
    final ClientPartitionAdvisor prMetaData = regionMetaData.get(region.getFullPath());
    Awaitility.waitAtMost(60, TimeUnit.SECONDS).until(() -> (prMetaData.getBucketServerLocationsMap_TEST_ONLY().size() == 4));
}
Also used : ClientMetadataService(org.apache.geode.cache.client.internal.ClientMetadataService) ClientPartitionAdvisor(org.apache.geode.cache.client.internal.ClientPartitionAdvisor) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) ClientServerTest(org.apache.geode.test.junit.categories.ClientServerTest) Test(org.junit.Test)

Example 14 with ClientMetadataService

use of org.apache.geode.cache.client.internal.ClientMetadataService in project geode by apache.

the class Shipment method test_MetadataServiceCallAccuracy.

/**
   * 2 servers, 2 clients.One client to one server. Put from c1 to s1. Now put from c2. So since
   * there will be a hop at least once, fetchservice has to be triggered. Now put again from
   * c2.There should be no hop at all.
   */
@Test
public void test_MetadataServiceCallAccuracy() {
    Integer port0 = (Integer) member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer(1, 4));
    Integer port1 = (Integer) member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer(1, 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.put(new Integer(0), "create0");
    region.put(new Integer(1), "create1");
    region.put(new Integer(2), "create2");
    region.put(new Integer(3), "create3");
    Awaitility.waitAtMost(60, TimeUnit.SECONDS).until(() -> cms.isRefreshMetadataTestOnly() == true);
    // make sure all fetch tasks are completed
    Awaitility.waitAtMost(60, TimeUnit.SECONDS).until(() -> cms.getRefreshTaskCount() == 0);
    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");
    Awaitility.waitAtMost(60, TimeUnit.SECONDS).until(() -> cms.isRefreshMetadataTestOnly() == false);
}
Also used : ClientMetadataService(org.apache.geode.cache.client.internal.ClientMetadataService) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) ClientServerTest(org.apache.geode.test.junit.categories.ClientServerTest) Test(org.junit.Test)

Example 15 with ClientMetadataService

use of org.apache.geode.cache.client.internal.ClientMetadataService in project geode by apache.

the class FixedPRSinglehopDUnitTest method printMetadata.

public static void printMetadata() {
    if (cache != null) {
        ClientMetadataService cms = ((GemFireCacheImpl) cache).getClientMetadataService();
        ((GemFireCacheImpl) cache).getLogger().info("Metadata is " + cms.getClientPRMetadata_TEST_ONLY());
    }
}
Also used : ClientMetadataService(org.apache.geode.cache.client.internal.ClientMetadataService)

Aggregations

ClientMetadataService (org.apache.geode.cache.client.internal.ClientMetadataService)37 ClientPartitionAdvisor (org.apache.geode.cache.client.internal.ClientPartitionAdvisor)15 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)13 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)13 Test (org.junit.Test)13 ClientServerTest (org.apache.geode.test.junit.categories.ClientServerTest)12 Entry (java.util.Map.Entry)8 WaitCriterion (org.apache.geode.test.dunit.WaitCriterion)6 Region (org.apache.geode.cache.Region)5 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)2 List (java.util.List)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Cache (org.apache.geode.cache.Cache)2 CacheException (org.apache.geode.cache.CacheException)2 CacheSerializableRunnable (org.apache.geode.cache30.CacheSerializableRunnable)2 ServerLocation (org.apache.geode.distributed.internal.ServerLocation)2 ServerBucketProfile (org.apache.geode.internal.cache.BucketAdvisor.ServerBucketProfile)2 GemFireCacheImpl (org.apache.geode.internal.cache.GemFireCacheImpl)2