new-integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiConfigMap.java
@Test
  @Order(1)
  @DisplayName("Create model in image domain with a configmap")
  @Slow
  @MustNotRunInParallel
  public void testCreateMiiConfigMapDomain() {
    final int replicaCount = 2;

    // Create the repo secret to pull the image
    assertDoesNotThrow(() -> createRepoSecret(domainNamespace),
            String.format("createSecret failed for %s", REPO_SECRET_NAME));

    // create secret for admin credentials
    logger.info("Create secret for admin credentials");
    String adminSecretName = "weblogic-credentials";
    assertDoesNotThrow(() -> createDomainSecret(adminSecretName,"weblogic",
            "welcome1", domainNamespace),
            String.format("createSecret failed for %s", adminSecretName));

    // create encryption secret
    logger.info("Create encryption secret");
    String encryptionSecretName = "encryptionsecret";
    assertDoesNotThrow(() -> createDomainSecret(encryptionSecretName, "weblogicenc",
            "weblogicenc", domainNamespace),
             String.format("createSecret failed for %s", encryptionSecretName));

    //ToDo need to replace with actual URL once we have dynamic PDB instance 
    //is available thru JUnit5 extension framework
    logger.info("Create database secret");
    final String dbSecretName = domainUid  + "-db-secret";
    assertDoesNotThrow(() -> createDatabaseSecret(dbSecretName, "scott",
            "tiger", "jdbc:oracle:thin:localhost:/ORCLCDB", domainNamespace),
             String.format("createSecret failed for %s", dbSecretName));

    String configMapName = "jdbc-jms-wldf-configmap";

    createConfigMapAndVerify(
        configMapName, domainUid, domainNamespace,
        Arrays.asList("model.jdbc.yaml", "model.jms.yaml", "model.wldf.yaml"));

    // create the domain CR with a pre-defined configmap
    createDomainResource(domainUid, domainNamespace, adminSecretName,
        REPO_SECRET_NAME, encryptionSecretName,
        replicaCount, configMapName, dbSecretName);

    // wait for the domain to exist
    logger.info("Check for domain custom resource in namespace {0}", domainNamespace);
    withStandardRetryPolicy
        .conditionEvaluationListener(
            condition -> logger.info("Waiting for domain {0} to be created in namespace {1} "
                    + "(elapsed time {2}ms, remaining time {3}ms)",
                domainUid,
                domainNamespace,
                condition.getElapsedTimeInMS(),
                condition.getRemainingTimeInMS()))
        .until(domainExists(domainUid, DOMAIN_VERSION, domainNamespace));


    // check admin server pod exists
    logger.info("Check for admin server pod {0} existence in namespace {1}",
        adminServerPodName, domainNamespace);
    checkPodReady(adminServerPodName, domainUid, domainNamespace);

    // check managed server pods exist
    for (int i = 1; i <= replicaCount; i++) {
      logger.info("Check for managed server pod {0} existence in namespace {1}",
          managedServerPrefix + i, domainNamespace);
      checkPodReady(managedServerPrefix + i, domainUid, domainNamespace);
    }

    // check admin server pod is ready
    logger.info("Wait for admin server pod {0} to be ready in namespace {1}",
        adminServerPodName, domainNamespace);
    checkPodReady(adminServerPodName, domainUid, domainNamespace);

    // check managed server pods are ready
    for (int i = 1; i <= replicaCount; i++) {
      logger.info("Wait for managed server pod {0} to be ready in namespace {1}",
          managedServerPrefix + i, domainNamespace);
      checkPodReady(managedServerPrefix + i, domainUid, domainNamespace);
    }

    logger.info("Check admin service {0} is created in namespace {1}",
        adminServerPodName, domainNamespace);
    checkServiceExists(adminServerPodName, domainNamespace);

    // check managed server services created
    for (int i = 1; i <= replicaCount; i++) {
      logger.info("Check managed server service {0} is created in namespace {1}",
          managedServerPrefix + i, domainNamespace);
      checkServiceExists(managedServerPrefix + i, domainNamespace);
    }

    ExecResult result = null;
    result = checkSystemResourceConfiguration("JDBCSystemResources", "TestDataSource");
    assertNotNull(result, "CheckJDBCSystemResources returned null");
    logger.info("CheckJDBCSystemResource returned {0}", result.toString());
    assertEquals("200", result.stdout(), "DataSource configuration not found");
    logger.info("Found the DataSource configuration");

    result = null;
    result = checkSystemResourceConfiguration("JMSSystemResources", "TestClusterJmsModule");
    assertNotNull(result, "CheckJMSSystemResources returned null");
    logger.info("CheckJMSSystemResource returned {0}", result.toString());
    assertEquals("200", result.stdout(), "JMSSystemResource not found");
    logger.info("Found the JMSSystemResource configuration");

    result = null;
    result = checkSystemResourceConfiguration("WLDFSystemResources", "TestWldfModule");
    assertNotNull(result, "CheckWLDFSystemResources returned null");
    logger.info("CheckWLDFSystemResource returned {0}", result.toString());
    assertEquals("200", result.stdout(), "WLDFSystemResource not found");
    logger.info("Found the WLDFSystemResource configuration");

    result = null;
    result = checkJdbcRuntime("TestDataSource");
    logger.info("checkJdbcRuntime: returned {0}", result.toString());
    assertTrue(result.stdout().contains("jdbc:oracle:thin:localhost"),
         String.format("Overriden Database URL not found on RuntimeMBean"));
    assertTrue(result.stdout().contains("scott"),
         String.format("Overriden Database user not found on RuntimeMBean"));
  }
/**
   * Deploy a WebLogic domain with a defined configmap in configuration/model section of the domain resource.
   * The configmap has multiple sparse WDT model files that define 
   * a JDBCSystemResource, a JMSSystemResource, and a WLDFSystemResource.
   * Verify all the SystemResource configurations using the rest API call using adminserver's public nodeport
   */
Deploy a WebLogic domain with a defined configmap in configuration/model section of the domain resource.
The configmap has multiple sparse WDT model files that define
a JDBCSystemResource, a JMSSystemResource, and a WLDFSystemResource.
Verify all the SystemResource configurations using the rest API call using adminserver's public nodeport
Deploy a WebLogic domain with a defined configmap in configuration / model section of the domain resource . The configmap has multiple sparse WDT model files that define a JDBCSystemResource a JMSSystemResource and a WLDFSystemResource . Verify all the SystemResource configurations using the rest API call using adminserver ' s public nodeport
@Test
  @Order(1)
  @DisplayName("Create model in image domain with a configmap")
  @Slow
  @MustNotRunInParallel
  public void testCreateMiiConfigMapDomain() {
    final int replicaCount = 2;
    assertDoesNotThrow(() -> createRepoSecret(domainNamespace),
            String.format("createSecret failed for %s", REPO_SECRET_NAME));
    logger.info("Create secret for admin credentials");
    String adminSecretName = "weblogic-credentials";
    assertDoesNotThrow(() -> createDomainSecret(adminSecretName,"weblogic",
            "welcome1", domainNamespace),
            String.format("createSecret failed for %s", adminSecretName));
    logger.info("Create encryption secret");
    String encryptionSecretName = "encryptionsecret";
    assertDoesNotThrow(() -> createDomainSecret(encryptionSecretName, "weblogicenc",
            "weblogicenc", domainNamespace),
             String.format("createSecret failed for %s", encryptionSecretName));
    logger.info("Create database secret");
    final String dbSecretName = domainUid  + "-db-secret";
    assertDoesNotThrow(() -> createDatabaseSecret(dbSecretName, "scott",
            "tiger", "jdbc:oracle:thin:localhost:/ORCLCDB", domainNamespace),
             String.format("createSecret failed for %s", dbSecretName));
    String configMapName = "jdbc-jms-wldf-configmap";
    createConfigMapAndVerify(
        configMapName, domainUid, domainNamespace,
        Arrays.asList("model.jdbc.yaml", "model.jms.yaml", "model.wldf.yaml"));
    createDomainResource(domainUid, domainNamespace, adminSecretName,
        REPO_SECRET_NAME, encryptionSecretName,
        replicaCount, configMapName, dbSecretName);
    logger.info("Check for domain custom resource in namespace {0}", domainNamespace);
    withStandardRetryPolicy
        .conditionEvaluationListener(
            condition -> logger.info("Waiting for domain {0} to be created in namespace {1} "
                    + "(elapsed time {2}ms, remaining time {3}ms)",
                domainUid,
                domainNamespace,
                condition.getElapsedTimeInMS(),
                condition.getRemainingTimeInMS()))
        .until(domainExists(domainUid, DOMAIN_VERSION, domainNamespace));
    logger.info("Check for admin server pod {0} existence in namespace {1}",
        adminServerPodName, domainNamespace);
    checkPodReady(adminServerPodName, domainUid, domainNamespace);
    for (int i = 1; i <= replicaCount; i++) {
      logger.info("Check for managed server pod {0} existence in namespace {1}",
          managedServerPrefix + i, domainNamespace);
      checkPodReady(managedServerPrefix + i, domainUid, domainNamespace);
    }
    logger.info("Wait for admin server pod {0} to be ready in namespace {1}",
        adminServerPodName, domainNamespace);
    checkPodReady(adminServerPodName, domainUid, domainNamespace);
    for (int i = 1; i <= replicaCount; i++) {
      logger.info("Wait for managed server pod {0} to be ready in namespace {1}",
          managedServerPrefix + i, domainNamespace);
      checkPodReady(managedServerPrefix + i, domainUid, domainNamespace);
    }
    logger.info("Check admin service {0} is created in namespace {1}",
        adminServerPodName, domainNamespace);
    checkServiceExists(adminServerPodName, domainNamespace);
    for (int i = 1; i <= replicaCount; i++) {
      logger.info("Check managed server service {0} is created in namespace {1}",
          managedServerPrefix + i, domainNamespace);
      checkServiceExists(managedServerPrefix + i, domainNamespace);
    }
    ExecResult result = null;
    result = checkSystemResourceConfiguration("JDBCSystemResources", "TestDataSource");
    assertNotNull(result, "CheckJDBCSystemResources returned null");
    logger.info("CheckJDBCSystemResource returned {0}", result.toString());
    assertEquals("200", result.stdout(), "DataSource configuration not found");
    logger.info("Found the DataSource configuration");
    result = null;
    result = checkSystemResourceConfiguration("JMSSystemResources", "TestClusterJmsModule");
    assertNotNull(result, "CheckJMSSystemResources returned null");
    logger.info("CheckJMSSystemResource returned {0}", result.toString());
    assertEquals("200", result.stdout(), "JMSSystemResource not found");
    logger.info("Found the JMSSystemResource configuration");
    result = null;
    result = checkSystemResourceConfiguration("WLDFSystemResources", "TestWldfModule");
    assertNotNull(result, "CheckWLDFSystemResources returned null");
    logger.info("CheckWLDFSystemResource returned {0}", result.toString());
    assertEquals("200", result.stdout(), "WLDFSystemResource not found");
    logger.info("Found the WLDFSystemResource configuration");
    result = null;
    result = checkJdbcRuntime("TestDataSource");
    logger.info("checkJdbcRuntime: returned {0}", result.toString());
    assertTrue(result.stdout().contains("jdbc:oracle:thin:localhost"),
         String.format("Overriden Database URL not found on RuntimeMBean"));
    assertTrue(result.stdout().contains("scott"),
         String.format("Overriden Database user not found on RuntimeMBean"));
  }
@ Test @ Order ( 1 ) @ DisplayName ( "Create model in image domain with a configmap" ) @ Slow @ MustNotRunInParallel public void testCreateMiiConfigMapDomain ( ) { final int replicaCount = 2 ; assertDoesNotThrow ( ( ) -> createRepoSecret ( domainNamespace ) , String . format ( "createSecret failed for %s" , REPO_SECRET_NAME ) ) ; logger . info ( "Create secret for admin credentials" ) ; String adminSecretName = "weblogic-credentials" ; assertDoesNotThrow ( ( ) -> createDomainSecret ( adminSecretName , "weblogic" , "welcome1" , domainNamespace ) , String . format ( "createSecret failed for %s" , adminSecretName ) ) ; logger . info ( "Create encryption secret" ) ; String encryptionSecretName = "encryptionsecret" ; assertDoesNotThrow ( ( ) -> createDomainSecret ( encryptionSecretName , "weblogicenc" , "weblogicenc" , domainNamespace ) , String . format ( "createSecret failed for %s" , encryptionSecretName ) ) ; logger . info ( "Create database secret" ) ; final String dbSecretName = domainUid + "-db-secret" ; assertDoesNotThrow ( ( ) -> createDatabaseSecret ( dbSecretName , "scott" , "tiger" , "jdbc:oracle:thin:localhost:/ORCLCDB" , domainNamespace ) , String . format ( "createSecret failed for %s" , dbSecretName ) ) ; String configMapName = "jdbc-jms-wldf-configmap" ; createConfigMapAndVerify ( configMapName , domainUid , domainNamespace , Arrays . asList ( "model.jdbc.yaml" , "model.jms.yaml" , "model.wldf.yaml" ) ) ; createDomainResource ( domainUid , domainNamespace , adminSecretName , REPO_SECRET_NAME , encryptionSecretName , replicaCount , configMapName , dbSecretName ) ; logger . info ( "Check for domain custom resource in namespace {0}" , domainNamespace ) ; withStandardRetryPolicy . conditionEvaluationListener ( condition -> logger . info ( "Waiting for domain {0} to be created in namespace {1} " + "(elapsed time {2}ms, remaining time {3}ms)" , domainUid , domainNamespace , condition . getElapsedTimeInMS ( ) , condition . getRemainingTimeInMS ( ) ) ) . until ( domainExists ( domainUid , DOMAIN_VERSION , domainNamespace ) ) ; logger . info ( "Check for admin server pod {0} existence in namespace {1}" , adminServerPodName , domainNamespace ) ; checkPodReady ( adminServerPodName , domainUid , domainNamespace ) ; for ( int i = 1 ; i <= replicaCount ; i ++ ) { logger . info ( "Check for managed server pod {0} existence in namespace {1}" , managedServerPrefix + i , domainNamespace ) ; checkPodReady ( managedServerPrefix + i , domainUid , domainNamespace ) ; } logger . info ( "Wait for admin server pod {0} to be ready in namespace {1}" , adminServerPodName , domainNamespace ) ; checkPodReady ( adminServerPodName , domainUid , domainNamespace ) ; for ( int i = 1 ; i <= replicaCount ; i ++ ) { logger . info ( "Wait for managed server pod {0} to be ready in namespace {1}" , managedServerPrefix + i , domainNamespace ) ; checkPodReady ( managedServerPrefix + i , domainUid , domainNamespace ) ; } logger . info ( "Check admin service {0} is created in namespace {1}" , adminServerPodName , domainNamespace ) ; checkServiceExists ( adminServerPodName , domainNamespace ) ; for ( int i = 1 ; i <= replicaCount ; i ++ ) { logger . info ( "Check managed server service {0} is created in namespace {1}" , managedServerPrefix + i , domainNamespace ) ; checkServiceExists ( managedServerPrefix + i , domainNamespace ) ; } ExecResult result = null ; result = checkSystemResourceConfiguration ( "JDBCSystemResources" , "TestDataSource" ) ; assertNotNull ( result , "CheckJDBCSystemResources returned null" ) ; logger . info ( "CheckJDBCSystemResource returned {0}" , result . toString ( ) ) ; assertEquals ( "200" , result . stdout ( ) , "DataSource configuration not found" ) ; logger . info ( "Found the DataSource configuration" ) ; result = null ; result = checkSystemResourceConfiguration ( "JMSSystemResources" , "TestClusterJmsModule" ) ; assertNotNull ( result , "CheckJMSSystemResources returned null" ) ; logger . info ( "CheckJMSSystemResource returned {0}" , result . toString ( ) ) ; assertEquals ( "200" , result . stdout ( ) , "JMSSystemResource not found" ) ; logger . info ( "Found the JMSSystemResource configuration" ) ; result = null ; result = checkSystemResourceConfiguration ( "WLDFSystemResources" , "TestWldfModule" ) ; assertNotNull ( result , "CheckWLDFSystemResources returned null" ) ; logger . info ( "CheckWLDFSystemResource returned {0}" , result . toString ( ) ) ; assertEquals ( "200" , result . stdout ( ) , "WLDFSystemResource not found" ) ; logger . info ( "Found the WLDFSystemResource configuration" ) ; result = null ; result = checkJdbcRuntime ( "TestDataSource" ) ; logger . info ( "checkJdbcRuntime: returned {0}" , result . toString ( ) ) ; assertTrue ( result . stdout ( ) . contains ( "jdbc:oracle:thin:localhost" ) , String . format ( "Overriden Database URL not found on RuntimeMBean" ) ) ; assertTrue ( result . stdout ( ) . contains ( "scott" ) , String . format ( "Overriden Database user not found on RuntimeMBean" ) ) ; }
Deploy a WebLogic domain with a defined configmap in configuration/model section of the domain resource.
Deploy a WebLogic domain with a defined configmap in configuration / model section of the domain resource .
// Create the repo secret to pull the image // create secret for admin credentials // create encryption secret //ToDo need to replace with actual URL once we have dynamic PDB instance  //is available thru JUnit5 extension framework // create the domain CR with a pre-defined configmap // wait for the domain to exist // check admin server pod exists // check managed server pods exist // check admin server pod is ready // check managed server pods are ready // check managed server services created