@@ -359,23 +359,26 @@ void testMiiCheckSystemResources() {
359359 }
360360
361361 /**
362- * Start a WebLogic domain using model-in-image with JMS/JDBC SystemResources.
363- * Create a configmap to delete JMS/JDBC SystemResources.
362+ * Start a WebLogic domain using model-in-image.
363+ * Create 1 configmap with 2 models files, one of them to add JMS/JDBC SystemResources
364+ * and another one to delete JMS/JDBC SystemResources
364365 * Patch the domain resource with the configmap.
365366 * Update the restart version of the domain resource.
366367 * Verify rolling restart of the domain by comparing PodCreationTimestamp
367368 * for all the server pods before and after rolling restart.
368369 * Verify SystemResources are deleted from the domain.
369370 */
370371 @ Test
371- @ Order (4 )
372+ @ Order (5 )
372373 @ DisplayName ("Delete SystemResources from the domain" )
373374 void testMiiDeleteSystemResources () {
374375
375376 String configMapName = "deletesysrescm" ;
377+ final String modelFileAdd = "model.add.sysresources.yaml" ;
378+ final String modelFileDelete = "model.delete.sysresources.yaml" ;
379+ List <String > modelFiles = Arrays .asList (MODEL_DIR + "/" + modelFileAdd , MODEL_DIR + "/" + modelFileDelete );
376380 createConfigMapAndVerify (
377- configMapName , domainUid , domainNamespace ,
378- Arrays .asList (MODEL_DIR + "/model.delete.sysresourcesbyconfigmap.yaml" ));
381+ configMapName , domainUid , domainNamespace , modelFiles );
379382
380383 LinkedHashMap <String , OffsetDateTime > pods = new LinkedHashMap <>();
381384 // get the creation time of the admin server pod before patching
@@ -433,7 +436,7 @@ void testMiiDeleteSystemResources() {
433436 * Verify JMS Server logs are written on PV.
434437 */
435438 @ Test
436- @ Order (5 )
439+ @ Order (6 )
437440 @ DisplayName ("Add new JDBC/JMS SystemResources to the domain" )
438441 void testMiiAddSystemResources () {
439442
@@ -505,7 +508,7 @@ void testMiiAddSystemResources() {
505508 * Verify servers from the new cluster are running.
506509 */
507510 @ Test
508- @ Order (6 )
511+ @ Order (7 )
509512 @ DisplayName ("Add a dynamic cluster to domain with non-zero replica count" )
510513 void testMiiAddDynamicCluster () {
511514
@@ -579,7 +582,7 @@ void testMiiAddDynamicCluster() {
579582 * Check the validity of new credentials by accessing WebLogic RESTful Service
580583 */
581584 @ Test
582- @ Order (7 )
585+ @ Order (8 )
583586 @ DisplayName ("Change the WebLogic Admin credential of the domain" )
584587 void testMiiUpdateWebLogicCredential () {
585588 verifyUpdateWebLogicCredential (adminSvcExtHost , domainNamespace , domainUid , adminServerPodName ,
@@ -601,7 +604,7 @@ void testMiiUpdateWebLogicCredential() {
601604 * Make sure JMS Connections and messages are distributed across 4 servers.
602605 */
603606 @ Test
604- @ Order (8 )
607+ @ Order (9 )
605608 @ DisplayName ("Test modification to Dynamic cluster size parameters" )
606609 void testMiiUpdateDynamicClusterSize () {
607610
@@ -745,6 +748,70 @@ private void buildClientOnPod() {
745748 assertEquals (0 , result .exitValue (), "Client compilation fails" );
746749 }
747750
751+ /**
752+ * Start a WebLogic domain using model-in-image with JMS/JDBC SystemResources.
753+ * Create a empty configmap to delete JMS/JDBC SystemResources
754+ * Patch the domain resource with the configmap.
755+ * Update the restart version of the domain resource.
756+ * Verify rolling restart of the domain by comparing PodCreationTimestamp
757+ * for all the server pods before and after rolling restart.
758+ * Verify SystemResources are deleted from the domain.
759+ */
760+ @ Test
761+ @ Order (4 )
762+ @ DisplayName ("Delete SystemResources from the domain" )
763+ void testMiiDeleteSystemResourcesByEmptyConfigMap () {
764+
765+ String configMapName = "deletesysrescm" ;
766+ createConfigMapAndVerify (
767+ configMapName , domainUid , domainNamespace ,
768+ Arrays .asList (MODEL_DIR + "/model.delete.sysresourcesbyconfigmap.yaml" ));
769+
770+ LinkedHashMap <String , OffsetDateTime > pods = new LinkedHashMap <>();
771+ // get the creation time of the admin server pod before patching
772+ OffsetDateTime adminPodCreationTime = getPodCreationTime (domainNamespace ,adminServerPodName );
773+ pods .put (adminServerPodName , adminPodCreationTime );
774+ // get the creation time of the managed server pods before patching
775+ for (int i = 1 ; i <= replicaCount ; i ++) {
776+ pods .put (managedServerPrefix + i , getPodCreationTime (domainNamespace , managedServerPrefix + i ));
777+ }
778+
779+ StringBuffer patchStr = null ;
780+ patchStr = new StringBuffer ("[{" );
781+ patchStr .append ("\" op\" : \" replace\" ," )
782+ .append (" \" path\" : \" /spec/configuration/model/configMap\" ," )
783+ .append (" \" value\" : \" " + configMapName + "\" " )
784+ .append (" }]" );
785+ logger .log (Level .INFO , "Configmap patch string: {0}" , patchStr );
786+
787+ patch = new V1Patch (new String (patchStr ));
788+ boolean cmPatched = assertDoesNotThrow (() ->
789+ patchDomainCustomResource (domainUid , domainNamespace , patch , "application/json-patch+json" ),
790+ "patchDomainCustomResource(configMap) failed " );
791+ assertTrue (cmPatched , "patchDomainCustomResource(configMap) failed" );
792+
793+ String newRestartVersion = patchDomainResourceWithNewRestartVersion (domainUid , domainNamespace );
794+ logger .log (Level .INFO , "New restart version is {0}" , newRestartVersion );
795+
796+ assertTrue (verifyRollingRestartOccurred (pods , 1 , domainNamespace ),
797+ "Rolling restart failed" );
798+
799+ // Even if pods are created, need the service to created
800+ for (int i = 1 ; i <= replicaCount ; i ++) {
801+ logger .info ("Check managed server service {0} created in namespace {1}" ,
802+ managedServerPrefix + i , domainNamespace );
803+ checkServiceExists (managedServerPrefix + i , domainNamespace );
804+ }
805+
806+ int adminServiceNodePort
807+ = getServiceNodePort (domainNamespace , getExternalServicePodName (adminServerPodName ), "default" );
808+ assertNotEquals (-1 , adminServiceNodePort , "admin server default node port is not valid" );
809+ verifySystemResourceConfiguration (adminSvcExtHost , adminServiceNodePort ,
810+ "JDBCSystemResources" , "TestDataSource" , "404" );
811+ verifySystemResourceConfiguration (adminSvcExtHost , adminServiceNodePort ,
812+ "JMSSystemResources" , "TestClusterJmsModule" , "404" );
813+ }
814+
748815 // Run standalone JMS Client in the pod using wlthint3client.jar in classpath.
749816 // The client sends 300 messsage to a Uniform Distributed Queue.
750817 // Make sure that each destination get excatly 150 messages each.
0 commit comments