new-integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/TestUtils.java
public static boolean verifyClusterMemberCommunication(
      String curlCmd,
      List<String> managedServerNames,
      int maxIterations) {
    LoggingFacade logger = getLogger();
    // first map all server names with false
    HashMap<String, Boolean> managedServers = new HashMap<>();
    managedServerNames.forEach(managedServerName
        -> managedServers.put(managedServerName, false)
    );

    logger.info("Calling clusterview at most {0} times using command: {1}", maxIterations, curlCmd);

    // check the response contains managed server name
    ExecResult result = null;
    for (int i = 0; i < maxIterations; i++) {
      if (managedServers.containsValue(false)) {
        try {
          TimeUnit.MILLISECONDS.sleep(100);
          result = ExecCommand.exec(curlCmd, true);
          String response = result.stdout().trim();
          for (var entry : managedServers.entrySet()) {
            if (response.contains("ServerName:" + entry.getKey())) {
              boolean bound = true;
              for (String managedServerName : managedServerNames) {
                bound = bound && response.contains("Bound:" + managedServerName);
              }
              if (bound) {
                managedServers.put(entry.getKey(), true);
              }
            }
          }
        } catch (IOException | InterruptedException e) {
          logger.info(e.toString());
          return false;
        }
      } else {
        return true;
      }
    }
    // after the max iterations, if hit here, one or more servers cannot see other
    managedServers.forEach((key, value) -> {
      if (value) {
        logger.info("The server {0} can see other cluster members", key);
      } else {
        logger.info("The server {0} is not bound in JNDI server "
            + "or is generating an unexpected curl response", key);
      }
    });

    return false;
  }
/**
   * Call the curl command and check the managed servers can see each other.
   *
   * @param curlCmd curl command to call the clusterview app
   * @param managedServerNames managed server names part of the cluster
   * @param maxIterations max iterations to call the curl command
   * @return true if the managed servers can see each other, false otherwise
   */
Call the curl command and check the managed servers can see each other.
@param curlCmd curl command to call the clusterview app
@param managedServerNames managed server names part of the cluster
@param maxIterations max iterations to call the curl command
@return true if the managed servers can see each other, false otherwise
Call the curl command and check the managed servers can see each other . @param curlCmd curl command to call the clusterview app @param managedServerNames managed server names part of the cluster @param maxIterations max iterations to call the curl command @return true if the managed servers can see each other false otherwise
public static boolean verifyClusterMemberCommunication(
      String curlCmd,
      List<String> managedServerNames,
      int maxIterations) {
    LoggingFacade logger = getLogger();
    HashMap<String, Boolean> managedServers = new HashMap<>();
    managedServerNames.forEach(managedServerName
        -> managedServers.put(managedServerName, false)
    );
    logger.info("Calling clusterview at most {0} times using command: {1}", maxIterations, curlCmd);
    ExecResult result = null;
    for (int i = 0; i < maxIterations; i++) {
      if (managedServers.containsValue(false)) {
        try {
          TimeUnit.MILLISECONDS.sleep(100);
          result = ExecCommand.exec(curlCmd, true);
          String response = result.stdout().trim();
          for (var entry : managedServers.entrySet()) {
            if (response.contains("ServerName:" + entry.getKey())) {
              boolean bound = true;
              for (String managedServerName : managedServerNames) {
                bound = bound && response.contains("Bound:" + managedServerName);
              }
              if (bound) {
                managedServers.put(entry.getKey(), true);
              }
            }
          }
        } catch (IOException | InterruptedException e) {
          logger.info(e.toString());
          return false;
        }
      } else {
        return true;
      }
    }
    managedServers.forEach((key, value) -> {
      if (value) {
        logger.info("The server {0} can see other cluster members", key);
      } else {
        logger.info("The server {0} is not bound in JNDI server "
            + "or is generating an unexpected curl response", key);
      }
    });
    return false;
  }
public static boolean verifyClusterMemberCommunication ( String curlCmd , List < String > managedServerNames , int maxIterations ) { LoggingFacade logger = getLogger ( ) ; HashMap < String , Boolean > managedServers = new HashMap < > ( ) ; managedServerNames . forEach ( managedServerName -> managedServers . put ( managedServerName , false ) ) ; logger . info ( "Calling clusterview at most {0} times using command: {1}" , maxIterations , curlCmd ) ; ExecResult result = null ; for ( int i = 0 ; i < maxIterations ; i ++ ) { if ( managedServers . containsValue ( false ) ) { try { TimeUnit . MILLISECONDS . sleep ( 100 ) ; result = ExecCommand . exec ( curlCmd , true ) ; String response = result . stdout ( ) . trim ( ) ; for ( var entry : managedServers . entrySet ( ) ) { if ( response . contains ( "ServerName:" + entry . getKey ( ) ) ) { boolean bound = true ; for ( String managedServerName : managedServerNames ) { bound = bound && response . contains ( "Bound:" + managedServerName ) ; } if ( bound ) { managedServers . put ( entry . getKey ( ) , true ) ; } } } } catch ( IOException | InterruptedException e ) { logger . info ( e . toString ( ) ) ; return false ; } } else { return true ; } } managedServers . forEach ( ( key , value ) -> { if ( value ) { logger . info ( "The server {0} can see other cluster members" , key ) ; } else { logger . info ( "The server {0} is not bound in JNDI server " + "or is generating an unexpected curl response" , key ) ; } } ) ; return false ; }
Call the curl command and check the managed servers can see each other.
Call the curl command and check the managed servers can see each other .
// first map all server names with false // check the response contains managed server name // after the max iterations, if hit here, one or more servers cannot see other