|
| 1 | +// Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved. |
| 2 | +// Licensed under the Universal Permissive License v 1.0 as shown at |
| 3 | +// http://oss.oracle.com/licenses/upl. |
| 4 | + |
| 5 | +package oracle.kubernetes.operator; |
| 6 | + |
| 7 | +import java.util.logging.Level; |
| 8 | + |
| 9 | +import org.junit.AfterClass; |
| 10 | +import org.junit.Assume; |
| 11 | +import org.junit.BeforeClass; |
| 12 | +import org.junit.Test; |
| 13 | + |
| 14 | +/** JUnit test class used for testing configuration override use cases for domain in pv WLS. */ |
| 15 | +public class ItSitConfigDomainInPV extends SitConfig { |
| 16 | + |
| 17 | + /** |
| 18 | + * This method gets called only once before any of the test methods are executed. It does the |
| 19 | + * initialization of the integration test properties defined in OperatorIT.properties and setting |
| 20 | + * the resultRoot, pvRoot and projectRoot attributes. |
| 21 | + * |
| 22 | + * @throws Exception when the initialization, creating directories , copying files and domain |
| 23 | + * creation fails. |
| 24 | + */ |
| 25 | + @BeforeClass |
| 26 | + public static void staticPrepare() throws Exception { |
| 27 | + SitConfig.staticPrepare( |
| 28 | + DOMAINONPV_WLST_YAML, |
| 29 | + "integration-tests/src/test/resources/sitconfig/scripts/create-domain-auto-custom-sit-config20.py"); |
| 30 | + } |
| 31 | + |
| 32 | + /** |
| 33 | + * Destroy domain, delete the MySQL DB container and teardown. |
| 34 | + * |
| 35 | + * @throws Exception when domain destruction or MySQL container destruction fails |
| 36 | + */ |
| 37 | + @AfterClass |
| 38 | + public static void staticUnPrepare() throws Exception { |
| 39 | + SitConfig.staticUnPrepare(); |
| 40 | + } |
| 41 | + |
| 42 | + /** |
| 43 | + * This test covers custom configuration override use cases for config.xml for administration |
| 44 | + * server. |
| 45 | + * |
| 46 | + * <p>The test checks the overridden config.xml attributes connect-timeout, max-message-size, |
| 47 | + * restart-max, JMXCore and ServerLifeCycle debug flags, the T3Channel public address. The |
| 48 | + * overridden values are verified against the ServerConfig MBean tree. It does not verifies |
| 49 | + * whether the overridden values are applied to the runtime. |
| 50 | + * |
| 51 | + * @throws Exception when the assertion fails due to unmatched values |
| 52 | + */ |
| 53 | + @Test |
| 54 | + public void testCustomSitConfigOverridesForDomainInPV() throws Exception { |
| 55 | + Assume.assumeFalse(QUICKTEST); |
| 56 | + String testMethod = new Object() {}.getClass().getEnclosingMethod().getName(); |
| 57 | + logTestBegin(testMethod); |
| 58 | + testCustomSitConfigOverridesForDomain(testMethod); |
| 59 | + logger.log(Level.INFO, "SUCCESS - {0}", testMethod); |
| 60 | + } |
| 61 | + |
| 62 | + /** |
| 63 | + * This test covers custom configuration override use cases for config.xml for managed server. |
| 64 | + * |
| 65 | + * <p>The test checks the overridden config.xml server template attribute max-message-size. The |
| 66 | + * overridden values are verified against the ServerConfig MBean tree. It does not verifies |
| 67 | + * whether the overridden values are applied to the runtime. |
| 68 | + * |
| 69 | + * @throws Exception when the assertion fails due to unmatched values |
| 70 | + */ |
| 71 | + @Test |
| 72 | + public void testCustomSitConfigOverridesForDomainMsInPV() throws Exception { |
| 73 | + Assume.assumeFalse(QUICKTEST); |
| 74 | + String testMethod = new Object() {}.getClass().getEnclosingMethod().getName(); |
| 75 | + logTestBegin(testMethod); |
| 76 | + testCustomSitConfigOverridesForDomainMS(testMethod); |
| 77 | + logger.log(Level.INFO, "SUCCESS - {0}", testMethod); |
| 78 | + } |
| 79 | + |
| 80 | + /** |
| 81 | + * This test covers custom resource override use cases for JDBC resource. |
| 82 | + * |
| 83 | + * <p>The resource override sets the following connection pool properties. initialCapacity, |
| 84 | + * maxCapacity, test-connections-on-reserve, connection-harvest-max-count, |
| 85 | + * inactive-connection-timeout-seconds in the JDBC resource override file. It also overrides the |
| 86 | + * jdbc driver parameters like data source url, db user and password using kubernetes secret. |
| 87 | + * |
| 88 | + * <p>The overridden values are verified against the ServerConfig MBean tree. It does not verifies |
| 89 | + * whether the overridden values are applied to the runtime except the JDBC URL which is verified |
| 90 | + * at runtime by making a connection to the MySql database and executing a DDL statement. |
| 91 | + * |
| 92 | + * @throws Exception when the assertion fails due to unmatched values |
| 93 | + */ |
| 94 | + @Test |
| 95 | + public void testCustomSitConfigOverridesForJdbcInPV() throws Exception { |
| 96 | + Assume.assumeFalse(QUICKTEST); |
| 97 | + String testMethod = new Object() {}.getClass().getEnclosingMethod().getName(); |
| 98 | + logTestBegin(testMethod); |
| 99 | + testCustomSitConfigOverridesForJdbc(testMethod); |
| 100 | + logger.log(Level.INFO, "SUCCESS - {0}", testMethod); |
| 101 | + } |
| 102 | + |
| 103 | + /** |
| 104 | + * This test covers custom resource use cases for JMS resource. The JMS resource override file |
| 105 | + * sets the following Delivery Failure Parameters re delivery limit and expiration policy for a |
| 106 | + * uniform-distributed-topic JMS resource. |
| 107 | + * |
| 108 | + * <p>The overridden values are verified against the ServerConfig MBean tree. It does not verifies |
| 109 | + * whether the overridden values are applied to the runtime. |
| 110 | + * |
| 111 | + * @throws Exception when the assertion fails due to unmatched values |
| 112 | + */ |
| 113 | + @Test |
| 114 | + public void testCustomSitConfigOverridesForJmsInPV() throws Exception { |
| 115 | + Assume.assumeFalse(QUICKTEST); |
| 116 | + String testMethod = new Object() {}.getClass().getEnclosingMethod().getName(); |
| 117 | + logTestBegin(testMethod); |
| 118 | + testCustomSitConfigOverridesForJms(testMethod); |
| 119 | + logger.log(Level.INFO, "SUCCESS - {0}", testMethod); |
| 120 | + } |
| 121 | + |
| 122 | + /** |
| 123 | + * This test covers custom resource override use cases for diagnostics resource. It adds the |
| 124 | + * following instrumentation monitors. Connector_After_Inbound, Connector_Around_Outbound, |
| 125 | + * Connector_Around_Tx, Connector_Around_Work, Connector_Before_Inbound, and harvesters for |
| 126 | + * weblogic.management.runtime.JDBCServiceRuntimeMBean, |
| 127 | + * weblogic.management.runtime.ServerRuntimeMBean. |
| 128 | + * |
| 129 | + * <p>The overridden values are verified against the ServerConfig MBean tree. It does not verifies |
| 130 | + * whether the overridden values are applied to the runtime. |
| 131 | + * |
| 132 | + * @throws Exception when the assertion fails due to unmatched values |
| 133 | + */ |
| 134 | + @Test |
| 135 | + public void testCustomSitConfigOverridesForWldfInPV() throws Exception { |
| 136 | + Assume.assumeFalse(QUICKTEST); |
| 137 | + String testMethod = new Object() {}.getClass().getEnclosingMethod().getName(); |
| 138 | + logTestBegin(testMethod); |
| 139 | + testCustomSitConfigOverridesForWldf(testMethod); |
| 140 | + logger.log(Level.INFO, "SUCCESS - {0}", testMethod); |
| 141 | + } |
| 142 | + |
| 143 | + /** |
| 144 | + * Test to verify the configuration override after a domain is up and running. Modifies the |
| 145 | + * existing config.xml entries to add startup and shutdown classes verifies those are overridden |
| 146 | + * when domain is restarted. |
| 147 | + * |
| 148 | + * @throws Exception when assertions fail. |
| 149 | + */ |
| 150 | + @Test |
| 151 | + public void testConfigOverrideAfterDomainStartupInPV() throws Exception { |
| 152 | + Assume.assumeFalse(QUICKTEST); |
| 153 | + String testMethod = new Object() {}.getClass().getEnclosingMethod().getName(); |
| 154 | + logTestBegin(testMethod); |
| 155 | + testConfigOverrideAfterDomainStartup(testMethod); |
| 156 | + logger.log(Level.INFO, "SUCCESS - {0}", testMethod); |
| 157 | + } |
| 158 | + |
| 159 | + /** |
| 160 | + * This test covers the overriding of JDBC system resource after a domain is up and running. It |
| 161 | + * creates a datasource , recreates the K8S configmap with updated JDBC descriptor and verifies |
| 162 | + * the new overridden values with restart of the WLS pods |
| 163 | + * |
| 164 | + * @throws Exception when assertions fail. |
| 165 | + */ |
| 166 | + @Test |
| 167 | + public void testOverrideJdbcResourceAfterDomainStartInPV() throws Exception { |
| 168 | + Assume.assumeFalse(QUICKTEST); |
| 169 | + String testMethod = new Object() {}.getClass().getEnclosingMethod().getName(); |
| 170 | + logTestBegin(testMethod); |
| 171 | + testOverrideJdbcResourceAfterDomainStart(testMethod); |
| 172 | + logger.log(Level.INFO, "SUCCESS - {0}", testMethod); |
| 173 | + } |
| 174 | + |
| 175 | + /** |
| 176 | + * This test covers the overriding of JDBC system resource with new kubernetes secret name for |
| 177 | + * dbusername and dbpassword. |
| 178 | + * |
| 179 | + * @throws Exception when assertions fail. |
| 180 | + */ |
| 181 | + @Test |
| 182 | + public void testOverrideJdbcResourceWithNewSecretInPV() throws Exception { |
| 183 | + Assume.assumeFalse(QUICKTEST); |
| 184 | + String testMethod = new Object() {}.getClass().getEnclosingMethod().getName(); |
| 185 | + logTestBegin(testMethod); |
| 186 | + testOverrideJdbcResourceWithNewSecret(testMethod); |
| 187 | + logger.log(Level.INFO, "SUCCESS - {0}", testMethod); |
| 188 | + } |
| 189 | +} |
0 commit comments