8
8
import java .nio .file .Files ;
9
9
10
10
import static oracle .kubernetes .operator .create .CreateDomainInputs .*;
11
- import static oracle .kubernetes .operator .create .ExecCreateDomain .execCreateDomain ;
12
- import static oracle .kubernetes .operator .create .ExecResultMatcher .succeedsAndPrints ;
11
+ import static oracle .kubernetes .operator .create .ExecCreateDomain .*;
12
+ import static oracle .kubernetes .operator .create .ExecResultMatcher .*;
13
+ import static oracle .kubernetes .operator .create .YamlUtils .*;
13
14
import static org .hamcrest .MatcherAssert .assertThat ;
14
15
import static org .hamcrest .Matchers .*;
15
16
@@ -36,34 +37,37 @@ public void tearDown() throws Exception {
36
37
37
38
@ Test
38
39
public void defaultInputsFile_hasCorrectContents () throws Exception {
39
- CreateDomainInputs i = readDefaultInputsFile ();
40
- assertThat (i .getAdminNodePort (), equalTo ("30701" ));
41
- assertThat (i .getAdminPort (), equalTo ("7001" ));
42
- assertThat (i .getAdminServerName (), equalTo ("admin-server" ));
43
- assertThat (i .getClusterName (), equalTo ("cluster-1" ));
44
- assertThat (i .getCreateDomainScript (), equalTo ("/u01/weblogic/create-domain-script.sh" ));
45
- assertThat (i .getDomainName (), equalTo ("base_domain" ));
46
- assertThat (i .getDomainUid (), equalTo ("domain1" ));
47
- assertThat (i .getExposeAdminNodePort (), equalTo ("false" ));
48
- assertThat (i .getExposeAdminT3Channel (), equalTo ("false" ));
49
- assertThat (i .getImagePullSecretName (), equalTo ("" ));
50
- assertThat (i .getJavaOptions (), equalTo ("-Dweblogic.StdoutDebugEnabled=false" ));
51
- assertThat (i .getLoadBalancer (), equalTo ("traefik" ));
52
- assertThat (i .getLoadBalancerAdminPort (), equalTo ("30315" ));
53
- assertThat (i .getLoadBalancerWebPort (), equalTo ("30305" ));
54
- assertThat (i .getManagedServerCount (), equalTo ("2" ));
55
- assertThat (i .getManagedServerNameBase (), equalTo ("managed-server" ));
56
- assertThat (i .getManagedServerPort (), equalTo ("8001" ));
57
- assertThat (i .getManagedServerStartCount (), equalTo ("2" ));
58
- assertThat (i .getNamespace (), equalTo ("default" ));
59
- assertThat (i .getPersistencePath (), equalTo ("/scratch/k8s_dir/persistentVolume001" ));
60
- assertThat (i .getPersistenceSize (), equalTo ("10Gi" ));
61
- assertThat (i .getPersistenceVolumeClaimName (), equalTo ("pv001-claim" ));
62
- assertThat (i .getPersistenceVolumeName (), equalTo ("pv001" ));
63
- assertThat (i .getProductionModeEnabled (), equalTo ("true" ));
64
- assertThat (i .getSecretName (), equalTo ("domain1-weblogic-credentials" ));
65
- assertThat (i .getStartupControl (), equalTo ("AUTO" ));
66
- assertThat (i .getT3ChannelPort (), equalTo ("30012" ));
40
+ assertThat (
41
+ readDefaultInputsFile (),
42
+ yamlEqualTo ((new CreateDomainInputs ())
43
+ .adminNodePort ("30701" )
44
+ .adminPort ("7001" )
45
+ .adminServerName ("admin-server" )
46
+ .clusterName ("cluster-1" )
47
+ .createDomainScript ("/u01/weblogic/create-domain-script.sh" )
48
+ .domainName ("base_domain" )
49
+ .domainUid ("domain1" )
50
+ .exposeAdminNodePort ("false" )
51
+ .exposeAdminT3Channel ("false" )
52
+ .imagePullSecretName ("" )
53
+ .javaOptions ("-Dweblogic.StdoutDebugEnabled=false" )
54
+ .loadBalancer ("traefik" )
55
+ .loadBalancerAdminPort ("30315" )
56
+ .loadBalancerWebPort ("30305" )
57
+ .managedServerCount ("2" )
58
+ .managedServerNameBase ("managed-server" )
59
+ .managedServerPort ("8001" )
60
+ .managedServerStartCount ("2" )
61
+ .namespace ("default" )
62
+ .persistencePath ("/scratch/k8s_dir/persistentVolume001" )
63
+ .persistenceSize ("10Gi" )
64
+ .persistenceVolumeClaimName ("pv001-claim" )
65
+ .persistenceVolumeName ("pv001" )
66
+ .productionModeEnabled ("true" )
67
+ .secretName ("domain1-weblogic-credentials" )
68
+ .startupControl ("AUTO" )
69
+ .t3ChannelPort ("30012" )
70
+ .t3PublicAddress ("kubernetes" )));
67
71
}
68
72
69
73
@ Test
@@ -72,11 +76,14 @@ public void createDomain_usesSpecifiedInputsFileAndSucceedsAndGeneratesExpectedY
72
76
CreateDomainInputs inputs = readDefaultInputsFile ().domainUid ("test-domain-uid" );
73
77
assertThat (execCreateDomain (userProjects .getPath (), inputs ), succeedsAndPrints ("Completed" ));
74
78
DomainFiles domainFiles = new DomainFiles (userProjects .getPath (), inputs );
79
+ assertThat (Files .isRegularFile (domainFiles .getCreateWeblogicDomainInputsYamlPath ()), is (true ));
75
80
assertThat (Files .isRegularFile (domainFiles .getCreateWeblogicDomainJobYamlPath ()), is (true ));
76
81
assertThat (Files .isRegularFile (domainFiles .getDomainCustomResourceYamlPath ()), is (true ));
77
82
assertThat (Files .isRegularFile (domainFiles .getTraefikYamlPath ()), is (true ));
78
83
assertThat (Files .isRegularFile (domainFiles .getTraefikSecurityYamlPath ()), is (true ));
79
84
assertThat (Files .isRegularFile (domainFiles .getWeblogicDomainPersistentVolumeYamlPath ()), is (true ));
80
85
assertThat (Files .isRegularFile (domainFiles .getWeblogicDomainPersistentVolumeClaimYamlPath ()), is (true ));
86
+ // TBD - assert that the generated per-domain directory doesn't contain any extra files?
87
+ // TBD - assert that the copy of the inputs in generated per-domain directory matches the origin one
81
88
}
82
89
}
0 commit comments