diff --git a/integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration/BaseTest.java b/integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration/BaseTest.java index 18735fa1db..3b79ed51c0 100644 --- a/integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration/BaseTest.java +++ b/integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration/BaseTest.java @@ -44,6 +44,7 @@ public class BaseTest { protected static String encryptModelScript = ""; protected static String validateModelScript = ""; protected static String domainParentDir = ""; + protected static String prepareModelScript = ""; protected static final String ORACLE_DB_IMG = "phx.ocir.io/weblogick8s/database/enterprise"; protected static final String ORACLE_DB_IMG_TAG = "12.2.0.1-slim"; private static final String DB_CONTAINER_NAME = generateDatabaseContainerName(); @@ -74,6 +75,7 @@ protected static void initialize() { encryptModelScript = getWDTScriptsHome() + FS + "encryptModel.sh"; validateModelScript = getWDTScriptsHome() + FS + "validateModel.sh"; compareModelScript = getWDTScriptsHome() + FS + "compareModel.sh"; + prepareModelScript = getWDTScriptsHome() + FS + "prepareModel.sh"; domainParentDir = "." + FS + "target" + FS + "domains"; } diff --git a/integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration/ITWdt.java b/integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration/ITWdt.java index 7588310459..8edbda3837 100644 --- a/integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration/ITWdt.java +++ b/integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration/ITWdt.java @@ -34,8 +34,7 @@ import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.api.TestMethodOrder; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assumptions.assumeTrue; @IntegrationTest @@ -964,6 +963,37 @@ void test31DiscoverDomainWithModelFile(TestInfo testInfo) throws Exception { stopAdminServer(domainHome); } } + /** + * test discoverDomain.sh with -domain_type as JRF + * @throws Exception - if any error occurs + */ + @DisplayName("Test 32: Prepare model") + @Order(32) + @Tag("gate") + @Test + void test32PrepareModel(TestInfo testInfo) throws Exception { + + try (PrintWriter out = getTestMethodWriter(testInfo)) { + String wkoModelFile = getSampleModelFile("-targetwko"); + Path outputFiles = getTestOutputPath(testInfo); + String cmd = prepareModelScript + + " -oracle_home " + mwhome_12213 + + " -output_dir " + outputFiles + + " -model_file " + wkoModelFile + + " -target " + "wko"; + + CommandResult result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out); + + verifyResult(result, "prepareModel.sh completed successfully"); + + // verify model file + String tempWkoModel = outputFiles + FS + wkoModelFile; + + cmd = "grep -c 'Partition' " + tempWkoModel; + CommandResult result3 = Runner.run(cmd, getTestMethodEnvironment(testInfo), out); + assertNotEquals(0, result3.exitValue(), "Partition section was not removed from model"); + } + } private boolean startAdminServer(String domainHome, Path outputFile) throws Exception { boolean isServerUp = false; diff --git a/integration-tests/system-test/src/test/resources/simple-topology-targetwko.yaml b/integration-tests/system-test/src/test/resources/simple-topology-targetwko.yaml new file mode 100644 index 0000000000..e6ba5a877d --- /dev/null +++ b/integration-tests/system-test/src/test/resources/simple-topology-targetwko.yaml @@ -0,0 +1,70 @@ +domainInfo: + AdminUserName: weblogic + AdminPassword: 'welcome1' +topology: + Name: DemoDomain + Cluster: + staticCluster: + CoherenceClusterSystemResource: DataGridConfig + JTACluster: + # remove, attribute is online only + DeterminerCandidateResourceInfoList: [] + Notes: not here + dynamicCluster: + DynamicServers: + # add CalculatedListenPorts set to false + MaxDynamicClusterSize: 4 + DynamicClusterSize: 3 + dynamicCluster2: + DynamicServers: + MaxDynamicClusterSize: 4 + # change CalculatedListenPorts to false + CalculatedListenPorts: true + DynamicClusterSize: 3 + Server: + m1: + Cluster: staticCluster + ListenPort: 5001 + Machine: "machine-1" + m2: + Cluster: staticCluster + # string value should match numeric value + ListenPort: "5001" + Machine: "machine-1" + m3: + Cluster: staticCluster + # this should cause a warning message + ListenPort: 5002 + Machine: "machine-1" + ServerTemplate: + 'template-1': + Machine: "machine-1" + Machine: + # this machine and any references to it should be removed + machine-1: + VirtualTarget: + target-2: + + # confirm that model traversal deals with artificial type folders correctly + SecurityConfiguration: + Realm: + yourRealm: + AuthenticationProvider: + DefaultAuthenticator: + DefaultAuthenticator: + ControlFlag: OPTIONAL + # remove, attribute is online only + ProviderClassName: 'com.defaultClass' + +resources: + Partition: + my-partition: + ResourceGroup: + my-resource-group: + +appDeployments: + Application: + myApp: + SourcePath: 'wlsdeploy/applications/sample-app.war' + # remove, attribute is online only + MultiVersionApp: false