@Test
  public void testMetadataInClientWithFixedPartitions() throws Exception {

    final Host host = Host.getHost(0);
    VM server1 = host.getVM(0);
    VM server2 = host.getVM(1);
    VM server3 = host.getVM(2);
    VM server4 = host.getVM(3);
    Boolean simpleFPR = false;
    final int portLocator = getRandomAvailableTCPPort();
    final String hostLocator = NetworkUtils.getServerHostName(server1.getHost());
    final String locator = hostLocator + "[" + portLocator + "]";
    server3.invoke(() -> FixedPRSinglehopDUnitTest.startLocatorInVM(portLocator));
    try {

      List<FixedPartitionAttributes> fpaList = new ArrayList<>();

      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q1", true, 3));
      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q2", false, 3));

      Integer port1 = server1.invoke(() -> FixedPRSinglehopDUnitTest
          .createServerWithLocator(locator, false, fpaList, simpleFPR));
      fpaList.clear();
      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q3", true, 3));

      Integer port2 = server2.invoke(() -> FixedPRSinglehopDUnitTest
          .createServerWithLocator(locator, false, fpaList, simpleFPR));
      fpaList.clear();

      createClientWithLocator(hostLocator, portLocator);

      putIntoPartitionedRegionsThreeQs();

      getFromPartitionedRegionsFor3Qs();
      // Server 1 is actually primary for both Q1 and Q2, since there is no FPA server with
      // primary set to true.
      await()
          .until(() -> (server1.invoke(FixedPRSinglehopDUnitTest::primaryBucketsOnServer) == 6)
              && (server2.invoke(FixedPRSinglehopDUnitTest::primaryBucketsOnServer) == 3));

      // TODO: Verify that all the fpa's are in the map
      server1.invoke(FixedPRSinglehopDUnitTest::printView);
      server2.invoke(FixedPRSinglehopDUnitTest::printView);

      int totalBucketOnServer = 0;
      totalBucketOnServer +=
          server1.invoke(FixedPRSinglehopDUnitTest::primaryBucketsOnServer);
      totalBucketOnServer +=
          server2.invoke(FixedPRSinglehopDUnitTest::primaryBucketsOnServer);

      verifyMetadata(totalBucketOnServer, 1);
      updateIntoSinglePRFor3Qs();

      // now create one more partition
      fpaList.clear();
      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q4", true, 3));
      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q2", true, 3));
      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q1", false, 3));
      fpaList.add(FixedPartitionAttributes.createFixedPartition("Q3", false, 3));

      Integer port4 = server4.invoke(() -> FixedPRSinglehopDUnitTest
          .createServerWithLocator(locator, false, fpaList, simpleFPR));

      putIntoPartitionedRegions();
      // Wait to make sure that the buckets have actually moved.
      await()
          .until(() -> (server1.invoke(FixedPRSinglehopDUnitTest::primaryBucketsOnServer) == 3)
              && (server2.invoke(FixedPRSinglehopDUnitTest::primaryBucketsOnServer) == 3)
              && (server4.invoke(FixedPRSinglehopDUnitTest::primaryBucketsOnServer) == 6));

      getFromPartitionedRegions();

      server1.invoke(FixedPRSinglehopDUnitTest::printView);
      server2.invoke(FixedPRSinglehopDUnitTest::printView);
      server4.invoke(FixedPRSinglehopDUnitTest::printView);

      updateIntoSinglePR(false);

      ClientMetadataService cms = ((GemFireCacheImpl) cache).getClientMetadataService();
      ClientPartitionAdvisor advisor = cms.getClientPartitionAdvisor(SEPARATOR + PR_NAME);
      int[] expected = new int[] {port1, port1, port1, port4, port4, port4, port2, port2, port2,
          port4, port4, port4};
      for (int i = 0; i < expected.length; i++) {
        ServerLocation primary = advisor.advisePrimaryServerLocation(i);
        assertNotNull("bucket " + i + " had no primary server", primary);
        assertEquals("bucket " + i + " was incorrect", expected[i], primary.getPort());
      }
    } finally {
      server3.invoke(FixedPRSinglehopDUnitTest::stopLocator);
    }
  }
This test will check to see if all the partitionAttributes are sent to the client. In case one
partition comes late, we should fetch that when there is a network hop because of that
partitioned region. This test will create 3 servers with partition. Do some operations on them.
Validate that the metadata are fetched and then later up one more partition and do some
operations on them. It should fetch new fpa. Verify that the correct servers are known to the
client metadata service at the end.
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/FixedPRSinglehopDUnitTest.java