@@ -43,6 +43,8 @@ public class SitConfig extends BaseTest {
43
43
private static String mysqlYamlFile = "" ;
44
44
private static String domainYaml ;
45
45
private static String JDBC_RES_SCRIPT ;
46
+ private static String oldSecret = "test-secrets" ;
47
+ private static String newSecret = "test-secrets-new" ;
46
48
47
49
/**
48
50
* This method gets called only once before any of the test methods are executed. It does the
@@ -84,7 +86,7 @@ protected static void staticPrepare(String domainInputYaml, String domainScript)
84
86
"jms-ClusterJmsSystemResource.xml" ,
85
87
"version.txt"
86
88
};
87
- copySitConfigFiles (files , "test-secrets" );
89
+ copySitConfigFiles (files , oldSecret );
88
90
// create weblogic domain with configOverrides
89
91
domain = createSitConfigDomain (domainInputYaml , domainScript );
90
92
Assert .assertNotNull (domain );
@@ -183,13 +185,13 @@ private static void copySitConfigFiles(String files[], String secretName) throws
183
185
logger .log (Level .INFO , "Copying {0}" , path .toString ());
184
186
String content = new String (Files .readAllBytes (path ), charset );
185
187
content = content .replaceAll ("JDBC_URL" , JDBC_URL );
186
- content = content .replaceAll ("test-secrets" , secretName );
188
+ content = content .replaceAll (oldSecret , secretName );
187
189
if (getWeblogicImageTag ().contains (PS3_TAG )) {
188
190
content = content .replaceAll (JDBC_DRIVER_NEW , JDBC_DRIVER_OLD );
189
191
}
190
192
path = Paths .get (dstDir , file );
191
193
logger .log (Level .INFO , "to {0}" , path .toString ());
192
- Files .write (path , content .getBytes (charset ));
194
+ Files .write (path , content .getBytes (charset ), StandardOpenOption . TRUNCATE_EXISTING );
193
195
}
194
196
}
195
197
@@ -381,7 +383,7 @@ protected void testConfigOverrideAfterDomainStartup() throws Exception {
381
383
Paths .get (srcDir , "config_1.xml" ),
382
384
Paths .get (dstDir , "config.xml" ),
383
385
StandardCopyOption .REPLACE_EXISTING );
384
- recreateConfigMapandRestart ("test-secrets" , "test-secrets" );
386
+ recreateConfigMapandRestart (oldSecret , oldSecret );
385
387
transferTests ();
386
388
ExecResult result =
387
389
TestUtils .exec (
@@ -416,7 +418,7 @@ protected void testOverrideJdbcResourceAfterDomainStart() throws Exception {
416
418
Paths .get (srcDir , "jdbc-JdbcTestDataSource-1.xml" ),
417
419
Paths .get (dstDir , "jdbc-JdbcTestDataSource-1.xml" ),
418
420
StandardCopyOption .REPLACE_EXISTING );
419
- recreateConfigMapandRestart ("test-secrets" , "test-secrets" );
421
+ recreateConfigMapandRestart (oldSecret , oldSecret );
420
422
transferTests ();
421
423
ExecResult result =
422
424
TestUtils .exec (
@@ -444,10 +446,9 @@ protected void testOverrideJdbcResourceWithNewSecret() throws Exception {
444
446
logTestBegin (testMethod );
445
447
// recreate the map with new situational config files
446
448
String [] files = {"config.xml" , "jdbc-JdbcTestDataSource-0.xml" };
447
- String newSecret = "test-secrets-new" ;
448
449
try {
449
450
copySitConfigFiles (files , newSecret );
450
- recreateConfigMapandRestart ("test-secrets" , newSecret );
451
+ recreateConfigMapandRestart (oldSecret , newSecret );
451
452
transferTests ();
452
453
ExecResult result =
453
454
TestUtils .exec (
0 commit comments