Skip to content

Commit

Permalink
Delete all run/debug configs so as not to find an unexpected one
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Kurz <[email protected]>
  • Loading branch information
scottkurz committed Sep 19, 2023
1 parent 213fb4a commit 4297ba9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import static io.openliberty.tools.eclipse.test.it.utils.MagicWidgetFinder.context;
import static io.openliberty.tools.eclipse.test.it.utils.MagicWidgetFinder.go;
import static io.openliberty.tools.eclipse.test.it.utils.MagicWidgetFinder.goGlobal;
import static io.openliberty.tools.eclipse.test.it.utils.SWTBotPluginOperations.deleteLibertyToolsRunConfigEntriesFromAppRunAs;
import static io.openliberty.tools.eclipse.test.it.utils.SWTBotPluginOperations.deleteLibertyToolsDebugConfigEntriesFromMenu;
import static io.openliberty.tools.eclipse.test.it.utils.SWTBotPluginOperations.enableLibertyTools;
import static io.openliberty.tools.eclipse.test.it.utils.SWTBotPluginOperations.getAppDebugAsMenu;
import static io.openliberty.tools.eclipse.test.it.utils.SWTBotPluginOperations.getAppRunAsMenu;
Expand Down Expand Up @@ -380,7 +380,7 @@ public void testDashboardStopExternalServer() throws CommandNotFoundException, I
public void testDashboardStartWithCustomConfigAction() {

// Delete any previously created configs.
deleteLibertyToolsRunConfigEntriesFromAppRunAs(GRADLE_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

// Delete the test report files before we start this test.
Path projectPath = Paths.get("resources", "applications", "gradle", "liberty-gradle-test-app");
Expand Down Expand Up @@ -417,7 +417,7 @@ public void testDashboardStartWithCustomConfigAction() {
public void testDashboardDebugWithCustomConfigAction() {

// Delete any previously created configs.
deleteLibertyToolsRunConfigEntriesFromAppRunAs(GRADLE_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

// Delete the test report files before we start this test.
Path projectPath = Paths.get("resources", "applications", "gradle", "liberty-gradle-test-app");
Expand Down Expand Up @@ -586,7 +586,7 @@ public void testAddingProjectToDashboardManually() throws Exception {
public void testStartWithDefaultRunAsConfig() {

// Delete any previously created configs.
deleteLibertyToolsRunConfigEntriesFromAppRunAs(GRADLE_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

// Start dev mode.
launchStartWithDefaultRunConfigFromAppRunAs(GRADLE_APP_NAME);
Expand All @@ -613,7 +613,7 @@ public void testStartWithDefaultRunAsConfig() {
public void testStartWithCustomRunAsConfig() {

// Delete any previously created configs.
deleteLibertyToolsRunConfigEntriesFromAppRunAs(GRADLE_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

// Delete the test report files before we start this test.
Path projectPath = Paths.get("resources", "applications", "gradle", "liberty-gradle-test-app");
Expand Down Expand Up @@ -650,7 +650,7 @@ public void testStartWithCustomRunAsConfig() {
public void testRunAsShortcutActions() {

// Delete any previously created configs.
deleteLibertyToolsRunConfigEntriesFromAppRunAs(GRADLE_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

// Delete the test report files before we start this test.
Path projectPath = Paths.get("resources", "applications", "gradle", "liberty-gradle-test-app");
Expand Down Expand Up @@ -698,7 +698,7 @@ public void testRunAsShortcutActions() {
@Test
public void testStartWithCustomDebugAsConfig() {
// Delete any previously created configs.
deleteLibertyToolsRunConfigEntriesFromAppRunAs(GRADLE_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

// Delete the test report files before we start this test.
Path projectPath = Paths.get("resources", "applications", "gradle", "liberty-gradle-test-app");
Expand Down Expand Up @@ -738,7 +738,7 @@ public void testStartWithCustomDebugAsConfig() {
@Test
public void testStartWithDebugAsShortcut() {

deleteLibertyToolsRunConfigEntriesFromAppRunAs(GRADLE_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

// Start dev mode.
launchStartWithDebugAsShortcut(GRADLE_APP_NAME);
Expand Down Expand Up @@ -767,7 +767,7 @@ public void testStartWithDebugAsShortcut() {
@Test
public void testDefaultJRECompliance() {
// Delete any previously created configs.
deleteLibertyToolsRunConfigEntriesFromAppRunAs(GRADLE_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

Shell configShell = launchRunConfigurationsDialogFromAppRunAs(GRADLE_APP_NAME);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import static io.openliberty.tools.eclipse.test.it.utils.MagicWidgetFinder.context;
import static io.openliberty.tools.eclipse.test.it.utils.MagicWidgetFinder.go;
import static io.openliberty.tools.eclipse.test.it.utils.MagicWidgetFinder.goGlobal;
import static io.openliberty.tools.eclipse.test.it.utils.SWTBotPluginOperations.deleteLibertyToolsRunConfigEntriesFromAppRunAs;
import static io.openliberty.tools.eclipse.test.it.utils.SWTBotPluginOperations.deleteLibertyToolsDebugConfigEntriesFromMenu;
import static io.openliberty.tools.eclipse.test.it.utils.SWTBotPluginOperations.enableLibertyTools;
import static io.openliberty.tools.eclipse.test.it.utils.SWTBotPluginOperations.getAppDebugAsMenu;
import static io.openliberty.tools.eclipse.test.it.utils.SWTBotPluginOperations.getAppRunAsMenu;
Expand Down Expand Up @@ -435,7 +435,7 @@ public void testDashboardDebugAction() {
public void testDashboardStartWithCustomConfigAction() {

// Delete any previously created configs.
deleteLibertyToolsRunConfigEntriesFromAppRunAs(MVN_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

// Delete the test report files before we start this test.
Path pathToITReport = Paths.get(projectPath.toString(), "target", "site", "failsafe-report.html");
Expand Down Expand Up @@ -471,7 +471,7 @@ public void testDashboardStartWithCustomConfigAction() {
public void testDashboardDebugWithCustomConfigAction() {

// Delete any previously created configs.
deleteLibertyToolsRunConfigEntriesFromAppRunAs(MVN_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

// Delete the test report files before we start this test.
Path pathToITReport = Paths.get(projectPath.toString(), "target", "site", "failsafe-report.html");
Expand Down Expand Up @@ -558,7 +558,7 @@ public void testDashboardActions() {
@Test
public void testStartWithDefaultRunAsConfig() {

deleteLibertyToolsRunConfigEntriesFromAppRunAs(MVN_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

// Start dev mode.
launchStartWithDefaultRunConfigFromAppRunAs(MVN_APP_NAME);
Expand All @@ -585,7 +585,7 @@ public void testStartWithDefaultRunAsConfig() {
@Test
public void testStartWithCustomRunAsConfig() {
// Delete any previously created configs.
deleteLibertyToolsRunConfigEntriesFromAppRunAs(MVN_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

// Delete the test report files before we start this test.
Path pathToITReport = Paths.get(projectPath.toString(), "target", "site", "failsafe-report.html");
Expand Down Expand Up @@ -618,7 +618,7 @@ public void testStartWithCustomRunAsConfig() {
public void testRunAsShortcutActions() {

// Delete any previously created configs.
deleteLibertyToolsRunConfigEntriesFromAppRunAs(MVN_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

// Delete the test report files before we start this test.
Path pathToITReport = Paths.get(projectPath.toString(), "target", "site", "failsafe-report.html");
Expand Down Expand Up @@ -669,7 +669,7 @@ public void testRunAsShortcutActions() {
@Test
public void testStartWithCustomDebugAsConfig() {

deleteLibertyToolsRunConfigEntriesFromAppRunAs(MVN_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

// Delete the test report files before we start this test.
Path pathToITReport = Paths.get(projectPath.toString(), "target", "site", "failsafe-report.html");
Expand Down Expand Up @@ -718,7 +718,7 @@ public void testStartWithCustomDebugAsConfig() {
public void testStartWithDebugAsShortcut() {

// Delete any previously created configs.
deleteLibertyToolsRunConfigEntriesFromAppRunAs(MVN_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

// Start dev mode.
launchStartWithDebugAsShortcut(MVN_APP_NAME);
Expand Down Expand Up @@ -839,7 +839,7 @@ public void testStartWithNoWrapperAndPreferencesSet() {
@Test
public void testDefaultJRECompliance() {
// Delete any previously created configs.
deleteLibertyToolsRunConfigEntriesFromAppRunAs(MVN_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

Shell configShell = launchRunConfigurationsDialogFromAppRunAs(MVN_APP_NAME);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
package io.openliberty.tools.eclipse.test.it;

import static io.openliberty.tools.eclipse.test.it.utils.MagicWidgetFinder.go;
import static io.openliberty.tools.eclipse.test.it.utils.SWTBotPluginOperations.deleteLibertyToolsRunConfigEntriesFromAppRunAs;
import static io.openliberty.tools.eclipse.test.it.utils.SWTBotPluginOperations.deleteLibertyToolsDebugConfigEntriesFromMenu;
import static io.openliberty.tools.eclipse.test.it.utils.SWTBotPluginOperations.getDashboardContent;
import static io.openliberty.tools.eclipse.test.it.utils.SWTBotPluginOperations.getDashboardItemMenuActions;
import static io.openliberty.tools.eclipse.test.it.utils.SWTBotPluginOperations.getLibertyTreeItem;
Expand Down Expand Up @@ -247,7 +247,7 @@ public void testStartWithDefaultRunAsConfig() {
setBuildCmdPathInPreferences(bot, "Maven");

// Delete any previously created configs.
deleteLibertyToolsRunConfigEntriesFromAppRunAs(MVN_APP_NAME);
deleteLibertyToolsDebugConfigEntriesFromMenu();

// Start dev mode.
launchStartWithDefaultRunConfigFromAppRunAs(MVN_APP_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,32 +396,6 @@ public static SWTBotTreeItem getRemoteJavaAppConfigMenuItem(Shell shell) {
return new SWTBotTreeItem((TreeItem)find(LAUNCH_CONFIG_REMOTE_JAVA_APP, shell));
}

/**
* Deletes Liberty run configuration entries.
*
* @param bot The SWTWorkbenchBot instance..
* @param appName The application name.
*/
public static void deleteLibertyToolsRunConfigEntriesFromAppRunAs(String appName) {

Shell configShell = launchRunConfigurationsDialogFromAppRunAs(appName);

try {
SWTBotTreeItem libertyToolsEntry = getLibertyTreeItem(configShell);

Assertions.assertTrue((libertyToolsEntry != null), () -> "The Liberty entry was not found in run Configurations dialog.");

List<String> configs = libertyToolsEntry.getNodes();

for (String config : configs) {
deleteRunDebugConfigEntry(libertyToolsEntry, config);
}
} finally {
// Close the configuration dialog.
MagicWidgetFinder.go("Close", configShell);
}
}

/**
* Deletes Liberty debug configuration entries.
*
Expand Down

0 comments on commit 4297ba9

Please sign in to comment.