new-integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporter.java
private static String createAndVerifyDomainInImage() {
    // create image with model files
    logger.info("Create image with model file with monitoring exporter app and verify");
    String app1Path = String.format("%s/wls-exporter.war", monitoringExporterAppDir);
    String app2Path = String.format("%s/../src/integration-tests/apps/testwebapp.war", ITTESTS_DIR);

    List<String> appList = new ArrayList();
    appList.add(app1Path);
    appList.add(app2Path);

    final int t3ChannelPort = getNextFreePort(31000, 32767);  // the port range has to be between 30,000 to 32,767

    Properties p = new Properties();
    p.setProperty("ADMIN_USER", ADMIN_USERNAME_DEFAULT);
    p.setProperty("ADMIN_PWD", ADMIN_PASSWORD_DEFAULT);
    p.setProperty("DOMAIN_NAME", domain2Uid);
    p.setProperty("ADMIN_NAME", "admin-server");
    p.setProperty("PRODUCTION_MODE_ENABLED", "true");
    p.setProperty("CLUSTER_NAME", clusterName);
    p.setProperty("CLUSTER_TYPE", "DYNAMIC");
    p.setProperty("CONFIGURED_MANAGED_SERVER_COUNT", "2");
    p.setProperty("MANAGED_SERVER_NAME_BASE", "managed-server");
    p.setProperty("T3_CHANNEL_PORT", Integer.toString(t3ChannelPort));
    p.setProperty("T3_PUBLIC_ADDRESS", K8S_NODEPORT_HOST);
    p.setProperty("MANAGED_SERVER_PORT", "8001");
    p.setProperty("SERVER_START_MODE", "prod");
    p.setProperty("ADMIN_PORT", "7001");
    p.setProperty("MYSQL_USER", "wluser1");
    p.setProperty("MYSQL_PWD", "wlpwd123");
    // create a temporary WebLogic domain property file as a input for WDT model file
    File domainPropertiesFile = assertDoesNotThrow(() ->
                    File.createTempFile("domain", "properties"),
            "Failed to create domain properties file");
    assertDoesNotThrow(() ->
                    p.store(new FileOutputStream(domainPropertiesFile), "WDT properties file"),
            "Failed to write domain properties file");

    final List<String> propertyList = Collections.singletonList(domainPropertiesFile.getPath());

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

    wdtImage =
        createImageAndVerify(MONEXP_IMAGE_NAME,
                modelList,
                appList,
                propertyList,
                WLS_BASE_IMAGE_NAME,
                WLS_BASE_IMAGE_TAG,
                WLS,
                false,
                domain2Uid, true);



    // docker login and push image to docker registry if necessary
    dockerLoginAndPushImageToRegistry(wdtImage);

    // create docker registry secret to pull the image from registry
    logger.info("Create docker registry secret in namespace {0}", domain2Namespace);
    assertDoesNotThrow(() -> createDockerRegistrySecret(domain2Namespace),
        String.format("create Docker Registry Secret failed for %s", REPO_SECRET_NAME));

    return wdtImage;
  }
/**
   * Create and verify domain in image from endtoend sample topology with monitoring exporter.
   * @return image name
   */
Create and verify domain in image from endtoend sample topology with monitoring exporter.
@return image name
Create and verify domain in image from endtoend sample topology with monitoring exporter . @return image name
private static String createAndVerifyDomainInImage() {
    logger.info("Create image with model file with monitoring exporter app and verify");
    String app1Path = String.format("%s/wls-exporter.war", monitoringExporterAppDir);
    String app2Path = String.format("%s/../src/integration-tests/apps/testwebapp.war", ITTESTS_DIR);
    List<String> appList = new ArrayList();
    appList.add(app1Path);
    appList.add(app2Path);
    final int t3ChannelPort = getNextFreePort(31000, 32767);  
    Properties p = new Properties();
    p.setProperty("ADMIN_USER", ADMIN_USERNAME_DEFAULT);
    p.setProperty("ADMIN_PWD", ADMIN_PASSWORD_DEFAULT);
    p.setProperty("DOMAIN_NAME", domain2Uid);
    p.setProperty("ADMIN_NAME", "admin-server");
    p.setProperty("PRODUCTION_MODE_ENABLED", "true");
    p.setProperty("CLUSTER_NAME", clusterName);
    p.setProperty("CLUSTER_TYPE", "DYNAMIC");
    p.setProperty("CONFIGURED_MANAGED_SERVER_COUNT", "2");
    p.setProperty("MANAGED_SERVER_NAME_BASE", "managed-server");
    p.setProperty("T3_CHANNEL_PORT", Integer.toString(t3ChannelPort));
    p.setProperty("T3_PUBLIC_ADDRESS", K8S_NODEPORT_HOST);
    p.setProperty("MANAGED_SERVER_PORT", "8001");
    p.setProperty("SERVER_START_MODE", "prod");
    p.setProperty("ADMIN_PORT", "7001");
    p.setProperty("MYSQL_USER", "wluser1");
    p.setProperty("MYSQL_PWD", "wlpwd123");
    File domainPropertiesFile = assertDoesNotThrow(() ->
                    File.createTempFile("domain", "properties"),
            "Failed to create domain properties file");
    assertDoesNotThrow(() ->
                    p.store(new FileOutputStream(domainPropertiesFile), "WDT properties file"),
            "Failed to write domain properties file");
    final List<String> propertyList = Collections.singletonList(domainPropertiesFile.getPath());
    final List<String> modelList = Collections.singletonList(monitoringExporterEndToEndDir
            + MONEXP_WDT_FILE);
    wdtImage =
        createImageAndVerify(MONEXP_IMAGE_NAME,
                modelList,
                appList,
                propertyList,
                WLS_BASE_IMAGE_NAME,
                WLS_BASE_IMAGE_TAG,
                WLS,
                false,
                domain2Uid, true);
    dockerLoginAndPushImageToRegistry(wdtImage);
    logger.info("Create docker registry secret in namespace {0}", domain2Namespace);
    assertDoesNotThrow(() -> createDockerRegistrySecret(domain2Namespace),
        String.format("create Docker Registry Secret failed for %s", REPO_SECRET_NAME));
    return wdtImage;
  }
private static String createAndVerifyDomainInImage ( ) { logger . info ( "Create image with model file with monitoring exporter app and verify" ) ; String app1Path = String . format ( "%s/wls-exporter.war" , monitoringExporterAppDir ) ; String app2Path = String . format ( "%s/../src/integration-tests/apps/testwebapp.war" , ITTESTS_DIR ) ; List < String > appList = new ArrayList ( ) ; appList . add ( app1Path ) ; appList . add ( app2Path ) ; final int t3ChannelPort = getNextFreePort ( 31000 , 32767 ) ; Properties p = new Properties ( ) ; p . setProperty ( "ADMIN_USER" , ADMIN_USERNAME_DEFAULT ) ; p . setProperty ( "ADMIN_PWD" , ADMIN_PASSWORD_DEFAULT ) ; p . setProperty ( "DOMAIN_NAME" , domain2Uid ) ; p . setProperty ( "ADMIN_NAME" , "admin-server" ) ; p . setProperty ( "PRODUCTION_MODE_ENABLED" , "true" ) ; p . setProperty ( "CLUSTER_NAME" , clusterName ) ; p . setProperty ( "CLUSTER_TYPE" , "DYNAMIC" ) ; p . setProperty ( "CONFIGURED_MANAGED_SERVER_COUNT" , "2" ) ; p . setProperty ( "MANAGED_SERVER_NAME_BASE" , "managed-server" ) ; p . setProperty ( "T3_CHANNEL_PORT" , Integer . toString ( t3ChannelPort ) ) ; p . setProperty ( "T3_PUBLIC_ADDRESS" , K8S_NODEPORT_HOST ) ; p . setProperty ( "MANAGED_SERVER_PORT" , "8001" ) ; p . setProperty ( "SERVER_START_MODE" , "prod" ) ; p . setProperty ( "ADMIN_PORT" , "7001" ) ; p . setProperty ( "MYSQL_USER" , "wluser1" ) ; p . setProperty ( "MYSQL_PWD" , "wlpwd123" ) ; File domainPropertiesFile = assertDoesNotThrow ( ( ) -> File . createTempFile ( "domain" , "properties" ) , "Failed to create domain properties file" ) ; assertDoesNotThrow ( ( ) -> p . store ( new FileOutputStream ( domainPropertiesFile ) , "WDT properties file" ) , "Failed to write domain properties file" ) ; final List < String > propertyList = Collections . singletonList ( domainPropertiesFile . getPath ( ) ) ; final List < String > modelList = Collections . singletonList ( monitoringExporterEndToEndDir + MONEXP_WDT_FILE ) ; wdtImage = createImageAndVerify ( MONEXP_IMAGE_NAME , modelList , appList , propertyList , WLS_BASE_IMAGE_NAME , WLS_BASE_IMAGE_TAG , WLS , false , domain2Uid , true ) ; dockerLoginAndPushImageToRegistry ( wdtImage ) ; logger . info ( "Create docker registry secret in namespace {0}" , domain2Namespace ) ; assertDoesNotThrow ( ( ) -> createDockerRegistrySecret ( domain2Namespace ) , String . format ( "create Docker Registry Secret failed for %s" , REPO_SECRET_NAME ) ) ; return wdtImage ; }
Create and verify domain in image from endtoend sample topology with monitoring exporter.
Create and verify domain in image from endtoend sample topology with monitoring exporter .
// create image with model files // the port range has to be between 30,000 to 32,767 // create a temporary WebLogic domain property file as a input for WDT model file // build the model file list // docker login and push image to docker registry if necessary // create docker registry secret to pull the image from registry