From a40e294e1f0d7a5f550f46055931e1a930ab0893 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Wed, 16 Oct 2024 18:29:36 +0530 Subject: [PATCH] Gradle multi module test add path for windows Signed-off-by: Arun Venmany --- .../TestMultiModuleLooseEarAppDevMode.groovy | 8 ++++++-- .../TestMultiModuleLooseEarWithPages.groovy | 20 ++++++++++++------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/test/groovy/io/openliberty/tools/gradle/TestMultiModuleLooseEarAppDevMode.groovy b/src/test/groovy/io/openliberty/tools/gradle/TestMultiModuleLooseEarAppDevMode.groovy index d52706c5..8f4eb9e9 100644 --- a/src/test/groovy/io/openliberty/tools/gradle/TestMultiModuleLooseEarAppDevMode.groovy +++ b/src/test/groovy/io/openliberty/tools/gradle/TestMultiModuleLooseEarAppDevMode.groovy @@ -55,7 +55,11 @@ class TestMultiModuleLooseEarAppDevMode extends BaseDevTest { } @AfterClass - public static void tearDown() throws Exception { - runTasks(buildDir, 'libertyStop') + public static void cleanUpAfterClass() throws Exception { + String stdout = getContents(logFile, "Dev mode std output"); + System.out.println(stdout); + String stderr = getContents(errFile, "Dev mode std error"); + System.out.println(stderr); + cleanUpAfterClass(true); } } diff --git a/src/test/groovy/io/openliberty/tools/gradle/TestMultiModuleLooseEarWithPages.groovy b/src/test/groovy/io/openliberty/tools/gradle/TestMultiModuleLooseEarWithPages.groovy index d4593482..68d205b8 100644 --- a/src/test/groovy/io/openliberty/tools/gradle/TestMultiModuleLooseEarWithPages.groovy +++ b/src/test/groovy/io/openliberty/tools/gradle/TestMultiModuleLooseEarWithPages.groovy @@ -13,6 +13,7 @@ import javax.xml.parsers.DocumentBuilderFactory import javax.xml.xpath.XPath import javax.xml.xpath.XPathConstants import javax.xml.xpath.XPathFactory +import io.openliberty.tools.common.plugins.util.OSUtil public class TestMultiModuleLooseEarWithPages extends AbstractIntegrationTest{ static File resourceDir = new File("build/resources/test/multi-module-loose-ear-pages-test") @@ -64,6 +65,10 @@ public class TestMultiModuleLooseEarWithPages extends AbstractIntegrationTest{ public void test_loose_config_file_contents_are_correct(){ File on = new File("build/testBuilds/multi-module-loose-ear-pages-test/ear/build/wlp/usr/servers/ejbServer/apps/ejb-ear-1.0-SNAPSHOT.ear.xml"); FileInputStream input = new FileInputStream(on); + String ejbWar = "/ejb-war-1.0-SNAPSHOT.war" + String warWebappsFolder = "/multi-module-loose-ear-pages-test/war/src/main/webapp" + String ejbJar = "/WEB-INF/lib/ejb-jar-1.0-SNAPSHOT.jar" + // get input XML Document DocumentBuilderFactory inputBuilderFactory = DocumentBuilderFactory.newInstance(); @@ -85,24 +90,25 @@ public class TestMultiModuleLooseEarWithPages extends AbstractIntegrationTest{ expression = "/archive/archive"; nodes = (NodeList) xPath.compile(expression).evaluate(inputDoc, XPathConstants.NODESET); Assert.assertEquals("Number of element ==>", 2, nodes.getLength()); - - String ejbWar = "/ejb-war-1.0-SNAPSHOT.war" - - Assert.assertTrue(ejbWar.equals(nodes.item(0).getAttributes().getNamedItem("targetInArchive").getNodeValue())) + if (OSUtil.isWindows()) { + ejbWar = "\\ejb-war-1.0-SNAPSHOT.war" + warWebappsFolder = "\\multi-module-loose-ear-pages-test\\war\\src\\main\\webapp" + ejbJar = "\\WEB-INF\\lib\\ejb-jar-1.0-SNAPSHOT.jar" + } + Assert.assertEquals(ejbWar, nodes.item(0).getAttributes() + .getNamedItem("targetInArchive").getNodeValue()) expression = "/archive/archive/dir"; nodes = (NodeList) xPath.compile(expression).evaluate(inputDoc, XPathConstants.NODESET); Assert.assertEquals("Number of element ==>", 3, nodes.getLength()); - String warWebappsFolder = "/multi-module-loose-ear-pages-test/war/src/main/webapp" Assert.assertTrue(nodes.item(0).getAttributes().getNamedItem("sourceOnDisk").getNodeValue().contains(warWebappsFolder)); expression = "/archive/archive/archive"; nodes = (NodeList) xPath.compile(expression).evaluate(inputDoc, XPathConstants.NODESET); Assert.assertEquals("Number of element ==>", 1, nodes.getLength()); - String ejbJar = "/WEB-INF/lib/ejb-jar-1.0-SNAPSHOT.jar" - Assert.assertTrue(ejbJar.equals(nodes.item(0).getAttributes().getNamedItem("targetInArchive").getNodeValue())) + Assert.assertEquals(ejbJar, nodes.item(0).getAttributes().getNamedItem("targetInArchive").getNodeValue()) expression = "/archive/file"; nodes = (NodeList) xPath.compile(expression).evaluate(inputDoc, XPathConstants.NODESET);