1
- // Copyright 2019, 2020, Oracle Corporation and/or its affiliates. All rights reserved.
1
+ // Copyright 2019, 2020, Oracle Corporation and/or its affiliates.
2
2
// Licensed under the Universal Permissive License v 1.0 as shown at
3
3
// http://oss.oracle.com/licenses/upl.
4
4
14
14
import org .junit .Test ;
15
15
import org .junit .rules .TestWatcher ;
16
16
import org .junit .runner .Description ;
17
+ import java .util .ArrayList ;
18
+ import java .util .List ;
17
19
import java .nio .file .Files ;
18
20
import java .nio .file .Path ;
19
21
import java .nio .file .Paths ;
20
22
import java .nio .file .StandardCopyOption ;
21
-
22
23
@ FixMethodOrder (MethodSorters .NAME_ASCENDING )
23
24
public class ITWdt extends BaseTest {
24
25
@@ -392,10 +393,24 @@ public void testFDiscoverDomainWithRequiredArgument() throws Exception {
392
393
// verify model file
393
394
String expectedModelFile = System .getProperty ("java.io.tmpdir" ) + FS + "model" + FS + "restrictedJRFD1.yaml" ;
394
395
verifyModelFile (expectedModelFile );
396
+ verifyFDiscoverDomainWithRequiredArgument (expectedModelFile );
397
+ System .out .println ("model file=" + expectedModelFile );
395
398
396
399
logTestEnd (testMethodName );
397
400
}
398
401
402
+ private void verifyFDiscoverDomainWithRequiredArgument (String expectedModelFile ) throws Exception {
403
+ List <String > checkContents = new ArrayList <>();
404
+ checkContents .add ("domainInfo:" );
405
+ checkContents .add ("AdminUserName: '--FIX ME--'" );
406
+ checkContents .add ("CoherenceClusterSystemResource: defaultCoherenceCluster" );
407
+ checkContents .add ("PublicAddress: kubernetes" );
408
+ checkContents .add ("Trust Service Identity Asserter:" );
409
+ checkContents .add ("appDeployments:" );
410
+ checkContents .add ("SourcePath: 'wlsdeploy/applications/simple-app.war'" );
411
+ verifyModelFileContents (expectedModelFile , checkContents );
412
+ }
413
+
399
414
/**
400
415
* test discoverDomain.sh with -model_file argument
401
416
* @throws Exception - if any error occurs
@@ -421,6 +436,40 @@ public void testGDiscoverDomainWithModelFile() throws Exception {
421
436
422
437
logTestEnd (testMethodName );
423
438
}
439
+ /**
440
+ * test discoverDomain.sh with -variable_file argument
441
+ * @throws Exception - if any error occurs
442
+ */
443
+ @ Test
444
+ public void testGDiscoverDomainWithVariableFile () throws Exception {
445
+ String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
446
+ logTestBegin (testMethodName );
447
+
448
+ String discoveredArchive = System .getProperty ("java.io.tmpdir" ) + FS + "discoveredArchive.zip" ;
449
+ String discoveredModelFile = System .getProperty ("java.io.tmpdir" ) + FS + "discoveredRestrictedJRFD1.yaml" ;
450
+ String discoveredVaribleFile = System .getProperty ("java.io.tmpdir" ) + FS + "discoveredRestrictedJRFD1.properties" ;
451
+ String cmd = discoverDomainScript + " -oracle_home " + mwhome_12213 + " -domain_home " +
452
+ domainParent12213 + FS + "restrictedJRFD1 -archive_file " + discoveredArchive +
453
+ " -model_file " + discoveredModelFile + " -variable_file " + discoveredVaribleFile ;
454
+
455
+ logger .info ("executing command: " + cmd );
456
+ ExecResult result = ExecCommand .exec (cmd );
457
+
458
+ verifyResult (result , "discoverDomain.sh completed successfully" );
459
+
460
+ // verify model file and variable file
461
+ verifyModelFile (discoveredModelFile );
462
+ verifyModelFile (discoveredVaribleFile );
463
+ verifyGDiscoverDomainWithVariableFile (discoveredModelFile );
464
+
465
+ logTestEnd (testMethodName );
466
+ }
467
+
468
+ private void verifyGDiscoverDomainWithVariableFile (String expectedModelFile ) throws Exception {
469
+ List <String > checkContents = new ArrayList <>();
470
+ checkContents .add ("AdminUserName: '@@PROP:AdminUserName@@'" );
471
+ verifyModelFileContents (expectedModelFile , checkContents );
472
+ }
424
473
425
474
/**
426
475
* test discoverDomain.sh with -domain_type as JRF
@@ -444,10 +493,21 @@ public void testHDiscoverDomainJRFDomainType() throws Exception {
444
493
445
494
// verify model file
446
495
verifyModelFile (discoveredModelFile );
447
-
496
+ verifyHDiscoverDomainJRFDomainType ( discoveredModelFile );
448
497
logTestEnd (testMethodName );
449
498
}
450
499
500
+ private void verifyHDiscoverDomainJRFDomainType (String expectedModelFile ) throws Exception {
501
+ List <String > checkContents = new ArrayList <>();
502
+ checkContents .add ("AWT Application Context Startup Class" );
503
+ try {
504
+ verifyModelFileContents (expectedModelFile , checkContents );
505
+ throw new Exception ("JRF blacklist components found in model file" );
506
+ } catch (Exception e ) {
507
+ // empty this is expected result
508
+ }
509
+ }
510
+
451
511
/**
452
512
* test updateDomain.sh, update the domain to set the number of dynamic servers to 4
453
513
* @throws Exception - if any error occurs
0 commit comments