Skip to content

Commit d693e6e

Browse files
authored
Backport resolution of OWLS-104983 to release/3.4 (#3894)
1 parent 6a29497 commit d693e6e

File tree

2 files changed

+61
-10
lines changed

2 files changed

+61
-10
lines changed

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

Lines changed: 33 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;
@@ -251,7 +251,7 @@ void testExternalRmiAccessThruTraefik() {
251251

252252
// Build the standalone JMS Client to send and receive messages
253253
buildClient();
254-
buildClientOnPod();
254+
// buildClientOnPod();
255255

256256
// Prepare the ingress file from the template file by replacing
257257
// domain namespace, domain UID, cluster service name and tls secret
@@ -411,13 +411,18 @@ private void runExtHttpsClient(int httpsTunnelingPort, int serverCount, boolean
411411
runExtHttpsClient(null, httpsTunnelingPort, serverCount, checkConnection);
412412
}
413413

414+
// Run the RMI client outside the K8s Cluster using the JDK binary copied
415+
// from the Pod in the method buildClient()
414416
private void runExtHttpsClient(String routeHost, int httpsTunnelingPort, int serverCount, boolean checkConnection) {
415417
String hostAndPort = getHostAndPort(routeHost, httpsTunnelingPort);
416418
// Generate java command to execute client with classpath
417419
StringBuffer httpsUrl = new StringBuffer("https://");
418420
httpsUrl.append(hostAndPort);
419421

420-
StringBuffer javasCmd = new StringBuffer("java -cp ");
422+
// StringBuffer javasCmd = new StringBuffer("java -cp ");
423+
StringBuffer javasCmd = new StringBuffer("");
424+
javasCmd.append(Paths.get(RESULTS_ROOT, "/jdk/bin/java "));
425+
javasCmd.append("-cp ");
421426
javasCmd.append(Paths.get(RESULTS_ROOT, "wlthint3client.jar"));
422427
javasCmd.append(":");
423428
javasCmd.append(Paths.get(RESULTS_ROOT));
@@ -475,12 +480,17 @@ private void runExtClient(int httpTunnelingPort, int serverCount, boolean checkC
475480
runExtClient(null, httpTunnelingPort, serverCount, checkConnection);
476481
}
477482

483+
// Run the RMI client outside the K8s Cluster using the JDK binary copied
484+
// from the Pod in the method buildClient()
478485
private void runExtClient(String routeHost, int httpTunnelingPort, int serverCount, boolean checkConnection) {
479486
String hostAndPort = getHostAndPort(routeHost, httpTunnelingPort);
480487
// Generate java command to execute client with classpath
481488
StringBuffer httpUrl = new StringBuffer("http://");
482489
httpUrl.append(hostAndPort);
483-
StringBuffer javaCmd = new StringBuffer("java -cp ");
490+
// StringBuffer javaCmd = new StringBuffer("java -cp ");
491+
StringBuffer javaCmd = new StringBuffer("");
492+
javaCmd.append(Paths.get(RESULTS_ROOT, "/jdk/bin/java "));
493+
javaCmd.append("-cp ");
484494
javaCmd.append(Paths.get(RESULTS_ROOT, "wlthint3client.jar"));
485495
javaCmd.append(":");
486496
javaCmd.append(Paths.get(RESULTS_ROOT));
@@ -501,13 +511,31 @@ private void runExtClient(String routeHost, int httpTunnelingPort, int serverCou
501511
// JMS client that sends messages to a Uniform Distributed Queue using
502512
// load balancer http(s) url which maps to custom channel on cluster member
503513
// server on WebLogic cluster.
514+
// Copy the installed JDK from WebLogic server pod to local filesystem
515+
// to build and run the JMS client outside of K8s Cluster.
504516
private void buildClient() {
505517

506518
assertDoesNotThrow(() -> copyFileFromPod(domainNamespace,
507519
adminServerPodName, "weblogic-server",
508520
"/u01/oracle/wlserver/server/lib/wlthint3client.jar",
509521
Paths.get(RESULTS_ROOT, "wlthint3client.jar")));
510-
StringBuffer javacCmd = new StringBuffer("javac -cp ");
522+
523+
assertDoesNotThrow(() -> copyFileFromPod(domainNamespace,
524+
adminServerPodName, "weblogic-server",
525+
"/u01/jdk", Paths.get(RESULTS_ROOT, "jdk")));
526+
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 "));
511539
javacCmd.append(Paths.get(RESULTS_ROOT, "wlthint3client.jar "));
512540
javacCmd.append(Paths.get(RESOURCE_DIR, "tunneling", "JmsTestClient.java"));
513541
javacCmd.append(Paths.get(" -d "));

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

Lines changed: 28 additions & 5 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;
@@ -209,7 +209,7 @@ void testExternalRmiAccessThruNodePortService() {
209209

210210
// Build the standalone JMS Client to send and receive messages
211211
buildClient();
212-
buildClientOnPod();
212+
// buildClientOnPod();
213213

214214
// Prepare the Nodeport service yaml file from the template file by
215215
// replacing domain namespace, domain UID, cluster name and host name
@@ -255,12 +255,18 @@ void testExternalRmiAccessThruNodePortService() {
255255
logger.info("External RMI tunneling works for NodePortService");
256256
}
257257

258-
// Run the RMI client outside the K8s Cluster
258+
// Run the RMI client outside the K8s Cluster using the JDK binary copied
259+
// from the Pod in the method buildClient()
259260
private void runExtClient(String hostAndPort, int serverCount, boolean checkConnection) {
260261
// Generate java command to execute client with classpath
261262
StringBuffer httpUrl = new StringBuffer("http://");
262263
httpUrl.append(hostAndPort);
263-
StringBuffer javaCmd = new StringBuffer("java -cp ");
264+
265+
266+
// StringBuffer javaCmd = new StringBuffer("java -cp ");
267+
StringBuffer javaCmd = new StringBuffer("");
268+
javaCmd.append(Paths.get(RESULTS_ROOT, "/jdk/bin/java "));
269+
javaCmd.append("-cp ");
264270
javaCmd.append(Paths.get(RESULTS_ROOT, "wlthint3client.jar"));
265271
javaCmd.append(":");
266272
javaCmd.append(Paths.get(RESULTS_ROOT));
@@ -280,13 +286,30 @@ private void runExtClient(String hostAndPort, int serverCount, boolean checkConn
280286
// JMS client that sends messages to a Uniform Distributed Queue using
281287
// load balancer http(s) url which maps to custom channel on cluster member
282288
// server on WebLogic cluster.
289+
// Copy the installed JDK from WebLogic server pod to local filesystem to
290+
// build and run the JMS client outside of K8s Cluster.
283291
private void buildClient() {
284292

285293
assertDoesNotThrow(() -> copyFileFromPod(domainNamespace,
286294
adminServerPodName, "weblogic-server",
287295
"/u01/oracle/wlserver/server/lib/wlthint3client.jar",
288296
Paths.get(RESULTS_ROOT, "wlthint3client.jar")));
289-
StringBuffer javacCmd = new StringBuffer("javac -cp ");
297+
298+
assertDoesNotThrow(() -> copyFileFromPod(domainNamespace,
299+
adminServerPodName, "weblogic-server",
300+
"/u01/jdk", Paths.get(RESULTS_ROOT, "jdk")));
301+
StringBuffer chmodCmd = new StringBuffer("chmod +x ");
302+
chmodCmd.append(Paths.get(RESULTS_ROOT, "jdk/bin/java "));
303+
chmodCmd.append(Paths.get(RESULTS_ROOT, "jdk/bin/javac "));
304+
ExecResult cresult = assertDoesNotThrow(
305+
() -> exec(new String(chmodCmd), true));
306+
logger.info("chmod command {0}", chmodCmd.toString());
307+
logger.info("chmod command returned {0}", cresult.toString());
308+
309+
// StringBuffer javacCmd = new StringBuffer("javac -cp ");
310+
StringBuffer javacCmd = new StringBuffer("");
311+
javacCmd.append(Paths.get(RESULTS_ROOT, "/jdk/bin/javac "));
312+
javacCmd.append(Paths.get(" -cp "));
290313
javacCmd.append(Paths.get(RESULTS_ROOT, "wlthint3client.jar "));
291314
javacCmd.append(Paths.get(RESOURCE_DIR, "tunneling", "JmsTestClient.java"));
292315
javacCmd.append(Paths.get(" -d "));

0 commit comments

Comments
 (0)