Skip to content

Commit d260885

Browse files
authored
Backport resolution to OWLS-104983 into release/4.0 (#3892)
1 parent 6e41a98 commit d260885

File tree

2 files changed

+55
-12
lines changed

2 files changed

+55
-12
lines changed

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItExternalLbTunneling.java

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, 2022, Oracle and/or its affiliates.
1+
// Copyright (c) 2020, 2023, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.weblogic.kubernetes;
@@ -420,7 +420,10 @@ private void runExtHttpsClient(String routeHost, int httpsTunnelingPort, int ser
420420
StringBuffer httpsUrl = new StringBuffer("https://");
421421
httpsUrl.append(hostAndPort);
422422

423-
StringBuffer javasCmd = new StringBuffer("java -cp ");
423+
// StringBuffer javasCmd = new StringBuffer("java -cp ");
424+
StringBuffer javasCmd = new StringBuffer("");
425+
javasCmd.append(Paths.get(RESULTS_ROOT, "/jdk/bin/java "));
426+
javasCmd.append("-cp ");
424427
javasCmd.append(Paths.get(RESULTS_ROOT, "wlthint3client.jar"));
425428
javasCmd.append(":");
426429
javasCmd.append(Paths.get(RESULTS_ROOT));
@@ -473,17 +476,22 @@ private void runClientInsidePod(int serverCount, boolean checkConnection) {
473476
testUntil(runJmsClient(new String(javapCmd)), logger, "Wait for t3 JMS Client to access WLS");
474477
}
475478

476-
// Run the RMI client outside the K8s Cluster
477479
private void runExtClient(int httpTunnelingPort, int serverCount, boolean checkConnection) {
478480
runExtClient(null, httpTunnelingPort, serverCount, checkConnection);
479481
}
480482

483+
// Run the RMI client outside the K8s Cluster using the JDK binary copied
484+
// from the Pod in the method buildClient()
481485
private void runExtClient(String routeHost, int httpTunnelingPort, int serverCount, boolean checkConnection) {
482486
String hostAndPort = getHostAndPort(routeHost, httpTunnelingPort);
483487
// Generate java command to execute client with classpath
484488
StringBuffer httpUrl = new StringBuffer("http://");
485489
httpUrl.append(hostAndPort);
486-
StringBuffer javaCmd = new StringBuffer("java -cp ");
490+
491+
// StringBuffer javaCmd = new StringBuffer("java -cp ");
492+
StringBuffer javaCmd = new StringBuffer("");
493+
javaCmd.append(Paths.get(RESULTS_ROOT, "/jdk/bin/java "));
494+
javaCmd.append("-cp ");
487495
javaCmd.append(Paths.get(RESULTS_ROOT, "wlthint3client.jar"));
488496
javaCmd.append(":");
489497
javaCmd.append(Paths.get(RESULTS_ROOT));
@@ -504,13 +512,30 @@ private void runExtClient(String routeHost, int httpTunnelingPort, int serverCou
504512
// JMS client that sends messages to a Uniform Distributed Queue using
505513
// load balancer http(s) url which maps to custom channel on cluster member
506514
// server on WebLogic cluster.
515+
// Copy the installed JDK from WebLogic server pod to local filesystem
516+
// to build and run the JMS client outside of K8s Cluster.
507517
private void buildClient() {
508518

509519
assertDoesNotThrow(() -> copyFileFromPod(domainNamespace,
510520
adminServerPodName, "weblogic-server",
511521
"/u01/oracle/wlserver/server/lib/wlthint3client.jar",
512522
Paths.get(RESULTS_ROOT, "wlthint3client.jar")));
513-
StringBuffer javacCmd = new StringBuffer("javac -cp ");
523+
524+
assertDoesNotThrow(() -> copyFileFromPod(domainNamespace,
525+
adminServerPodName, "weblogic-server",
526+
"/u01/jdk", Paths.get(RESULTS_ROOT, "jdk")));
527+
StringBuffer chmodCmd = new StringBuffer("chmod +x ");
528+
chmodCmd.append(Paths.get(RESULTS_ROOT, "jdk/bin/java "));
529+
chmodCmd.append(Paths.get(RESULTS_ROOT, "jdk/bin/javac "));
530+
ExecResult cresult = assertDoesNotThrow(
531+
() -> exec(new String(chmodCmd), true));
532+
logger.info("chmod command {0}", chmodCmd.toString());
533+
logger.info("chmod command returned {0}", cresult.toString());
534+
535+
// StringBuffer javacCmd = new StringBuffer("javac -cp ");
536+
StringBuffer javacCmd = new StringBuffer("");
537+
javacCmd.append(Paths.get(RESULTS_ROOT, "/jdk/bin/javac "));
538+
javacCmd.append(Paths.get(" -cp "));
514539
javacCmd.append(Paths.get(RESULTS_ROOT, "wlthint3client.jar "));
515540
javacCmd.append(Paths.get(RESOURCE_DIR, "tunneling", "JmsTestClient.java"));
516541
javacCmd.append(Paths.get(" -d "));

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItExternalNodePortService.java

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2021, 2022, Oracle and/or its affiliates.
1+
// Copyright (c) 2021, 2023, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.weblogic.kubernetes;
@@ -213,10 +213,8 @@ public void beforeEach() {
213213
@Test
214214
@DisplayName("Verify RMI access to WLS through NodePort Service")
215215
void testExternalRmiAccessThruNodePortService() {
216-
// Build the standalone JMS Client to send and receive messages
216+
// Build the standalone JMS Client locally to send and receive messages
217217
buildClient();
218-
buildClientOnPod();
219-
220218
// Prepare the Nodeport service yaml file from the template file by
221219
// replacing domain namespace, domain UID, cluster name and host name
222220
Map<String, String> templateMap = new HashMap<>();
@@ -261,12 +259,16 @@ void testExternalRmiAccessThruNodePortService() {
261259
logger.info("External RMI tunneling works for NodePortService");
262260
}
263261

264-
// Run the RMI client outside the K8s Cluster
262+
// Run the RMI client outside the K8s Cluster using the JDK binary copied
263+
// from the Pod in the method buildClient()
265264
private void runExtClient(String hostAndPort, int serverCount, boolean checkConnection) {
266265
// Generate java command to execute client with classpath
267266
StringBuffer httpUrl = new StringBuffer("http://");
268267
httpUrl.append(hostAndPort);
269-
StringBuffer javaCmd = new StringBuffer("java -cp ");
268+
// StringBuffer javaCmd = new StringBuffer("java -cp ");
269+
StringBuffer javaCmd = new StringBuffer("");
270+
javaCmd.append(Paths.get(RESULTS_ROOT, "/jdk/bin/java "));
271+
javaCmd.append("-cp ");
270272
javaCmd.append(Paths.get(RESULTS_ROOT, "wlthint3client.jar"));
271273
javaCmd.append(":");
272274
javaCmd.append(Paths.get(RESULTS_ROOT));
@@ -286,13 +288,29 @@ private void runExtClient(String hostAndPort, int serverCount, boolean checkConn
286288
// JMS client that sends messages to a Uniform Distributed Queue using
287289
// load balancer http(s) url which maps to custom channel on cluster member
288290
// server on WebLogic cluster.
291+
// Copy the installed JDK from WebLogic server pod to local filesystem to
292+
// build and run the JMS client outside of K8s Cluster.
289293
private void buildClient() {
290294

291295
assertDoesNotThrow(() -> copyFileFromPod(domainNamespace,
292296
adminServerPodName, "weblogic-server",
293297
"/u01/oracle/wlserver/server/lib/wlthint3client.jar",
294298
Paths.get(RESULTS_ROOT, "wlthint3client.jar")));
295-
StringBuffer javacCmd = new StringBuffer("javac -cp ");
299+
assertDoesNotThrow(() -> copyFileFromPod(domainNamespace,
300+
adminServerPodName, "weblogic-server",
301+
"/u01/jdk", Paths.get(RESULTS_ROOT, "jdk")));
302+
StringBuffer chmodCmd = new StringBuffer("chmod +x ");
303+
chmodCmd.append(Paths.get(RESULTS_ROOT, "jdk/bin/java "));
304+
chmodCmd.append(Paths.get(RESULTS_ROOT, "jdk/bin/javac "));
305+
ExecResult cresult = assertDoesNotThrow(
306+
() -> exec(new String(chmodCmd), true));
307+
logger.info("chmod command {0}", chmodCmd.toString());
308+
logger.info("chmod command returned {0}", cresult.toString());
309+
310+
// StringBuffer javacCmd = new StringBuffer("javac -cp ");
311+
StringBuffer javacCmd = new StringBuffer("");
312+
javacCmd.append(Paths.get(RESULTS_ROOT, "/jdk/bin/javac "));
313+
javacCmd.append(Paths.get(" -cp "));
296314
javacCmd.append(Paths.get(RESULTS_ROOT, "wlthint3client.jar "));
297315
javacCmd.append(Paths.get(RESOURCE_DIR, "tunneling", "JmsTestClient.java"));
298316
javacCmd.append(Paths.get(" -d "));

0 commit comments

Comments
 (0)