new-integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonTestUtils.java
public static Path generateFileFromTemplate(
       String inputTemplateFile, String outputFile,
       Map<String, String> templateMap) throws IOException {

    LoggingFacade logger = getLogger();

    Path targetFileParent = Paths.get(outputFile).getParent();
    if (targetFileParent != null) {
      checkDirectory(targetFileParent.toString());
    }
    Path srcFile = Paths.get(inputTemplateFile);
    Path targetFile = Paths.get(RESULTS_ROOT, outputFile);
    logger.info("Copying  source file {0} to target file {1}", inputTemplateFile, targetFile.toString());

    // Add the parent directory for the target file
    Path parentDir = targetFile.getParent();
    Files.createDirectories(parentDir);
    Files.copy(srcFile, targetFile, StandardCopyOption.REPLACE_EXISTING);
    String out = targetFile.toString();
    for (Map.Entry<String, String> entry : templateMap.entrySet()) {
      logger.info("Replacing String {0} with the value {1}", entry.getKey(), entry.getValue());
      replaceStringInFile(out, entry.getKey(), entry.getValue());
    }
    return targetFile;
  }
/**
   * Generate a text file in RESULTS_ROOT directory by replacing template value.
   * @param inputTemplateFile input template file
   * @param outputFile output file to be generated. This file will be copied to RESULTS_ROOT. If outputFile contains
   *                   a directory, then the directory will created if it does not exist.
   *                   example - crossdomxaction/istio-cdt-http-srvice.yaml
   * @param templateMap map containing template variable(s) to be replaced
   * @return path of the generated file - will be under RESULTS_ROOT
  */
Generate a text file in RESULTS_ROOT directory by replacing template value.
@param inputTemplateFile input template file
@param outputFile output file to be generated. This file will be copied to RESULTS_ROOT. If outputFile contains
a directory, then the directory will created if it does not exist.
Generate a text file in RESULTS_ROOT directory by replacing template value . @param inputTemplateFile input template file @param outputFile output file to be generated . This file will be copied to RESULTS_ROOT . If outputFile contains a directory then the directory will created if it does not exist .
public static Path generateFileFromTemplate(
       String inputTemplateFile, String outputFile,
       Map<String, String> templateMap) throws IOException {
    LoggingFacade logger = getLogger();
    Path targetFileParent = Paths.get(outputFile).getParent();
    if (targetFileParent != null) {
      checkDirectory(targetFileParent.toString());
    }
    Path srcFile = Paths.get(inputTemplateFile);
    Path targetFile = Paths.get(RESULTS_ROOT, outputFile);
    logger.info("Copying  source file {0} to target file {1}", inputTemplateFile, targetFile.toString());
    Path parentDir = targetFile.getParent();
    Files.createDirectories(parentDir);
    Files.copy(srcFile, targetFile, StandardCopyOption.REPLACE_EXISTING);
    String out = targetFile.toString();
    for (Map.Entry<String, String> entry : templateMap.entrySet()) {
      logger.info("Replacing String {0} with the value {1}", entry.getKey(), entry.getValue());
      replaceStringInFile(out, entry.getKey(), entry.getValue());
    }
    return targetFile;
  }
public static Path generateFileFromTemplate ( String inputTemplateFile , String outputFile , Map < String , String > templateMap ) throws IOException { LoggingFacade logger = getLogger ( ) ; Path targetFileParent = Paths . get ( outputFile ) . getParent ( ) ; if ( targetFileParent != null ) { checkDirectory ( targetFileParent . toString ( ) ) ; } Path srcFile = Paths . get ( inputTemplateFile ) ; Path targetFile = Paths . get ( RESULTS_ROOT , outputFile ) ; logger . info ( "Copying  source file {0} to target file {1}" , inputTemplateFile , targetFile . toString ( ) ) ; Path parentDir = targetFile . getParent ( ) ; Files . createDirectories ( parentDir ) ; Files . copy ( srcFile , targetFile , StandardCopyOption . REPLACE_EXISTING ) ; String out = targetFile . toString ( ) ; for ( Map . Entry < String , String > entry : templateMap . entrySet ( ) ) { logger . info ( "Replacing String {0} with the value {1}" , entry . getKey ( ) , entry . getValue ( ) ) ; replaceStringInFile ( out , entry . getKey ( ) , entry . getValue ( ) ) ; } return targetFile ; }
Generate a text file in RESULTS_ROOT directory by replacing template value.
Generate a text file in RESULTS_ROOT directory by replacing template value .
// Add the parent directory for the target file