integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java
private void appendToDomainYamlAndCreate() throws Exception {

    String domainYaml =
        userProjectsDir + "/weblogic-domains/" + domainUid + "/domain.yaml";

    if (domainMap.containsKey("configOverrides")) {
      String contentToAppend =
          "  configOverrides: "
              + domainUid
              + "-"
              + domainMap.get("configOverrides")
              + "\n"
              + "  configOverrideSecrets: [ \""
              + domainUid
              + "-test-secrets\" ]"
              + "\n";

      Files.write(Paths.get(domainYaml), contentToAppend.getBytes(), StandardOpenOption.APPEND);
    }

    if (domainMap.containsKey("shutdownOptionsOverrides")) {
      Map<String, Object> shutdownProps = (Map<String, Object>)domainMap.get("shutdownOptionsOverrides");
      DomainCrd crd = new DomainCrd(domainYaml);
      if (shutdownProps.containsKey("cluster")) {
        List<Map<String, Object>> shutdownPropsClusters = (List<Map<String, Object>>)shutdownProps.get("cluster");
        for (Map<String, Object> shutdownPropsCluster : shutdownPropsClusters) {
          for (Map.Entry<String, Object> entry : shutdownPropsCluster.entrySet()) {
            crd.addShutdownOptionsToCluster(entry.getKey(),(Map<String, Object>)entry.getValue());

          }
        }
        LoggerHelper.getLocal().log(Level.INFO, "domain.yaml is modified with cluster level shutdownoptions");
      }
      if (shutdownProps.containsKey("server")) {
        List<Map<String, Object>> shutdownPropsServers = (List<Map<String, Object>>)shutdownProps.get("server");
        for (Map<String, Object> shutdownPropsServer : shutdownPropsServers) {
          for (Map.Entry<String, Object> entry : shutdownPropsServer.entrySet()) {
            crd.addShutDownOptionToMS(entry.getKey(),(Map<String, Object>)entry.getValue());
          }
        }
        LoggerHelper.getLocal().log(Level.INFO, "domain.yaml is modified with server level shutdownoptions");
      }
      if (shutdownProps.containsKey("domain")) {
        Map<String, Object> shutdownPropsDomain = (Map<String, Object>)shutdownProps.get("domain");
        crd.addShutdownOptionToDomain(shutdownPropsDomain);
        LoggerHelper.getLocal().log(Level.INFO, "domain.yaml is modified with domain level shutdownoptions");
      }
      if (shutdownProps.containsKey("env")) {
        Map<String, String> shutdownPropsEnv = (Map<String, String>)shutdownProps.get("env");
        crd.addEnvOption(shutdownPropsEnv);
        LoggerHelper.getLocal().log(Level.INFO, "domain.yaml is modified with env level shutdownoptions");
      }

      Charset charset = StandardCharsets.UTF_8;
      Path path = Paths.get(domainYaml);
      String modYaml = crd.getYamlTree();
      Files.write(path, modYaml.getBytes(charset));
      LoggerHelper.getLocal().log(Level.INFO, "Shutdown options are added to domain.yaml ");

    }

    String command = "kubectl create -f " + domainYaml;
    ExecResult result = TestUtils.execOrAbortProcess(command);
    LoggerHelper.getLocal().log(Level.INFO, "Command returned " + result.stdout().trim());
  }
/**
   * Append configOverrides, shutdownOptionsOverrides and configOverrideSecrets section to the generated domain.yaml and
   * create the domain crd by calling kubectl create on the generated domain.yaml.
   *
   * @throws Exception if any error occurs writing to the file or if could not run kubectl create
   *                   command
   */
Append configOverrides, shutdownOptionsOverrides and configOverrideSecrets section to the generated domain.yaml and
create the domain crd by calling kubectl create on the generated domain.yaml.

@throws Exception if any error occurs writing to the file or if could not run kubectl create
command
Append configOverrides shutdownOptionsOverrides and configOverrideSecrets section to the generated domain . yaml and create the domain crd by calling kubectl create on the generated domain . yaml . @throws Exception if any error occurs writing to the file or if could not run kubectl create command
private void appendToDomainYamlAndCreate() throws Exception {
    String domainYaml =
        userProjectsDir + "/weblogic-domains/" + domainUid + "/domain.yaml";
    if (domainMap.containsKey("configOverrides")) {
      String contentToAppend =
          "  configOverrides: "
              + domainUid
              + "-"
              + domainMap.get("configOverrides")
              + "\n"
              + "  configOverrideSecrets: [ \""
              + domainUid
              + "-test-secrets\" ]"
              + "\n";
      Files.write(Paths.get(domainYaml), contentToAppend.getBytes(), StandardOpenOption.APPEND);
    }
    if (domainMap.containsKey("shutdownOptionsOverrides")) {
      Map<String, Object> shutdownProps = (Map<String, Object>)domainMap.get("shutdownOptionsOverrides");
      DomainCrd crd = new DomainCrd(domainYaml);
      if (shutdownProps.containsKey("cluster")) {
        List<Map<String, Object>> shutdownPropsClusters = (List<Map<String, Object>>)shutdownProps.get("cluster");
        for (Map<String, Object> shutdownPropsCluster : shutdownPropsClusters) {
          for (Map.Entry<String, Object> entry : shutdownPropsCluster.entrySet()) {
            crd.addShutdownOptionsToCluster(entry.getKey(),(Map<String, Object>)entry.getValue());
          }
        }
        LoggerHelper.getLocal().log(Level.INFO, "domain.yaml is modified with cluster level shutdownoptions");
      }
      if (shutdownProps.containsKey("server")) {
        List<Map<String, Object>> shutdownPropsServers = (List<Map<String, Object>>)shutdownProps.get("server");
        for (Map<String, Object> shutdownPropsServer : shutdownPropsServers) {
          for (Map.Entry<String, Object> entry : shutdownPropsServer.entrySet()) {
            crd.addShutDownOptionToMS(entry.getKey(),(Map<String, Object>)entry.getValue());
          }
        }
        LoggerHelper.getLocal().log(Level.INFO, "domain.yaml is modified with server level shutdownoptions");
      }
      if (shutdownProps.containsKey("domain")) {
        Map<String, Object> shutdownPropsDomain = (Map<String, Object>)shutdownProps.get("domain");
        crd.addShutdownOptionToDomain(shutdownPropsDomain);
        LoggerHelper.getLocal().log(Level.INFO, "domain.yaml is modified with domain level shutdownoptions");
      }
      if (shutdownProps.containsKey("env")) {
        Map<String, String> shutdownPropsEnv = (Map<String, String>)shutdownProps.get("env");
        crd.addEnvOption(shutdownPropsEnv);
        LoggerHelper.getLocal().log(Level.INFO, "domain.yaml is modified with env level shutdownoptions");
      }
      Charset charset = StandardCharsets.UTF_8;
      Path path = Paths.get(domainYaml);
      String modYaml = crd.getYamlTree();
      Files.write(path, modYaml.getBytes(charset));
      LoggerHelper.getLocal().log(Level.INFO, "Shutdown options are added to domain.yaml ");
    }
    String command = "kubectl create -f " + domainYaml;
    ExecResult result = TestUtils.execOrAbortProcess(command);
    LoggerHelper.getLocal().log(Level.INFO, "Command returned " + result.stdout().trim());
  }
private void appendToDomainYamlAndCreate ( ) throws Exception { String domainYaml = userProjectsDir + "/weblogic-domains/" + domainUid + "/domain.yaml" ; if ( domainMap . containsKey ( "configOverrides" ) ) { String contentToAppend = "  configOverrides: " + domainUid + "-" + domainMap . get ( "configOverrides" ) + "\n" + "  configOverrideSecrets: [ \"" + domainUid + "-test-secrets\" ]" + "\n" ; Files . write ( Paths . get ( domainYaml ) , contentToAppend . getBytes ( ) , StandardOpenOption . APPEND ) ; } if ( domainMap . containsKey ( "shutdownOptionsOverrides" ) ) { Map < String , Object > shutdownProps = ( Map < String , Object > ) domainMap . get ( "shutdownOptionsOverrides" ) ; DomainCrd crd = new DomainCrd ( domainYaml ) ; if ( shutdownProps . containsKey ( "cluster" ) ) { List < Map < String , Object > > shutdownPropsClusters = ( List < Map < String , Object > > ) shutdownProps . get ( "cluster" ) ; for ( Map < String , Object > shutdownPropsCluster : shutdownPropsClusters ) { for ( Map . Entry < String , Object > entry : shutdownPropsCluster . entrySet ( ) ) { crd . addShutdownOptionsToCluster ( entry . getKey ( ) , ( Map < String , Object > ) entry . getValue ( ) ) ; } } LoggerHelper . getLocal ( ) . log ( Level . INFO , "domain.yaml is modified with cluster level shutdownoptions" ) ; } if ( shutdownProps . containsKey ( "server" ) ) { List < Map < String , Object > > shutdownPropsServers = ( List < Map < String , Object > > ) shutdownProps . get ( "server" ) ; for ( Map < String , Object > shutdownPropsServer : shutdownPropsServers ) { for ( Map . Entry < String , Object > entry : shutdownPropsServer . entrySet ( ) ) { crd . addShutDownOptionToMS ( entry . getKey ( ) , ( Map < String , Object > ) entry . getValue ( ) ) ; } } LoggerHelper . getLocal ( ) . log ( Level . INFO , "domain.yaml is modified with server level shutdownoptions" ) ; } if ( shutdownProps . containsKey ( "domain" ) ) { Map < String , Object > shutdownPropsDomain = ( Map < String , Object > ) shutdownProps . get ( "domain" ) ; crd . addShutdownOptionToDomain ( shutdownPropsDomain ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "domain.yaml is modified with domain level shutdownoptions" ) ; } if ( shutdownProps . containsKey ( "env" ) ) { Map < String , String > shutdownPropsEnv = ( Map < String , String > ) shutdownProps . get ( "env" ) ; crd . addEnvOption ( shutdownPropsEnv ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "domain.yaml is modified with env level shutdownoptions" ) ; } Charset charset = StandardCharsets . UTF_8 ; Path path = Paths . get ( domainYaml ) ; String modYaml = crd . getYamlTree ( ) ; Files . write ( path , modYaml . getBytes ( charset ) ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Shutdown options are added to domain.yaml " ) ; } String command = "kubectl create -f " + domainYaml ; ExecResult result = TestUtils . execOrAbortProcess ( command ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Command returned " + result . stdout ( ) . trim ( ) ) ; }
Append configOverrides, shutdownOptionsOverrides and configOverrideSecrets section to the generated domain.yaml and
 create the domain crd by calling kubectl create on the generated domain.yaml.
Append configOverrides shutdownOptionsOverrides and configOverrideSecrets section to the generated domain . yaml and create the domain crd by calling kubectl create on the generated domain . yaml .