new-integration-tests/src/test/java/oracle/weblogic/kubernetes/ItConfigDistributionStrategy.java
@Order(3)
  @Test
  @DisplayName("Test overrideDistributionStrategy value DYNAMIC")
  public void testDynamicOverride() {

    //patching the domain with /spec/configuration/overrideDistributionStrategy: DYNAMIC
    String patchStr = "["
        + "{\"op\": \"add\", \"path\": \"/spec/configuration/overrideDistributionStrategy\", "
        + "\"value\": \"DYNAMIC\"}"
        + "]";
    logger.info("Updating domain configuration using patch string: {0}", patchStr);
    V1Patch patch = new V1Patch(patchStr);
    assertTrue(patchDomainCustomResource(domainUid, domainNamespace, patch, V1Patch.PATCH_FORMAT_JSON_PATCH),
        "Failed to patch domain");

    //TODO: - does changing overrideDistributionStrategy needs restart of server pods?
    restartDomain(); // if above is a bug, remove this after the above bug is fixed

    //store the pod creation timestamps
    storePodCreationTimestamps();

    List<Path> overrideFiles = new ArrayList<>();
    overrideFiles.add(
        Paths.get(RESOURCE_DIR, "configfiles/configoverridesset1/jdbc-JdbcTestDataSource-0.xml"));
    overrideFiles.add(Paths.get(RESOURCE_DIR, "configfiles/configoverridesset1/config.xml"));
    overrideFiles.add(Paths.get(RESOURCE_DIR, "configfiles/configoverridesset1/version.txt"));

    //create config override map
    createConfigMapFromFiles(overridecm, overrideFiles, domainNamespace);

    String introspectVersion = assertDoesNotThrow(() -> getNextIntrospectVersion(domainUid, domainNamespace));

    logger.info("patch the domain resource with overridesConfigMap, secrets , cluster and introspectVersion");
    patchStr
        = "["
        + "{\"op\": \"add\", \"path\": \"/spec/configuration/overridesConfigMap\", \"value\": \"" + overridecm + "\"},"
        + "{\"op\": \"replace\", \"path\": \"/spec/introspectVersion\", \"value\": \"" + introspectVersion + "\"}"
        + "]";
    logger.info("Updating domain configuration using patch string: {0}", patchStr);
    patch = new V1Patch(patchStr);
    assertTrue(patchDomainCustomResource(domainUid, domainNamespace, patch, V1Patch.PATCH_FORMAT_JSON_PATCH),
        "Failed to patch domain");

    verifyIntrospectorRuns();
    verifyPodsStateNotChanged();

    //wait until config is updated upto 5 minutes
    withStandardRetryPolicy
        .conditionEvaluationListener(
            condition -> logger.info("Waiting for server configuration to be updated"
                + "(elapsed time {0} ms, remaining time {1} ms)",
                condition.getElapsedTimeInMS(),
                condition.getRemainingTimeInMS()))
        .until(configUpdated("9999999"));

    verifyConfigXMLOverride(true);
    verifyResourceJDBC0Override(true);

    patchStr
        = "["
        + "{\"op\": \"remove\", \"path\": \"/spec/configuration/overrideDistributionStrategy\"}"
        + "]";
    logger.info("Updating domain configuration using patch string: {0}", patchStr);
    patch = new V1Patch(patchStr);
    assertTrue(patchDomainCustomResource(domainUid, domainNamespace, patch, V1Patch.PATCH_FORMAT_JSON_PATCH),
        "Failed to patch domain");
  }
/**
   * Test server configuration and datasource configurations are dynamically overridden when
   * /spec/configuration/overrideDistributionStrategy is set to DYNAMIC.
   *
   * <p>Test sets the above field to DYNAMIC and overrides the /spec/configuration/overridesConfigMap
   * with new configuration.
   *
   * <p>Verifies after introspector runs and the server configuration and JDBC datasource configurations are
   * updated as expected.
   */
Test server configuration and datasource configurations are dynamically overridden when
/spec/configuration/overrideDistributionStrategy is set to DYNAMIC.

Test sets the above field to DYNAMIC and overrides the /spec/configuration/overridesConfigMap
with new configuration.

Verifies after introspector runs and the server configuration and JDBC datasource configurations are
updated as expected.
Test server configuration and datasource configurations are dynamically overridden when / spec / configuration / overrideDistributionStrategy is set to DYNAMIC . Test sets the above field to DYNAMIC and overrides the / spec / configuration / overridesConfigMap with new configuration . Verifies after introspector runs and the server configuration and JDBC datasource configurations are updated as expected .
@Order(3)
  @Test
  @DisplayName("Test overrideDistributionStrategy value DYNAMIC")
  public void testDynamicOverride() {
    String patchStr = "["
        + "{\"op\": \"add\", \"path\": \"/spec/configuration/overrideDistributionStrategy\", "
        + "\"value\": \"DYNAMIC\"}"
        + "]";
    logger.info("Updating domain configuration using patch string: {0}", patchStr);
    V1Patch patch = new V1Patch(patchStr);
    assertTrue(patchDomainCustomResource(domainUid, domainNamespace, patch, V1Patch.PATCH_FORMAT_JSON_PATCH),
        "Failed to patch domain");
    restartDomain(); 
    storePodCreationTimestamps();
    List<Path> overrideFiles = new ArrayList<>();
    overrideFiles.add(
        Paths.get(RESOURCE_DIR, "configfiles/configoverridesset1/jdbc-JdbcTestDataSource-0.xml"));
    overrideFiles.add(Paths.get(RESOURCE_DIR, "configfiles/configoverridesset1/config.xml"));
    overrideFiles.add(Paths.get(RESOURCE_DIR, "configfiles/configoverridesset1/version.txt"));
    createConfigMapFromFiles(overridecm, overrideFiles, domainNamespace);
    String introspectVersion = assertDoesNotThrow(() -> getNextIntrospectVersion(domainUid, domainNamespace));
    logger.info("patch the domain resource with overridesConfigMap, secrets , cluster and introspectVersion");
    patchStr
        = "["
        + "{\"op\": \"add\", \"path\": \"/spec/configuration/overridesConfigMap\", \"value\": \"" + overridecm + "\"},"
        + "{\"op\": \"replace\", \"path\": \"/spec/introspectVersion\", \"value\": \"" + introspectVersion + "\"}"
        + "]";
    logger.info("Updating domain configuration using patch string: {0}", patchStr);
    patch = new V1Patch(patchStr);
    assertTrue(patchDomainCustomResource(domainUid, domainNamespace, patch, V1Patch.PATCH_FORMAT_JSON_PATCH),
        "Failed to patch domain");
    verifyIntrospectorRuns();
    verifyPodsStateNotChanged();
    withStandardRetryPolicy
        .conditionEvaluationListener(
            condition -> logger.info("Waiting for server configuration to be updated"
                + "(elapsed time {0} ms, remaining time {1} ms)",
                condition.getElapsedTimeInMS(),
                condition.getRemainingTimeInMS()))
        .until(configUpdated("9999999"));
    verifyConfigXMLOverride(true);
    verifyResourceJDBC0Override(true);
    patchStr
        = "["
        + "{\"op\": \"remove\", \"path\": \"/spec/configuration/overrideDistributionStrategy\"}"
        + "]";
    logger.info("Updating domain configuration using patch string: {0}", patchStr);
    patch = new V1Patch(patchStr);
    assertTrue(patchDomainCustomResource(domainUid, domainNamespace, patch, V1Patch.PATCH_FORMAT_JSON_PATCH),
        "Failed to patch domain");
  }
@ Order ( 3 ) @ Test @ DisplayName ( "Test overrideDistributionStrategy value DYNAMIC" ) public void testDynamicOverride ( ) { String patchStr = "[" + "{\"op\": \"add\", \"path\": \"/spec/configuration/overrideDistributionStrategy\", " + "\"value\": \"DYNAMIC\"}" + "]" ; logger . info ( "Updating domain configuration using patch string: {0}" , patchStr ) ; V1Patch patch = new V1Patch ( patchStr ) ; assertTrue ( patchDomainCustomResource ( domainUid , domainNamespace , patch , V1Patch . PATCH_FORMAT_JSON_PATCH ) , "Failed to patch domain" ) ; restartDomain ( ) ; storePodCreationTimestamps ( ) ; List < Path > overrideFiles = new ArrayList < > ( ) ; overrideFiles . add ( Paths . get ( RESOURCE_DIR , "configfiles/configoverridesset1/jdbc-JdbcTestDataSource-0.xml" ) ) ; overrideFiles . add ( Paths . get ( RESOURCE_DIR , "configfiles/configoverridesset1/config.xml" ) ) ; overrideFiles . add ( Paths . get ( RESOURCE_DIR , "configfiles/configoverridesset1/version.txt" ) ) ; createConfigMapFromFiles ( overridecm , overrideFiles , domainNamespace ) ; String introspectVersion = assertDoesNotThrow ( ( ) -> getNextIntrospectVersion ( domainUid , domainNamespace ) ) ; logger . info ( "patch the domain resource with overridesConfigMap, secrets , cluster and introspectVersion" ) ; patchStr = "[" + "{\"op\": \"add\", \"path\": \"/spec/configuration/overridesConfigMap\", \"value\": \"" + overridecm + "\"}," + "{\"op\": \"replace\", \"path\": \"/spec/introspectVersion\", \"value\": \"" + introspectVersion + "\"}" + "]" ; logger . info ( "Updating domain configuration using patch string: {0}" , patchStr ) ; patch = new V1Patch ( patchStr ) ; assertTrue ( patchDomainCustomResource ( domainUid , domainNamespace , patch , V1Patch . PATCH_FORMAT_JSON_PATCH ) , "Failed to patch domain" ) ; verifyIntrospectorRuns ( ) ; verifyPodsStateNotChanged ( ) ; withStandardRetryPolicy . conditionEvaluationListener ( condition -> logger . info ( "Waiting for server configuration to be updated" + "(elapsed time {0} ms, remaining time {1} ms)" , condition . getElapsedTimeInMS ( ) , condition . getRemainingTimeInMS ( ) ) ) . until ( configUpdated ( "9999999" ) ) ; verifyConfigXMLOverride ( true ) ; verifyResourceJDBC0Override ( true ) ; patchStr = "[" + "{\"op\": \"remove\", \"path\": \"/spec/configuration/overrideDistributionStrategy\"}" + "]" ; logger . info ( "Updating domain configuration using patch string: {0}" , patchStr ) ; patch = new V1Patch ( patchStr ) ; assertTrue ( patchDomainCustomResource ( domainUid , domainNamespace , patch , V1Patch . PATCH_FORMAT_JSON_PATCH ) , "Failed to patch domain" ) ; }
Test server configuration and datasource configurations are dynamically overridden when
 /spec/configuration/overrideDistributionStrategy is set to DYNAMIC.
Test server configuration and datasource configurations are dynamically overridden when / spec / configuration / overrideDistributionStrategy is set to DYNAMIC .
//patching the domain with /spec/configuration/overrideDistributionStrategy: DYNAMIC //TODO: - does changing overrideDistributionStrategy needs restart of server pods? // if above is a bug, remove this after the above bug is fixed //store the pod creation timestamps //create config override map //wait until config is updated upto 5 minutes