|
1 | | -// Copyright (c) 2020, 2024, Oracle and/or its affiliates. |
| 1 | +// Copyright (c) 2020, 2025, Oracle and/or its affiliates. |
2 | 2 | // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. |
3 | 3 |
|
4 | 4 | package oracle.weblogic.kubernetes; |
|
72 | 72 | import static oracle.weblogic.kubernetes.TestConstants.TRAEFIK_INGRESS_HTTP_HOSTPORT; |
73 | 73 | import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TAG_DEFAULT; |
74 | 74 | import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TO_USE_IN_SPEC; |
| 75 | +import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_SHIPHOME; |
75 | 76 | import static oracle.weblogic.kubernetes.actions.ActionConstants.APP_DIR; |
76 | 77 | import static oracle.weblogic.kubernetes.actions.ActionConstants.DOWNLOAD_DIR; |
77 | 78 | import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR; |
78 | 79 | import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR; |
| 80 | +import static oracle.weblogic.kubernetes.actions.ActionConstants.WDT; |
79 | 81 | import static oracle.weblogic.kubernetes.actions.ActionConstants.WDT_DOWNLOAD_URL; |
80 | 82 | import static oracle.weblogic.kubernetes.actions.TestActions.createSecret; |
81 | 83 | import static oracle.weblogic.kubernetes.actions.TestActions.getNextIntrospectVersion; |
|
84 | 86 | import static oracle.weblogic.kubernetes.actions.TestActions.shutdownDomain; |
85 | 87 | import static oracle.weblogic.kubernetes.actions.TestActions.startDomain; |
86 | 88 | import static oracle.weblogic.kubernetes.actions.impl.Domain.patchDomainCustomResource; |
| 89 | +import static oracle.weblogic.kubernetes.actions.impl.primitive.Command.defaultCommandParams; |
87 | 90 | import static oracle.weblogic.kubernetes.assertions.TestAssertions.podStateNotChanged; |
88 | 91 | import static oracle.weblogic.kubernetes.assertions.TestAssertions.secretExists; |
89 | 92 | import static oracle.weblogic.kubernetes.utils.ApplicationUtils.verifyAdminServerRESTAccess; |
|
95 | 98 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkServiceExists; |
96 | 99 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createIngressHostRouting; |
97 | 100 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.exeAppInServerPod; |
| 101 | +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getActualLocationIfNeeded; |
98 | 102 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getDateAndTimeStamp; |
99 | 103 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getHostAndPort; |
100 | 104 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getNextFreePort; |
@@ -202,6 +206,9 @@ public void initAll(@Namespaces(2) List<String> namespaces) throws IOException { |
202 | 206 | // create pull secrets for WebLogic image when running in non Kind Kubernetes cluster |
203 | 207 | // this secret is used only for non-kind cluster |
204 | 208 | createBaseRepoSecret(domainNamespace); |
| 209 | + if (OKE_CLUSTER) { |
| 210 | + installOnPremWebLogic(); |
| 211 | + } |
205 | 212 |
|
206 | 213 | //create and start WebLogic domain |
207 | 214 | createDomain(); |
@@ -682,11 +689,13 @@ public static File createWdtPropertyFile(String wlsModelFilePrefix, String nodeP |
682 | 689 | } |
683 | 690 |
|
684 | 691 | private static void downloadAndInstallWDT() throws IOException { |
685 | | - String wdtUrl = WDT_DOWNLOAD_URL + "/download/weblogic-deploy.zip"; |
| 692 | + |
| 693 | + String wdtUrl = getActualLocationIfNeeded(WDT_DOWNLOAD_URL, WDT); |
| 694 | + |
686 | 695 | Path destLocation = Path.of(DOWNLOAD_DIR, "wdt", "weblogic-deploy.zip"); |
687 | 696 | encryptModelScript = Path.of(DOWNLOAD_DIR, "wdt", "weblogic-deploy", "bin", "encryptModel.sh"); |
688 | 697 | if (!Files.exists(destLocation) && !Files.exists(encryptModelScript)) { |
689 | | - logger.info("Downloading WDT to {0}", destLocation); |
| 698 | + logger.info("Downloading WDT from {0} to {1}", wdtUrl, destLocation); |
690 | 699 | Files.createDirectories(destLocation.getParent()); |
691 | 700 | OracleHttpClient.downloadFile(wdtUrl, destLocation.toString(), null, null, 3); |
692 | 701 | String cmd = "cd " + destLocation.getParent() + ";unzip " + destLocation; |
@@ -737,4 +746,16 @@ public static void createEncryptionSecret(String secretName, String namespace) { |
737 | 746 | assertTrue(secretCreated, String.format("create secret failed for %s", secretName)); |
738 | 747 | } |
739 | 748 | } |
| 749 | + |
| 750 | + private void installOnPremWebLogic() { |
| 751 | + Path installScript = Paths.get(RESOURCE_DIR, "bash-scripts", "install-wls.sh"); |
| 752 | + String command |
| 753 | + = String.format("%s %s %s %s", "/bin/bash", installScript, RESULTS_ROOT, WEBLOGIC_SHIPHOME); |
| 754 | + getLogger().info("WebLogic installation command {0}", command); |
| 755 | + assertTrue(() -> Command.withParams( |
| 756 | + defaultCommandParams() |
| 757 | + .command(command) |
| 758 | + .redirect(false)) |
| 759 | + .execute()); |
| 760 | + } |
740 | 761 | } |
0 commit comments