@@ -99,7 +99,7 @@ public void testCreateDomainTwoConfiguredCluster() throws Exception {
9999 && ((String ) domainMap .get ("loadBalancer" )).equalsIgnoreCase ("VOYAGER" ))) {
100100 domainMap .put ("voyagerWebPort" , new Integer ("30366" ));
101101 }
102- addCluster2ToDomainTemplate ();
102+ addCluster2ToDomainTemplate (domainMap );
103103 domain = TestUtils .createDomain (domainMap );
104104 domain .verifyDomainCreated ();
105105 String pods [] = {
@@ -156,7 +156,7 @@ public void testCreateDomainTwoMixedCluster() throws Exception {
156156 && ((String ) domainMap .get ("loadBalancer" )).equalsIgnoreCase ("VOYAGER" ))) {
157157 domainMap .put ("voyagerWebPort" , new Integer ("30377" ));
158158 }
159- addCluster2ToDomainTemplate ();
159+ addCluster2ToDomainTemplate (domainMap );
160160 domain = TestUtils .createDomain (domainMap );
161161 domain .verifyDomainCreated ();
162162 String pods [] = {
@@ -194,9 +194,9 @@ public void testCreateDomainTwoClusterWDTInImage() throws Exception {
194194 String DOMAINUID = "twoclusterdomainwdt" ;
195195 String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
196196 logTestBegin (testMethodName );
197- String wdttemplate =
198- BaseTest .getProjectRoot ()
199- + "/integration-tests/src/test/resources/wdt/config.cluster.topology.yaml" ;
197+ // String wdttemplate =
198+ // BaseTest.getProjectRoot()
199+ // + "/integration-tests/src/test/resources/wdt/config.cluster.topology.yaml";
200200 logger .info ("Creating Operator & waiting for the script to complete execution" );
201201 if (operator1 == null ) {
202202 operator1 = TestUtils .createOperator (OPERATOR1_YAML );
@@ -212,17 +212,25 @@ public void testCreateDomainTwoClusterWDTInImage() throws Exception {
212212 && ((String ) domainMap .get ("loadBalancer" )).equalsIgnoreCase ("VOYAGER" ))) {
213213 domainMap .put ("voyagerWebPort" , new Integer ("30377" ));
214214 }
215- addCluster2ToDomainTemplate ();
216- logger .log (Level .INFO , "Making a backup of the wdt template file:{0}" , wdttemplate );
217- if (!Files .exists (Paths .get (wdttemplate + ".org" ))) {
218- Files .copy (Paths .get (wdttemplate ), Paths .get (wdttemplate + ".org" ));
219- }
220- Files .copy (
221- Paths .get (
222- BaseTest .getProjectRoot ()
223- + "/integration-tests/src/test/resources/multipleclusters/wdtmultipledynclusters.yml" ),
224- Paths .get (wdttemplate ),
225- StandardCopyOption .REPLACE_EXISTING );
215+ domainMap .put (
216+ "customWdtTemplate" ,
217+ BaseTest .getProjectRoot ()
218+ + "/integration-tests/src/test/resources/multipleclusters/wdtmultipledynclusters.yml" );
219+ domainMap .put (
220+ "customDomainTemplate" ,
221+ BaseTest .getProjectRoot () + "/integration-tests/src/test/resources/multipleclusters/" );
222+ addCluster2ToDomainTemplate (domainMap );
223+ // logger.log(Level.INFO, "Making a backup of the wdt template file:{0}", wdttemplate);
224+ // if (!Files.exists(Paths.get(wdttemplate + ".org"))) {
225+ // Files.copy(Paths.get(wdttemplate), Paths.get(wdttemplate + ".org"));
226+ // }
227+ // Files.copy(
228+ // Paths.get(
229+ // BaseTest.getProjectRoot()
230+ // +
231+ // "/integration-tests/src/test/resources/multipleclusters/wdtmultipledynclusters.yml"),
232+ // Paths.get(wdttemplate),
233+ // StandardCopyOption.REPLACE_EXISTING);
226234 domain = TestUtils .createDomain (domainMap );
227235 domain .verifyDomainCreated ();
228236 String pods [] = {
@@ -242,14 +250,14 @@ public void testCreateDomainTwoClusterWDTInImage() throws Exception {
242250 if (domain != null && !SMOKETEST && (JENKINS || testCompletedSuccessfully )) {
243251 domain .destroy ();
244252 }
245- restoreDomainTemplate ();
246- if (Files .exists (Paths .get (wdttemplate + ".org" ))) {
247- Files .copy (
248- Paths .get (wdttemplate + ".org" ),
249- Paths .get (wdttemplate ),
250- StandardCopyOption .REPLACE_EXISTING );
251- Files .deleteIfExists (Paths .get (wdttemplate + ".org" ));
252- }
253+ // restoreDomainTemplate();
254+ // if (Files.exists(Paths.get(wdttemplate + ".org"))) {
255+ // Files.copy(
256+ // Paths.get(wdttemplate + ".org"),
257+ // Paths.get(wdttemplate),
258+ // StandardCopyOption.REPLACE_EXISTING);
259+ // Files.deleteIfExists(Paths.get(wdttemplate + ".org"));
260+ // }
253261 }
254262 logger .log (Level .INFO , "SUCCESS - {0}" , testMethodName );
255263 }
@@ -259,17 +267,18 @@ public void testCreateDomainTwoClusterWDTInImage() throws Exception {
259267 *
260268 * @throws IOException when append fails
261269 */
262- private void addCluster2ToDomainTemplate () throws IOException {
270+ private void addCluster2ToDomainTemplate (Map < String , Object > domainMap ) throws IOException {
263271 String add =
264272 " - clusterName: %CLUSTER_NAME%-2\n "
265273 + " serverStartState: \" RUNNING\" \n "
266274 + " replicas: %INITIAL_MANAGED_SERVER_REPLICAS%\n " ;
267- logger .info ("Making a backup of the domain template file:" + template );
268- if (!Files .exists (Paths .get (template + ".org" ))) {
269- Files .copy (Paths .get (template ), Paths .get (template + ".org" ));
270- }
271- Files .write (Paths .get (template ), add .getBytes (), StandardOpenOption .APPEND );
272- byte [] readAllBytes = Files .readAllBytes (Paths .get (template ));
275+ String customDomainTemplate =
276+ System .getProperty ("java.io.tmpdir" ) + "/customDomainTemplate.yaml" ;
277+ Files .copy (
278+ Paths .get (template ), Paths .get (customDomainTemplate ), StandardCopyOption .REPLACE_EXISTING );
279+ Files .write (Paths .get (customDomainTemplate ), add .getBytes (), StandardOpenOption .APPEND );
280+ domainMap .put ("customDomainTemplate" , customDomainTemplate );
281+ byte [] readAllBytes = Files .readAllBytes (Paths .get (customDomainTemplate ));
273282 logger .info (new String (readAllBytes , StandardCharsets .UTF_8 ));
274283 }
275284
0 commit comments