integration-tests/src/test/java/oracle/kubernetes/operator/ItSessionMigration.java
@Test
  public void testRepickPrimary() throws Exception {
    Assumptions.assumeTrue(FULLTEST);
    String testMethodName = new Object() {
    }.getClass().getEnclosingMethod().getName();
    logTestBegin(testMethodName);

    Map<String, Object> domainMap = domain.getDomainMap();
    final String domainNS = domainMap.get("namespace").toString();
    final String domainUid = domain.getDomainUid();

    String testAppPath = testAppName + "/CounterServlet";
    String sessCreateTime = "sessioncreatetime";
    String primaryServ = "primary";

    // Send the first HTTP request and save HTTP header/sessionID info
    ExecResult result = getHttpResponse(testAppPath, " -D ");

    // Get primary server name & session create time bf primaryServName1 is stopped
    String primaryServName1 = getHttpResponseAttribute(result.stdout(), primaryServ);
    String sessCreateTime1 = getHttpResponseAttribute(result.stdout(), sessCreateTime);

    // Stop primary server
    domain.shutdownManagedServerUsingServerStartPolicy(primaryServName1);

    // Send the second HTTP request using HTTP header/sessionID info save before
    result = getHttpResponse(testAppPath, " -b ");

    // Get primary server name & session create time af primaryServName1 is stopped
    String primaryServName2 = getHttpResponseAttribute(result.stdout(), primaryServ);
    String sessCreateTime2 = getHttpResponseAttribute(result.stdout(), sessCreateTime);

    // Verify that the same session info is used
    Assumptions.assumeTrue(sessCreateTime1.equals(sessCreateTime2), "HTTP Session should NOT change!");

    // Verify that a new primary server is picked
    Assumptions.assumeFalse(
        primaryServName1.trim().equals(primaryServName2.trim()),
        "A new primary server should be picked!");

    // Restore test env
    domain.restartManagedServerUsingServerStartPolicy(primaryServName1);
    TestUtils.checkPodReady(domainUid + "-" + primaryServName1, domainNS);

    LoggerHelper.getLocal().log(Level.INFO,
        "SUCCESS - " + testMethodName + ". ms <" + primaryServName2 + "> is new primary server.");
  }
/**
   * Verify that a new and running managed server is picked up as the primary server after the
   * primary server shut down.
   *
   * @throws Exception exception
   */
Verify that a new and running managed server is picked up as the primary server after the
primary server shut down.

@throws Exception exception
Verify that a new and running managed server is picked up as the primary server after the primary server shut down . @throws Exception exception
@Test
  public void testRepickPrimary() throws Exception {
    Assumptions.assumeTrue(FULLTEST);
    String testMethodName = new Object() {
    }.getClass().getEnclosingMethod().getName();
    logTestBegin(testMethodName);
    Map<String, Object> domainMap = domain.getDomainMap();
    final String domainNS = domainMap.get("namespace").toString();
    final String domainUid = domain.getDomainUid();
    String testAppPath = testAppName + "/CounterServlet";
    String sessCreateTime = "sessioncreatetime";
    String primaryServ = "primary";
    ExecResult result = getHttpResponse(testAppPath, " -D ");
    String primaryServName1 = getHttpResponseAttribute(result.stdout(), primaryServ);
    String sessCreateTime1 = getHttpResponseAttribute(result.stdout(), sessCreateTime);
    domain.shutdownManagedServerUsingServerStartPolicy(primaryServName1);
    result = getHttpResponse(testAppPath, " -b ");
    String primaryServName2 = getHttpResponseAttribute(result.stdout(), primaryServ);
    String sessCreateTime2 = getHttpResponseAttribute(result.stdout(), sessCreateTime);
    Assumptions.assumeTrue(sessCreateTime1.equals(sessCreateTime2), "HTTP Session should NOT change!");
    Assumptions.assumeFalse(
        primaryServName1.trim().equals(primaryServName2.trim()),
        "A new primary server should be picked!");
    domain.restartManagedServerUsingServerStartPolicy(primaryServName1);
    TestUtils.checkPodReady(domainUid + "-" + primaryServName1, domainNS);
    LoggerHelper.getLocal().log(Level.INFO,
        "SUCCESS - " + testMethodName + ". ms <" + primaryServName2 + "> is new primary server.");
  }
@ Test public void testRepickPrimary ( ) throws Exception { Assumptions . assumeTrue ( FULLTEST ) ; String testMethodName = new Object ( ) { } . getClass ( ) . getEnclosingMethod ( ) . getName ( ) ; logTestBegin ( testMethodName ) ; Map < String , Object > domainMap = domain . getDomainMap ( ) ; final String domainNS = domainMap . get ( "namespace" ) . toString ( ) ; final String domainUid = domain . getDomainUid ( ) ; String testAppPath = testAppName + "/CounterServlet" ; String sessCreateTime = "sessioncreatetime" ; String primaryServ = "primary" ; ExecResult result = getHttpResponse ( testAppPath , " -D " ) ; String primaryServName1 = getHttpResponseAttribute ( result . stdout ( ) , primaryServ ) ; String sessCreateTime1 = getHttpResponseAttribute ( result . stdout ( ) , sessCreateTime ) ; domain . shutdownManagedServerUsingServerStartPolicy ( primaryServName1 ) ; result = getHttpResponse ( testAppPath , " -b " ) ; String primaryServName2 = getHttpResponseAttribute ( result . stdout ( ) , primaryServ ) ; String sessCreateTime2 = getHttpResponseAttribute ( result . stdout ( ) , sessCreateTime ) ; Assumptions . assumeTrue ( sessCreateTime1 . equals ( sessCreateTime2 ) , "HTTP Session should NOT change!" ) ; Assumptions . assumeFalse ( primaryServName1 . trim ( ) . equals ( primaryServName2 . trim ( ) ) , "A new primary server should be picked!" ) ; domain . restartManagedServerUsingServerStartPolicy ( primaryServName1 ) ; TestUtils . checkPodReady ( domainUid + "-" + primaryServName1 , domainNS ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "SUCCESS - " + testMethodName + ". ms <" + primaryServName2 + "> is new primary server." ) ; }
Verify that a new and running managed server is picked up as the primary server after the
 primary server shut down.
Verify that a new and running managed server is picked up as the primary server after the primary server shut down .
// Send the first HTTP request and save HTTP header/sessionID info // Get primary server name & session create time bf primaryServName1 is stopped // Stop primary server // Send the second HTTP request using HTTP header/sessionID info save before // Get primary server name & session create time af primaryServName1 is stopped // Verify that the same session info is used // Verify that a new primary server is picked // Restore test env