From 8842de241ec7c7ea787be6ed58a126201588d977 Mon Sep 17 00:00:00 2001 From: Anusree Lakshmi <141303561+anusreelakshmi934@users.noreply.github.com> Date: Wed, 23 Oct 2024 11:55:34 +0530 Subject: [PATCH 1/8] stop and clean up terminal --- .../it/SingleModMPProjectTestCommon.java | 74 +++++++++++++++++++ .../tools/intellij/it/UIBotTestUtils.java | 23 ++++++ .../it/fixtures/ProjectFrameFixture.java | 18 +++++ 3 files changed, 115 insertions(+) diff --git a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java index b81c26b6b..befc08e12 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java +++ b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java @@ -11,17 +11,22 @@ import com.automation.remarks.junit5.Video; import com.intellij.remoterobot.RemoteRobot; +import com.intellij.remoterobot.fixtures.ComponentFixture; +import com.intellij.remoterobot.utils.Keyboard; +import io.openliberty.tools.intellij.it.fixtures.ProjectFrameFixture; import io.openliberty.tools.intellij.it.fixtures.WelcomeFrameFixture; import org.junit.jupiter.api.*; import org.junit.jupiter.api.condition.EnabledOnOs; import org.junit.jupiter.api.condition.OS; +import java.awt.*; import java.io.File; import java.io.IOException; import java.nio.file.Paths; import java.time.Duration; import java.util.Map; +import static com.intellij.remoterobot.search.locators.Locators.byXpath; import static com.intellij.remoterobot.utils.RepeatUtilsKt.waitForIgnoringError; /** @@ -35,6 +40,11 @@ public abstract class SingleModMPProjectTestCommon { */ public static final String REMOTE_BOT_URL = "http://localhost:8082"; + /** + * To clean the terminal. + */ + private boolean shouldCleanupTerminal = true; + /** * The remote robot object. */ @@ -58,6 +68,7 @@ public void beforeEach(TestInfo info) { @AfterEach public void afterEach(TestInfo info) { TestUtils.printTrace(TestUtils.TraceSevLevel.INFO, this.getClass().getSimpleName() + "." + info.getDisplayName() + ". Exit"); + cleanAndResetTerminal(); } /** @@ -84,6 +95,7 @@ protected static void closeProjectView() { @Test @Video public void testOpenBuildFileActionUsingPopUpMenu() { + shouldCleanupTerminal = false; String editorTabName = getBuildFileName() + " (" + getSmMPProjectName() + ")"; // Close the editor tab if it was previously opened. @@ -672,6 +684,7 @@ public void testStartWithConfigInRunModeUsingMenu() { @Test @Video public void testMultipleConfigEditHistory() { + shouldCleanupTerminal = false; String testName = "testMultipleConfigEditHistory"; // The path of the project build file expected in the configuration. This path constant for this test. @@ -1007,6 +1020,67 @@ public static void deleteDirectoryIfExists(String dirPath) { } } + /** + * Clean project. + */ + public void stopTerminal() { + if (!shouldCleanupTerminal) { + return; + } + + Keyboard keyboard = new Keyboard(remoteRobot); + ProjectFrameFixture projectFrame = remoteRobot.find(ProjectFrameFixture.class, Duration.ofSeconds(10)); + ComponentFixture terminal = remoteRobot.find(ComponentFixture.class, byXpath("//div[@class='JBTerminalPanel']"), Duration.ofSeconds(10)); + + terminal.rightClick(); + ComponentFixture openFixtureNewTab = projectFrame.getActionMenuItem("New Tab"); + openFixtureNewTab.click(new Point()); + + // Perform clean + String projectName = getSmMPProjectName(); + if ("singleModMavenMP".equalsIgnoreCase(projectName)) { + keyboard.enterText("mvn liberty:stop"); + + } else if ("singleModGradleMP".equalsIgnoreCase(projectName) || "singleMod GradleMP".equalsIgnoreCase(projectName)) { + keyboard.enterText("gradle libertyStop"); + } + keyboard.enter(); + TestUtils.sleepAndIgnoreException(5); + } + + /** + * Stop the Server. + */ + public void cleanTerminal() { + if (!shouldCleanupTerminal) { + return; + } + + Keyboard keyboard = new Keyboard(remoteRobot); + // Perform clean + String projectName = getSmMPProjectName(); + if ("singleModMavenMP".equalsIgnoreCase(projectName)) { + keyboard.enterText("mvn clean"); + keyboard.enter(); + } else if ("singleModGradleMP".equalsIgnoreCase(projectName) || "singleMod GradleMP".equalsIgnoreCase(projectName)) { + keyboard.enterText("gradle clean"); + keyboard.enter(); + } + keyboard.enter(); + TestUtils.sleepAndIgnoreException(5); + } + + /** + * Cleans up and resets the terminal. + */ + public void cleanAndResetTerminal() { + stopTerminal(); + UIBotTestUtils.closeTerminalTabs(remoteRobot); + UIBotTestUtils.openTerminalWindow(remoteRobot); + cleanTerminal(); + UIBotTestUtils.closeTerminalTabs(remoteRobot); + } + /** * Returns the projects directory path. * diff --git a/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java b/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java index 0e4d07615..2bb31a96a 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java +++ b/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java @@ -2498,4 +2498,27 @@ public static void closeErrorDialog(RemoteRobot remoteRobot) { okButton.click(); } } + + /** + * Closes Terminal. + */ + public static void closeTerminalTabs(RemoteRobot remoteRobot) { + ProjectFrameFixture projectFrame = remoteRobot.find(ProjectFrameFixture.class, Duration.ofSeconds(10)); + try { + ProjectFrameFixture.rightClickOnTerminalTab(projectFrame); + ProjectFrameFixture.clickMenuOption(projectFrame, "action.CloseAllNotifications.text"); + + while (true) { + ComponentFixture terminateButton = projectFrame.find(ComponentFixture.class, byXpath("//div[@accessiblename='Terminate']")); + if (terminateButton.callJs("component.isEnabled();", false)) { + terminateButton.click(); + // Optionally add a small delay here if needed + } else { + break; // Exit loop if no enabled "Terminate" button is found + } + } + } catch (WaitForConditionTimeoutException e) { + // The Terminal tab is most likely closed. + } + } } diff --git a/src/test/java/io/openliberty/tools/intellij/it/fixtures/ProjectFrameFixture.java b/src/test/java/io/openliberty/tools/intellij/it/fixtures/ProjectFrameFixture.java index 2416c2fef..5b1d476e7 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/fixtures/ProjectFrameFixture.java +++ b/src/test/java/io/openliberty/tools/intellij/it/fixtures/ProjectFrameFixture.java @@ -217,6 +217,24 @@ public ComponentFixture getTree(String... xpathVars) { Duration.ofSeconds(Integer.parseInt(waitTime))); } + /** + * Right-clicks on the terminal tab. + */ + public static void rightClickOnTerminalTab(ProjectFrameFixture projectFrame) { + String terminalLabelXPath = "//div[@class='TabPanel'][.//div[@class='BaseLabel']]//div[@text='Terminal:']"; + ComponentFixture terminalLabel = projectFrame.getActionButton(terminalLabelXPath, "10"); + terminalLabel.rightClick(); + } + + /** + * Clicks on a menu option based on the text key provided. + */ + public static void clickMenuOption(ProjectFrameFixture projectFrame, String textKey) { + String optionXPath = String.format("//div[contains(@text.key, '%s')]", textKey); + ComponentFixture option = projectFrame.getActionButton(optionXPath, "10"); + option.click(); + } + /** * Return the ComponentFixture object associated with the InplaceButton class. * From 088e81a61dbf3a84333de2bc6f7e5af58ac0362e Mon Sep 17 00:00:00 2001 From: Anusree Lakshmi <141303561+anusreelakshmi934@users.noreply.github.com> Date: Thu, 24 Oct 2024 11:50:59 +0530 Subject: [PATCH 2/8] Print "Exit" after all operations. --- .../tools/intellij/it/SingleModMPProjectTestCommon.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java index befc08e12..5dfa19e15 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java +++ b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java @@ -67,8 +67,8 @@ public void beforeEach(TestInfo info) { */ @AfterEach public void afterEach(TestInfo info) { - TestUtils.printTrace(TestUtils.TraceSevLevel.INFO, this.getClass().getSimpleName() + "." + info.getDisplayName() + ". Exit"); cleanAndResetTerminal(); + TestUtils.printTrace(TestUtils.TraceSevLevel.INFO, this.getClass().getSimpleName() + "." + info.getDisplayName() + ". Exit"); } /** From 44d9061cd6354a78fd17870d36dc191f1665ca8c Mon Sep 17 00:00:00 2001 From: Anusree Lakshmi <141303561+anusreelakshmi934@users.noreply.github.com> Date: Mon, 28 Oct 2024 14:03:38 +0530 Subject: [PATCH 3/8] Addressed review comments --- .../it/GradleSingleModMPProjectTest.java | 13 ++++++ .../it/GradleSingleModMPSIDProjectTest.java | 13 ++++++ .../it/MavenSingleModMPProjectTest.java | 13 ++++++ .../it/MavenSingleModMPSIDProjectTest.java | 13 ++++++ .../it/SingleModMPProjectTestCommon.java | 46 +++++++++++-------- .../tools/intellij/it/UIBotTestUtils.java | 2 +- 6 files changed, 79 insertions(+), 21 deletions(-) diff --git a/src/test/java/io/openliberty/tools/intellij/it/GradleSingleModMPProjectTest.java b/src/test/java/io/openliberty/tools/intellij/it/GradleSingleModMPProjectTest.java index a22df91ba..678b347c8 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/GradleSingleModMPProjectTest.java +++ b/src/test/java/io/openliberty/tools/intellij/it/GradleSingleModMPProjectTest.java @@ -60,6 +60,11 @@ public class GradleSingleModMPProjectTest extends SingleModMPProjectTestCommon { */ private final String BUILD_FILE_NAME = "build.gradle"; + /** + * Build Category. + */ + private final BuildType BUILD_CATEGORY = BuildType.GRADLE_TYPE; + /** * Action command to open the build file. */ @@ -202,4 +207,12 @@ public void validateTestReportsExist() { //TODO: rewrite validateTestReportExists() to accept one argument or to accept a null as the second argument TestUtils.validateTestReportExists(TEST_REPORT_PATH, TEST_REPORT_PATH); } + + /** + * Returns the build type category (either MAVEN_TYPE or GRADLE_TYPE) + */ + @Override + public BuildType getBuildCategory() { + return BUILD_CATEGORY; + } } \ No newline at end of file diff --git a/src/test/java/io/openliberty/tools/intellij/it/GradleSingleModMPSIDProjectTest.java b/src/test/java/io/openliberty/tools/intellij/it/GradleSingleModMPSIDProjectTest.java index 7596d4205..8c7923cc1 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/GradleSingleModMPSIDProjectTest.java +++ b/src/test/java/io/openliberty/tools/intellij/it/GradleSingleModMPSIDProjectTest.java @@ -74,6 +74,11 @@ public class GradleSingleModMPSIDProjectTest extends SingleModMPProjectTestCommo */ private final String BUILD_FILE_NAME = "build.gradle"; + /** + * Build Category. + */ + private final BuildType BUILD_CATEGORY = BuildType.GRADLE_TYPE; + /** * Action command to open the build file. */ @@ -255,4 +260,12 @@ public void deleteTestReports() { public void validateTestReportsExist() { TestUtils.validateTestReportExists(TEST_REPORT_PATH, TEST_REPORT_PATH); } + + /** + * Returns the build type category (either MAVEN_TYPE or GRADLE_TYPE) + */ + @Override + public BuildType getBuildCategory() { + return BUILD_CATEGORY; + } } \ No newline at end of file diff --git a/src/test/java/io/openliberty/tools/intellij/it/MavenSingleModMPProjectTest.java b/src/test/java/io/openliberty/tools/intellij/it/MavenSingleModMPProjectTest.java index 32a3a92d9..8b49902cc 100755 --- a/src/test/java/io/openliberty/tools/intellij/it/MavenSingleModMPProjectTest.java +++ b/src/test/java/io/openliberty/tools/intellij/it/MavenSingleModMPProjectTest.java @@ -57,6 +57,11 @@ public class MavenSingleModMPProjectTest extends SingleModMPProjectTestCommon { */ private final String BUILD_FILE_NAME = "pom.xml"; + /** + * Build Category. + */ + private final BuildType BUILD_CATEGORY = BuildType.MAVEN_TYPE; + /** * Action command to open the build file. */ @@ -219,4 +224,12 @@ public void validateTestReportsExist() { TestUtils.validateTestReportExists(pathToITReport34, pathToITReport35); TestUtils.validateTestReportExists(pathToUTReport34, pathToUTReport35); } + + /** + * Returns the build type category (either MAVEN_TYPE or GRADLE_TYPE) + */ + @Override + public BuildType getBuildCategory() { + return BUILD_CATEGORY; + } } diff --git a/src/test/java/io/openliberty/tools/intellij/it/MavenSingleModMPSIDProjectTest.java b/src/test/java/io/openliberty/tools/intellij/it/MavenSingleModMPSIDProjectTest.java index 186e7a4e9..f9322b814 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/MavenSingleModMPSIDProjectTest.java +++ b/src/test/java/io/openliberty/tools/intellij/it/MavenSingleModMPSIDProjectTest.java @@ -64,6 +64,11 @@ public class MavenSingleModMPSIDProjectTest extends SingleModMPProjectTestCommon */ private final String BUILD_FILE_NAME = "pom.xml"; + /** + * Build Category. + */ + private final BuildType BUILD_CATEGORY = BuildType.MAVEN_TYPE; + /** * Action command to open the build file. */ @@ -245,4 +250,12 @@ public void validateTestReportsExist() { TestUtils.validateTestReportExists(pathToITReport34, pathToITReport35); TestUtils.validateTestReportExists(pathToUTReport34, pathToUTReport35); } + + /** + * Returns the build type category (either MAVEN_TYPE or GRADLE_TYPE) + */ + @Override + public BuildType getBuildCategory() { + return BUILD_CATEGORY; + } } diff --git a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java index 5dfa19e15..2901758b2 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java +++ b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java @@ -45,6 +45,13 @@ public abstract class SingleModMPProjectTestCommon { */ private boolean shouldCleanupTerminal = true; + /** + * Supported build types. + */ + public enum BuildType { + MAVEN_TYPE, GRADLE_TYPE + } + /** * The remote robot object. */ @@ -67,7 +74,9 @@ public void beforeEach(TestInfo info) { */ @AfterEach public void afterEach(TestInfo info) { - cleanAndResetTerminal(); + if (shouldCleanupTerminal) { + cleanAndResetTerminal(); + } TestUtils.printTrace(TestUtils.TraceSevLevel.INFO, this.getClass().getSimpleName() + "." + info.getDisplayName() + ". Exit"); } @@ -1024,9 +1033,6 @@ public static void deleteDirectoryIfExists(String dirPath) { * Clean project. */ public void stopTerminal() { - if (!shouldCleanupTerminal) { - return; - } Keyboard keyboard = new Keyboard(remoteRobot); ProjectFrameFixture projectFrame = remoteRobot.find(ProjectFrameFixture.class, Duration.ofSeconds(10)); @@ -1036,38 +1042,33 @@ public void stopTerminal() { ComponentFixture openFixtureNewTab = projectFrame.getActionMenuItem("New Tab"); openFixtureNewTab.click(new Point()); - // Perform clean - String projectName = getSmMPProjectName(); - if ("singleModMavenMP".equalsIgnoreCase(projectName)) { - keyboard.enterText("mvn liberty:stop"); + // Perform Stop Action + if (getBuildCategory() == BuildType.MAVEN_TYPE) { + keyboard.enterText("./mvnw liberty:stop"); - } else if ("singleModGradleMP".equalsIgnoreCase(projectName) || "singleMod GradleMP".equalsIgnoreCase(projectName)) { - keyboard.enterText("gradle libertyStop"); + } else if (getBuildCategory() == BuildType.GRADLE_TYPE) { + keyboard.enterText("./gradlew libertyStop"); } keyboard.enter(); - TestUtils.sleepAndIgnoreException(5); + TestUtils.sleepAndIgnoreException(10); } /** * Stop the Server. */ public void cleanTerminal() { - if (!shouldCleanupTerminal) { - return; - } Keyboard keyboard = new Keyboard(remoteRobot); // Perform clean - String projectName = getSmMPProjectName(); - if ("singleModMavenMP".equalsIgnoreCase(projectName)) { - keyboard.enterText("mvn clean"); + if (getBuildCategory() == BuildType.MAVEN_TYPE) { + keyboard.enterText("./mvnw clean"); keyboard.enter(); - } else if ("singleModGradleMP".equalsIgnoreCase(projectName) || "singleMod GradleMP".equalsIgnoreCase(projectName)) { - keyboard.enterText("gradle clean"); + } else if (getBuildCategory() == BuildType.GRADLE_TYPE) { + keyboard.enterText("./gradlew clean"); keyboard.enter(); } keyboard.enter(); - TestUtils.sleepAndIgnoreException(5); + TestUtils.sleepAndIgnoreException(10); } /** @@ -1162,4 +1163,9 @@ public void cleanAndResetTerminal() { * Validates that test reports were generated. */ public abstract void validateTestReportsExist(); + + /** + * Returns Build Category + */ + public abstract BuildType getBuildCategory(); } \ No newline at end of file diff --git a/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java b/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java index 2bb31a96a..9e075dcc9 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java +++ b/src/test/java/io/openliberty/tools/intellij/it/UIBotTestUtils.java @@ -2512,7 +2512,7 @@ public static void closeTerminalTabs(RemoteRobot remoteRobot) { ComponentFixture terminateButton = projectFrame.find(ComponentFixture.class, byXpath("//div[@accessiblename='Terminate']")); if (terminateButton.callJs("component.isEnabled();", false)) { terminateButton.click(); - // Optionally add a small delay here if needed + TestUtils.sleepAndIgnoreException(10); } else { break; // Exit loop if no enabled "Terminate" button is found } From a9c067fb211d2c7251644944c34f9c643b16fc44 Mon Sep 17 00:00:00 2001 From: Anusree Lakshmi <141303561+anusreelakshmi934@users.noreply.github.com> Date: Mon, 28 Oct 2024 22:03:53 +0530 Subject: [PATCH 4/8] Update SingleModMPProjectTestCommon.java --- .../tools/intellij/it/SingleModMPProjectTestCommon.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java index 2901758b2..b6a1240a3 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java +++ b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java @@ -19,7 +19,7 @@ import org.junit.jupiter.api.condition.EnabledOnOs; import org.junit.jupiter.api.condition.OS; -import java.awt.*; +import java.awt.Point; import java.io.File; import java.io.IOException; import java.nio.file.Paths; From 8d74d7380558a9a4f80f2d47e243a8535847ae50 Mon Sep 17 00:00:00 2001 From: Anusree Lakshmi <141303561+anusreelakshmi934@users.noreply.github.com> Date: Tue, 29 Oct 2024 13:54:29 +0530 Subject: [PATCH 5/8] Update SingleModMPProjectTestCommon.java --- .../tools/intellij/it/SingleModMPProjectTestCommon.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java index b6a1240a3..4dfb2279d 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java +++ b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java @@ -1048,6 +1048,8 @@ public void stopTerminal() { } else if (getBuildCategory() == BuildType.GRADLE_TYPE) { keyboard.enterText("./gradlew libertyStop"); + } else { + TestUtils.printTrace(TestUtils.TraceSevLevel.INFO, "Invalid build type specified"); } keyboard.enter(); TestUtils.sleepAndIgnoreException(10); @@ -1066,6 +1068,8 @@ public void cleanTerminal() { } else if (getBuildCategory() == BuildType.GRADLE_TYPE) { keyboard.enterText("./gradlew clean"); keyboard.enter(); + } else { + TestUtils.printTrace(TestUtils.TraceSevLevel.INFO, "Invalid build type specified"); } keyboard.enter(); TestUtils.sleepAndIgnoreException(10); From 4cb6be0b9fb4908a54a23317f46413acd1f84007 Mon Sep 17 00:00:00 2001 From: Anusree Lakshmi <141303561+anusreelakshmi934@users.noreply.github.com> Date: Wed, 30 Oct 2024 11:12:53 +0530 Subject: [PATCH 6/8] Remove unwanted enter --- .../tools/intellij/it/SingleModMPProjectTestCommon.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java index 4dfb2279d..af74909b8 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java +++ b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java @@ -1045,7 +1045,6 @@ public void stopTerminal() { // Perform Stop Action if (getBuildCategory() == BuildType.MAVEN_TYPE) { keyboard.enterText("./mvnw liberty:stop"); - } else if (getBuildCategory() == BuildType.GRADLE_TYPE) { keyboard.enterText("./gradlew libertyStop"); } else { @@ -1064,10 +1063,8 @@ public void cleanTerminal() { // Perform clean if (getBuildCategory() == BuildType.MAVEN_TYPE) { keyboard.enterText("./mvnw clean"); - keyboard.enter(); } else if (getBuildCategory() == BuildType.GRADLE_TYPE) { keyboard.enterText("./gradlew clean"); - keyboard.enter(); } else { TestUtils.printTrace(TestUtils.TraceSevLevel.INFO, "Invalid build type specified"); } From 67aa984bec7800866d72b8f81b37973ee2b6cd0b Mon Sep 17 00:00:00 2001 From: Anusree Lakshmi <141303561+anusreelakshmi934@users.noreply.github.com> Date: Fri, 1 Nov 2024 09:47:33 +0530 Subject: [PATCH 7/8] Added logger warning --- .../intellij/it/SingleModMPProjectTestCommon.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java index af74909b8..e995ef522 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java +++ b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java @@ -10,9 +10,11 @@ package io.openliberty.tools.intellij.it; import com.automation.remarks.junit5.Video; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.remoterobot.RemoteRobot; import com.intellij.remoterobot.fixtures.ComponentFixture; import com.intellij.remoterobot.utils.Keyboard; +import io.openliberty.tools.intellij.LibertyExplorer; import io.openliberty.tools.intellij.it.fixtures.ProjectFrameFixture; import io.openliberty.tools.intellij.it.fixtures.WelcomeFrameFixture; import org.junit.jupiter.api.*; @@ -34,6 +36,8 @@ */ public abstract class SingleModMPProjectTestCommon { + private final static Logger LOGGER = Logger.getInstance(LibertyExplorer.class); + /** * URL to display the UI Component hierarchy. This is used to obtain xPath related * information to find UI components. @@ -1048,7 +1052,8 @@ public void stopTerminal() { } else if (getBuildCategory() == BuildType.GRADLE_TYPE) { keyboard.enterText("./gradlew libertyStop"); } else { - TestUtils.printTrace(TestUtils.TraceSevLevel.INFO, "Invalid build type specified"); + LOGGER.warn("Invalid build type specified."); + return; } keyboard.enter(); TestUtils.sleepAndIgnoreException(10); @@ -1066,7 +1071,8 @@ public void cleanTerminal() { } else if (getBuildCategory() == BuildType.GRADLE_TYPE) { keyboard.enterText("./gradlew clean"); } else { - TestUtils.printTrace(TestUtils.TraceSevLevel.INFO, "Invalid build type specified"); + LOGGER.warn("Invalid build type specified."); + return; } keyboard.enter(); TestUtils.sleepAndIgnoreException(10); From a7f96ee97d3abea0cf55b9c2f3e4345bee9e57d4 Mon Sep 17 00:00:00 2001 From: Anusree Lakshmi <141303561+anusreelakshmi934@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:32:16 +0530 Subject: [PATCH 8/8] changed warn back to printTrace --- .../tools/intellij/it/SingleModMPProjectTestCommon.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java index e995ef522..b4c55edde 100644 --- a/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java +++ b/src/test/java/io/openliberty/tools/intellij/it/SingleModMPProjectTestCommon.java @@ -10,11 +10,9 @@ package io.openliberty.tools.intellij.it; import com.automation.remarks.junit5.Video; -import com.intellij.openapi.diagnostic.Logger; import com.intellij.remoterobot.RemoteRobot; import com.intellij.remoterobot.fixtures.ComponentFixture; import com.intellij.remoterobot.utils.Keyboard; -import io.openliberty.tools.intellij.LibertyExplorer; import io.openliberty.tools.intellij.it.fixtures.ProjectFrameFixture; import io.openliberty.tools.intellij.it.fixtures.WelcomeFrameFixture; import org.junit.jupiter.api.*; @@ -36,8 +34,6 @@ */ public abstract class SingleModMPProjectTestCommon { - private final static Logger LOGGER = Logger.getInstance(LibertyExplorer.class); - /** * URL to display the UI Component hierarchy. This is used to obtain xPath related * information to find UI components. @@ -1052,7 +1048,7 @@ public void stopTerminal() { } else if (getBuildCategory() == BuildType.GRADLE_TYPE) { keyboard.enterText("./gradlew libertyStop"); } else { - LOGGER.warn("Invalid build type specified."); + TestUtils.printTrace(TestUtils.TraceSevLevel.INFO, "Invalid build type specified"); return; } keyboard.enter(); @@ -1071,7 +1067,7 @@ public void cleanTerminal() { } else if (getBuildCategory() == BuildType.GRADLE_TYPE) { keyboard.enterText("./gradlew clean"); } else { - LOGGER.warn("Invalid build type specified."); + TestUtils.printTrace(TestUtils.TraceSevLevel.INFO, "Invalid build type specified"); return; } keyboard.enter();