new-integration-tests/src/test/java/oracle/weblogic/kubernetes/extensions/ImageBuilders.java
public Callable<Boolean> createBasicImage(String imageName, String imageTag, String modelFile, String varFile,
                                            String appName, String domainType) {
    return (() -> {
      LoggingFacade logger = getLogger();
      final String image = imageName + ":" + imageTag;

      // build the model file list
      final List<String> modelList = Collections.singletonList(MODEL_DIR + "/" + modelFile);

      // build an application archive using what is in resources/apps/APP_NAME
      logger.info("Build an application archive using resources/apps/{0}", appName);
      assertTrue(buildAppArchive(defaultAppParams()
                      .srcDirList(Collections.singletonList(appName))),
              String.format("Failed to create app archive for %s", appName));

      // build the archive list
      String zipFile = String.format("%s/%s.zip", ARCHIVE_DIR, appName);
      final List<String> archiveList = Collections.singletonList(zipFile);

      // Set additional environment variables for WIT
      checkDirectory(WIT_BUILD_DIR);
      Map<String, String> env = new HashMap<>();
      env.put("WLSIMG_BLDDIR", WIT_BUILD_DIR);

      // For k8s 1.16 support and as of May 6, 2020, we presently need a different JDK for these
      // tests and for image tool. This is expected to no longer be necessary once JDK 11.0.8 or
      // the next JDK 14 versions are released.
      String witJavaHome = System.getenv("WIT_JAVA_HOME");
      if (witJavaHome != null) {
        env.put("JAVA_HOME", witJavaHome);
      }

      // build an image using WebLogic Image Tool
      boolean imageCreation = false;
      logger.info("Create image {0} using model directory {1}", image, MODEL_DIR);
      if (domainType.equalsIgnoreCase("wdt")) {
        final List<String> modelVarList = Collections.singletonList(MODEL_DIR + "/" + varFile);
        imageCreation = createImage(
                defaultWitParams()
                        .modelImageName(imageName)
                        .modelImageTag(WDT_BASIC_IMAGE_TAG)
                        .modelFiles(modelList)
                        .modelArchiveFiles(archiveList)
                        .modelVariableFiles(modelVarList)
                        .domainHome(WDT_BASIC_IMAGE_DOMAINHOME)
                        .wdtOperation("CREATE")
                        .wdtVersion(WDT_VERSION)
                        .env(env)
                        .redirect(true));
      } else if (domainType.equalsIgnoreCase("mii")) {
        imageCreation = createImage(
                defaultWitParams()
                        .modelImageName(imageName)
                        .modelImageTag(MII_BASIC_IMAGE_TAG)
                        .modelFiles(modelList)
                        .modelArchiveFiles(archiveList)
                        .wdtModelOnly(true)
                        .wdtVersion(WDT_VERSION)
                        .env(env)
                        .redirect(true));
      }
      return imageCreation;
    });
  }
/**
   * Create image with basic domain model yaml, variable file and sample application.
   * @param imageName name of the image
   * @param imageTag tag of the image
   * @param modelFile model file to build the image
   * @param varFile variable file to build the image
   * @param appName name of the application to build the image
   * @param domainType domain type to be built
   * @return true if image is created successfully
   */
Create image with basic domain model yaml, variable file and sample application.
Create image with basic domain model yaml variable file and sample application .
public Callable<Boolean> createBasicImage(String imageName, String imageTag, String modelFile, String varFile,
                                            String appName, String domainType) {
    return (() -> {
      LoggingFacade logger = getLogger();
      final String image = imageName + ":" + imageTag;
      final List<String> modelList = Collections.singletonList(MODEL_DIR + "/" + modelFile);
      logger.info("Build an application archive using resources/apps/{0}", appName);
      assertTrue(buildAppArchive(defaultAppParams()
                      .srcDirList(Collections.singletonList(appName))),
              String.format("Failed to create app archive for %s", appName));
      String zipFile = String.format("%s/%s.zip", ARCHIVE_DIR, appName);
      final List<String> archiveList = Collections.singletonList(zipFile);
      checkDirectory(WIT_BUILD_DIR);
      Map<String, String> env = new HashMap<>();
      env.put("WLSIMG_BLDDIR", WIT_BUILD_DIR);
      String witJavaHome = System.getenv("WIT_JAVA_HOME");
      if (witJavaHome != null) {
        env.put("JAVA_HOME", witJavaHome);
      }
      boolean imageCreation = false;
      logger.info("Create image {0} using model directory {1}", image, MODEL_DIR);
      if (domainType.equalsIgnoreCase("wdt")) {
        final List<String> modelVarList = Collections.singletonList(MODEL_DIR + "/" + varFile);
        imageCreation = createImage(
                defaultWitParams()
                        .modelImageName(imageName)
                        .modelImageTag(WDT_BASIC_IMAGE_TAG)
                        .modelFiles(modelList)
                        .modelArchiveFiles(archiveList)
                        .modelVariableFiles(modelVarList)
                        .domainHome(WDT_BASIC_IMAGE_DOMAINHOME)
                        .wdtOperation("CREATE")
                        .wdtVersion(WDT_VERSION)
                        .env(env)
                        .redirect(true));
      } else if (domainType.equalsIgnoreCase("mii")) {
        imageCreation = createImage(
                defaultWitParams()
                        .modelImageName(imageName)
                        .modelImageTag(MII_BASIC_IMAGE_TAG)
                        .modelFiles(modelList)
                        .modelArchiveFiles(archiveList)
                        .wdtModelOnly(true)
                        .wdtVersion(WDT_VERSION)
                        .env(env)
                        .redirect(true));
      }
      return imageCreation;
    });
  }
public Callable < Boolean > createBasicImage ( String imageName , String imageTag , String modelFile , String varFile , String appName , String domainType ) { return ( ( ) -> { LoggingFacade logger = getLogger ( ) ; final String image = imageName + ":" + imageTag ; final List < String > modelList = Collections . singletonList ( MODEL_DIR + "/" + modelFile ) ; logger . info ( "Build an application archive using resources/apps/{0}" , appName ) ; assertTrue ( buildAppArchive ( defaultAppParams ( ) . srcDirList ( Collections . singletonList ( appName ) ) ) , String . format ( "Failed to create app archive for %s" , appName ) ) ; String zipFile = String . format ( "%s/%s.zip" , ARCHIVE_DIR , appName ) ; final List < String > archiveList = Collections . singletonList ( zipFile ) ; checkDirectory ( WIT_BUILD_DIR ) ; Map < String , String > env = new HashMap < > ( ) ; env . put ( "WLSIMG_BLDDIR" , WIT_BUILD_DIR ) ; String witJavaHome = System . getenv ( "WIT_JAVA_HOME" ) ; if ( witJavaHome != null ) { env . put ( "JAVA_HOME" , witJavaHome ) ; } boolean imageCreation = false ; logger . info ( "Create image {0} using model directory {1}" , image , MODEL_DIR ) ; if ( domainType . equalsIgnoreCase ( "wdt" ) ) { final List < String > modelVarList = Collections . singletonList ( MODEL_DIR + "/" + varFile ) ; imageCreation = createImage ( defaultWitParams ( ) . modelImageName ( imageName ) . modelImageTag ( WDT_BASIC_IMAGE_TAG ) . modelFiles ( modelList ) . modelArchiveFiles ( archiveList ) . modelVariableFiles ( modelVarList ) . domainHome ( WDT_BASIC_IMAGE_DOMAINHOME ) . wdtOperation ( "CREATE" ) . wdtVersion ( WDT_VERSION ) . env ( env ) . redirect ( true ) ) ; } else if ( domainType . equalsIgnoreCase ( "mii" ) ) { imageCreation = createImage ( defaultWitParams ( ) . modelImageName ( imageName ) . modelImageTag ( MII_BASIC_IMAGE_TAG ) . modelFiles ( modelList ) . modelArchiveFiles ( archiveList ) . wdtModelOnly ( true ) . wdtVersion ( WDT_VERSION ) . env ( env ) . redirect ( true ) ) ; } return imageCreation ; } ) ; }
Create image with basic domain model yaml, variable file and sample application.
Create image with basic domain model yaml variable file and sample application .
// build the model file list // build an application archive using what is in resources/apps/APP_NAME // build the archive list // Set additional environment variables for WIT // For k8s 1.16 support and as of May 6, 2020, we presently need a different JDK for these // tests and for image tool. This is expected to no longer be necessary once JDK 11.0.8 or // the next JDK 14 versions are released. // build an image using WebLogic Image Tool