@Category(FlakyTest.class) @Test public void test_FPAmetadataFetch(){
  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=AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
  final String hostLocator=NetworkUtils.getServerHostName(server1.getHost());
  final String locator=hostLocator + "[" + portLocator+ "]";
  server3.invoke(null);
  try {
    List<FixedPartitionAttributes> fpaList=new ArrayList<FixedPartitionAttributes>();
    fpaList.add(FixedPartitionAttributes.createFixedPartition("Q1",true,3));
    fpaList.add(FixedPartitionAttributes.createFixedPartition("Q2",false,3));
    Integer port1=(Integer)server1.invoke(null);
    fpaList.clear();
    fpaList.add(FixedPartitionAttributes.createFixedPartition("Q3",true,3));
    Integer port2=(Integer)server2.invoke(null);
    fpaList.clear();
    createClientWithLocator(hostLocator,portLocator);
    putIntoPartitionedRegionsThreeQs();
    getFromPartitionedRegionsFor3Qs();
    Wait.pause(2000);
    server1.invoke(null);
    server2.invoke(null);
    int totalBucketOnServer=0;
    totalBucketOnServer+=(Integer)server1.invoke(null);
    totalBucketOnServer+=(Integer)server2.invoke(null);
    int currentRedundancy=1;
    verifyMetadata(totalBucketOnServer,currentRedundancy);
    updateIntoSinglePRFor3Qs();
    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=(Integer)server4.invoke(null);
    Wait.pause(2000);
    putIntoPartitionedRegions();
    getFromPartitionedRegions();
    Wait.pause(2000);
    server1.invoke(null);
    server2.invoke(null);
    server4.invoke(null);
    totalBucketOnServer=0;
    totalBucketOnServer+=(Integer)server1.invoke(null);
    totalBucketOnServer+=(Integer)server2.invoke(null);
    totalBucketOnServer+=(Integer)server4.invoke(null);
    updateIntoSinglePR();
  }
  finally {
    server3.invoke(null);
  }
}

@ Category ( FlakyTest . class ) @ Test public void test_FPAmetadataFetch ( ) { 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 = AvailablePort . getRandomAvailablePort ( AvailablePort . SOCKET ) ; final String hostLocator = NetworkUtils . getServerHostName ( server1 . getHost ( ) ) ; final String locator = hostLocator + "[" + portLocator + "]" ; server3 . invoke ( null ) ; try { List < FixedPartitionAttributes > fpaList = new ArrayList < FixedPartitionAttributes > ( ) ; fpaList . add ( FixedPartitionAttributes . createFixedPartition ( "Q1" , true , 3 ) ) ; fpaList . add ( FixedPartitionAttributes . createFixedPartition ( "Q2" , false , 3 ) ) ; Integer port1 = ( Integer ) server1 . invoke ( null ) ; fpaList . clear ( ) ; fpaList . add ( FixedPartitionAttributes . createFixedPartition ( "Q3" , true , 3 ) ) ; Integer port2 = ( Integer ) server2 . invoke ( null ) ; fpaList . clear ( ) ; createClientWithLocator ( hostLocator , portLocator ) ; putIntoPartitionedRegionsThreeQs ( ) ; getFromPartitionedRegionsFor3Qs ( ) ; Wait . pause ( 2000 ) ; server1 . invoke ( null ) ; server2 . invoke ( null ) ; int totalBucketOnServer = 0 ; totalBucketOnServer += ( Integer ) server1 . invoke ( null ) ; totalBucketOnServer += ( Integer ) server2 . invoke ( null ) ; int currentRedundancy = 1 ; verifyMetadata ( totalBucketOnServer , currentRedundancy ) ; updateIntoSinglePRFor3Qs ( ) ; 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 = ( Integer ) server4 . invoke ( null ) ; Wait . pause ( 2000 ) ; putIntoPartitionedRegions ( ) ; getFromPartitionedRegions ( ) ; Wait . pause ( 2000 ) ; server1 . invoke ( null ) ; server2 . invoke ( null ) ; server4 . invoke ( null ) ; totalBucketOnServer = 0 ; totalBucketOnServer += ( Integer ) server1 . invoke ( null ) ; totalBucketOnServer += ( Integer ) server2 . invoke ( null ) ; totalBucketOnServer += ( Integer ) server4 . invoke ( null ) ; updateIntoSinglePR ( ) ; } finally { server3 . invoke ( null ) ; } }
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 .
