integration-tests/src/test/java/oracle/kubernetes/operator/ItMonitoringExporter.java
private static void executeShelScript(String srcLoc, String destLoc, String fileName, String args, String outLogFile)
      throws Exception {
    if (!new File(destLoc).exists()) {
      LoggerHelper.getLocal().log(Level.INFO," creating script dir " + destLoc);
      Files.createDirectories(Paths.get(destLoc));
    }
    String crdCmd = " cp " + srcLoc + "/" + fileName + " " + destLoc;
    TestUtils.execOrAbortProcess(crdCmd, true);
    crdCmd =
        "cd "
            + destLoc
            + " && chmod 777 ./"
            + fileName
            + " && . ./"
            + fileName
            + " "
            + args
            + " | tee "
            + outLogFile;
    ExecResult result = ExecCommand.exec(crdCmd);
    if (result.exitValue() != 0) {
      throw new Exception(
          "FAILURE: Command "
              + crdCmd
              + " failed with stderr = "
              + result.stderr()
              + " \n stdout = "
              + result.stdout());
    }
    assertNotNull(result, "Result of execution is null");
    LoggerHelper.getLocal().log(Level.INFO, "Result output from  the command " + crdCmd + " : " + result.stdout());
    assertFalse(result.stdout().contains("returned: 1"), "script failed");
  }
/**
   * Utility to execute any shell scripts.
   *
   * @param srcLoc   - path to the shell script
   * @param destLoc  - destination path there the shell script will be executed
   * @param fileName - name of the shell script
   * @param args     - args to pass to the shell script
   * @throws Exception if could not run the command successfully to clone from github
   */
Utility to execute any shell scripts.
Utility to execute any shell scripts .
private static void executeShelScript(String srcLoc, String destLoc, String fileName, String args, String outLogFile)
      throws Exception {
    if (!new File(destLoc).exists()) {
      LoggerHelper.getLocal().log(Level.INFO," creating script dir " + destLoc);
      Files.createDirectories(Paths.get(destLoc));
    }
    String crdCmd = " cp " + srcLoc + "/" + fileName + " " + destLoc;
    TestUtils.execOrAbortProcess(crdCmd, true);
    crdCmd =
        "cd "
            + destLoc
            + " && chmod 777 ./"
            + fileName
            + " && . ./"
            + fileName
            + " "
            + args
            + " | tee "
            + outLogFile;
    ExecResult result = ExecCommand.exec(crdCmd);
    if (result.exitValue() != 0) {
      throw new Exception(
          "FAILURE: Command "
              + crdCmd
              + " failed with stderr = "
              + result.stderr()
              + " \n stdout = "
              + result.stdout());
    }
    assertNotNull(result, "Result of execution is null");
    LoggerHelper.getLocal().log(Level.INFO, "Result output from  the command " + crdCmd + " : " + result.stdout());
    assertFalse(result.stdout().contains("returned: 1"), "script failed");
  }
private static void executeShelScript ( String srcLoc , String destLoc , String fileName , String args , String outLogFile ) throws Exception { if ( ! new File ( destLoc ) . exists ( ) ) { LoggerHelper . getLocal ( ) . log ( Level . INFO , " creating script dir " + destLoc ) ; Files . createDirectories ( Paths . get ( destLoc ) ) ; } String crdCmd = " cp " + srcLoc + "/" + fileName + " " + destLoc ; TestUtils . execOrAbortProcess ( crdCmd , true ) ; crdCmd = "cd " + destLoc + " && chmod 777 ./" + fileName + " && . ./" + fileName + " " + args + " | tee " + outLogFile ; ExecResult result = ExecCommand . exec ( crdCmd ) ; if ( result . exitValue ( ) != 0 ) { throw new Exception ( "FAILURE: Command " + crdCmd + " failed with stderr = " + result . stderr ( ) + " \n stdout = " + result . stdout ( ) ) ; } assertNotNull ( result , "Result of execution is null" ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Result output from  the command " + crdCmd + " : " + result . stdout ( ) ) ; assertFalse ( result . stdout ( ) . contains ( "returned: 1" ) , "script failed" ) ; }
Utility to execute any shell scripts.
Utility to execute any shell scripts .