35
35
import static oracle .weblogic .kubernetes .actions .ActionConstants .RESOURCE_DIR ;
36
36
import static oracle .weblogic .kubernetes .actions .TestActions .patchDomainCustomResource ;
37
37
import static oracle .weblogic .kubernetes .actions .impl .primitive .Command .defaultCommandParams ;
38
+ import static oracle .weblogic .kubernetes .utils .CommonMiiTestUtils .verifyUpdateWebLogicCredential ;
38
39
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .checkPodDeleted ;
39
40
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .createDomainAndVerify ;
40
41
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .createMiiImageAndVerify ;
45
46
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .dockerLoginAndPushImageToRegistry ;
46
47
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .installAndVerifyOperator ;
47
48
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .patchServerStartPolicy ;
49
+ import static oracle .weblogic .kubernetes .utils .CommonTestUtils .updateRcuAccessSecret ;
48
50
import static oracle .weblogic .kubernetes .utils .DbUtils .setupDBandRCUschema ;
51
+ import static oracle .weblogic .kubernetes .utils .DbUtils .updateRcuPassword ;
49
52
import static oracle .weblogic .kubernetes .utils .FmwUtils .verifyDomainReady ;
50
53
import static oracle .weblogic .kubernetes .utils .ThreadSafeLogger .getLogger ;
51
54
import static org .awaitility .Awaitility .with ;
54
57
import static org .junit .jupiter .api .Assertions .assertTrue ;
55
58
56
59
@ TestMethodOrder (MethodOrderer .OrderAnnotation .class )
57
- @ DisplayName ("Test to a create JRF model in image domain and start the domain" )
60
+ @ DisplayName ("Test to a create FMW model in image domain and start the domain" )
58
61
@ IntegrationTest
59
62
public class ItFmwMiiDomain {
60
63
61
64
private static String dbNamespace = null ;
62
65
private static String opNamespace = null ;
63
- private static String jrfDomainNamespace = null ;
64
- private static String jrfMiiImage = null ;
66
+ private static String fmwDomainNamespace = null ;
67
+ private static String fmwMiiImage = null ;
65
68
66
- private static final String RCUSCHEMAPREFIX = "jrfdomainmii " ;
69
+ private static final String RCUSCHEMAPREFIX = "FMWDOMAINMII " ;
67
70
private static final String ORACLEDBURLPREFIX = "oracledb." ;
68
71
private static final String ORACLEDBSUFFIX = ".svc.cluster.local:1521/devpdb.k8s" ;
69
72
private static final String RCUSYSUSERNAME = "sys" ;
70
73
private static final String RCUSYSPASSWORD = "Oradoc_db1" ;
71
74
private static final String RCUSCHEMAUSERNAME = "myrcuuser" ;
72
75
private static final String RCUSCHEMAPASSWORD = "Oradoc_db1" ;
76
+ private static final String RCUSCHEMAPASSWORDNEW = "Oradoc_db2" ;
73
77
private static final String modelFile = "model-singleclusterdomain-sampleapp-jrf.yaml" ;
74
78
75
79
private static String dbUrl = null ;
76
80
private static LoggingFacade logger = null ;
77
81
78
- private String domainUid = "jrfdomain -mii" ;
82
+ private String domainUid = "fmwdomain -mii" ;
79
83
private String adminServerPodName = domainUid + "-admin-server" ;
80
84
private String managedServerPrefix = domainUid + "-managed-server" ;
81
85
private int replicaCount = 2 ;
@@ -113,9 +117,9 @@ public static void initAll(@Namespaces(3) List<String> namespaces) {
113
117
assertNotNull (namespaces .get (1 ), "Namespace is null" );
114
118
opNamespace = namespaces .get (1 );
115
119
116
- logger .info ("Assign a unique namespace for JRF domain" );
120
+ logger .info ("Assign a unique namespace for FMW domain" );
117
121
assertNotNull (namespaces .get (2 ), "Namespace is null" );
118
- jrfDomainNamespace = namespaces .get (2 );
122
+ fmwDomainNamespace = namespaces .get (2 );
119
123
120
124
logger .info ("Start DB and create RCU schema for namespace: {0}, RCU prefix: {1}, "
121
125
+ "dbUrl: {2}, dbImage: {3}, fmwImage: {4} " , dbNamespace , RCUSCHEMAPREFIX , dbUrl ,
@@ -126,15 +130,15 @@ public static void initAll(@Namespaces(3) List<String> namespaces) {
126
130
+ "dbUrl %s" , RCUSCHEMAPREFIX , dbNamespace , dbUrl ));
127
131
128
132
// install operator and verify its running in ready state
129
- installAndVerifyOperator (opNamespace , jrfDomainNamespace );
133
+ installAndVerifyOperator (opNamespace , fmwDomainNamespace );
130
134
131
135
logger .info ("For ItFmwMiiDomain using DB image: {0}, FMW image {1}" ,
132
136
DB_IMAGE_TO_USE_IN_SPEC , FMWINFRA_IMAGE_TO_USE_IN_SPEC );
133
137
134
138
}
135
139
136
140
/**
137
- * Create a basic JRF model in image domain.
141
+ * Create a basic FMW model in image domain.
138
142
* Verify Pod is ready and service exists for both admin server and managed servers.
139
143
* Verify EM console is accessible.
140
144
*/
@@ -144,13 +148,13 @@ public static void initAll(@Namespaces(3) List<String> namespaces) {
144
148
public void testFmwModelInImage () {
145
149
// Create the repo secret to pull the image
146
150
// this secret is used only for non-kind cluster
147
- createOcirRepoSecret (jrfDomainNamespace );
151
+ createOcirRepoSecret (fmwDomainNamespace );
148
152
149
153
// create secret for admin credentials
150
154
logger .info ("Create secret for admin credentials" );
151
155
assertDoesNotThrow (() -> createSecretWithUsernamePassword (
152
156
adminSecretName ,
153
- jrfDomainNamespace ,
157
+ fmwDomainNamespace ,
154
158
"weblogic" ,
155
159
"welcome1" ),
156
160
String .format ("createSecret failed for %s" , adminSecretName ));
@@ -159,7 +163,7 @@ public void testFmwModelInImage() {
159
163
logger .info ("Create encryption secret" );
160
164
assertDoesNotThrow (() -> createSecretWithUsernamePassword (
161
165
encryptionSecretName ,
162
- jrfDomainNamespace ,
166
+ fmwDomainNamespace ,
163
167
"weblogicenc" ,
164
168
"weblogicenc" ),
165
169
String .format ("createSecret failed for %s" , encryptionSecretName ));
@@ -169,7 +173,7 @@ public void testFmwModelInImage() {
169
173
rcuaccessSecretName , RCUSCHEMAPREFIX , RCUSCHEMAPASSWORD , dbUrl );
170
174
assertDoesNotThrow (() -> createRcuAccessSecret (
171
175
rcuaccessSecretName ,
172
- jrfDomainNamespace ,
176
+ fmwDomainNamespace ,
173
177
RCUSCHEMAPREFIX ,
174
178
RCUSCHEMAPASSWORD ,
175
179
dbUrl ),
@@ -178,13 +182,13 @@ public void testFmwModelInImage() {
178
182
logger .info ("Create OPSS wallet password secret" );
179
183
assertDoesNotThrow (() -> createOpsswalletpasswordSecret (
180
184
opsswalletpassSecretName ,
181
- jrfDomainNamespace ,
185
+ fmwDomainNamespace ,
182
186
"welcome1" ),
183
187
String .format ("createSecret failed for %s" , opsswalletpassSecretName ));
184
188
185
189
logger .info ("Create an image with jrf model file" );
186
190
final List <String > modelList = Collections .singletonList (MODEL_DIR + "/" + modelFile );
187
- jrfMiiImage = createMiiImageAndVerify (
191
+ fmwMiiImage = createMiiImageAndVerify (
188
192
"jrf-mii-image" ,
189
193
modelList ,
190
194
Collections .singletonList (MII_BASIC_APP_NAME ),
@@ -194,21 +198,21 @@ public void testFmwModelInImage() {
194
198
false );
195
199
196
200
// push the image to a registry to make it accessible in multi-node cluster
197
- dockerLoginAndPushImageToRegistry (jrfMiiImage );
201
+ dockerLoginAndPushImageToRegistry (fmwMiiImage );
198
202
199
203
// create the domain object
200
204
Domain domain = FmwUtils .createDomainResource (domainUid ,
201
- jrfDomainNamespace ,
205
+ fmwDomainNamespace ,
202
206
adminSecretName ,
203
207
OCIR_SECRET_NAME ,
204
208
encryptionSecretName ,
205
209
rcuaccessSecretName ,
206
210
opsswalletpassSecretName ,
207
211
replicaCount ,
208
- jrfMiiImage );
212
+ fmwMiiImage );
209
213
210
- createDomainAndVerify (domain , jrfDomainNamespace );
211
- verifyDomainReady (jrfDomainNamespace , domainUid , replicaCount );
214
+ createDomainAndVerify (domain , fmwDomainNamespace );
215
+ verifyDomainReady (fmwDomainNamespace , domainUid , replicaCount );
212
216
}
213
217
214
218
/**
@@ -223,11 +227,53 @@ public void testFmwModelInImage() {
223
227
@ Test
224
228
@ DisplayName ("Reuse the same RCU schema to restart JRF domain" )
225
229
public void testReuseRCUschemalToRestartDomain () {
226
- saveAndRestoreOpssWalletfileSecret (jrfDomainNamespace , domainUid , opsswalletfileSecretName );
230
+ saveAndRestoreOpssWalletfileSecret (fmwDomainNamespace , domainUid , opsswalletfileSecretName );
227
231
shutdownDomain ();
228
232
patchDomainWithWalletFileSecret (opsswalletfileSecretName );
229
233
startupDomain ();
230
- verifyDomainReady (jrfDomainNamespace , domainUid , replicaCount );
234
+ verifyDomainReady (fmwDomainNamespace , domainUid , replicaCount );
235
+ }
236
+
237
+ /**
238
+ * Shutdown the FMW domain completely.
239
+ * Update all the passwords for the RCU schema.
240
+ * Update the RCU access secret with new RCU schema password.
241
+ * Start the domain and verify domain is up and running.
242
+ */
243
+ @ Order (3 )
244
+ @ Test
245
+ @ DisplayName ("Update RCU schema password" )
246
+ public void testUpdateRcuSchemaPassword () {
247
+ shutdownDomain ();
248
+ logger .info ("Updating RCU schema password with dbNamespace: {0}, RCU prefix: {1}, new schemapassword: {2}" ,
249
+ dbNamespace , RCUSCHEMAPREFIX , RCUSCHEMAPASSWORDNEW );
250
+ updateRcuPassword (dbNamespace , RCUSCHEMAPREFIX , RCUSCHEMAPASSWORDNEW );
251
+ logger .info ("Updating RCU access secret: {0}, with prefix: {1}, new schemapassword: {2}, dbUrl: {3})" ,
252
+ rcuaccessSecretName , RCUSCHEMAPREFIX , RCUSCHEMAPASSWORDNEW , dbUrl );
253
+ assertDoesNotThrow (() -> updateRcuAccessSecret (
254
+ rcuaccessSecretName ,
255
+ fmwDomainNamespace ,
256
+ RCUSCHEMAPREFIX ,
257
+ RCUSCHEMAPASSWORDNEW ,
258
+ dbUrl ),
259
+ String .format ("update Secret failed for %s with new schema password %s" , rcuaccessSecretName ,
260
+ RCUSCHEMAPASSWORDNEW ));
261
+ startupDomain ();
262
+ verifyDomainReady (fmwDomainNamespace , domainUid , replicaCount );
263
+ }
264
+
265
+ /**
266
+ * After updating RCU schema password change the WebLogic Admin credential of the domain.
267
+ * Update domainRestartVersion to trigger a rolling restart of server pods.
268
+ * Verify all the server pods are re-started in a rolling fashion.
269
+ * Check the validity of new credentials by accessing WebLogic RESTful Service.
270
+ */
271
+ @ Order (4 )
272
+ @ Test
273
+ @ DisplayName ("Update WebLogic Credentials after updating RCU schema password" )
274
+ public void testUpdateWebLogicCredentialAfterUpdateRcuSchemaPassword () {
275
+ verifyUpdateWebLogicCredential (fmwDomainNamespace , domainUid , adminServerPodName ,
276
+ managedServerPrefix , replicaCount , "-c1" );
231
277
}
232
278
233
279
/**
@@ -269,13 +315,13 @@ private void saveAndRestoreOpssWalletfileSecret(String namespace, String domainU
269
315
* Shutdown the domain by setting serverStartPolicy as "NEVER".
270
316
*/
271
317
private void shutdownDomain () {
272
- patchServerStartPolicy ("/spec/serverStartPolicy" , "NEVER" , jrfDomainNamespace , domainUid );
318
+ patchServerStartPolicy ("/spec/serverStartPolicy" , "NEVER" , fmwDomainNamespace , domainUid );
273
319
logger .info ("Domain is patched to stop entire WebLogic domain" );
274
320
275
321
// make sure all the server pods are removed after patch
276
- checkPodDeleted (adminServerPodName , domainUid , jrfDomainNamespace );
322
+ checkPodDeleted (adminServerPodName , domainUid , fmwDomainNamespace );
277
323
for (int i = 1 ; i <= replicaCount ; i ++) {
278
- checkPodDeleted (managedServerPrefix + i , domainUid , jrfDomainNamespace );
324
+ checkPodDeleted (managedServerPrefix + i , domainUid , fmwDomainNamespace );
279
325
}
280
326
281
327
logger .info ("Domain shutdown success" );
@@ -286,7 +332,7 @@ private void shutdownDomain() {
286
332
* Startup the domain by setting serverStartPolicy as "IF_NEEDED".
287
333
*/
288
334
private void startupDomain () {
289
- patchServerStartPolicy ("/spec/serverStartPolicy" , "IF_NEEDED" , jrfDomainNamespace , domainUid );
335
+ patchServerStartPolicy ("/spec/serverStartPolicy" , "IF_NEEDED" , fmwDomainNamespace , domainUid );
290
336
logger .info ("Domain is patched to start all servers in the domain" );
291
337
}
292
338
@@ -305,10 +351,10 @@ private boolean patchDomainWithWalletFileSecret(String opssWalletFileSecretName)
305
351
.append ("\" }]" );
306
352
307
353
logger .info ("Adding opssWalletPasswordSecretName for domain {0} in namespace {1} using patch string: {2}" ,
308
- domainUid , jrfDomainNamespace , patchStr .toString ());
354
+ domainUid , fmwDomainNamespace , patchStr .toString ());
309
355
310
356
V1Patch patch = new V1Patch (new String (patchStr ));
311
357
312
- return patchDomainCustomResource (domainUid , jrfDomainNamespace , patch , V1Patch .PATCH_FORMAT_JSON_PATCH );
358
+ return patchDomainCustomResource (domainUid , fmwDomainNamespace , patch , V1Patch .PATCH_FORMAT_JSON_PATCH );
313
359
}
314
360
}
0 commit comments