new-integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonTestUtils.java
public static void createPV(String pvName, String domainUid, String className) {

    LoggingFacade logger = getLogger();
    logger.info("creating persistent volume for pvName {0}, domainUid: {1}, className: {2}",
        pvName, domainUid, className);
    Path pvHostPath = null;
    // when tests are running in local box the PV directories need to exist
    try {
      pvHostPath = Files.createDirectories(Paths.get(
          PV_ROOT, className, pvName));
      logger.info("Creating PV directory host path {0}", pvHostPath);
      org.apache.commons.io.FileUtils.deleteDirectory(pvHostPath.toFile());
      Files.createDirectories(pvHostPath);
    } catch (IOException ioex) {
      logger.severe(ioex.getMessage());
      fail("Create persistent volume host path failed");
    }

    V1PersistentVolume v1pv = new V1PersistentVolume()
        .spec(new V1PersistentVolumeSpec()
            .addAccessModesItem("ReadWriteMany")
            .storageClassName("weblogic-domain-storage-class")
            .volumeMode("Filesystem")
            .putCapacityItem("storage", Quantity.fromString("5Gi"))
            .persistentVolumeReclaimPolicy("Recycle")
            .accessModes(Arrays.asList("ReadWriteMany"))
            .hostPath(new V1HostPathVolumeSource()
                .path(pvHostPath.toString())))
        .metadata(new V1ObjectMeta()
            .name(pvName)
            .putLabelsItem("weblogic.resourceVersion", "domain-v2")
            .putLabelsItem("weblogic.domainUid", domainUid));
    boolean success = assertDoesNotThrow(() -> createPersistentVolume(v1pv),
        "Failed to create persistent volume");
    assertTrue(success, "PersistentVolume creation failed");
  }
/** Create a persistent volume.
   * @param pvName name of the persistent volume to create
   * @param domainUid domain UID
   * @param className name of the class to call this method
  */
Create a persistent volume.
@param pvName name of the persistent volume to create
@param domainUid domain UID
@param className name of the class to call this method
Create a persistent volume . @param pvName name of the persistent volume to create @param domainUid domain UID @param className name of the class to call this method
public static void createPV(String pvName, String domainUid, String className) {
    LoggingFacade logger = getLogger();
    logger.info("creating persistent volume for pvName {0}, domainUid: {1}, className: {2}",
        pvName, domainUid, className);
    Path pvHostPath = null;
    try {
      pvHostPath = Files.createDirectories(Paths.get(
          PV_ROOT, className, pvName));
      logger.info("Creating PV directory host path {0}", pvHostPath);
      org.apache.commons.io.FileUtils.deleteDirectory(pvHostPath.toFile());
      Files.createDirectories(pvHostPath);
    } catch (IOException ioex) {
      logger.severe(ioex.getMessage());
      fail("Create persistent volume host path failed");
    }
    V1PersistentVolume v1pv = new V1PersistentVolume()
        .spec(new V1PersistentVolumeSpec()
            .addAccessModesItem("ReadWriteMany")
            .storageClassName("weblogic-domain-storage-class")
            .volumeMode("Filesystem")
            .putCapacityItem("storage", Quantity.fromString("5Gi"))
            .persistentVolumeReclaimPolicy("Recycle")
            .accessModes(Arrays.asList("ReadWriteMany"))
            .hostPath(new V1HostPathVolumeSource()
                .path(pvHostPath.toString())))
        .metadata(new V1ObjectMeta()
            .name(pvName)
            .putLabelsItem("weblogic.resourceVersion", "domain-v2")
            .putLabelsItem("weblogic.domainUid", domainUid));
    boolean success = assertDoesNotThrow(() -> createPersistentVolume(v1pv),
        "Failed to create persistent volume");
    assertTrue(success, "PersistentVolume creation failed");
  }
public static void createPV ( String pvName , String domainUid , String className ) { LoggingFacade logger = getLogger ( ) ; logger . info ( "creating persistent volume for pvName {0}, domainUid: {1}, className: {2}" , pvName , domainUid , className ) ; Path pvHostPath = null ; try { pvHostPath = Files . createDirectories ( Paths . get ( PV_ROOT , className , pvName ) ) ; logger . info ( "Creating PV directory host path {0}" , pvHostPath ) ; org . apache . commons . io . FileUtils . deleteDirectory ( pvHostPath . toFile ( ) ) ; Files . createDirectories ( pvHostPath ) ; } catch ( IOException ioex ) { logger . severe ( ioex . getMessage ( ) ) ; fail ( "Create persistent volume host path failed" ) ; } V1PersistentVolume v1pv = new V1PersistentVolume ( ) . spec ( new V1PersistentVolumeSpec ( ) . addAccessModesItem ( "ReadWriteMany" ) . storageClassName ( "weblogic-domain-storage-class" ) . volumeMode ( "Filesystem" ) . putCapacityItem ( "storage" , Quantity . fromString ( "5Gi" ) ) . persistentVolumeReclaimPolicy ( "Recycle" ) . accessModes ( Arrays . asList ( "ReadWriteMany" ) ) . hostPath ( new V1HostPathVolumeSource ( ) . path ( pvHostPath . toString ( ) ) ) ) . metadata ( new V1ObjectMeta ( ) . name ( pvName ) . putLabelsItem ( "weblogic.resourceVersion" , "domain-v2" ) . putLabelsItem ( "weblogic.domainUid" , domainUid ) ) ; boolean success = assertDoesNotThrow ( ( ) -> createPersistentVolume ( v1pv ) , "Failed to create persistent volume" ) ; assertTrue ( success , "PersistentVolume creation failed" ) ; }
Create a persistent volume.
Create a persistent volume .
// when tests are running in local box the PV directories need to exist