Skip to content

Commit 88c8292

Browse files
author
Tom Barnes
committed
Add data source custom override to introspect mock/unit test.
1 parent aeb3e2c commit 88c8292

File tree

6 files changed

+81
-22
lines changed

6 files changed

+81
-22
lines changed
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
/Servers/admin-server,ListenAddress,,domain1-admin-server
2-
#/Servers/admin-server,ListenAddress,foob,domain1-admin-server
3-
#/Servers/admin-server,ListenAddress,,foob
4-
#/Servers/admin-server,ListenAddress,,
5-
#,
6-
2+
/JDBCSystemResources/testDS/JDBCResource/testDS/JDBCDriverParams/testDS,Url,jdbc:oracle:thin:@myoriginalhostname:1521:myoriginalsid,jdbc:oracle:thin:@mynewhost:1521:mynewsid

src/integration-tests/introspector/createDomain.pyt

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,48 @@ cmo.setPassword(admin_password)
7070
# ==============================================
7171
setOption('OverwriteDomain', 'true')
7272

73-
# Configure the node manager
74-
# ==========================
75-
# cd('/NMProperties')
76-
# set('ListenAddress','0.0.0.0')
77-
# set('ListenPort',5556)
78-
# set('CrashRecoveryEnabled', 'true')
79-
# set('NativeVersionEnabled', 'true')
80-
# set('StartScriptEnabled', 'false')
81-
# set('SecureListener', 'false')
82-
# set('LogLevel', 'FINEST')
83-
# set('DomainsDirRemoteSharingEnabled', 'true')
84-
85-
# Set the Node Manager user name and password (domain name will change after writeDomain)
86-
# cd('/SecurityConfiguration/base_domain')
87-
# set('NodeManagerUsername', admin_username)
88-
# set('NodeManagerPasswordEncrypted', admin_password)
73+
# Setup a datasource
74+
# ============================================
75+
def createDataSource(dsName,dsJNDI,dsHost,dsSID,dsTarget):
76+
cd('/')
77+
print 'create JDBCSystemResource'
78+
create(dsName, 'JDBCSystemResource')
79+
cd('/JDBCSystemResource/' + dsName)
80+
#set('Target',dsTarget)
81+
cd('/JDBCSystemResource/' + dsName + '/JdbcResource/' + dsName)
82+
cmo.setName(dsName)
83+
84+
print 'create JDBCDataSourceParams'
85+
cd('/JDBCSystemResource/' + dsName + '/JdbcResource/' + dsName)
86+
create('testDataSourceParams','JDBCDataSourceParams')
87+
cd('JDBCDataSourceParams/NO_NAME_0')
88+
set('JNDIName', java.lang.String(dsJNDI))
89+
set('GlobalTransactionsProtocol', java.lang.String('None'))
90+
91+
print 'create JDBCDriverParams'
92+
cd('/JDBCSystemResource/' + dsName + '/JdbcResource/' + dsName)
93+
create('testDriverParams','JDBCDriverParams')
94+
cd('JDBCDriverParams/NO_NAME_0')
95+
set('DriverName','oracle.jdbc.OracleDriver')
96+
set('URL','jdbc:oracle:thin:@myoriginalhostname:1521:myoriginalsid')
97+
set('PasswordEncrypted', 'manager')
98+
set('UseXADataSourceInterface', 'false')
99+
100+
print 'create JDBCDriverParams Properties'
101+
create('testProperties','Properties')
102+
cd('Properties/NO_NAME_0')
103+
create('user','Property')
104+
cd('Property')
105+
cd('user')
106+
set('Value', 'scott')
107+
108+
print 'create JDBCConnectionPoolParams'
109+
cd('/JDBCSystemResource/' + dsName + '/JdbcResource/' + dsName)
110+
create('testJdbcConnectionPoolParams','JDBCConnectionPoolParams')
111+
cd('JDBCConnectionPoolParams/NO_NAME_0')
112+
set('TestTableName','SQL SELECT 1 FROM DUAL')
113+
114+
createDataSource('testDS','testDS','myhost','mysid','${ADMIN_NAME}')
89115

90116
# Create a cluster
91117
# ======================

src/integration-tests/introspector/introspectTest.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,26 @@ function deployTestScriptConfigMap() {
335335

336336
}
337337

338+
#############################################################################
339+
#
340+
# Deploy custom override cm
341+
#
342+
#
343+
344+
function deployCustomOverridesConfigMap() {
345+
local cmdir="${test_home}/customOverrides"
346+
local cmname="${DOMAIN_UID}-mycustom-overrides-cm"
347+
mkdir -p $cmdir
348+
cp ${SCRIPTPATH}/jdbc-testDS.xml $cmdir || exit 1
349+
cp ${SCRIPTPATH}/version.txt $cmdir || exit 1
350+
351+
kubectl -n $NAMESPACE delete cm $cmname \
352+
--ignore-not-found \
353+
2>&1 | tracePipe "Info: kubectl output: "
354+
355+
createConfigMapFromDir $cmname $cmdir || exit 1
356+
}
357+
338358
#############################################################################
339359
#
340360
# Create base directory for PV (uses a job)
@@ -476,10 +496,10 @@ function deployPod() {
476496

477497
# Wait for pod to come up successfully
478498

479-
tracen "Info: Waiting for pod readiness"
480499
local status="0/1"
481500
local startsecs=$SECONDS
482501
local maxsecs=180
502+
tracen "Info: Waiting up to $maxsecs seconds for pod readiness"
483503
while [ "${status}" != "1/1" ] ; do
484504
if [ $((SECONDS - startsecs)) -gt $maxsecs ]; then
485505
echo
@@ -552,6 +572,8 @@ deployDomainConfigMap
552572

553573
deployTestScriptConfigMap
554574

575+
deployCustomOverridesConfigMap
576+
555577
createTestRootPVDir
556578

557579
deployWebLogic_PV_PVC_and_Secret
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<jdbc-data-source xmlns="http://xmlns.oracle.com/weblogic/jdbc-data-source" xmlns:f="http://xmlns.oracle.com/weblogic/jdbc-data-source-fragment" xmlns:s="http://xmlns.oracle.com/weblogic/situational-config">
3+
<name>testDS</name>
4+
<jdbc-driver-params>
5+
<url f:combine-mode="replace">jdbc:oracle:thin:@mynewhost:1521:mynewsid</url>
6+
</jdbc-driver-params>
7+
</jdbc-data-source>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.0

src/integration-tests/introspector/wl-job.yamlt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ spec:
4343
- name: weblogic-domain-cm-volume
4444
mountPath: /weblogic-operator/scripts
4545
readOnly: true
46+
- name: ${DOMAIN_UID}-mycustom-overrides-cm-volume
47+
mountPath: /weblogic-operator/config-overrides
48+
readOnly: true
4649
- name: test-script-cm-volume
4750
mountPath: /test-scripts
4851
readOnly: true
@@ -57,6 +60,10 @@ spec:
5760
configMap:
5861
defaultMode: 365
5962
name: weblogic-domain-cm
63+
- name: ${DOMAIN_UID}-mycustom-overrides-cm-volume
64+
configMap:
65+
defaultMode: 365
66+
name: ${DOMAIN_UID}-mycustom-overrides-cm
6067
- name: test-script-cm-volume
6168
configMap:
6269
defaultMode: 365

0 commit comments

Comments
 (0)