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
44package 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 " ));
0 commit comments