integration-tests/src/test/java/oracle/kubernetes/operator/ItMiiConfigUpdateCm.java
@Test
  public void testMiiConfigUpdateJdbcCm() {
    Assumptions.assumeTrue(QUICKTEST);
    String testMethodName = new Object() {
    }.getClass().getEnclosingMethod().getName();
    boolean testCompletedSuccessfully = false;
    // The value for property oracle.net.CONNECT_TIMEOUT set in model.jdbc.yaml
    // for a client to establish an Oracle Net connection to the database instance.
    final String connTimeout = "5200";
    Domain domain = null;

    try {
      logTestBegin(testMethodName);
      LoggerHelper.getLocal().log(Level.INFO,
          "Creating Domain & waiting for the script to complete execution");

      // create domain w JDBC DS using the image created by MII
      boolean createDS = true;
      domain = createDomainUsingMii(createDS, domainNS, testClassName);
      assertNotNull(domain, "Failed to create a domain");

      // get JDBC DS prop values via WLST on server pod
      final String destDir = getResultDir() + "/samples/model-in-image-update";
      String jdbcResourceData = getJdbcResources(destDir, domain);

      // verify that JDBC DS is created by checking DS name, JNDI name and read timeout
      LoggerHelper.getLocal().log(Level.INFO, "Verify that JDBC DS is created");
      final String[] jdbcResourcesToVerify1 =
          {"datasource.name.1=" + dsName,
              "datasource.jndiname.1=array(java.lang.String,['" + jndiName + "'])",
              "datasource.readTimeout.1=" + readTimeout_1};
      for (String prop : jdbcResourcesToVerify1) {
        assertTrue(jdbcResourceData.contains(prop), prop + " is not found");
        LoggerHelper.getLocal().log(Level.INFO, prop + " exists");
      }

      // copy model files that contains JDBC DS to a dir, re-create cm to update config,
      // patch domain to change domain-level restart version and verify domain restarted successfully
      final String[] modelFiles = {"model.jdbc.yaml", "model.jdbc.properties"};
      createCmAndPatchDomain(domain, destDir, modelFiles);

      // get JDBC DS props via WLST on server pod
      jdbcResourceData = getJdbcResources(destDir, domain);

      // verify that JDBC DS is updated by checking JDBC DS name,
      // connection timeout and read timeout via WLST on server pod
      LoggerHelper.getLocal().log(Level.INFO, "Verify that JDBC DS is created");
      final String[] jdbcResourcesToVerify2 =
          {"datasource.name.1=" + dsName,
              "datasource.readTimeout.1=" + readTimeout_2,
              "datasource.connectionTimeout.1=" + connTimeout};
      for (String prop : jdbcResourcesToVerify2) {
        assertTrue(jdbcResourceData.contains(prop), prop + " is not found");
        LoggerHelper.getLocal().log(Level.INFO, prop + " exists");
      }

      testCompletedSuccessfully = true;
    } catch (Exception ex) {
      fail("FAILED - " + testMethodName);
    } finally {
      if (domain != null && (JENKINS || testCompletedSuccessfully)) {
        try {
          TestUtils.deleteWeblogicDomainResources(domain.getDomainUid());
        } catch (Exception ex) {
          LoggerHelper.getLocal().log(Level.INFO, "Failed to delete domain\n " + ex.getMessage());
        }
      }
    }

    LoggerHelper.getLocal().log(Level.INFO, "SUCCESS - " + testMethodName);
  }
/**
   * Create a domain with a JDBC DS using model in image and having config map
   * in the domain.yaml before deploying the domain. After the domain resources
   * is created, re-create the config map with a model file that define a JDBC DataSource
   * and patch to change domain-level restart version to reload the model file,
   * generate new config and initiate a rolling restart.
   */
Create a domain with a JDBC DS using model in image and having config map
in the domain.yaml before deploying the domain. After the domain resources
is created, re-create the config map with a model file that define a JDBC DataSource
and patch to change domain-level restart version to reload the model file,
generate new config and initiate a rolling restart.
Create a domain with a JDBC DS using model in image and having config map in the domain . yaml before deploying the domain . After the domain resources is created re - create the config map with a model file that define a JDBC DataSource and patch to change domain - level restart version to reload the model file generate new config and initiate a rolling restart .
@Test
  public void testMiiConfigUpdateJdbcCm() {
    Assumptions.assumeTrue(QUICKTEST);
    String testMethodName = new Object() {
    }.getClass().getEnclosingMethod().getName();
    boolean testCompletedSuccessfully = false;
    final String connTimeout = "5200";
    Domain domain = null;
    try {
      logTestBegin(testMethodName);
      LoggerHelper.getLocal().log(Level.INFO,
          "Creating Domain & waiting for the script to complete execution");
      boolean createDS = true;
      domain = createDomainUsingMii(createDS, domainNS, testClassName);
      assertNotNull(domain, "Failed to create a domain");
      final String destDir = getResultDir() + "/samples/model-in-image-update";
      String jdbcResourceData = getJdbcResources(destDir, domain);
      LoggerHelper.getLocal().log(Level.INFO, "Verify that JDBC DS is created");
      final String[] jdbcResourcesToVerify1 =
          {"datasource.name.1=" + dsName,
              "datasource.jndiname.1=array(java.lang.String,['" + jndiName + "'])",
              "datasource.readTimeout.1=" + readTimeout_1};
      for (String prop : jdbcResourcesToVerify1) {
        assertTrue(jdbcResourceData.contains(prop), prop + " is not found");
        LoggerHelper.getLocal().log(Level.INFO, prop + " exists");
      }
      final String[] modelFiles = {"model.jdbc.yaml", "model.jdbc.properties"};
      createCmAndPatchDomain(domain, destDir, modelFiles);
      jdbcResourceData = getJdbcResources(destDir, domain);
      LoggerHelper.getLocal().log(Level.INFO, "Verify that JDBC DS is created");
      final String[] jdbcResourcesToVerify2 =
          {"datasource.name.1=" + dsName,
              "datasource.readTimeout.1=" + readTimeout_2,
              "datasource.connectionTimeout.1=" + connTimeout};
      for (String prop : jdbcResourcesToVerify2) {
        assertTrue(jdbcResourceData.contains(prop), prop + " is not found");
        LoggerHelper.getLocal().log(Level.INFO, prop + " exists");
      }
      testCompletedSuccessfully = true;
    } catch (Exception ex) {
      fail("FAILED - " + testMethodName);
    } finally {
      if (domain != null && (JENKINS || testCompletedSuccessfully)) {
        try {
          TestUtils.deleteWeblogicDomainResources(domain.getDomainUid());
        } catch (Exception ex) {
          LoggerHelper.getLocal().log(Level.INFO, "Failed to delete domain\n " + ex.getMessage());
        }
      }
    }
    LoggerHelper.getLocal().log(Level.INFO, "SUCCESS - " + testMethodName);
  }
@ Test public void testMiiConfigUpdateJdbcCm ( ) { Assumptions . assumeTrue ( QUICKTEST ) ; String testMethodName = new Object ( ) { } . getClass ( ) . getEnclosingMethod ( ) . getName ( ) ; boolean testCompletedSuccessfully = false ; final String connTimeout = "5200" ; Domain domain = null ; try { logTestBegin ( testMethodName ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Creating Domain & waiting for the script to complete execution" ) ; boolean createDS = true ; domain = createDomainUsingMii ( createDS , domainNS , testClassName ) ; assertNotNull ( domain , "Failed to create a domain" ) ; final String destDir = getResultDir ( ) + "/samples/model-in-image-update" ; String jdbcResourceData = getJdbcResources ( destDir , domain ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Verify that JDBC DS is created" ) ; final String [ ] jdbcResourcesToVerify1 = { "datasource.name.1=" + dsName , "datasource.jndiname.1=array(java.lang.String,['" + jndiName + "'])" , "datasource.readTimeout.1=" + readTimeout_1 } ; for ( String prop : jdbcResourcesToVerify1 ) { assertTrue ( jdbcResourceData . contains ( prop ) , prop + " is not found" ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , prop + " exists" ) ; } final String [ ] modelFiles = { "model.jdbc.yaml" , "model.jdbc.properties" } ; createCmAndPatchDomain ( domain , destDir , modelFiles ) ; jdbcResourceData = getJdbcResources ( destDir , domain ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Verify that JDBC DS is created" ) ; final String [ ] jdbcResourcesToVerify2 = { "datasource.name.1=" + dsName , "datasource.readTimeout.1=" + readTimeout_2 , "datasource.connectionTimeout.1=" + connTimeout } ; for ( String prop : jdbcResourcesToVerify2 ) { assertTrue ( jdbcResourceData . contains ( prop ) , prop + " is not found" ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , prop + " exists" ) ; } testCompletedSuccessfully = true ; } catch ( Exception ex ) { fail ( "FAILED - " + testMethodName ) ; } finally { if ( domain != null && ( JENKINS || testCompletedSuccessfully ) ) { try { TestUtils . deleteWeblogicDomainResources ( domain . getDomainUid ( ) ) ; } catch ( Exception ex ) { LoggerHelper . getLocal ( ) . log ( Level . INFO , "Failed to delete domain\n " + ex . getMessage ( ) ) ; } } } LoggerHelper . getLocal ( ) . log ( Level . INFO , "SUCCESS - " + testMethodName ) ; }
Create a domain with a JDBC DS using model in image and having config map
 in the domain.yaml before deploying the domain.
Create a domain with a JDBC DS using model in image and having config map in the domain . yaml before deploying the domain .
// The value for property oracle.net.CONNECT_TIMEOUT set in model.jdbc.yaml // for a client to establish an Oracle Net connection to the database instance. // create domain w JDBC DS using the image created by MII // get JDBC DS prop values via WLST on server pod // verify that JDBC DS is created by checking DS name, JNDI name and read timeout // copy model files that contains JDBC DS to a dir, re-create cm to update config, // patch domain to change domain-level restart version and verify domain restarted successfully // get JDBC DS props via WLST on server pod // verify that JDBC DS is updated by checking JDBC DS name, // connection timeout and read timeout via WLST on server pod