@Test
  public void testRollingUpgradeWithDeployment() throws IOException {
    int locatorPort = portSupplier.getAvailablePort();
    int locatorJmxPort = portSupplier.getAvailablePort();
    int locator2Port = portSupplier.getAvailablePort();
    int locator2JmxPort = portSupplier.getAvailablePort();
    int server1Port = portSupplier.getAvailablePort();
    int server2Port = portSupplier.getAvailablePort();

    GfshExecution startupExecution = GfshScript
        .of(startLocatorCommand("loc1", locatorPort, locatorJmxPort, 0, -1))
        .and(startLocatorCommand("loc2", locator2Port, locator2JmxPort, 0, locatorPort))
        .and(startServerCommand("server1", server1Port, locatorPort))
        .and(startServerCommand("server2", server2Port, locatorPort))
        .and(deployDirCommand())
        .execute(oldGfsh);

    // doing rolling upgrades
    startupExecution.locatorStopper().stop("loc1");
    GfshScript
        .of(startLocatorCommand("loc1", locatorPort, locatorJmxPort, 0, locator2Port))
        .execute(currentGfsh);
    verifyListDeployed(locatorPort);

    startupExecution.locatorStopper().stop("loc2");
    GfshScript
        .of(startLocatorCommand("loc2", locator2Port, locator2JmxPort, 0, locatorPort))
        .execute(currentGfsh);
    verifyListDeployed(locator2Port);

    // make sure servers can do rolling upgrade too
    startupExecution.serverStopper().stop("server1");
    GfshScript
        .of(startServerCommand("server1", server1Port, locatorPort))
        .execute(currentGfsh);

    startupExecution.serverStopper().stop("server2");
    GfshScript
        .of(startServerCommand("server2", server2Port, locatorPort))
        .execute(currentGfsh);
  }
This test iterates through the versions of Geode and executes client compatibility with
the current version of Geode.
geode-assembly/src/upgradeTest/java/org/apache/geode/management/RollingUpgradeWithGfshDUnitTest.java