integration-tests/src/test/java/oracle/kubernetes/operator/ItPodsShutdown.java
@Test
  public void testShutdownOptionsOverrideViaEnv() throws Exception {
    Assumptions.assumeTrue(FULLTEST);
    String testMethodName = new Object() {
    }.getClass().getEnclosingMethod().getName();
    logTestBegin(testMethodName);
    Map<String, String> shutdownEnvProps = new HashMap();
    shutdownEnvProps.put("SHUTDOWN_TYPE", "Forced");
    shutdownEnvProps.put("SHUTDOWN_TIMEOUT", "60");
    Map<String, Object> shutdownPropsOpt = new HashMap<>();
    shutdownPropsOpt.put("env",shutdownEnvProps);


    Map<String, Object> shutdownProps = new HashMap();
    shutdownProps.put("timeoutSeconds", 20);
    shutdownProps.put("shutdownType", "Graceful");
    shutdownProps.put("ignoreSessions", false);
    List<Map<String,Object>> shutdownPropsMSs = new ArrayList<>();
    Map<String, Object> shutdownPropsMyMS = new HashMap();
    shutdownPropsMyMS.put("managed-server1", shutdownProps);
    shutdownPropsMSs.add(shutdownPropsMyMS);
    shutdownPropsOpt.put("server",shutdownPropsMSs);

    Domain domain = null;
    try {
      domain = createDomain(domainNSShutOpOverrideViaEnv,shutdownPropsOpt);
      Assertions.assertNotNull(domain,
          domainNSShutOpOverrideViaEnv
              + " failed to create, returns null");
      Assertions.assertTrue(checkShutdownUpdatedProp(domain.getDomainUid()
              + "-managed-server1", domain.getDomainNs(), "Forced", "60"),
          domain.getDomainUid()
              + "-managed-server1 :"
              + " shutdown properties don't not match the expected : "
              + "shutdownType=Forced, timeoutSeconds=60");;
      Assertions.assertTrue(checkShutdownUpdatedProp(domain.getDomainUid()
              + "-admin-server", domain.getDomainNs(),"Forced", "60"),
          domain.getDomainUid()
              + "-admin-server :"
              + " shutdown properties don't not match the expected : "
              + "shutdownType=Forced, timeoutSeconds=60");

    } finally {
      if (domain != null) {
        TestUtils.deleteWeblogicDomainResources(domain.getDomainUid());
      }
    }
    LoggerHelper.getLocal().log(Level.INFO, "SUCCESS - {0}", testMethodName);
  }
/**
   * Add shutdown env vars at domain spec level and managed server level,verify env override server level.
   *
   * @throws Exception If domain cannot be started or failed to verify shutdown options
   */
Add shutdown env vars at domain spec level and managed server level,verify env override server level.
@throws Exception If domain cannot be started or failed to verify shutdown options
Add shutdown env vars at domain spec level and managed server level verify env override server level . @throws Exception If domain cannot be started or failed to verify shutdown options
@Test
  public void testShutdownOptionsOverrideViaEnv() throws Exception {
    Assumptions.assumeTrue(FULLTEST);
    String testMethodName = new Object() {
    }.getClass().getEnclosingMethod().getName();
    logTestBegin(testMethodName);
    Map<String, String> shutdownEnvProps = new HashMap();
    shutdownEnvProps.put("SHUTDOWN_TYPE", "Forced");
    shutdownEnvProps.put("SHUTDOWN_TIMEOUT", "60");
    Map<String, Object> shutdownPropsOpt = new HashMap<>();
    shutdownPropsOpt.put("env",shutdownEnvProps);
    Map<String, Object> shutdownProps = new HashMap();
    shutdownProps.put("timeoutSeconds", 20);
    shutdownProps.put("shutdownType", "Graceful");
    shutdownProps.put("ignoreSessions", false);
    List<Map<String,Object>> shutdownPropsMSs = new ArrayList<>();
    Map<String, Object> shutdownPropsMyMS = new HashMap();
    shutdownPropsMyMS.put("managed-server1", shutdownProps);
    shutdownPropsMSs.add(shutdownPropsMyMS);
    shutdownPropsOpt.put("server",shutdownPropsMSs);
    Domain domain = null;
    try {
      domain = createDomain(domainNSShutOpOverrideViaEnv,shutdownPropsOpt);
      Assertions.assertNotNull(domain,
          domainNSShutOpOverrideViaEnv
              + " failed to create, returns null");
      Assertions.assertTrue(checkShutdownUpdatedProp(domain.getDomainUid()
              + "-managed-server1", domain.getDomainNs(), "Forced", "60"),
          domain.getDomainUid()
              + "-managed-server1 :"
              + " shutdown properties don't not match the expected : "
              + "shutdownType=Forced, timeoutSeconds=60");;
      Assertions.assertTrue(checkShutdownUpdatedProp(domain.getDomainUid()
              + "-admin-server", domain.getDomainNs(),"Forced", "60"),
          domain.getDomainUid()
              + "-admin-server :"
              + " shutdown properties don't not match the expected : "
              + "shutdownType=Forced, timeoutSeconds=60");
    } finally {
      if (domain != null) {
        TestUtils.deleteWeblogicDomainResources(domain.getDomainUid());
      }
    }
    LoggerHelper.getLocal().log(Level.INFO, "SUCCESS - {0}", testMethodName);
  }
@ Test public void testShutdownOptionsOverrideViaEnv ( ) throws Exception { Assumptions . assumeTrue ( FULLTEST ) ; String testMethodName = new Object ( ) { } . getClass ( ) . getEnclosingMethod ( ) . getName ( ) ; logTestBegin ( testMethodName ) ; Map < String , String > shutdownEnvProps = new HashMap ( ) ; shutdownEnvProps . put ( "SHUTDOWN_TYPE" , "Forced" ) ; shutdownEnvProps . put ( "SHUTDOWN_TIMEOUT" , "60" ) ; Map < String , Object > shutdownPropsOpt = new HashMap < > ( ) ; shutdownPropsOpt . put ( "env" , shutdownEnvProps ) ; Map < String , Object > shutdownProps = new HashMap ( ) ; shutdownProps . put ( "timeoutSeconds" , 20 ) ; shutdownProps . put ( "shutdownType" , "Graceful" ) ; shutdownProps . put ( "ignoreSessions" , false ) ; List < Map < String , Object > > shutdownPropsMSs = new ArrayList < > ( ) ; Map < String , Object > shutdownPropsMyMS = new HashMap ( ) ; shutdownPropsMyMS . put ( "managed-server1" , shutdownProps ) ; shutdownPropsMSs . add ( shutdownPropsMyMS ) ; shutdownPropsOpt . put ( "server" , shutdownPropsMSs ) ; Domain domain = null ; try { domain = createDomain ( domainNSShutOpOverrideViaEnv , shutdownPropsOpt ) ; Assertions . assertNotNull ( domain , domainNSShutOpOverrideViaEnv + " failed to create, returns null" ) ; Assertions . assertTrue ( checkShutdownUpdatedProp ( domain . getDomainUid ( ) + "-managed-server1" , domain . getDomainNs ( ) , "Forced" , "60" ) , domain . getDomainUid ( ) + "-managed-server1 :" + " shutdown properties don't not match the expected : " + "shutdownType=Forced, timeoutSeconds=60" ) ; ; Assertions . assertTrue ( checkShutdownUpdatedProp ( domain . getDomainUid ( ) + "-admin-server" , domain . getDomainNs ( ) , "Forced" , "60" ) , domain . getDomainUid ( ) + "-admin-server :" + " shutdown properties don't not match the expected : " + "shutdownType=Forced, timeoutSeconds=60" ) ; } finally { if ( domain != null ) { TestUtils . deleteWeblogicDomainResources ( domain . getDomainUid ( ) ) ; } } LoggerHelper . getLocal ( ) . log ( Level . INFO , "SUCCESS - {0}" , testMethodName ) ; }
Add shutdown env vars at domain spec level and managed server level,verify env override server level.
Add shutdown env vars at domain spec level and managed server level verify env override server level .