new-integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/primitive/Command.java
public boolean executeAndVerify(String expectedResponse) {
    if (params.verbose()) {
      getLogger().info("Executing command {0}", params.command());
    }
    try {
      ExecResult result = ExecCommand.exec(
          params.command(), 
          params.redirect(),
          params.env());
      if (params.saveResults()) {
        params.stdout(result.stdout());
        params.stderr(result.stderr());
      }

      // check exitValue to determine if the command execution has failed.
      if (params.verbose()) {
        if (result.exitValue() != 0) {
          getLogger().severe("The command execution failed because it returned non-zero exit value: {0}.", result);
        } else {
          getLogger().info("The command execution succeeded with result: {0}.", result);
        }
      } 

      return result.exitValue() == 0
             && result.stdout() != null
             && result.stdout().contains(expectedResponse);
    } catch (IOException | InterruptedException ie) {
      getLogger().severe("The command execution failed", ie);
      return false;
    }
  }
/**
   * Execute a command and verify the response.
   *
   * @param expectedResponse the expected response to verify
   * @return true if the execution succeeded and response contains the expected value
   */
Execute a command and verify the response.
@param expectedResponse the expected response to verify
@return true if the execution succeeded and response contains the expected value
Execute a command and verify the response . @param expectedResponse the expected response to verify @return true if the execution succeeded and response contains the expected value
public boolean executeAndVerify(String expectedResponse) {
    if (params.verbose()) {
      getLogger().info("Executing command {0}", params.command());
    }
    try {
      ExecResult result = ExecCommand.exec(
          params.command(), 
          params.redirect(),
          params.env());
      if (params.saveResults()) {
        params.stdout(result.stdout());
        params.stderr(result.stderr());
      }
      if (params.verbose()) {
        if (result.exitValue() != 0) {
          getLogger().severe("The command execution failed because it returned non-zero exit value: {0}.", result);
        } else {
          getLogger().info("The command execution succeeded with result: {0}.", result);
        }
      } 
      return result.exitValue() == 0
             && result.stdout() != null
             && result.stdout().contains(expectedResponse);
    } catch (IOException | InterruptedException ie) {
      getLogger().severe("The command execution failed", ie);
      return false;
    }
  }
public boolean executeAndVerify ( String expectedResponse ) { if ( params . verbose ( ) ) { getLogger ( ) . info ( "Executing command {0}" , params . command ( ) ) ; } try { ExecResult result = ExecCommand . exec ( params . command ( ) , params . redirect ( ) , params . env ( ) ) ; if ( params . saveResults ( ) ) { params . stdout ( result . stdout ( ) ) ; params . stderr ( result . stderr ( ) ) ; } if ( params . verbose ( ) ) { if ( result . exitValue ( ) != 0 ) { getLogger ( ) . severe ( "The command execution failed because it returned non-zero exit value: {0}." , result ) ; } else { getLogger ( ) . info ( "The command execution succeeded with result: {0}." , result ) ; } } return result . exitValue ( ) == 0 && result . stdout ( ) != null && result . stdout ( ) . contains ( expectedResponse ) ; } catch ( IOException | InterruptedException ie ) { getLogger ( ) . severe ( "The command execution failed" , ie ) ; return false ; } }
Execute a command and verify the response.
Execute a command and verify the response .
// check exitValue to determine if the command execution has failed.