Skip to content

Commit a04b34d

Browse files
Wdt 666 prepare model integration test (#1215)
* Fix for flattened folders without tokens in location * add prepare model system test and test * add prepare model system test and test * add prepare model system test and test * add prepare model system test and test * add prepare model system test and test * add prepare model system test and test * system test * print out temp file * print out temp file * print out temp file * try another test * try another test * for testing * fix to check correct grep return code * remove changes to verify_helper * remove changes to verify_helper * remove changes to verify_helper * finalize test
1 parent 7e639c7 commit a04b34d

File tree

3 files changed

+104
-2
lines changed

3 files changed

+104
-2
lines changed

integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration/BaseTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class BaseTest {
4444
protected static String encryptModelScript = "";
4545
protected static String validateModelScript = "";
4646
protected static String domainParentDir = "";
47+
protected static String prepareModelScript = "";
4748
protected static final String ORACLE_DB_IMG = "phx.ocir.io/weblogick8s/database/enterprise";
4849
protected static final String ORACLE_DB_IMG_TAG = "12.2.0.1-slim";
4950
private static final String DB_CONTAINER_NAME = generateDatabaseContainerName();
@@ -74,6 +75,7 @@ protected static void initialize() {
7475
encryptModelScript = getWDTScriptsHome() + FS + "encryptModel.sh";
7576
validateModelScript = getWDTScriptsHome() + FS + "validateModel.sh";
7677
compareModelScript = getWDTScriptsHome() + FS + "compareModel.sh";
78+
prepareModelScript = getWDTScriptsHome() + FS + "prepareModel.sh";
7779

7880
domainParentDir = "." + FS + "target" + FS + "domains";
7981
}

integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration/ITWdt.java

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
import org.junit.jupiter.api.TestInfo;
3535
import org.junit.jupiter.api.TestMethodOrder;
3636

37-
import static org.junit.jupiter.api.Assertions.assertEquals;
38-
import static org.junit.jupiter.api.Assertions.assertTrue;
37+
import static org.junit.jupiter.api.Assertions.*;
3938
import static org.junit.jupiter.api.Assumptions.assumeTrue;
4039

4140
@IntegrationTest
@@ -964,6 +963,37 @@ void test31DiscoverDomainWithModelFile(TestInfo testInfo) throws Exception {
964963
stopAdminServer(domainHome);
965964
}
966965
}
966+
/**
967+
* test discoverDomain.sh with -domain_type as JRF
968+
* @throws Exception - if any error occurs
969+
*/
970+
@DisplayName("Test 32: Prepare model")
971+
@Order(32)
972+
@Tag("gate")
973+
@Test
974+
void test32PrepareModel(TestInfo testInfo) throws Exception {
975+
976+
try (PrintWriter out = getTestMethodWriter(testInfo)) {
977+
String wkoModelFile = getSampleModelFile("-targetwko");
978+
Path outputFiles = getTestOutputPath(testInfo);
979+
String cmd = prepareModelScript
980+
+ " -oracle_home " + mwhome_12213
981+
+ " -output_dir " + outputFiles
982+
+ " -model_file " + wkoModelFile
983+
+ " -target " + "wko";
984+
985+
CommandResult result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
986+
987+
verifyResult(result, "prepareModel.sh completed successfully");
988+
989+
// verify model file
990+
String tempWkoModel = outputFiles + FS + wkoModelFile;
991+
992+
cmd = "grep -c 'Partition' " + tempWkoModel;
993+
CommandResult result3 = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
994+
assertNotEquals(0, result3.exitValue(), "Partition section was not removed from model");
995+
}
996+
}
967997

968998
private boolean startAdminServer(String domainHome, Path outputFile) throws Exception {
969999
boolean isServerUp = false;
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
domainInfo:
2+
AdminUserName: weblogic
3+
AdminPassword: 'welcome1'
4+
topology:
5+
Name: DemoDomain
6+
Cluster:
7+
staticCluster:
8+
CoherenceClusterSystemResource: DataGridConfig
9+
JTACluster:
10+
# remove, attribute is online only
11+
DeterminerCandidateResourceInfoList: []
12+
Notes: not here
13+
dynamicCluster:
14+
DynamicServers:
15+
# add CalculatedListenPorts set to false
16+
MaxDynamicClusterSize: 4
17+
DynamicClusterSize: 3
18+
dynamicCluster2:
19+
DynamicServers:
20+
MaxDynamicClusterSize: 4
21+
# change CalculatedListenPorts to false
22+
CalculatedListenPorts: true
23+
DynamicClusterSize: 3
24+
Server:
25+
m1:
26+
Cluster: staticCluster
27+
ListenPort: 5001
28+
Machine: "machine-1"
29+
m2:
30+
Cluster: staticCluster
31+
# string value should match numeric value
32+
ListenPort: "5001"
33+
Machine: "machine-1"
34+
m3:
35+
Cluster: staticCluster
36+
# this should cause a warning message
37+
ListenPort: 5002
38+
Machine: "machine-1"
39+
ServerTemplate:
40+
'template-1':
41+
Machine: "machine-1"
42+
Machine:
43+
# this machine and any references to it should be removed
44+
machine-1:
45+
VirtualTarget:
46+
target-2:
47+
48+
# confirm that model traversal deals with artificial type folders correctly
49+
SecurityConfiguration:
50+
Realm:
51+
yourRealm:
52+
AuthenticationProvider:
53+
DefaultAuthenticator:
54+
DefaultAuthenticator:
55+
ControlFlag: OPTIONAL
56+
# remove, attribute is online only
57+
ProviderClassName: 'com.defaultClass'
58+
59+
resources:
60+
Partition:
61+
my-partition:
62+
ResourceGroup:
63+
my-resource-group:
64+
65+
appDeployments:
66+
Application:
67+
myApp:
68+
SourcePath: 'wlsdeploy/applications/sample-app.war'
69+
# remove, attribute is online only
70+
MultiVersionApp: false

0 commit comments

Comments
 (0)