diff --git a/src/test/Gradle9TestDevModeActions.ts b/src/test/Gradle9TestDevModeActions.ts
new file mode 100644
index 00000000..fd8e166a
--- /dev/null
+++ b/src/test/Gradle9TestDevModeActions.ts
@@ -0,0 +1,457 @@
+// test same functionality as GradleTestDevModeActions
+// make sure paths or constants that call liberty-gradle-test-wrapper call liberty-gradle-9-test-wrapper here
+// make sure you can run it as an individual test
+
+/*
+ * IBM Confidential
+ * Copyright IBM Corp. 2023, 2026
+ */
+import { expect } from 'chai';
+import { EditorView, VSBrowser, Workbench } from 'vscode-extension-tester';
+import * as utils from './utils/testUtils';
+import * as constants from './definitions/constants';
+import { logger } from './utils/testLogger';
+import path = require('path');
+import { DashboardPage } from './pages/DashboardPage';
+
+describe('Open and conduct devmode action tests for Gradle 9.0 Project', () => {
+ let dashboard: DashboardPage;
+
+ before(async function() {
+ this.timeout(30000);
+
+ await VSBrowser.instance.openResources(utils.getGradle9ProjectPath());
+ await VSBrowser.instance.waitForWorkbench();
+
+ dashboard = new DashboardPage();
+ });
+
+ afterEach(async function() {
+ this.timeout(10000); // Increase timeout for cleanup operations
+ // Close any open editors after each test
+ if (this.currentTest?.state === 'failed') {
+ await VSBrowser.instance.driver.takeScreenshot();
+ logger.error(`Test failed: ${this.currentTest.title}`);
+ }
+
+ try {
+ await new EditorView().closeAllEditors();
+ } catch (error) {
+ logger.error('Failed to close editors in afterEach', error);
+ }
+
+ // Clear terminal between tests to avoid confusion with old output
+ try {
+ const workbench = new Workbench();
+ await workbench.executeCommand('terminal clear');
+ } catch (error) {
+ logger.error('Failed to clear terminal in afterEach', error);
+ }
+ });
+
+
+ it('Find Liberty Tools in sidebar', async () => {
+ logger.testStart('Find Liberty Tools in sidebar');
+ try {
+ logger.step(1, 'Attempting to get Liberty Tools section');
+ const section = await dashboard.getSection();
+ logger.stepSuccess(1, 'Found Liberty Tools section');
+
+ logger.step(2, 'Validating sidebar is not undefined');
+ expect(section).not.undefined;
+ logger.testComplete('Find Liberty Tools in sidebar');
+ } catch (error) {
+ logger.testFailed('Find Liberty Tools in sidebar', error);
+ throw error;
+ }
+ }).timeout(60000);
+
+ it('Liberty Tools shows items - Gradle', async () => {
+ logger.testStart('Liberty Tools shows items - Gradle');
+ try {
+ logger.step(1, 'Getting dashboard section');
+ const section = await dashboard.getSection();
+ logger.stepSuccess(1, 'Dashboard section retrieved');
+
+ logger.step(2, 'Waiting for Liberty Tools to load');
+ await utils.waitForDashboardToLoad(section);
+ logger.stepSuccess(2, 'Liberty Tools loaded successfully');
+
+ logger.step(3, 'Getting visible items from section');
+ const menu = await utils.waitForCondition(async () => {
+ const items = await section.getVisibleItems();
+ if (items && items.length > 0) {
+ return items;
+ }
+ return;
+ }, 60);
+ logger.info(`Found ${menu.length} visible items in dashboard`);
+ expect(menu).not.empty;
+
+ logger.step(4, `Finding Gradle project item: ${constants.GRADLE_9_PROJECT}`);
+ const item = await dashboard.getProjectItem(constants.GRADLE_9_PROJECT);
+ logger.stepSuccess(4, 'Gradle project item found');
+ expect(item).not.undefined;
+
+ logger.testComplete('Liberty Tools shows items - Gradle');
+ } catch (error) {
+ logger.testFailed('Liberty Tools shows items - Gradle', error);
+ throw error;
+ }
+ }).timeout(300000);
+
+ it('Start Gradle project from Liberty Tools', async () => {
+ logger.testStart('Start Gradle project from Liberty Tools');
+ try {
+ logger.step(1, 'Launching dashboard start action');
+ await dashboard.runAction(constants.GRADLE_9_PROJECT, constants.START_DASHBOARD_ACTION, constants.START_DASHBOARD_MAC_ACTION);
+
+ logger.step(2, 'Waiting for server to start');
+ const serverStartStatus = await utils.waitForServerStart(constants.SERVER_START_STRING);
+
+ if (!serverStartStatus) {
+ logger.error('Server started message not found in the terminal');
+ } else {
+ logger.stepSuccess(2, 'Server successfully started');
+
+ logger.step(3, 'Launching dashboard stop action');
+ await dashboard.runAction(constants.GRADLE_9_PROJECT, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION);
+
+ logger.step(4, 'Waiting for server to stop');
+ const serverStopStatus = await utils.waitForServerStop(constants.SERVER_STOP_STRING);
+
+ if (!serverStopStatus) {
+ logger.error('Server stopped message not found in the terminal');
+ } else {
+ logger.stepSuccess(4, 'Server stopped successfully');
+ }
+ expect(serverStopStatus).to.be.true;
+ }
+
+ expect(serverStartStatus).to.be.true;
+ logger.testComplete('Start Gradle project from Liberty Tools');
+ } catch (error) {
+ logger.testFailed('Start Gradle project from Liberty Tools', error);
+ throw error;
+ }
+ }).timeout(350000);
+
+ it('Start Gradle with Docker from Liberty Tools', async () => {
+ logger.testStart('Start Gradle with Docker from Liberty Tools');
+
+ if ((process.platform === 'darwin') || (process.platform === 'win32')) {
+ logger.skip(`Test skipped for platform: ${process.platform} (Docker test only runs on Linux)`);
+ return true;
+ }
+
+ try {
+ logger.step(1, 'Launching dashboard start action with Docker');
+ await dashboard.runAction(constants.GRADLE_9_PROJECT, constants.START_DASHBOARD_ACTION_WITHDOCKER, constants.START_DASHBOARD_MAC_ACTION_WITHDOCKER);
+
+ logger.step(2, 'Waiting for server to start in Docker container');
+ const serverStartStatus = await utils.waitForServerStart(constants.SERVER_START_STRING);
+
+ if (!serverStartStatus) {
+ logger.error('Server started message not found in the terminal');
+ } else {
+ logger.stepSuccess(2, 'Server successfully started in Docker container');
+
+ logger.step(3, 'Launching dashboard stop action');
+ await dashboard.runAction(constants.GRADLE_9_PROJECT, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION);
+
+ logger.step(4, 'Waiting for server to stop');
+ const serverStopStatus = await utils.waitForServerStop(constants.SERVER_STOP_STRING);
+
+ if (!serverStopStatus) {
+ logger.error('Server stopped message not found in the terminal');
+ } else {
+ logger.stepSuccess(4, 'Server stopped successfully');
+ }
+ expect(serverStopStatus).to.be.true;
+ }
+
+ expect(serverStartStatus).to.be.true;
+ logger.testComplete('Start Gradle with Docker from Liberty Tools');
+ } catch (error) {
+ logger.testFailed('Start Gradle with Docker from Liberty Tools', error);
+ throw error;
+ }
+ }).timeout(350000);
+
+ it('Run tests for Gradle project', async () => {
+ logger.testStart('Run tests for Gradle project');
+ try {
+ logger.step(1, 'Launching dashboard start action');
+ await dashboard.runAction(constants.GRADLE_9_PROJECT, constants.START_DASHBOARD_ACTION, constants.START_DASHBOARD_MAC_ACTION);
+
+ logger.step(2, 'Waiting for server to start');
+ const serverStartStatus = await utils.waitForServerStart(constants.SERVER_START_STRING);
+
+ if (!serverStartStatus) {
+ logger.error('Server started message not found in the terminal');
+ } else {
+ logger.stepSuccess(2, 'Server successfully started');
+
+ logger.step(3, 'Launching run tests dashboard action');
+ await dashboard.runAction(constants.GRADLE_9_PROJECT, constants.RUNTEST_DASHBOARD_ACTION, constants.RUNTEST_DASHBOARD_MAC_ACTION);
+
+ logger.step(4, 'Checking test execution status');
+ const testStatus = await utils.checkTestStatus(constants.GRADLE_TEST_RUN_STRING);
+ logger.info(`Test status result: ${testStatus}`);
+
+ expect(testStatus).to.be.true;
+ logger.stepSuccess(4, 'Tests executed successfully');
+
+ logger.step(5, 'Launching dashboard stop action');
+ await dashboard.runAction(constants.GRADLE_9_PROJECT, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION);
+
+ logger.step(6, 'Waiting for server to stop');
+ const serverStopStatus = await utils.waitForServerStop(constants.SERVER_STOP_STRING);
+
+ if (!serverStopStatus) {
+ logger.error('Server stopped message not found in the terminal');
+ } else {
+ logger.stepSuccess(6, 'Server stopped successfully');
+ }
+ expect(serverStopStatus).to.be.true;
+ }
+
+ expect(serverStartStatus).to.be.true;
+ logger.testComplete('Run tests for Gradle project');
+ } catch (error) {
+ logger.testFailed('Run tests for Gradle project', error);
+ throw error;
+ }
+ }).timeout(350000);
+
+
+ it('Start Gradle with options from Liberty Tools', async () => {
+ logger.testStart('Start Gradle with options from Liberty Tools');
+ try {
+ const reportPath = path.join(utils.getGradle9ProjectPath(), "build", "reports", "tests", "test", "index.html");
+ logger.info(`Report path: ${reportPath}`);
+
+ logger.step(1, 'Deleting existing test report');
+ const deleteReport = await utils.deleteReports(reportPath);
+ logger.info(`Report deletion result: ${deleteReport}`);
+ expect(deleteReport).to.be.true;
+
+ logger.step(2, 'Launching dashboard start action with custom parameters');
+ await dashboard.runAction(constants.GRADLE_9_PROJECT, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM);
+
+ logger.step(3, 'Setting custom parameter: --hotTests');
+ await utils.setCustomParameter("--hotTests");
+
+ logger.step(4, 'Waiting for server to start with parameters');
+ const serverStartStatus = await utils.waitForServerStart(constants.SERVER_START_STRING);
+
+ if (!serverStartStatus) {
+ logger.error('Server started with params message not found in terminal');
+ } else {
+ logger.stepSuccess(4, 'Server successfully started with custom parameters');
+
+ logger.step(5, 'Waiting for test report');
+ let checkFile = await utils.waitForTestReport(reportPath);
+ logger.info(`Report exists: ${checkFile}`);
+
+ expect(checkFile).to.be.true;
+ logger.stepSuccess(5, 'Test report found');
+
+ logger.step(6, 'Launching dashboard stop action');
+ await dashboard.runAction(constants.GRADLE_9_PROJECT, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION);
+
+ logger.step(7, 'Waiting for server to stop');
+ const serverStopStatus = await utils.waitForServerStop(constants.SERVER_STOP_STRING);
+
+ if (!serverStopStatus) {
+ logger.error('Server stopped message not found in the terminal');
+ } else {
+ logger.stepSuccess(7, 'Server stopped successfully');
+ }
+ expect(serverStopStatus).to.be.true;
+ }
+
+ expect(serverStartStatus).to.be.true;
+ logger.testComplete('Start Gradle with options from Liberty Tools');
+ } catch (error) {
+ logger.testFailed('Start Gradle with options from Liberty Tools', error);
+ throw error;
+ }
+ }).timeout(550000);
+
+ it('Start Gradle with history from Liberty Tools', async () => {
+ logger.testStart('Start Gradle with history from Liberty Tools');
+ try {
+ const reportPath = path.join(utils.getGradle9ProjectPath(), "build", "reports", "tests", "test", "index.html");
+ logger.info(`Report path: ${reportPath}`);
+
+ logger.step(1, 'Deleting existing test report');
+ const deleteReport = await utils.deleteReports(reportPath);
+ logger.info(`Report deletion result: ${deleteReport}`);
+ expect(deleteReport).to.be.true;
+
+ logger.step(2, 'Launching dashboard start action with parameters');
+ await dashboard.runAction(constants.GRADLE_9_PROJECT, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM);
+
+ logger.step(3, 'Choosing command from history: --hotTests');
+ const foundCommand = await utils.chooseCmdFromHistory("--hotTests");
+ logger.info(`Command found in history: ${foundCommand}`);
+ expect(foundCommand).to.be.true;
+
+ logger.step(4, 'Waiting for server to start with historical parameters');
+ const serverStartStatus = await utils.waitForServerStart(constants.SERVER_START_STRING);
+
+ if (!serverStartStatus) {
+ logger.error('Server started with params message not found in the terminal');
+ } else {
+ logger.stepSuccess(4, 'Server successfully started with historical parameters');
+
+ logger.step(5, 'Waiting for test report');
+ let checkFile = await utils.waitForTestReport(reportPath);
+ logger.info(`Report exists: ${checkFile}`);
+
+ expect(checkFile).to.be.true;
+ logger.stepSuccess(5, 'Test report found');
+
+ logger.step(6, 'Launching dashboard stop action');
+ await dashboard.runAction(constants.GRADLE_9_PROJECT, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION);
+
+ logger.step(7, 'Waiting for server to stop');
+ const serverStopStatus = await utils.waitForServerStop(constants.SERVER_STOP_STRING);
+
+ if (!serverStopStatus) {
+ logger.error('Server stopped message not found in terminal');
+ } else {
+ logger.stepSuccess(7, 'Server stopped successfully');
+ }
+ expect(serverStopStatus).to.be.true;
+ }
+
+ expect(serverStartStatus).to.be.true;
+ logger.testComplete('Start Gradle with history from Liberty Tools');
+ } catch (error) {
+ logger.testFailed('Start Gradle with history from Liberty Tools', error);
+ throw error;
+ }
+ }).timeout(350000);
+
+ /**
+ * All future test cases should be written before the test that attaches the debugger, as this will switch the UI to the debugger view.
+ * If, for any reason, a test case needs to be written after the debugger test, ensure that the UI is switched back to the explorer view before executing the subsequent tests.
+ */
+ it('Attach debugger for Gradle with custom parameter event', async () => {
+ logger.testStart('Attach debugger for Gradle with custom parameter event');
+ let isServerRunning: Boolean = true;
+ let attachStatus: Boolean = false;
+
+ try {
+ logger.step(1, 'Launching dashboard start action with custom parameters');
+ await dashboard.runAction(constants.GRADLE_9_PROJECT, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM);
+
+ logger.step(2, 'Setting custom debug parameter: -DdebugPort=7777');
+ await utils.setCustomParameter("-DdebugPort=7777");
+
+ logger.step(3, 'Waiting for server to start in debug mode');
+ isServerRunning = await utils.waitForServerStart(constants.SERVER_START_STRING);
+
+ if (!isServerRunning) {
+ logger.error('Server started with params message not found in terminal');
+ } else {
+ logger.stepSuccess(3, 'Server successfully started in debug mode');
+
+ logger.step(4, 'Launching attach debugger dashboard action');
+ await dashboard.runAction(constants.GRADLE_9_PROJECT, constants.ATTACH_DEBUGGER_DASHBOARD_ACTION, constants.ATTACH_DEBUGGER_DASHBOARD_MAC_ACTION);
+ logger.info('Attach Debugger action completed');
+
+ logger.step(5, 'Waiting for debugger to attach');
+ attachStatus = await utils.waitForDebuggerAttach();
+
+ if (!attachStatus) {
+ logger.error('DebugToolbar not found - debugger may not have attached');
+ } else {
+ logger.stepSuccess(5, 'Debugger attached successfully');
+ }
+
+ logger.step(6, 'Stopping Liberty server');
+ await utils.stopLibertyserver(constants.GRADLE_9_PROJECT);
+
+ logger.step(7, 'Waiting for server to stop');
+ isServerRunning = !await utils.waitForServerStop(constants.SERVER_STOP_STRING);
+
+ if (!isServerRunning) {
+ logger.stepSuccess(7, 'Server stopped successfully');
+ } else {
+ logger.error('Server stop message not found in terminal');
+ }
+ }
+ } catch (e) {
+ logger.error('Exception occurred during attach debugger test', e);
+ throw e;
+ } finally {
+ logger.info(`Finally block - Server running status: ${isServerRunning}`);
+ if (isServerRunning) {
+ logger.info('Attempting to stop server in finally block');
+ await utils.stopLibertyserver(constants.GRADLE_9_PROJECT);
+ } else {
+ logger.info('Server already stopped, test cleanup complete');
+ }
+ }
+
+ expect(attachStatus).to.be.true;
+ logger.testComplete('Attach debugger for Gradle with custom parameter event');
+ }).timeout(550000);
+
+ it('View test report for Gradle project', async () => {
+ logger.testStart('View test report for Gradle project');
+
+ if ((process.platform === 'darwin') || (process.platform === 'win32') || (process.platform == 'linux')) {
+ logger.skip(`Test skipped for platform: ${process.platform} (enable once https://github.com/OpenLiberty/liberty-tools-vscode/issues/266 is resolved)`);
+ return true;
+ }
+
+ try {
+ logger.step(1, 'Launching view test report dashboard action');
+ await dashboard.runAction(constants.GRADLE_9_PROJECT, constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION);
+
+ logger.step(2, 'Waiting for test report tab to open');
+ const tabs = await utils.waitForEditorTab(constants.GRADLE_9_TEST_REPORT_TITLE);
+ logger.info(`Open editor tabs: ${tabs.join(', ')}`);
+
+ logger.step(3, `Checking if Gradle test report tab is open: ${constants.GRADLE_9_TEST_REPORT_TITLE}`);
+ const reportFound = tabs.indexOf(constants.GRADLE_9_TEST_REPORT_TITLE) > -1;
+ logger.info(`Gradle test report found: ${reportFound}`);
+
+ expect(reportFound, "Gradle test report not found").to.equal(true);
+ logger.stepSuccess(3, 'Gradle test report tab is open');
+ logger.testComplete('View test report for Gradle project');
+ } catch (error) {
+ logger.testFailed('View test report for Gradle project', error);
+ throw error;
+ }
+ }).timeout(30000);
+
+ // Based on the UI testing code, it sometimes selects the wrong command in "command palette", such as choosing "Liberty: Start ..." instead of "Liberty: Start" from the recent suggestions. This discrepancy occurs because we specifically need "Liberty: Start" at that moment.
+ // Now, clear the command history of the "command palette" to avoid receiving "recently used" suggestions. This action should be performed at the end of Gradle Project tests.
+ it('Clear Command Palette', async () => {
+ logger.testStart('Clear Command Palette');
+ try {
+ logger.step(1, 'Clearing command palette history');
+ await utils.clearCommandPalette();
+ logger.stepSuccess(1, 'Command palette history cleared');
+ logger.testComplete('Clear Command Palette');
+ } catch (error) {
+ logger.testFailed('Clear Command Palette', error);
+ throw error;
+ }
+ }).timeout(100000);
+
+ /**
+ * The following after hook closes the workspace and copies screenshots.
+ * Closing the workspace ensures the next test file starts with a clean slate.
+ */
+ after(async function() {
+ this.timeout(10000);
+ await utils.closeWorkspace();
+ utils.copyScreenshotsToProjectFolder('gradle');
+ });
+});
\ No newline at end of file
diff --git a/src/test/GradleInitProject.ts b/src/test/GradleInitProject.ts
deleted file mode 100755
index c2c31282..00000000
--- a/src/test/GradleInitProject.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * IBM Confidential
- * Copyright IBM Corp. 2023, 2026
- */
-
-import { WebDriver, VSBrowser } from 'vscode-extension-tester';
-import * as utils from './utils/testUtils';
-
-describe('Open Gradle Project', () => {
- let driver: WebDriver;
-
- before(() => {
- driver = VSBrowser.instance.driver;
- });
-
- it('Open Sample Gradle Project', async () => {
- await VSBrowser.instance.openResources(utils.getGradleProjectPath());
- }).timeout(15000);
-});
\ No newline at end of file
diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts
index f932be03..ad3adb69 100755
--- a/src/test/GradleTestDevModeActions.ts
+++ b/src/test/GradleTestDevModeActions.ts
@@ -439,9 +439,12 @@ describe('Devmode action tests for Gradle Project', () => {
}).timeout(100000);
/**
- * The following after hook copies the screenshot from the temporary folder in which it is saved to a known permanent location in the project folder.
+ * The following after hook closes the workspace and copies screenshots.
+ * Closing the workspace ensures the next test file starts with a clean slate.
*/
- after(() => {
+ after(async function() {
+ this.timeout(10000);
+ await utils.closeWorkspace();
utils.copyScreenshotsToProjectFolder('gradle');
});
});
\ No newline at end of file
diff --git a/src/test/GradleTestLSPHover.ts b/src/test/GradleTestLSPHover.ts
index 75c79e20..29df7041 100644
--- a/src/test/GradleTestLSPHover.ts
+++ b/src/test/GradleTestLSPHover.ts
@@ -185,4 +185,3 @@ describe('LSP Hover tests for Gradle Project', () => {
});
-// Made with Bob
diff --git a/src/test/GradleTestLSPRestSnippetAndDiagnostic.ts b/src/test/GradleTestLSPRestSnippetAndDiagnostic.ts
index 22e6725a..c3737817 100644
--- a/src/test/GradleTestLSPRestSnippetAndDiagnostic.ts
+++ b/src/test/GradleTestLSPRestSnippetAndDiagnostic.ts
@@ -4,7 +4,7 @@
* Copyright IBM Corp. 2026
*/
import { expect } from 'chai';
-import { EditorView, VSBrowser, WebDriver } from 'vscode-extension-tester';
+import { EditorView, VSBrowser } from 'vscode-extension-tester';
import * as utils from './utils/testUtils';
import { logger } from './utils/testLogger';
import * as path from 'path';
@@ -17,7 +17,6 @@ import * as editorUtils from './utils/editorUtils';
describe('Rest Class Snippet Test for Gradle Project', () => {
let editorPage: EditorPage;
let wait: any;
- let driver: WebDriver;
const testRestPath = path.resolve(
utils.getGradleProjectPath(),
@@ -29,7 +28,6 @@ describe('Rest Class Snippet Test for Gradle Project', () => {
this.timeout(60000);
logger.info('Setting up rest_class snippet test');
- driver = VSBrowser.instance.driver;
wait = utils.getWaitHelper();
// Open folder, wait for workbench
await VSBrowser.instance.openResources(utils.getGradleProjectPath());
@@ -43,8 +41,7 @@ describe('Rest Class Snippet Test for Gradle Project', () => {
afterEach(async function() {
// Take screenshot on failure but don't close editor
if (this.currentTest?.state === 'failed') {
- const driver = VSBrowser.instance.driver;
- const screenshot = await driver.takeScreenshot();
+ await VSBrowser.instance.driver.takeScreenshot();
logger.error(`Test failed: ${this.currentTest.title}`);
}
});
diff --git a/src/test/MavenInitProject.ts b/src/test/MavenInitProject.ts
deleted file mode 100755
index 3249d539..00000000
--- a/src/test/MavenInitProject.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * IBM Confidential
- * Copyright IBM Corp. 2023, 2026
- */
-import { WebDriver, VSBrowser } from 'vscode-extension-tester';
-import * as utils from './utils/testUtils';
-
-describe('Open Maven Project', () => {
- let driver: WebDriver;
-
- before(() => {
- driver = VSBrowser.instance.driver;
- });
-
- it('Open Sample Maven Project', async () => {
- await VSBrowser.instance.openResources(utils.getMvnProjectPath());
- }).timeout(15000);
-});
\ No newline at end of file
diff --git a/src/test/MavenTestDevModeActions.ts b/src/test/MavenTestDevModeActions.ts
index c95ed989..a5d40caf 100755
--- a/src/test/MavenTestDevModeActions.ts
+++ b/src/test/MavenTestDevModeActions.ts
@@ -453,9 +453,12 @@ describe('Devmode action tests for Maven Project', () => {
}).timeout(350000);
/**
- * The following after hook copies the screenshot from the temporary folder in which it is saved to a known permanent location in the project folder.
+ * The following after hook closes the workspace and copies screenshots.
+ * Closing the workspace ensures the next test file starts with a clean slate.
*/
- after(() => {
+ after(async function() {
+ this.timeout(10000);
+ await utils.closeWorkspace();
utils.copyScreenshotsToProjectFolder('maven');
});
});
diff --git a/src/test/MavenTestLSPHover.ts b/src/test/MavenTestLSPHover.ts
index 2abef330..c8568945 100644
--- a/src/test/MavenTestLSPHover.ts
+++ b/src/test/MavenTestLSPHover.ts
@@ -36,6 +36,10 @@ describe('LSP Hover tests for Maven Project', () => {
serverXml = await new EditorPage().openFile(serverXmlPath, 'server.xml');
logger.info('Server.xml file opened and editor obtained');
+
+ // Wait for editor to be fully ready and Language Server to attach
+ await utils.getWaitHelper().sleep(5000);
+ logger.info('Editor ready for Language Server interaction');
});
afterEach(async function() {
@@ -67,7 +71,7 @@ describe('LSP Hover tests for Maven Project', () => {
await utils.waitForLanguageServerInit(
'Language Support for Liberty',
'Initialized Liberty Language server',
- 60
+ 120
);
logger.testComplete('Liberty Language Server initialized successfully');
} catch (error) {
@@ -131,6 +135,10 @@ describe('LSP Hover tests for Maven Project', () => {
javaFile = await new EditorPage().openFile(javaFilePath, 'HelloServlet.java')
logger.info('HelloServlet.java file opened and editor obtained');
+
+ // Wait for Java editor to be fully ready and Language Server to attach
+ await utils.getWaitHelper().sleep(10000);
+ logger.info('Java editor ready for Language Server interaction');
});
it('LSP4Jakarta Language Server should initialize', async function() {
@@ -141,7 +149,7 @@ describe('LSP Hover tests for Maven Project', () => {
await utils.waitForLanguageServerInit(
'Language Support for Jakarta EE',
'Initializing Jakarta EE server',
- 60
+ 120
);
logger.testComplete('LSP4Jakarta Language Server initialized successfully');
} catch (error) {
diff --git a/src/test/MavenTestLSPRestSnippetAndDiagnostic.ts b/src/test/MavenTestLSPRestSnippetAndDiagnostic.ts
index 2253f191..945c89ce 100644
--- a/src/test/MavenTestLSPRestSnippetAndDiagnostic.ts
+++ b/src/test/MavenTestLSPRestSnippetAndDiagnostic.ts
@@ -4,7 +4,7 @@
* Copyright IBM Corp. 2026
*/
import { expect } from 'chai';
-import { EditorView, VSBrowser, WebDriver } from 'vscode-extension-tester';
+import { EditorView, VSBrowser } from 'vscode-extension-tester';
import * as utils from './utils/testUtils';
import { logger } from './utils/testLogger';
import * as path from 'path';
@@ -15,9 +15,8 @@ import { QuickFixPage } from './pages/QuickFixPage';
import * as editorUtils from './utils/editorUtils';
describe('Rest Class Snippet Test for Maven Project', () => {
- let editorPage: EditorPage;
+ let editorPage: EditorPage;
let wait: any;
- let driver: WebDriver;
const testRestPath = path.resolve(
utils.getMvnProjectPath(),
@@ -29,8 +28,7 @@ describe('Rest Class Snippet Test for Maven Project', () => {
this.timeout(60000);
logger.info('Setting up rest_class snippet test');
- driver = VSBrowser.instance.driver;
- wait = utils.getWaitHelper();
+ wait = utils.getWaitHelper();
// Open folder, wait for workbench
await VSBrowser.instance.openResources(utils.getMvnProjectPath());
await VSBrowser.instance.waitForWorkbench();
@@ -43,8 +41,7 @@ describe('Rest Class Snippet Test for Maven Project', () => {
afterEach(async function() {
// Take screenshot on failure but don't close editor
if (this.currentTest?.state === 'failed') {
- const driver = VSBrowser.instance.driver;
- const screenshot = await driver.takeScreenshot();
+ await VSBrowser.instance.driver.takeScreenshot();
logger.error(`Test failed: ${this.currentTest.title}`);
}
});
diff --git a/src/test/definitions/constants.ts b/src/test/definitions/constants.ts
index 2dc65b30..2edaaa54 100755
--- a/src/test/definitions/constants.ts
+++ b/src/test/definitions/constants.ts
@@ -5,6 +5,7 @@
export const MAVEN_PROJECT = "liberty-maven-test-wrapper-app";
export const GRADLE_PROJECT= "liberty-gradle-test-wrapper-app";
+export const GRADLE_9_PROJECT= "liberty-gradle-9-test-wrapper-app";
export const START_DASHBOARD_ACTION = "Start";
export const STOP_DASHBOARD_ACTION = "Stop";
export const START_DASHBOARD_MAC_ACTION = "Liberty: Start";
@@ -29,6 +30,7 @@ export const ITR_DASHBOARD_MAC_ACTION = "Liberty: View integration test report";
export const SUREFIRE_REPORT_TITLE = "liberty-maven-test-wrapper-app surefire report";
export const FAILSAFE_REPORT_TITLE = "liberty-maven-test-wrapper-app failsafe report";
export const GRADLE_TEST_REPORT_TITLE = "liberty-gradle-test-wrapper-app test report";
+export const GRADLE_9_TEST_REPORT_TITLE = "liberty-gradle-9-test-wrapper-app test report";
export const ATTACH_DEBUGGER_DASHBOARD_ACTION = "Attach debugger";
export const ATTACH_DEBUGGER_DASHBOARD_MAC_ACTION = "Liberty: Attach debugger";
/** Maven: Dev mode debug port argument key. */
diff --git a/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/Dockerfile b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/Dockerfile
new file mode 100755
index 00000000..e9e606ff
--- /dev/null
+++ b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/Dockerfile
@@ -0,0 +1,3 @@
+FROM icr.io/appcafe/open-liberty:kernel-slim-java17-openj9-ubi
+COPY --chown=1001:0 build/wlp/usr/servers/defaultServer/server.xml /config/
+RUN features.sh
diff --git a/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/build.gradle b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/build.gradle
new file mode 100755
index 00000000..81f6f253
--- /dev/null
+++ b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/build.gradle
@@ -0,0 +1,46 @@
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'io.openliberty.tools:liberty-gradle-plugin:4.0.0'
+ }
+}
+
+apply plugin: 'java'
+apply plugin: 'liberty'
+apply plugin: 'war'
+
+version '1.0'
+group 'liberty-gradle-test-wrapper-app'
+
+java {
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
+}
+
+tasks.withType(JavaCompile) {
+ options.encoding = 'UTF-8'
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ // provided dependencies
+ providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
+ providedCompile 'org.eclipse.microprofile:microprofile:5.0'
+
+ // test dependencies
+ testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
+ testImplementation 'org.apache.httpcomponents.client5:httpclient5:5.6.1'
+}
+
+liberty {
+ server{
+ verifyAppStartTimeout = 150
+ }
+}
+
+clean.dependsOn 'libertyStop'
diff --git a/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/gradle/wrapper/gradle-wrapper.jar b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/gradle/wrapper/gradle-wrapper.jar
new file mode 100755
index 00000000..b1b8ef56
Binary files /dev/null and b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/gradle/wrapper/gradle-wrapper.properties b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/gradle/wrapper/gradle-wrapper.properties
new file mode 100755
index 00000000..68ab1235
--- /dev/null
+++ b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,9 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
+networkTimeout=10000
+retries=0
+retryBackOffMs=500
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/gradlew b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/gradlew
new file mode 100755
index 00000000..b9bb139f
--- /dev/null
+++ b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/gradlew
@@ -0,0 +1,248 @@
+#!/bin/sh
+
+#
+# Copyright © 2015 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/gradlew.bat b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/gradlew.bat
new file mode 100755
index 00000000..aa5f10b0
--- /dev/null
+++ b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/gradlew.bat
@@ -0,0 +1,82 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables, and ensure extensions are enabled
+setlocal EnableExtensions
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+"%COMSPEC%" /c exit 1
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+"%COMSPEC%" /c exit 1
+
+:execute
+@rem Setup the command line
+
+
+
+@rem Execute Gradle
+@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
+@rem which allows us to clear the local environment before executing the java command
+endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
+
+:exitWithErrorLevel
+@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
+"%COMSPEC%" /c exit %ERRORLEVEL%
diff --git a/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/src/main/java/test/gradle/liberty/web/app/HelloServlet.java b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/src/main/java/test/gradle/liberty/web/app/HelloServlet.java
new file mode 100755
index 00000000..26051393
--- /dev/null
+++ b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/src/main/java/test/gradle/liberty/web/app/HelloServlet.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+* Copyright (c) 2022 IBM Corporation and others.
+*
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v. 2.0 which is available at
+* http://www.eclipse.org/legal/epl-2.0.
+*
+* SPDX-License-Identifier: EPL-2.0
+*
+* Contributors:
+* IBM Corporation - initial implementation
+*******************************************************************************/
+package test.gradle.liberty.web.app;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@WebServlet(urlPatterns="/servlet")
+public class HelloServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
+ */
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ response.getWriter().append("Hello! How are you today?");
+ }
+
+ /**
+ * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
+ */
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ doGet(request, response);
+ }
+}
diff --git a/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/src/main/liberty/config/server.xml b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/src/main/liberty/config/server.xml
new file mode 100755
index 00000000..1653a344
--- /dev/null
+++ b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/src/main/liberty/config/server.xml
@@ -0,0 +1,21 @@
+
+
+Click here to get a greeting from the Hello Servlet. +
+ + diff --git a/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/src/test/java/test/gradle/liberty/web/app/ApplicationTest.java b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/src/test/java/test/gradle/liberty/web/app/ApplicationTest.java new file mode 100755 index 00000000..196ee0a4 --- /dev/null +++ b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/src/test/java/test/gradle/liberty/web/app/ApplicationTest.java @@ -0,0 +1,24 @@ +/******************************************************************************* +* Copyright (c) 2022 IBM Corporation and others. +* +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License v. 2.0 which is available at +* http://www.eclipse.org/legal/epl-2.0. +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* IBM Corporation - initial implementation +*******************************************************************************/ +package test.gradle.liberty.web.app; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class ApplicationTest { + @Test + public void testApplication() { + System.out.println("in app test"); + Assertions.assertTrue(true, "test fails!"); + } +} diff --git a/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/src/test/java/test/gradle/liberty/web/app/it/EndpointIT.java b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/src/test/java/test/gradle/liberty/web/app/it/EndpointIT.java new file mode 100755 index 00000000..0c72b115 --- /dev/null +++ b/src/test/resources/gradle/liberty-gradle-9-test-wrapper-app/src/test/java/test/gradle/liberty/web/app/it/EndpointIT.java @@ -0,0 +1,40 @@ +/******************************************************************************* +* Copyright (c) 2022, 2026 IBM Corporation and others. +* +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License v. 2.0 which is available at +* http://www.eclipse.org/legal/epl-2.0. +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* IBM Corporation - initial implementation +*******************************************************************************/ +package test.gradle.liberty.web.app.it; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.apache.hc.client5.http.classic.methods.HttpGet; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.core5.http.HttpStatus; +import org.apache.hc.core5.http.io.entity.EntityUtils; + +public class EndpointIT { + private String URL = "http://localhost:9080/liberty-gradle-test-wrapper-app/servlet"; + + @Test + public void testServlet() throws Exception { + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpGet request = new HttpGet(URL); + try (CloseableHttpResponse response = client.execute(request)) { + int statusCode = response.getCode(); + String responseBody = EntityUtils.toString(response.getEntity()); + + Assertions.assertEquals(HttpStatus.SC_OK, statusCode, "HTTP GET failed"); + Assertions.assertTrue(responseBody.contains("Hello! How are you today?"), "Unexpected response body"); + } + } + } +} diff --git a/src/test/resources/gradle/liberty-gradle-test-wrapper-app/build.gradle b/src/test/resources/gradle/liberty-gradle-test-wrapper-app/build.gradle index c650aefa..3edbf2c8 100755 --- a/src/test/resources/gradle/liberty-gradle-test-wrapper-app/build.gradle +++ b/src/test/resources/gradle/liberty-gradle-test-wrapper-app/build.gradle @@ -16,7 +16,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'io.openliberty.tools:liberty-gradle-plugin:3.6.1' + classpath 'io.openliberty.tools:liberty-gradle-plugin:3.10.0' } } diff --git a/src/test/resources/gradle/liberty-gradle-test-wrapper-app/src/main/java/test/gradle/liberty/web/app/TestRest.java b/src/test/resources/gradle/liberty-gradle-test-wrapper-app/src/main/java/test/gradle/liberty/web/app/TestRest.java index e69de29b..492d88b8 100644 --- a/src/test/resources/gradle/liberty-gradle-test-wrapper-app/src/main/java/test/gradle/liberty/web/app/TestRest.java +++ b/src/test/resources/gradle/liberty-gradle-test-wrapper-app/src/main/java/test/gradle/liberty/web/app/TestRest.java @@ -0,0 +1,16 @@ +package test.gradle.liberty.web.app; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; + +@Path("/path") +public class TestRest { + + @GET + @Produces(MediaType.TEXT_PLAIN) + private String methodname() { + return "hello"; + } +} \ No newline at end of file diff --git a/src/test/utils/testUtils.ts b/src/test/utils/testUtils.ts index 25ec5753..f33d7a6e 100755 --- a/src/test/utils/testUtils.ts +++ b/src/test/utils/testUtils.ts @@ -189,6 +189,13 @@ export function getGradleProjectPath(): string { return gradleProjectPath; } +export function getGradle9ProjectPath(): string { + const gradle9ProjectPath = path.join(__dirname, "..", "..", "..", "src", "test", "resources", "gradle", "liberty-gradle-9-test-wrapper-app"); + logger.info("Path is : " + gradle9ProjectPath); + return gradle9ProjectPath; +} + + export async function getDashboardSection(sidebar: any): Promise