Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #282 - project detection in dashboard #284

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0ba1870
Added liberty dashboard test
aparnamichael Aug 18, 2023
d5c063f
Test case for detect project with src/main/liberty/config/server.xml …
aparnamichael Aug 25, 2023
cb966ab
Merge remote-tracking branch 'upstream/main' into issue282_projectDet…
aparnamichael Aug 25, 2023
611b128
Changed the variable names
aparnamichael Sep 1, 2023
abbbc18
changed the variable names in the method
aparnamichael Sep 1, 2023
6230fce
Formatting changes in libertydashboardinitproject file
aparnamichael Sep 1, 2023
68b838b
Formatted the import statement in liberty dashboard test file
aparnamichael Sep 1, 2023
901b551
Removed the extra spacing after import
aparnamichael Sep 1, 2023
911f107
Formatted the spacing in testutils file.
aparnamichael Sep 1, 2023
44c9214
Formatted the test case files & added a check for timeout error
aparnamichael Sep 1, 2023
1c5e1bb
Added LGP and LMP with no server xml test
aparnamichael Sep 4, 2023
f8a1b71
Added test case for plugins block method
aparnamichael Sep 4, 2023
468c3d0
Merge remote-tracking branch 'upstream/main' into issue282_projectDet…
aparnamichael Nov 20, 2023
f48f443
Merge remote-tracking branch 'upstream/main' into issue282_projectDet…
aparnamichael Oct 24, 2024
332319d
Adding header to the new test file - DashboardLGPInitProjects.ts file
aparnamichael Oct 29, 2024
7f24c5c
Added header in new test file - DashboardLGPTest
aparnamichael Oct 29, 2024
116f4fb
Added licence header for DashboardLMPInitProject
aparnamichael Oct 29, 2024
f8167d8
Added licence header for DashboardLMPTest
aparnamichael Oct 29, 2024
09fbd97
Added licence header for LibertyDashboardInitProject
aparnamichael Oct 29, 2024
3ce8616
Added licence header for DashboardTest
aparnamichael Oct 29, 2024
08af3e7
Merge pull request #1 from aparnamichael/issue282_add_headerfiles
aparnamichael Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,11 @@
"buildJakarta": "gulp buildJakartaJdt buildJakartaLs",
"test": "npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/*.js'",
"test-mac-maven":"npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/M*.js'",
"test-mac-gradle": "npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/G*.js'"
"test-mac-gradle": "npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/G*.js'",
"test-mac-dashboard": "npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/Liberty*.js'",
"test-mac-LMP-dashboard": "npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/DashboardLMP*.js'",
"test-mac-LGP-dashboard": "npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/DashboardLGP*.js'"

},
"devDependencies": {
"@types/chai": "^4.3.4",
Expand Down
31 changes: 31 additions & 0 deletions src/test/DashboardLGPInitProjects.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Copyright (c) 2023 IBM Corporation.
*
* 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
*/
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 with no server.xml', async () => {

await VSBrowser.instance.openResources(utils.getGradleProjectPath());

}).timeout(15000);

});


111 changes: 111 additions & 0 deletions src/test/DashboardLGPTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/**
* Copyright (c) 2023 IBM Corporation.
*
* 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
*/
import { expect } from 'chai';
import { InputBox, Workbench, SideBarView, ViewItem, ViewSection, EditorView, DefaultTreeItem, DebugView } from 'vscode-extension-tester';
import * as utils from './utils/testUtils';
import * as constants from './definitions/constants';
import path = require('path');

describe('Devmode action tests for Gradle Project', () => {
let sidebar: SideBarView;
let section: ViewSection;
let item: DefaultTreeItem;

before(() => {
sidebar = new SideBarView();
});

/*************************************************************************************
** detect project with LGP config in build file only (ie. no server.xml in project) **
*************************************************************************************/

//buildscript + apply plugin method

it('Delete server.xml from config.', async () => {

const dest = path.join(utils.getGradleProjectPath(), "src", "main", "liberty", "config", "server.xml");
const deleteServerxml = await utils.deleteReports(dest);
expect(deleteServerxml).to.be.true;

}).timeout(80000);

it('getViewControl works with the correct label', async () => {

const contentPart = sidebar.getContent();
section = await contentPart.getSection('Liberty Dashboard');
console.log("Found Liberty Dashboard....");
expect(section).not.undefined;

}).timeout(10000);

it('Open dasboard shows items - Gradle', async () => {

await utils.delay(80000);
const menu = await section.getVisibleItems();
expect(menu).not.empty;
item = await section.findItem(constants.GRADLE_PROJECT) as DefaultTreeItem;
expect(item).not.undefined;

}).timeout(300000);



// plugins block method
it('Copy gradle.build file which uses plugins block method.', async () => {

await utils.delay(50000);
const serverxmlPath = path.join(utils.getGradleProjectPath(), "gradlefile", "build1.gradle");
const dest = path.join(utils.getGradleProjectPath(), "build.gradle");
await utils.copyFile(serverxmlPath, dest);
console.log("Finished copying file....");

}).timeout(90000);

it('getViewControl works with the correct label', async () => {

const contentPart = sidebar.getContent();
section = await contentPart.getSection('Liberty Dashboard');
console.log("Found Liberty Dashboard....");
expect(section).not.undefined;

}).timeout(10000);

it('Open dasboard shows items - Gradle', async () => {

await utils.delay(80000);
const menu = await section.getVisibleItems();
expect(menu).not.empty;
item = await section.findItem(constants.GRADLE_PROJECT) as DefaultTreeItem;
expect(item).not.undefined;

}).timeout(300000);

it('Copy gradle.build file which uses buildscript + apply plugin method.', async () => {

await utils.delay(50000);
const serverxmlPath = path.join(utils.getGradleProjectPath(), "gradlefile", "build2.gradle");
const dest = path.join(utils.getGradleProjectPath(), "build.gradle");
await utils.copyFile(serverxmlPath, dest);
console.log("Finished copying file....");

}).timeout(90000);

// Place server.xml back to the config folder.
it('Copy server.xml to config folder', async () => {

await utils.delay(50000);
const serverxmlPath = path.join(utils.getGradleProjectPath(), "src", "main", "liberty", "config", "serverxml", "server.xml");
const dest = path.join(utils.getGradleProjectPath(), "src", "main", "liberty", "config", "server.xml");
await utils.copyFile(serverxmlPath, dest);
console.log("Finished copying file....");

}).timeout(90000);
});

31 changes: 31 additions & 0 deletions src/test/DashboardLMPInitProject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Copyright (c) 2023 IBM Corporation.
*
* 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
*/
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 with no server.xml', async () => {

await VSBrowser.instance.openResources(utils.getMvnProjectPath());

}).timeout(15000);

});


66 changes: 66 additions & 0 deletions src/test/DashboardLMPTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**
* Copyright (c) 2023 IBM Corporation.
*
* 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
*/
import { expect } from 'chai';
import { SideBarView, ViewItem, ViewSection, DefaultTreeItem, DebugView } from 'vscode-extension-tester';
import * as utils from './utils/testUtils';
import * as constants from './definitions/constants';
import path = require('path');

describe('Liberty dashboard project detection tests with LMP config in build file only', () => {
let sidebar: SideBarView;
let section: ViewSection;
let item: DefaultTreeItem;

before(() => {
sidebar = new SideBarView();
});

/*************************************************************************************
** detect project with LMP config in build file only (ie. no server.xml in project) **
*************************************************************************************/

it('Delete server.xml from config.', async () => {

const dest = path.join(utils.getMvnProjectPath(), "src", "main", "liberty", "config", "server.xml");
const deleteServerxml = await utils.deleteReports(dest);
expect(deleteServerxml).to.be.true;

}).timeout(80000);

it('getViewControl works with the correct label', async () => {

const contentPart = sidebar.getContent();
section = await contentPart.getSection('Liberty Dashboard');
console.log("Found Liberty Dashboard test....");
expect(section).not.undefined;

}).timeout(10000);

it('Open dasboard shows items - Maven', async () => {

await utils.delay(50000);
const menu = await section.getVisibleItems();
expect(menu).not.empty;
item = await section.findItem(constants.MAVEN_PROJECT) as DefaultTreeItem;
expect(item).not.undefined;

}).timeout(80000);

it('Copy server.xml to config folder', async () => {

await utils.delay(50000);
const serverxmlPath = path.join(utils.getMvnProjectPath(), "src", "main", "liberty", "config", "serverxml", "server.xml");
const dest = path.join(utils.getMvnProjectPath(), "src", "main", "liberty", "config", "server.xml");
await utils.copyFile(serverxmlPath, dest);
console.log("Finished copying file....");

}).timeout(90000);

});
26 changes: 26 additions & 0 deletions src/test/LibertyDashboardInitProject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright (c) 2023 IBM Corporation.
*
* 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
*/import { WebDriver, VSBrowser } from 'vscode-extension-tester';
import * as utils from './utils/testUtils';

describe('Open Maven Server xml Project', () => {

let driver: WebDriver;

before(() => {
driver = VSBrowser.instance.driver;
});

it('Open Sample Maven Project with no LMP or LGP defined in build file', async () => {
await VSBrowser.instance.openResources(utils.getMvnServerXmlProjectPath());
}).timeout(15000);

});


74 changes: 74 additions & 0 deletions src/test/LibertyDashboardTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* Copyright (c) 2023 IBM Corporation.
*
* 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
*/
import { expect } from 'chai';
import { SideBarView, ViewItem, ViewSection, DefaultTreeItem, DebugView } from 'vscode-extension-tester';
import * as utils from './utils/testUtils';
import * as constants from './definitions/constants';
import path = require('path');

describe('Liberty dashboard project detection tests', () => {
let sidebar: SideBarView;
let section: ViewSection;
let item: DefaultTreeItem;

before(() => {
sidebar = new SideBarView();
});

/*************************************************************************************
******* detect project with src/main/liberty/config/server.xml file only ************
*************************************************************************************/

it('Delete server.xml from config.', async () => {

const dest = path.join(utils.getMvnServerXmlProjectPath(), "src", "main", "liberty", "config", "server.xml");
const deleteServerxml = await utils.deleteReports(dest);
expect(deleteServerxml).to.be.true;

}).timeout(80000);

it('getViewControl works with the correct label', async () => {

const contentPart = sidebar.getContent();
section = await contentPart.getSection('Liberty Dashboard');
console.log("Found Liberty Dashboard test....");
expect(section).not.undefined;

}).timeout(10000);

it('Liberty dashboard is empty', async () => {

await utils.delay(30000);
const isEmpty = await utils.isViewSectionEmpty(section);
expect(isEmpty).true;

}).timeout(70000);

it('Copy server.xml to config folder', async () => {

await utils.delay(50000);
const serverxmlPath = path.join(utils.getMvnServerXmlProjectPath(), "src", "main", "liberty", "config", "serverxml", "server.xml");
const dest = path.join(utils.getMvnServerXmlProjectPath(), "src", "main", "liberty", "config", "server.xml");
await utils.copyFile(serverxmlPath, dest);
console.log("Finished copying file....");

}).timeout(90000);

it('Open dasboard shows items - Maven', async () => {

await utils.delay(50000);
const menu = await section.getVisibleItems();
expect(menu).not.empty;
item = await section.findItem(constants.MAVEN_SERVERXML_PROJECT) as DefaultTreeItem;
expect(item).not.undefined;

}).timeout(80000);

});
1 change: 1 addition & 0 deletions src/test/definitions/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

export const MAVEN_PROJECT = "liberty.maven.test.wrapper.app";
export const MAVEN_SERVERXML_PROJECT = "liberty.maven.serverxml.test.wrapper.app";
export const GRADLE_PROJECT= "liberty.gradle.test.wrapper.app";
export const START_DASHBOARD_ACTION = "Start";
export const STOP_DASHBOARD_ACTION = "Stop";
Expand Down
Loading
Loading