@@ -393,20 +393,24 @@ public void testDeleteOneDomain() throws Exception {
393
393
operatorForDel1 = TestUtils .createOperator (opForDelYamlFile1 );
394
394
}
395
395
Domain domain = null ;
396
- boolean testCompletedSuccessfully = false ;
397
396
try {
398
397
domain = testDomainCreation (domain1ForDelValueYamlFile );
399
398
domain .verifyDomainCreated ();
400
399
TestUtils .verifyBeforeDeletion (domain );
400
+ } catch (Exception ex ) {
401
+ if (domain != null && JENKINS ) {
402
+ try {
403
+ domain .destroy ();
404
+ } catch (Exception ignore ) {
405
+ }
406
+ }
407
+ throw ex ;
408
+ }
401
409
402
- logger .info ("About to delete domain: " + domain .getDomainUid ());
403
- TestUtils .deleteWeblogicDomainResources (domain .getDomainUid ());
410
+ logger .info ("About to delete domain: " + domain .getDomainUid ());
411
+ TestUtils .deleteWeblogicDomainResources (domain .getDomainUid ());
404
412
405
- TestUtils .verifyAfterDeletion (domain );
406
- testCompletedSuccessfully = true ;
407
- } finally {
408
- if (domain != null && (JENKINS || testCompletedSuccessfully )) domain .destroy ();
409
- }
413
+ TestUtils .verifyAfterDeletion (domain );
410
414
logger .info ("SUCCESS - testDeleteOneDomain" );
411
415
}
412
416
@@ -420,7 +424,7 @@ public void testDeleteTwoDomains() throws Exception {
420
424
operatorForDel2 = TestUtils .createOperator (opForDelYamlFile2 );
421
425
}
422
426
Domain domainDel1 = null , domainDel2 = null ;
423
- boolean testCompletedSuccessfully = false ;
427
+
424
428
try {
425
429
domainDel1 = testDomainCreation (domain2ForDelValueYamlFile );
426
430
domainDel1 .verifyDomainCreated ();
@@ -429,19 +433,29 @@ public void testDeleteTwoDomains() throws Exception {
429
433
430
434
TestUtils .verifyBeforeDeletion (domainDel1 );
431
435
TestUtils .verifyBeforeDeletion (domainDel2 );
436
+ } catch (Exception ex ) {
432
437
433
- final String domainUidsToBeDeleted =
434
- domainDel1 .getDomainUid () + "," + domainDel2 .getDomainUid ();
435
- logger .info ("About to delete domains: " + domainUidsToBeDeleted );
436
- TestUtils .deleteWeblogicDomainResources (domainUidsToBeDeleted );
437
-
438
- TestUtils .verifyAfterDeletion (domainDel1 );
439
- TestUtils .verifyAfterDeletion (domainDel2 );
440
- testCompletedSuccessfully = true ;
441
- } finally {
442
- if (domainDel1 != null && (JENKINS || testCompletedSuccessfully )) domainDel1 .destroy ();
443
- if (domainDel2 != null && (JENKINS || testCompletedSuccessfully )) domainDel2 .destroy ();
438
+ if (domainDel1 != null && JENKINS ) {
439
+ try {
440
+ domainDel1 .destroy ();
441
+ } catch (Exception ignore ) {
442
+ }
443
+ }
444
+ if (domainDel2 != null && JENKINS ) {
445
+ try {
446
+ domainDel2 .destroy ();
447
+ } catch (Exception ignore ) {
448
+ }
449
+ }
450
+ throw ex ;
444
451
}
452
+ final String domainUidsToBeDeleted =
453
+ domainDel1 .getDomainUid () + "," + domainDel2 .getDomainUid ();
454
+ logger .info ("About to delete domains: " + domainUidsToBeDeleted );
455
+ TestUtils .deleteWeblogicDomainResources (domainUidsToBeDeleted );
456
+
457
+ TestUtils .verifyAfterDeletion (domainDel1 );
458
+ TestUtils .verifyAfterDeletion (domainDel2 );
445
459
logger .info ("SUCCESS - testDeleteTwoDomains" );
446
460
}
447
461
0 commit comments