geode-core/src/test/java/org/apache/geode/internal/cache/rollingupgrade/RollingUpgrade2DUnitTest.java
public void doTestPutAndGetMixedServers(String objectType, boolean partitioned, String oldVersion)
      throws Exception {
    final Host host = Host.getHost(0);
    VM currentServer1 = host.getVM(0);
    VM oldServerAndLocator = host.getVM(oldVersion, 1);
    VM currentServer2 = host.getVM(2);
    VM oldServer2 = host.getVM(oldVersion, 3);

    String regionName = "aRegion";

    RegionShortcut shortcut = RegionShortcut.REPLICATE;
    if (partitioned) {
      shortcut = RegionShortcut.PARTITION;
    }

    String serverHostName = NetworkUtils.getServerHostName(Host.getHost(0));
    int port = AvailablePortHelper.getRandomAvailableTCPPort();
    DistributedTestUtils.deleteLocatorStateFile(port);
    try {
      Properties props = getSystemProperties();
      props.remove(DistributionConfig.LOCATORS_NAME);
      invokeRunnableInVMs(invokeStartLocatorAndServer(serverHostName, port, props),
          oldServerAndLocator);

      props.put(DistributionConfig.LOCATORS_NAME, serverHostName + "[" + port + "]");

      invokeRunnableInVMs(invokeCreateCache(props), oldServer2, currentServer1, currentServer2);

      currentServer1.invoke(invokeAssertVersion(Version.CURRENT_ORDINAL));
      currentServer2.invoke(invokeAssertVersion(Version.CURRENT_ORDINAL));
      // oldServerAndLocator.invoke(invokeAssertVersion(oldOrdinal));
      // oldServer2.invoke(invokeAssertVersion(oldOrdinal));

      // create region
      invokeRunnableInVMs(invokeCreateRegion(regionName, shortcut), currentServer1, currentServer2,
          oldServerAndLocator, oldServer2);

      putAndVerify(objectType, currentServer1, regionName, 0, 10, currentServer2,
          oldServerAndLocator, oldServer2);
      putAndVerify(objectType, oldServerAndLocator, regionName, 5, 15, currentServer1,
          currentServer2, oldServer2);

    } finally {
      invokeRunnableInVMs(true, invokeCloseCache(), currentServer1, currentServer2,
          oldServerAndLocator, oldServer2);
    }
  }
/**
   * This test starts up multiple servers from the current code base and multiple servers from the
   * old version and executes puts and gets on a new server and old server and verifies that the
   * results are present. Note that the puts have overlapping region keys just to test new puts and
   * replaces
   */
This test starts up multiple servers from the current code base and multiple servers from the
old version and executes puts and gets on a new server and old server and verifies that the
results are present. Note that the puts have overlapping region keys just to test new puts and
replaces
This test starts up multiple servers from the current code base and multiple servers from the old version and executes puts and gets on a new server and old server and verifies that the results are present . Note that the puts have overlapping region keys just to test new puts and replaces
public void doTestPutAndGetMixedServers(String objectType, boolean partitioned, String oldVersion)
      throws Exception {
    final Host host = Host.getHost(0);
    VM currentServer1 = host.getVM(0);
    VM oldServerAndLocator = host.getVM(oldVersion, 1);
    VM currentServer2 = host.getVM(2);
    VM oldServer2 = host.getVM(oldVersion, 3);
    String regionName = "aRegion";
    RegionShortcut shortcut = RegionShortcut.REPLICATE;
    if (partitioned) {
      shortcut = RegionShortcut.PARTITION;
    }
    String serverHostName = NetworkUtils.getServerHostName(Host.getHost(0));
    int port = AvailablePortHelper.getRandomAvailableTCPPort();
    DistributedTestUtils.deleteLocatorStateFile(port);
    try {
      Properties props = getSystemProperties();
      props.remove(DistributionConfig.LOCATORS_NAME);
      invokeRunnableInVMs(invokeStartLocatorAndServer(serverHostName, port, props),
          oldServerAndLocator);
      props.put(DistributionConfig.LOCATORS_NAME, serverHostName + "[" + port + "]");
      invokeRunnableInVMs(invokeCreateCache(props), oldServer2, currentServer1, currentServer2);
      currentServer1.invoke(invokeAssertVersion(Version.CURRENT_ORDINAL));
      currentServer2.invoke(invokeAssertVersion(Version.CURRENT_ORDINAL));
      invokeRunnableInVMs(invokeCreateRegion(regionName, shortcut), currentServer1, currentServer2,
          oldServerAndLocator, oldServer2);
      putAndVerify(objectType, currentServer1, regionName, 0, 10, currentServer2,
          oldServerAndLocator, oldServer2);
      putAndVerify(objectType, oldServerAndLocator, regionName, 5, 15, currentServer1,
          currentServer2, oldServer2);
    } finally {
      invokeRunnableInVMs(true, invokeCloseCache(), currentServer1, currentServer2,
          oldServerAndLocator, oldServer2);
    }
  }
public void doTestPutAndGetMixedServers ( String objectType , boolean partitioned , String oldVersion ) throws Exception { final Host host = Host . getHost ( 0 ) ; VM currentServer1 = host . getVM ( 0 ) ; VM oldServerAndLocator = host . getVM ( oldVersion , 1 ) ; VM currentServer2 = host . getVM ( 2 ) ; VM oldServer2 = host . getVM ( oldVersion , 3 ) ; String regionName = "aRegion" ; RegionShortcut shortcut = RegionShortcut . REPLICATE ; if ( partitioned ) { shortcut = RegionShortcut . PARTITION ; } String serverHostName = NetworkUtils . getServerHostName ( Host . getHost ( 0 ) ) ; int port = AvailablePortHelper . getRandomAvailableTCPPort ( ) ; DistributedTestUtils . deleteLocatorStateFile ( port ) ; try { Properties props = getSystemProperties ( ) ; props . remove ( DistributionConfig . LOCATORS_NAME ) ; invokeRunnableInVMs ( invokeStartLocatorAndServer ( serverHostName , port , props ) , oldServerAndLocator ) ; props . put ( DistributionConfig . LOCATORS_NAME , serverHostName + "[" + port + "]" ) ; invokeRunnableInVMs ( invokeCreateCache ( props ) , oldServer2 , currentServer1 , currentServer2 ) ; currentServer1 . invoke ( invokeAssertVersion ( Version . CURRENT_ORDINAL ) ) ; currentServer2 . invoke ( invokeAssertVersion ( Version . CURRENT_ORDINAL ) ) ; invokeRunnableInVMs ( invokeCreateRegion ( regionName , shortcut ) , currentServer1 , currentServer2 , oldServerAndLocator , oldServer2 ) ; putAndVerify ( objectType , currentServer1 , regionName , 0 , 10 , currentServer2 , oldServerAndLocator , oldServer2 ) ; putAndVerify ( objectType , oldServerAndLocator , regionName , 5 , 15 , currentServer1 , currentServer2 , oldServer2 ) ; } finally { invokeRunnableInVMs ( true , invokeCloseCache ( ) , currentServer1 , currentServer2 , oldServerAndLocator , oldServer2 ) ; } }
This test starts up multiple servers from the current code base and multiple servers from the
 old version and executes puts and gets on a new server and old server and verifies that the
 results are present.
This test starts up multiple servers from the current code base and multiple servers from the old version and executes puts and gets on a new server and old server and verifies that the results are present .
// oldServerAndLocator.invoke(invokeAssertVersion(oldOrdinal)); // oldServer2.invoke(invokeAssertVersion(oldOrdinal)); // create region