new-integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonTestUtils.java
public static void createConfigMapForDomainCreation(String configMapName, List<Path> files,
      String namespace, String className)
      throws ApiException, IOException {

    LoggingFacade logger = getLogger();
    logger.info("Creating configmap {0}, namespace {1}, className {2}", configMapName, namespace, className);

    Path domainScriptsDir = Files.createDirectories(
        Paths.get(TestConstants.LOGS_DIR, className, namespace));

    // add domain creation scripts and properties files to the configmap
    Map<String, String> data = new HashMap<>();
    for (Path file : files) {
      logger.info("Adding file {0} in configmap", file);
      data.put(file.getFileName().toString(), Files.readString(file));
      logger.info("Making a copy of file {0} to {1} for diagnostic purposes", file,
          domainScriptsDir.resolve(file.getFileName()));
      Files.copy(file, domainScriptsDir.resolve(file.getFileName()));
    }
    V1ObjectMeta meta = new V1ObjectMeta()
        .name(configMapName)
        .namespace(namespace);
    V1ConfigMap configMap = new V1ConfigMap()
        .data(data)
        .metadata(meta);

    boolean cmCreated = assertDoesNotThrow(() -> createConfigMap(configMap),
        String.format("Failed to create configmap %s with files %s", configMapName, files));
    assertTrue(cmCreated, String.format("Failed while creating ConfigMap %s", configMapName));
  }
/**
   * Create configmap containing domain creation scripts.
   *
   * @param configMapName name of the configmap to create
   * @param files files to add in configmap
   * @param namespace name of the namespace in which to create configmap
   * @param className name of the class to call this method
   * @throws IOException when reading the domain script files fail
   * @throws ApiException if create configmap fails
   */
Create configmap containing domain creation scripts.
Create configmap containing domain creation scripts .
public static void createConfigMapForDomainCreation(String configMapName, List<Path> files,
      String namespace, String className)
      throws ApiException, IOException {
    LoggingFacade logger = getLogger();
    logger.info("Creating configmap {0}, namespace {1}, className {2}", configMapName, namespace, className);
    Path domainScriptsDir = Files.createDirectories(
        Paths.get(TestConstants.LOGS_DIR, className, namespace));
    Map<String, String> data = new HashMap<>();
    for (Path file : files) {
      logger.info("Adding file {0} in configmap", file);
      data.put(file.getFileName().toString(), Files.readString(file));
      logger.info("Making a copy of file {0} to {1} for diagnostic purposes", file,
          domainScriptsDir.resolve(file.getFileName()));
      Files.copy(file, domainScriptsDir.resolve(file.getFileName()));
    }
    V1ObjectMeta meta = new V1ObjectMeta()
        .name(configMapName)
        .namespace(namespace);
    V1ConfigMap configMap = new V1ConfigMap()
        .data(data)
        .metadata(meta);
    boolean cmCreated = assertDoesNotThrow(() -> createConfigMap(configMap),
        String.format("Failed to create configmap %s with files %s", configMapName, files));
    assertTrue(cmCreated, String.format("Failed while creating ConfigMap %s", configMapName));
  }
public static void createConfigMapForDomainCreation ( String configMapName , List < Path > files , String namespace , String className ) throws ApiException , IOException { LoggingFacade logger = getLogger ( ) ; logger . info ( "Creating configmap {0}, namespace {1}, className {2}" , configMapName , namespace , className ) ; Path domainScriptsDir = Files . createDirectories ( Paths . get ( TestConstants . LOGS_DIR , className , namespace ) ) ; Map < String , String > data = new HashMap < > ( ) ; for ( Path file : files ) { logger . info ( "Adding file {0} in configmap" , file ) ; data . put ( file . getFileName ( ) . toString ( ) , Files . readString ( file ) ) ; logger . info ( "Making a copy of file {0} to {1} for diagnostic purposes" , file , domainScriptsDir . resolve ( file . getFileName ( ) ) ) ; Files . copy ( file , domainScriptsDir . resolve ( file . getFileName ( ) ) ) ; } V1ObjectMeta meta = new V1ObjectMeta ( ) . name ( configMapName ) . namespace ( namespace ) ; V1ConfigMap configMap = new V1ConfigMap ( ) . data ( data ) . metadata ( meta ) ; boolean cmCreated = assertDoesNotThrow ( ( ) -> createConfigMap ( configMap ) , String . format ( "Failed to create configmap %s with files %s" , configMapName , files ) ) ; assertTrue ( cmCreated , String . format ( "Failed while creating ConfigMap %s" , configMapName ) ) ; }
Create configmap containing domain creation scripts.
Create configmap containing domain creation scripts .
// add domain creation scripts and properties files to the configmap