10
10
import org .junit .runners .MethodSorters ;
11
11
import org .junit .BeforeClass ;
12
12
import org .junit .AfterClass ;
13
+ import org .junit .Rule ;
13
14
import org .junit .Test ;
15
+ import org .junit .rules .TestRule ;
16
+ import org .junit .rules .TestWatcher ;
17
+ import org .junit .runner .Description ;
14
18
import java .nio .file .Files ;
15
19
import java .nio .file .Path ;
16
20
import java .nio .file .Paths ;
@@ -43,6 +47,22 @@ public static void staticUnprepare() throws Exception {
43
47
cleanup ();
44
48
}
45
49
50
+
51
+ @ Rule
52
+ public TestWatcher watcher = new TestWatcher () {
53
+ @ Override
54
+ protected void failed (Throwable e , Description description ) {
55
+ if (e != null ) {
56
+ logger .info ("Method " + description .getMethodName () + " Exception: " + e .getLocalizedMessage ());
57
+ }
58
+ try {
59
+ saveLogFiles (description .getMethodName ());
60
+ } catch (Exception le ) {
61
+ logger .info ("Unable to save log files : " + le .getLocalizedMessage ());
62
+ }
63
+ }
64
+ };
65
+
46
66
/**
47
67
* test createDomain.sh with only -oracle_home argument
48
68
* @throws Exception - if any error occurs
@@ -362,6 +382,7 @@ public void testFDiscoverDomainWithRequiredArgument() throws Exception {
362
382
363
383
logger .info ("executing command: " + cmd );
364
384
ExecResult result = ExecCommand .exec (cmd );
385
+
365
386
verifyResult (result , "discoverDomain.sh completed successfully" );
366
387
367
388
// unzip discoveredArchive.zip
@@ -393,6 +414,7 @@ public void testGDiscoverDomainWithModelFile() throws Exception {
393
414
394
415
logger .info ("executing command: " + cmd );
395
416
ExecResult result = ExecCommand .exec (cmd );
417
+
396
418
verifyResult (result , "discoverDomain.sh completed successfully" );
397
419
398
420
// verify model file
@@ -418,6 +440,7 @@ public void testHDiscoverDomainJRFDomainType() throws Exception {
418
440
419
441
logger .info ("executing command: " + cmd );
420
442
ExecResult result = ExecCommand .exec (cmd );
443
+
421
444
verifyResult (result , "discoverDomain.sh completed successfully" );
422
445
423
446
// verify model file
0 commit comments