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

    Yaml yaml = new Yaml();
    InputStream pvis =
        new FileInputStream(
            new File(
                resultsDir
                    + "/samples/scripts/create-weblogic-domain-pv-pvc/create-pv-pvc-inputs.yaml"));
    pvMap = yaml.load(pvis);
    pvis.close();

    LoggerHelper.getLocal().log(Level.INFO, "pvSharing for this domain is: " + pvSharing);
    if (!pvSharing) {
      pvMap.put("domainUID", domainUid);
    } else {
      pvMap.put("baseName", "weblogic-sharing");
    }
    LoggerHelper.getLocal().log(Level.INFO,
        "baseName of PVPVC for this domain is: " + (String) pvMap.get("baseName"));

    // Now there is only one pvSharing test case and we just use parameter "baseName"+"-pvc" as PVC
    if ((domainUid != null) && !pvSharing) {
      domainMap.put("persistentVolumeClaimName", domainUid + "-" + pvMap.get("baseName") + "-pvc");
    } else {
      domainMap.put("persistentVolumeClaimName", pvMap.get("baseName") + "-pvc");
    }

    if (domainMap.get("weblogicDomainStorageReclaimPolicy") != null) {
      pvMap.put(
          "weblogicDomainStorageReclaimPolicy",
          domainMap.get("weblogicDomainStorageReclaimPolicy"));
    }
    if (domainMap.get("weblogicDomainStorageSize") != null) {
      pvMap.put("weblogicDomainStorageSize", domainMap.get("weblogicDomainStorageSize"));
    }
    pvMap.put("namespace", domainNS);
    pvMap.put("weblogicDomainStorageNFSServer", TestUtils.getHostName());
    pvMap.put("userProjectsDir", userProjectsDir);
    pvMap.put("pvRoot", pvRoot);

    if (BaseTest.OPENSHIFT) {
      pvMap.put("weblogicDomainStorageType", "NFS");
    }

    // set pv path
    domainMap.put(
        "weblogicDomainStoragePath",
        pvRoot + "/acceptance_test_pv/persistentVolume-" + domainUid);

    pvMap.put(
        "weblogicDomainStoragePath",
        pvRoot + "/acceptance_test_pv/persistentVolume-" + domainUid);

    pvMap.values().removeIf(Objects::isNull);

    // k8s job mounts PVROOT /scratch/<usr>/wl_k8s_test_results to /scratch, create PV/PVC
    new PersistentVolume(pvRoot + "/acceptance_test_pv/persistentVolume-" + domainUid, pvMap);

    String cmd =
        BaseTest.getProjectRoot()
            + "/src/integration-tests/bash/krun.sh -m "
            // + pvRoot
            + "/scratch:/scratch -n " + domainNS + " -c \"ls -ltr /scratch "
            + pvRoot
            + " "
            + pvRoot
            + "/acceptance_test_pv"
            + "\"";
    LoggerHelper.getLocal().log(Level.INFO, "Check PVROOT by running " + cmd);
    ExecResult result = ExecCommand.exec(cmd);
    LoggerHelper.getLocal().log(
        Level.INFO, "ls -ltr output " + result.stdout() + " err " + result.stderr());
  }
/**
   * Create a map with attributes required to create PV/PVC and create PV dir by calling
   * PersistentVolume.
   *
   * @throws Exception If the file create-pv-pvc-inputs.yaml does not exist, is a directory rather
   *                   than a regular file, or for some other reason cannot be opened for reading. or if an I/O
   *                   error occurs or any errors while creating PV dir or generating PV/PVC input file or any
   *                   errors while executing sample create-pv-pvc.sh script
   */
Create a map with attributes required to create PV/PVC and create PV dir by calling
PersistentVolume.

@throws Exception If the file create-pv-pvc-inputs.yaml does not exist, is a directory rather
than a regular file, or for some other reason cannot be opened for reading. or if an I/O
error occurs or any errors while creating PV dir or generating PV/PVC input file or any
errors while executing sample create-pv-pvc.sh script
Create a map with attributes required to create PV / PVC and create PV dir by calling PersistentVolume . @throws Exception If the file create - pv - pvc - inputs . yaml does not exist is a directory rather than a regular file or for some other reason cannot be opened for reading . or if an I / O error occurs or any errors while creating PV dir or generating PV / PVC input file or any errors while executing sample create - pv - pvc . sh script
protected void createPv() throws Exception {
    Yaml yaml = new Yaml();
    InputStream pvis =
        new FileInputStream(
            new File(
                resultsDir
                    + "/samples/scripts/create-weblogic-domain-pv-pvc/create-pv-pvc-inputs.yaml"));
    pvMap = yaml.load(pvis);
    pvis.close();
    LoggerHelper.getLocal().log(Level.INFO, "pvSharing for this domain is: " + pvSharing);
    if (!pvSharing) {
      pvMap.put("domainUID", domainUid);
    } else {
      pvMap.put("baseName", "weblogic-sharing");
    }
    LoggerHelper.getLocal().log(Level.INFO,
        "baseName of PVPVC for this domain is: " + (String) pvMap.get("baseName"));
    if ((domainUid != null) && !pvSharing) {
      domainMap.put("persistentVolumeClaimName", domainUid + "-" + pvMap.get("baseName") + "-pvc");
    } else {
      domainMap.put("persistentVolumeClaimName", pvMap.get("baseName") + "-pvc");
    }
    if (domainMap.get("weblogicDomainStorageReclaimPolicy") != null) {
      pvMap.put(
          "weblogicDomainStorageReclaimPolicy",
          domainMap.get("weblogicDomainStorageReclaimPolicy"));
    }
    if (domainMap.get("weblogicDomainStorageSize") != null) {
      pvMap.put("weblogicDomainStorageSize", domainMap.get("weblogicDomainStorageSize"));
    }
    pvMap.put("namespace", domainNS);
    pvMap.put("weblogicDomainStorageNFSServer", TestUtils.getHostName());
    pvMap.put("userProjectsDir", userProjectsDir);
    pvMap.put("pvRoot", pvRoot);
    if (BaseTest.OPENSHIFT) {
      pvMap.put("weblogicDomainStorageType", "NFS");
    }
    domainMap.put(
        "weblogicDomainStoragePath",
        pvRoot + "/acceptance_test_pv/persistentVolume-" + domainUid);
    pvMap.put(
        "weblogicDomainStoragePath",
        pvRoot + "/acceptance_test_pv/persistentVolume-" + domainUid);
    pvMap.values().removeIf(Objects::isNull);
    new PersistentVolume(pvRoot + "/acceptance_test_pv/persistentVolume-" + domainUid, pvMap);
    String cmd =
        BaseTest.getProjectRoot()
            + "/src/integration-tests/bash/krun.sh -m "
            + "/scratch:/scratch -n " + domainNS + " -c \"ls -ltr /scratch "
            + pvRoot
            + " "
            + pvRoot
            + "/acceptance_test_pv"
            + "\"";
    LoggerHelper.getLocal().log(Level.INFO, "Check PVROOT by running " + cmd);
    ExecResult result = ExecCommand.exec(cmd);
    LoggerHelper.getLocal().log(
        Level.INFO, "ls -ltr output " + result.stdout() + " err " + result.stderr());
  }
protected void createPv ( ) throws Exception { Yaml yaml = new Yaml ( ) ; InputStream pvis = new FileInputStream ( new File ( resultsDir + "/samples/scripts/create-weblogic-domain-pv-pvc/create-pv-pvc-inputs.yaml" ) ) ; pvMap = yaml . load ( pvis ) ; pvis . close ( ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "pvSharing for this domain is: " + pvSharing ) ; if ( ! pvSharing ) { pvMap . put ( "domainUID" , domainUid ) ; } else { pvMap . put ( "baseName" , "weblogic-sharing" ) ; } LoggerHelper . getLocal ( ) . log ( Level . INFO , "baseName of PVPVC for this domain is: " + ( String ) pvMap . get ( "baseName" ) ) ; if ( ( domainUid != null ) && ! pvSharing ) { domainMap . put ( "persistentVolumeClaimName" , domainUid + "-" + pvMap . get ( "baseName" ) + "-pvc" ) ; } else { domainMap . put ( "persistentVolumeClaimName" , pvMap . get ( "baseName" ) + "-pvc" ) ; } if ( domainMap . get ( "weblogicDomainStorageReclaimPolicy" ) != null ) { pvMap . put ( "weblogicDomainStorageReclaimPolicy" , domainMap . get ( "weblogicDomainStorageReclaimPolicy" ) ) ; } if ( domainMap . get ( "weblogicDomainStorageSize" ) != null ) { pvMap . put ( "weblogicDomainStorageSize" , domainMap . get ( "weblogicDomainStorageSize" ) ) ; } pvMap . put ( "namespace" , domainNS ) ; pvMap . put ( "weblogicDomainStorageNFSServer" , TestUtils . getHostName ( ) ) ; pvMap . put ( "userProjectsDir" , userProjectsDir ) ; pvMap . put ( "pvRoot" , pvRoot ) ; if ( BaseTest . OPENSHIFT ) { pvMap . put ( "weblogicDomainStorageType" , "NFS" ) ; } domainMap . put ( "weblogicDomainStoragePath" , pvRoot + "/acceptance_test_pv/persistentVolume-" + domainUid ) ; pvMap . put ( "weblogicDomainStoragePath" , pvRoot + "/acceptance_test_pv/persistentVolume-" + domainUid ) ; pvMap . values ( ) . removeIf ( Objects :: isNull ) ; new PersistentVolume ( pvRoot + "/acceptance_test_pv/persistentVolume-" + domainUid , pvMap ) ; String cmd = BaseTest . getProjectRoot ( ) + "/src/integration-tests/bash/krun.sh -m " + "/scratch:/scratch -n " + domainNS + " -c \"ls -ltr /scratch " + pvRoot + " " + pvRoot + "/acceptance_test_pv" + "\"" ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Check PVROOT by running " + cmd ) ; ExecResult result = ExecCommand . exec ( cmd ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "ls -ltr output " + result . stdout ( ) + " err " + result . stderr ( ) ) ; }
Create a map with attributes required to create PV/PVC and create PV dir by calling
 PersistentVolume.
Create a map with attributes required to create PV / PVC and create PV dir by calling PersistentVolume .
// Now there is only one pvSharing test case and we just use parameter "baseName"+"-pvc" as PVC // set pv path // k8s job mounts PVROOT /scratch/<usr>/wl_k8s_test_results to /scratch, create PV/PVC // + pvRoot