1
- // Copyright (c) 2020, 2022 , Oracle and/or its affiliates.
1
+ // Copyright (c) 2020, 2023 , 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 ;
@@ -251,7 +251,7 @@ void testExternalRmiAccessThruTraefik() {
251
251
252
252
// Build the standalone JMS Client to send and receive messages
253
253
buildClient ();
254
- buildClientOnPod ();
254
+ // buildClientOnPod();
255
255
256
256
// Prepare the ingress file from the template file by replacing
257
257
// domain namespace, domain UID, cluster service name and tls secret
@@ -411,13 +411,18 @@ private void runExtHttpsClient(int httpsTunnelingPort, int serverCount, boolean
411
411
runExtHttpsClient (null , httpsTunnelingPort , serverCount , checkConnection );
412
412
}
413
413
414
+ // Run the RMI client outside the K8s Cluster using the JDK binary copied
415
+ // from the Pod in the method buildClient()
414
416
private void runExtHttpsClient (String routeHost , int httpsTunnelingPort , int serverCount , boolean checkConnection ) {
415
417
String hostAndPort = getHostAndPort (routeHost , httpsTunnelingPort );
416
418
// Generate java command to execute client with classpath
417
419
StringBuffer httpsUrl = new StringBuffer ("https://" );
418
420
httpsUrl .append (hostAndPort );
419
421
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 " );
421
426
javasCmd .append (Paths .get (RESULTS_ROOT , "wlthint3client.jar" ));
422
427
javasCmd .append (":" );
423
428
javasCmd .append (Paths .get (RESULTS_ROOT ));
@@ -475,12 +480,17 @@ private void runExtClient(int httpTunnelingPort, int serverCount, boolean checkC
475
480
runExtClient (null , httpTunnelingPort , serverCount , checkConnection );
476
481
}
477
482
483
+ // Run the RMI client outside the K8s Cluster using the JDK binary copied
484
+ // from the Pod in the method buildClient()
478
485
private void runExtClient (String routeHost , int httpTunnelingPort , int serverCount , boolean checkConnection ) {
479
486
String hostAndPort = getHostAndPort (routeHost , httpTunnelingPort );
480
487
// Generate java command to execute client with classpath
481
488
StringBuffer httpUrl = new StringBuffer ("http://" );
482
489
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 " );
484
494
javaCmd .append (Paths .get (RESULTS_ROOT , "wlthint3client.jar" ));
485
495
javaCmd .append (":" );
486
496
javaCmd .append (Paths .get (RESULTS_ROOT ));
@@ -501,13 +511,31 @@ private void runExtClient(String routeHost, int httpTunnelingPort, int serverCou
501
511
// JMS client that sends messages to a Uniform Distributed Queue using
502
512
// load balancer http(s) url which maps to custom channel on cluster member
503
513
// 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.
504
516
private void buildClient () {
505
517
506
518
assertDoesNotThrow (() -> copyFileFromPod (domainNamespace ,
507
519
adminServerPodName , "weblogic-server" ,
508
520
"/u01/oracle/wlserver/server/lib/wlthint3client.jar" ,
509
521
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 " ));
511
539
javacCmd .append (Paths .get (RESULTS_ROOT , "wlthint3client.jar " ));
512
540
javacCmd .append (Paths .get (RESOURCE_DIR , "tunneling" , "JmsTestClient.java" ));
513
541
javacCmd .append (Paths .get (" -d " ));
0 commit comments