From bda813cc9ac37c7e2b4de7bb345df2dbbf2f48f4 Mon Sep 17 00:00:00 2001 From: Adam Wisniewski Date: Wed, 4 Sep 2024 09:09:21 -0400 Subject: [PATCH 1/2] Update JDTLS Signed-off-by: Adam Wisniewski --- releng/io.openliberty.tools.update/category.xml | 2 +- releng/target-platform-2Q2024/target-platform-2Q2024.target | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/releng/io.openliberty.tools.update/category.xml b/releng/io.openliberty.tools.update/category.xml index 1f4175bc..9ad890e1 100644 --- a/releng/io.openliberty.tools.update/category.xml +++ b/releng/io.openliberty.tools.update/category.xml @@ -18,7 +18,7 @@ - + diff --git a/releng/target-platform-2Q2024/target-platform-2Q2024.target b/releng/target-platform-2Q2024/target-platform-2Q2024.target index 0c9f225b..bc5a9454 100644 --- a/releng/target-platform-2Q2024/target-platform-2Q2024.target +++ b/releng/target-platform-2Q2024/target-platform-2Q2024.target @@ -82,7 +82,7 @@ - + From 2463b149c6a415799a0112ff8ebcef8853e97fb3 Mon Sep 17 00:00:00 2001 From: Adam Wisniewski Date: Wed, 4 Sep 2024 09:09:51 -0400 Subject: [PATCH 2/2] Add test report lookup location Signed-off-by: Adam Wisniewski --- .../tools/eclipse/DevModeOperations.java | 81 ++++++++++--------- .../test/it/LibertyPluginSWTBotMavenTest.java | 16 ++-- 2 files changed, 52 insertions(+), 45 deletions(-) diff --git a/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/DevModeOperations.java b/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/DevModeOperations.java index 200b1b11..844ba93f 100644 --- a/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/DevModeOperations.java +++ b/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/DevModeOperations.java @@ -18,7 +18,6 @@ import java.net.URL; import java.nio.file.Path; import java.nio.file.Paths; -import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -563,22 +562,13 @@ public void openMavenIntegrationTestReport(IProject inputProject) { } // Get the path to the test report. - Path path = getMavenIntegrationTestReportPath(projectPath); - if (!path.toFile().exists()) { - String msg = "No integration test results were found for project " + projectName + ". Select \"" - + DashboardView.APP_MENU_ACTION_RUN_TESTS + "\" before you select \"" - + DashboardView.APP_MENU_ACTION_VIEW_MVN_IT_REPORT + "\" on the menu."; - if (Trace.isEnabled()) { - Trace.getTracer().trace(Trace.TRACE_TOOLS, msg + " No-op. Path: " + path); - } - ErrorHandler.processErrorMessage(NLS.bind(Messages.mvn_int_test_report_none_found, new String[] { projectName, - DashboardView.APP_MENU_ACTION_RUN_TESTS, DashboardView.APP_MENU_ACTION_VIEW_MVN_IT_REPORT }), true); - return; - } + Path path = getMavenIntegrationTestReportPath(projectPath, projectName); - // Display the report on the browser. Browser display is based on eclipse configuration preferences. - String browserTabTitle = projectName + " " + BROWSER_MVN_IT_REPORT_NAME_SUFFIX; - openTestReport(projectName, path, path.toString(), browserTabTitle, browserTabTitle); + if (path != null) { + // Display the report on the browser. Browser display is based on eclipse configuration preferences. + String browserTabTitle = projectName + " " + BROWSER_MVN_IT_REPORT_NAME_SUFFIX; + openTestReport(projectName, path, path.toString(), browserTabTitle, browserTabTitle); + } } catch (Exception e) { String msg = "An error was detected when the view integration test report request was processed on project " + projectName + "."; @@ -637,22 +627,13 @@ public void openMavenUnitTestReport(IProject inputProject) { } // Get the path to the test report. - Path path = getMavenUnitTestReportPath(projectPath); - if (!path.toFile().exists()) { - String msg = "No unit test results were found for project " + projectName + ". Select \"" - + DashboardView.APP_MENU_ACTION_RUN_TESTS + "\" before you select \"" - + DashboardView.APP_MENU_ACTION_VIEW_MVN_UT_REPORT + "\" on the menu."; - if (Trace.isEnabled()) { - Trace.getTracer().trace(Trace.TRACE_TOOLS, msg + " No-op. Path: " + path); - } - ErrorHandler.processErrorMessage(NLS.bind(Messages.mvn_unit_test_report_none_found, new String[] { projectName, - DashboardView.APP_MENU_ACTION_RUN_TESTS, DashboardView.APP_MENU_ACTION_VIEW_MVN_UT_REPORT }), true); - return; - } + Path path = getMavenUnitTestReportPath(projectPath, projectName); - // Display the report on the browser. Browser display is based on eclipse configuration preferences. - String browserTabTitle = projectName + " " + BROWSER_MVN_UT_REPORT_NAME_SUFFIX; - openTestReport(projectName, path, path.toString(), browserTabTitle, browserTabTitle); + if (path != null) { + // Display the report on the browser. Browser display is based on eclipse configuration preferences. + String browserTabTitle = projectName + " " + BROWSER_MVN_UT_REPORT_NAME_SUFFIX; + openTestReport(projectName, path, path.toString(), browserTabTitle, browserTabTitle); + } } catch (Exception e) { String msg = "An error was detected when the view unit test report request was processed on project " + projectName + "."; if (Trace.isEnabled()) { @@ -983,10 +964,23 @@ public void run() { * * @return The path of the HTML file containing the integration test report. */ - public static Path getMavenIntegrationTestReportPath(String projectPath) { - Path path = Paths.get(projectPath, "target", "site", "failsafe-report.html"); + public static Path getMavenIntegrationTestReportPath(String projectPath, String projectName) { + Path path1 = Paths.get(projectPath, "target", "reports", "failsafe.html"); + Path path2 = Paths.get(projectPath, "target", "site", "failsafe-report.html"); + + if (!path1.toFile().exists() && !path2.toFile().exists()) { + String msg = "No integration test results were found for project " + projectName + ". Select \"" + + DashboardView.APP_MENU_ACTION_RUN_TESTS + "\" before you select \"" + + DashboardView.APP_MENU_ACTION_VIEW_MVN_IT_REPORT + "\" on the menu."; + if (Trace.isEnabled()) { + Trace.getTracer().trace(Trace.TRACE_TOOLS, msg + " No-op. Paths checked: " + path1 + ", " + path2); + } + ErrorHandler.processErrorMessage(NLS.bind(Messages.mvn_int_test_report_none_found, new String[] { projectName, + DashboardView.APP_MENU_ACTION_RUN_TESTS, DashboardView.APP_MENU_ACTION_VIEW_MVN_IT_REPORT }), true); + return null; + } - return path; + return path1.toFile().exists() ? path1 : path2; } /** @@ -996,10 +990,23 @@ public static Path getMavenIntegrationTestReportPath(String projectPath) { * * @return The path of the HTML file containing the unit test report. */ - public static Path getMavenUnitTestReportPath(String projectPath) { - Path path = Paths.get(projectPath, "target", "site", "surefire-report.html"); + public static Path getMavenUnitTestReportPath(String projectPath, String projectName) { + Path path1 = Paths.get(projectPath, "target", "reports", "surefire.html"); + Path path2 = Paths.get(projectPath, "target", "site", "surefire-report.html"); + + if (!path1.toFile().exists() && !path2.toFile().exists()) { + String msg = "No unit test results were found for project " + projectName + ". Select \"" + + DashboardView.APP_MENU_ACTION_RUN_TESTS + "\" before you select \"" + + DashboardView.APP_MENU_ACTION_VIEW_MVN_UT_REPORT + "\" on the menu."; + if (Trace.isEnabled()) { + Trace.getTracer().trace(Trace.TRACE_TOOLS, msg + " No-op. Paths checked: " + path1 + ", " + path2); + } + ErrorHandler.processErrorMessage(NLS.bind(Messages.mvn_unit_test_report_none_found, new String[] { projectName, + DashboardView.APP_MENU_ACTION_RUN_TESTS, DashboardView.APP_MENU_ACTION_VIEW_MVN_UT_REPORT }), true); + return null; + } - return path; + return path1.toFile().exists() ? path1 : path2; } /** diff --git a/tests/src/main/java/io/openliberty/tools/eclipse/test/it/LibertyPluginSWTBotMavenTest.java b/tests/src/main/java/io/openliberty/tools/eclipse/test/it/LibertyPluginSWTBotMavenTest.java index cd9bc1bd..b1a925a9 100644 --- a/tests/src/main/java/io/openliberty/tools/eclipse/test/it/LibertyPluginSWTBotMavenTest.java +++ b/tests/src/main/java/io/openliberty/tools/eclipse/test/it/LibertyPluginSWTBotMavenTest.java @@ -472,7 +472,7 @@ public void testDashboardStartWithCustomConfigAction() { deleteLibertyToolsRunConfigEntriesFromAppRunAs(MVN_APP_NAME); // Delete the test report files before we start this test. - Path pathToITReport = Paths.get(projectPath.toString(), "target", "site", "failsafe-report.html"); + Path pathToITReport = Paths.get(projectPath.toString(), "target", "reports", "failsafe.html"); boolean testReportDeleted = LibertyPluginTestUtils.deleteFile(pathToITReport.toFile()); Assertions.assertTrue(testReportDeleted, () -> "File: " + pathToITReport + " was not be deleted."); @@ -508,7 +508,7 @@ public void testDashboardDebugWithCustomConfigAction() { deleteLibertyToolsRunConfigEntriesFromAppRunAs(MVN_APP_NAME); // Delete the test report files before we start this test. - Path pathToITReport = Paths.get(projectPath.toString(), "target", "site", "failsafe-report.html"); + Path pathToITReport = Paths.get(projectPath.toString(), "target", "reports", "failsafe.html"); boolean testReportDeleted = LibertyPluginTestUtils.deleteFile(pathToITReport.toFile()); Assertions.assertTrue(testReportDeleted, () -> "File: " + pathToITReport + " was not be deleted."); @@ -544,11 +544,11 @@ public void testDashboardDebugWithCustomConfigAction() { public void testDashboardActions() { // Delete the test report files before we start this test. - Path pathToITReport = Paths.get(projectPath.toString(), "target", "site", "failsafe-report.html"); + Path pathToITReport = Paths.get(projectPath.toString(), "target", "reports", "failsafe.html"); boolean itReportDeleted = LibertyPluginTestUtils.deleteFile(pathToITReport.toFile()); Assertions.assertTrue(itReportDeleted, () -> "Test report file: " + pathToITReport + " was not be deleted."); - Path pathToUTReport = Paths.get(projectPath.toString(), "target", "site", "surefire-report.html"); + Path pathToUTReport = Paths.get(projectPath.toString(), "target", "reports", "surefire.html"); boolean utReportDeleted = LibertyPluginTestUtils.deleteFile(pathToITReport.toFile()); Assertions.assertTrue(utReportDeleted, () -> "Test report file: " + pathToITReport + " was not be deleted."); @@ -622,7 +622,7 @@ public void testStartWithCustomRunAsConfig() { deleteLibertyToolsRunConfigEntriesFromAppRunAs(MVN_APP_NAME); // Delete the test report files before we start this test. - Path pathToITReport = Paths.get(projectPath.toString(), "target", "site", "failsafe-report.html"); + Path pathToITReport = Paths.get(projectPath.toString(), "target", "reports", "failsafe.html"); boolean testReportDeleted = LibertyPluginTestUtils.deleteFile(pathToITReport.toFile()); Assertions.assertTrue(testReportDeleted, () -> "File: " + pathToITReport + " was not be deleted."); @@ -655,11 +655,11 @@ public void testRunAsShortcutActions() { deleteLibertyToolsRunConfigEntriesFromAppRunAs(MVN_APP_NAME); // Delete the test report files before we start this test. - Path pathToITReport = Paths.get(projectPath.toString(), "target", "site", "failsafe-report.html"); + Path pathToITReport = Paths.get(projectPath.toString(), "target", "reports", "failsafe.html"); boolean itReportDeleted = LibertyPluginTestUtils.deleteFile(pathToITReport.toFile()); Assertions.assertTrue(itReportDeleted, () -> "Test report file: " + pathToITReport + " was not be deleted."); - Path pathToUTReport = Paths.get(projectPath.toString(), "target", "site", "surefire-report.html"); + Path pathToUTReport = Paths.get(projectPath.toString(), "target", "reports", "surefire.html"); boolean utReportDeleted = LibertyPluginTestUtils.deleteFile(pathToITReport.toFile()); Assertions.assertTrue(utReportDeleted, () -> "Test report file: " + pathToITReport + " was not be deleted."); @@ -706,7 +706,7 @@ public void testStartWithCustomDebugAsConfig() { deleteLibertyToolsRunConfigEntriesFromAppRunAs(MVN_APP_NAME); // Delete the test report files before we start this test. - Path pathToITReport = Paths.get(projectPath.toString(), "target", "site", "failsafe-report.html"); + Path pathToITReport = Paths.get(projectPath.toString(), "target", "reports", "failsafe.html"); boolean testReportDeleted = LibertyPluginTestUtils.deleteFile(pathToITReport.toFile()); Assertions.assertTrue(testReportDeleted, () -> "File: " + pathToITReport + " was not be deleted.");