@@ -824,6 +824,111 @@ void test29EncryptModel(TestInfo testInfo) throws Exception {
824
824
}
825
825
}
826
826
827
+ /**
828
+ * test updateDomain.sh online with untargeting, deploy, and app update
829
+ * @throws Exception - if any error occurs
830
+ */
831
+ @ DisplayName ("Test 30: createDomain and run updateDomain online for application" )
832
+ @ Order (30 )
833
+ @ Tag ("gate" )
834
+ @ Test
835
+ void test30OnlineUpdateApp (TestInfo testInfo ) throws Exception {
836
+ String domainDir = "domain2" ;
837
+ String cmd = createDomainScript
838
+ + " -oracle_home " + mwhome_12213
839
+ + " -domain_home " + domainParentDir + FS + domainDir
840
+ + " -model_file " + getSampleModelFile ("-onlinebase" )
841
+ + " -archive_file " + getSampleArchiveFile ();
842
+
843
+ try (PrintWriter out = getTestMethodWriter (testInfo )) {
844
+ CommandResult result = Runner .run (cmd , getTestMethodEnvironment (testInfo ), out );
845
+ assertEquals (0 , result .exitValue (), "Unexpected return code" );
846
+ assertTrue (result .stdout ().contains ("createDomain.sh completed successfully" ), "Create failed" );
847
+ }
848
+
849
+ String domainHome = domainParentDir + FS + domainDir ;
850
+ setUpBootProperties (domainHome , "admin-server" , "weblogic" , "welcome1" );
851
+ Path adminServerOut = getTestOutputPath (testInfo ).resolve ("admin-server.out" );
852
+ boolean isServerUp = startAdminServer (domainHome , adminServerOut );
853
+
854
+ if (isServerUp ) {
855
+ try (PrintWriter out = getTestMethodWriter (testInfo )) {
856
+ // update wdt model file
857
+ Path source = Paths .get (getSampleModelFile ("-untargetapp" ));
858
+ Path model = getTestOutputPath (testInfo ).resolve (SAMPLE_MODEL_FILE_PREFIX + "-onlineUpdate.yaml" );
859
+ Files .copy (source , model , StandardCopyOption .REPLACE_EXISTING );
860
+
861
+ cmd = "echo welcome1 | "
862
+ + updateDomainScript
863
+ + " -oracle_home " + mwhome_12213
864
+ + " -domain_home " + domainParentDir + FS + domainDir
865
+ + " -model_file " + model
866
+ + " -archive_file " + getSampleArchiveFile ()
867
+ + " -admin_url t3://localhost:7001 -admin_user weblogic" ;
868
+ CommandResult result = Runner .run (cmd , getTestMethodEnvironment (testInfo ), out );
869
+
870
+ assertEquals (0 , result .exitValue (), "Unexpected return code for untargeting app" );
871
+ assertTrue (result .stdout ().contains ("<remove_app_from_deployment> <WLSDPLY-09339>" ),
872
+ "Update does not contains expected message WLSDPLY-09339" );
873
+
874
+ // Check result
875
+ source = Paths .get (getSampleModelFile ("-targetapp" ));
876
+ model = getTestOutputPath (testInfo ).resolve (SAMPLE_MODEL_FILE_PREFIX + "-onlineUpdate.yaml" );
877
+ Files .copy (source , model , StandardCopyOption .REPLACE_EXISTING );
878
+
879
+ cmd = "echo welcome1 | "
880
+ + updateDomainScript
881
+ + " -oracle_home " + mwhome_12213
882
+ + " -domain_home " + domainParentDir + FS + domainDir
883
+ + " -model_file " + model
884
+ + " -archive_file " + getSampleArchiveFile ()
885
+ + " -admin_url t3://localhost:7001 -admin_user weblogic" ;
886
+ result = Runner .run (cmd , getTestMethodEnvironment (testInfo ), out );
887
+
888
+ assertEquals (0 , result .exitValue (), "Unexpected return code for targeting app" );
889
+ assertTrue (result .stdout ().contains ("<__deploy_app_online> <WLSDPLY-09316>" ),
890
+ "Update does not contains expected message WLSDPLY-09316" );
891
+ assertTrue (result .stdout ().contains ("<__start_app> <WLSDPLY-09313>" ),
892
+ "Update does not contains expected message WLSDPLY-09313" );
893
+
894
+ updateSampleArchive ();
895
+
896
+ source = Paths .get (getSampleModelFile ("-targetapp" ));
897
+ model = getTestOutputPath (testInfo ).resolve (SAMPLE_MODEL_FILE_PREFIX + "-onlineUpdate.yaml" );
898
+ Files .copy (source , model , StandardCopyOption .REPLACE_EXISTING );
899
+
900
+ cmd = "echo welcome1 | "
901
+ + updateDomainScript
902
+ + " -oracle_home " + mwhome_12213
903
+ + " -domain_home " + domainParentDir + FS + domainDir
904
+ + " -model_file " + model
905
+ + " -archive_file " + getUpdatedSampleArchiveFile ()
906
+ + " -admin_url t3://localhost:7001 -admin_user weblogic" ;
907
+ result = Runner .run (cmd , getTestMethodEnvironment (testInfo ), out );
908
+
909
+ assertEquals (0 , result .exitValue (), "Unexpected return code for updating domain with new archive" );
910
+ assertTrue (result .stdout ().contains ("<__stop_app> <WLSDPLY-09312>" ),
911
+ "Update does not contains expected message WLSDPLY-09312" );
912
+ assertTrue (result .stdout ().contains ("<__undeploy_app> <WLSDPLY-09314>" ),
913
+ "Update does not contains expected message WLSDPLY-09314" );
914
+ assertTrue (result .stdout ().contains ("<__deploy_app_online> <WLSDPLY-09316>" ),
915
+ "Update does not contains expected message WLSDPLY-09316" );
916
+ assertTrue (result .stdout ().contains ("<__start_app> <WLSDPLY-09313>" ),
917
+ "Update does not contains expected message WLSDPLY-09313" );
918
+
919
+ stopAdminServer (domainHome );
920
+ }
921
+
922
+ } else {
923
+ // Best effort to clean up server
924
+ tryKillTheAdminServer (domainHome , "admin-server" );
925
+ throw new Exception ("testDOnlineUpdate failed - cannot bring up server" );
926
+ }
927
+
928
+
929
+ }
930
+
931
+
827
932
private boolean startAdminServer (String domainHome , Path outputFile ) throws Exception {
828
933
boolean isServerUp = false ;
829
934
String cmd = "nohup " + domainHome + "/bin/startWebLogic.sh > " + outputFile + " 2>&1 &" ;
0 commit comments