Skip to content

Wdt 666 prepare model integration test #1215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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