integration-tests/src/test/java/oracle/kubernetes/operator/MiiConfigUpdateBaseTest.java
protected void createMySql(Domain domain, String destDir, String mysqldbport) {
    Map<String, Object> domainMap = domain.getDomainMap();
    final String domainNS = domainMap.get("namespace").toString();
    final String domainUid = domain.getDomainUid();
    final String mysqlYamlFile = "mysql-dbservices.ymlt";
    final String origDir = BaseTest.getProjectRoot()
        + "/integration-tests/src/test/resources/mysql";
    String createMysqlCmd = null;
    ExecResult result = null;

    try {
      Files.deleteIfExists(Paths.get(destDir));
      Files.createDirectories(Paths.get(destDir));

      // copy mysql yaml file
      final Path src = Paths.get(origDir + "/" + mysqlYamlFile);
      final Path dst = Paths.get(destDir + "/" + mysqlYamlFile);
      LoggerHelper.getLocal().log(Level.INFO, "Copying " + src.toString() + " to " + dst.toString());
      Charset charset = StandardCharsets.UTF_8;
      String content = new String(Files.readAllBytes(src), charset);
      Files.write(dst, content.getBytes(charset));
      content = new String(Files.readAllBytes(dst), charset);
      content = content.replaceAll("@NAMESPACE@", domainNS);
      content = content.replaceAll("@DOMAIN_UID@", domainUid);
      content = content.replaceAll("@MYSQLPORT@", mysqldbport);
      Files.write(dst, content.getBytes(charset));

      createMysqlCmd = "kubectl create -f " + destDir + "/" + mysqlYamlFile;
      LoggerHelper.getLocal().log(Level.INFO, "Command to create mysql: " + createMysqlCmd);
      result = TestUtils.execOrAbortProcess(createMysqlCmd);
    } catch (Exception ex) {
      ex.printStackTrace();
      StringBuffer errorMsg = new StringBuffer("FAILURE: command: ");
      errorMsg
          .append(createMysqlCmd)
          .append(" failed, returned ")
          .append(result.stdout())
          .append("\n")
          .append(result.stderr());

      fail(errorMsg.toString(), ex.getCause());
    }
  }
/**
   * Create a MySQL pod.
   * @param domain the Domain where to change the image name
   * @param mysqldbport MySQL DB port number
   */
Create a MySQL pod.
@param domain the Domain where to change the image name
@param mysqldbport MySQL DB port number
Create a MySQL pod . @param domain the Domain where to change the image name @param mysqldbport MySQL DB port number
protected void createMySql(Domain domain, String destDir, String mysqldbport) {
    Map<String, Object> domainMap = domain.getDomainMap();
    final String domainNS = domainMap.get("namespace").toString();
    final String domainUid = domain.getDomainUid();
    final String mysqlYamlFile = "mysql-dbservices.ymlt";
    final String origDir = BaseTest.getProjectRoot()
        + "/integration-tests/src/test/resources/mysql";
    String createMysqlCmd = null;
    ExecResult result = null;
    try {
      Files.deleteIfExists(Paths.get(destDir));
      Files.createDirectories(Paths.get(destDir));
      final Path src = Paths.get(origDir + "/" + mysqlYamlFile);
      final Path dst = Paths.get(destDir + "/" + mysqlYamlFile);
      LoggerHelper.getLocal().log(Level.INFO, "Copying " + src.toString() + " to " + dst.toString());
      Charset charset = StandardCharsets.UTF_8;
      String content = new String(Files.readAllBytes(src), charset);
      Files.write(dst, content.getBytes(charset));
      content = new String(Files.readAllBytes(dst), charset);
      content = content.replaceAll("@NAMESPACE@", domainNS);
      content = content.replaceAll("@DOMAIN_UID@", domainUid);
      content = content.replaceAll("@MYSQLPORT@", mysqldbport);
      Files.write(dst, content.getBytes(charset));
      createMysqlCmd = "kubectl create -f " + destDir + "/" + mysqlYamlFile;
      LoggerHelper.getLocal().log(Level.INFO, "Command to create mysql: " + createMysqlCmd);
      result = TestUtils.execOrAbortProcess(createMysqlCmd);
    } catch (Exception ex) {
      ex.printStackTrace();
      StringBuffer errorMsg = new StringBuffer("FAILURE: command: ");
      errorMsg
          .append(createMysqlCmd)
          .append(" failed, returned ")
          .append(result.stdout())
          .append("\n")
          .append(result.stderr());
      fail(errorMsg.toString(), ex.getCause());
    }
  }
protected void createMySql ( Domain domain , String destDir , String mysqldbport ) { Map < String , Object > domainMap = domain . getDomainMap ( ) ; final String domainNS = domainMap . get ( "namespace" ) . toString ( ) ; final String domainUid = domain . getDomainUid ( ) ; final String mysqlYamlFile = "mysql-dbservices.ymlt" ; final String origDir = BaseTest . getProjectRoot ( ) + "/integration-tests/src/test/resources/mysql" ; String createMysqlCmd = null ; ExecResult result = null ; try { Files . deleteIfExists ( Paths . get ( destDir ) ) ; Files . createDirectories ( Paths . get ( destDir ) ) ; final Path src = Paths . get ( origDir + "/" + mysqlYamlFile ) ; final Path dst = Paths . get ( destDir + "/" + mysqlYamlFile ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Copying " + src . toString ( ) + " to " + dst . toString ( ) ) ; Charset charset = StandardCharsets . UTF_8 ; String content = new String ( Files . readAllBytes ( src ) , charset ) ; Files . write ( dst , content . getBytes ( charset ) ) ; content = new String ( Files . readAllBytes ( dst ) , charset ) ; content = content . replaceAll ( "@NAMESPACE@" , domainNS ) ; content = content . replaceAll ( "@DOMAIN_UID@" , domainUid ) ; content = content . replaceAll ( "@MYSQLPORT@" , mysqldbport ) ; Files . write ( dst , content . getBytes ( charset ) ) ; createMysqlCmd = "kubectl create -f " + destDir + "/" + mysqlYamlFile ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Command to create mysql: " + createMysqlCmd ) ; result = TestUtils . execOrAbortProcess ( createMysqlCmd ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; StringBuffer errorMsg = new StringBuffer ( "FAILURE: command: " ) ; errorMsg . append ( createMysqlCmd ) . append ( " failed, returned " ) . append ( result . stdout ( ) ) . append ( "\n" ) . append ( result . stderr ( ) ) ; fail ( errorMsg . toString ( ) , ex . getCause ( ) ) ; } }
Create a MySQL pod.
Create a MySQL pod .
// copy mysql yaml file