35
35
import oracle .weblogic .kubernetes .utils .ExecResult ;
36
36
import org .awaitility .core .ConditionFactory ;
37
37
import org .junit .jupiter .api .BeforeAll ;
38
+ import org .junit .jupiter .api .BeforeEach ;
38
39
import org .junit .jupiter .api .DisplayName ;
39
40
import org .junit .jupiter .api .MethodOrderer ;
40
41
import org .junit .jupiter .api .Order ;
54
55
import static oracle .weblogic .kubernetes .TestConstants .WEBLOGIC_SLIM ;
55
56
import static oracle .weblogic .kubernetes .actions .ActionConstants .APP_DIR ;
56
57
import static oracle .weblogic .kubernetes .actions .ActionConstants .MODEL_DIR ;
58
+ import static oracle .weblogic .kubernetes .actions .ActionConstants .WORK_DIR ;
57
59
import static oracle .weblogic .kubernetes .actions .TestActions .createDomainCustomResource ;
58
60
import static oracle .weblogic .kubernetes .actions .TestActions .getServiceNodePort ;
59
61
import static oracle .weblogic .kubernetes .assertions .TestAssertions .domainExists ;
60
62
import static oracle .weblogic .kubernetes .utils .ApplicationUtils .checkAppIsActive ;
61
63
import static oracle .weblogic .kubernetes .utils .BuildApplication .buildApplication ;
64
+ import static oracle .weblogic .kubernetes .utils .CommonTestUtils .checkPodReadyAndServiceExists ;
62
65
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .checkServiceExists ;
63
66
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getNextFreePort ;
64
67
import static oracle .weblogic .kubernetes .utils .DbUtils .getDBNodePort ;
71
74
import static oracle .weblogic .kubernetes .utils .ImageUtils .createSecretForBaseImages ;
72
75
import static oracle .weblogic .kubernetes .utils .ImageUtils .dockerLoginAndPushImageToRegistry ;
73
76
import static oracle .weblogic .kubernetes .utils .OperatorUtils .installAndVerifyOperator ;
74
- import static oracle .weblogic .kubernetes .utils .PodUtils .checkPodExists ;
75
- import static oracle .weblogic .kubernetes .utils .PodUtils .checkPodReady ;
76
77
import static oracle .weblogic .kubernetes .utils .PodUtils .getExternalServicePodName ;
77
78
import static oracle .weblogic .kubernetes .utils .PodUtils .setPodAntiAffinity ;
78
79
import static oracle .weblogic .kubernetes .utils .SecretUtils .createSecretWithUsernamePassword ;
@@ -172,6 +173,23 @@ public static void initAll(@Namespaces(3) List<String> namespaces) {
172
173
buildApplicationsAndDomains ();
173
174
}
174
175
176
+ /**
177
+ * Verify all server pods are running.
178
+ * Verify k8s services for all servers are created.
179
+ */
180
+ @ BeforeEach
181
+ public void beforeEach () {
182
+ int replicaCount = 2 ;
183
+ for (int i = 1 ; i <= replicaCount ; i ++) {
184
+ checkPodReadyAndServiceExists (domain2ManagedServerPrefix + i ,
185
+ domainUid2 , domain2Namespace );
186
+ }
187
+ for (int i = 1 ; i <= replicaCount ; i ++) {
188
+ checkPodReadyAndServiceExists (domain1ManagedServerPrefix + i ,
189
+ domainUid1 , domain1Namespace );
190
+ }
191
+ }
192
+
175
193
private static void updatePropertyFile () {
176
194
//create a temporary directory to copy and update the properties file
177
195
Path target = Paths .get (PROPS_TEMP_DIR );
@@ -214,8 +232,10 @@ private static void addToPropertyFile(String propFileName, String domainNamespac
214
232
private static void buildApplicationsAndDomains () {
215
233
216
234
//build application archive
235
+ Path targetDir = Paths .get (WORK_DIR ,
236
+ ItCrossDomainTransaction .class .getSimpleName () + "/txforward" );
217
237
Path distDir = buildApplication (Paths .get (APP_DIR , "txforward" ), null , null ,
218
- "build" , domain1Namespace );
238
+ "build" , domain1Namespace , targetDir );
219
239
logger .info ("distDir is {0}" , distDir .toString ());
220
240
assertTrue (Paths .get (distDir .toString (),
221
241
"txforward.ear" ).toFile ().exists (),
@@ -224,8 +244,10 @@ private static void buildApplicationsAndDomains() {
224
244
logger .info ("Application is in {0}" , appSource );
225
245
226
246
//build application archive
247
+ targetDir = Paths .get (WORK_DIR ,
248
+ ItCrossDomainTransaction .class .getSimpleName () + "/cdtservlet" );
227
249
distDir = buildApplication (Paths .get (APP_DIR , "cdtservlet" ), null , null ,
228
- "build" , domain1Namespace );
250
+ "build" , domain1Namespace , targetDir );
229
251
logger .info ("distDir is {0}" , distDir .toString ());
230
252
assertTrue (Paths .get (distDir .toString (),
231
253
"cdttxservlet.war" ).toFile ().exists (),
@@ -234,8 +256,10 @@ private static void buildApplicationsAndDomains() {
234
256
logger .info ("Application is in {0}" , appSource1 );
235
257
236
258
//build application archive for JMS Send/Receive
259
+ targetDir = Paths .get (WORK_DIR ,
260
+ ItCrossDomainTransaction .class .getSimpleName () + "/jmsservlet" );
237
261
distDir = buildApplication (Paths .get (APP_DIR , "jmsservlet" ), null , null ,
238
- "build" , domain1Namespace );
262
+ "build" , domain1Namespace , targetDir );
239
263
logger .info ("distDir is {0}" , distDir .toString ());
240
264
assertTrue (Paths .get (distDir .toString (),
241
265
"jmsservlet.war" ).toFile ().exists (),
@@ -260,8 +284,10 @@ private static void buildApplicationsAndDomains() {
260
284
"Could not modify the domain2Namespace in MDB Template file" );
261
285
262
286
//build application archive for MDB
287
+ targetDir = Paths .get (WORK_DIR ,
288
+ ItCrossDomainTransaction .class .getSimpleName () + "/mdbtopic" );
263
289
distDir = buildApplication (Paths .get (PROPS_TEMP_DIR , "mdbtopic" ), null , null ,
264
- "build" , domain1Namespace );
290
+ "build" , domain1Namespace , targetDir );
265
291
logger .info ("distDir is {0}" , distDir .toString ());
266
292
assertTrue (Paths .get (distDir .toString (),
267
293
"mdbtopic.jar" ).toFile ().exists (),
@@ -508,25 +534,13 @@ private static void createDomain(String domainUid, String domainNamespace, Strin
508
534
// check admin server pod exists
509
535
logger .info ("Check for admin server pod {0} existence in namespace {1}" ,
510
536
adminServerPodName , domainNamespace );
511
- checkPodExists (adminServerPodName , domainUid , domainNamespace );
512
-
513
- // check managed server pods exist
514
- for (int i = 1 ; i <= replicaCount ; i ++) {
515
- logger .info ("Check for managed server pod {0} existence in namespace {1}" ,
516
- managedServerPrefix + i , domainNamespace );
517
- checkPodExists (managedServerPrefix + i , domainUid , domainNamespace );
518
- }
519
-
520
- // check admin server pod is ready
521
- logger .info ("Wait for admin server pod {0} to be ready in namespace {1}" ,
522
- adminServerPodName , domainNamespace );
523
- checkPodReady (adminServerPodName , domainUid , domainNamespace );
537
+ checkPodReadyAndServiceExists (adminServerPodName , domainUid , domainNamespace );
524
538
525
539
// check managed server pods are ready
526
540
for (int i = 1 ; i <= replicaCount ; i ++) {
527
541
logger .info ("Wait for managed server pod {0} to be ready in namespace {1}" ,
528
542
managedServerPrefix + i , domainNamespace );
529
- checkPodReady (managedServerPrefix + i , domainUid , domainNamespace );
543
+ checkPodReadyAndServiceExists (managedServerPrefix + i , domainUid , domainNamespace );
530
544
}
531
545
532
546
logger .info ("Check admin service {0} is created in namespace {1}" ,
0 commit comments