JaroslavTulach commented on a change in pull request #2679:
URL: https://github.com/apache/netbeans/pull/2679#discussion_r560688439
##########
File path: java/java.lsp.server/vscode/src/test/suite/extension.test.ts
##########
@@ -34,7 +36,7 @@ suite('Extension Test Suite', () => {
test('Find clusters', async () => {
let clusters = myExtension.findClusters('non-existent');
- assert.strictEqual(clusters.length, 6, 'six clusters found: ' +
clusters);
+ assert.strictEqual(clusters.length, 7, 'seven clusters found: ' +
clusters);
Review comment:
This can certainly be changed by knowing the minimal list of clusters to
find and ignoring others.
##########
File path:
java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java
##########
@@ -151,6 +151,7 @@ public ServerTest(String name) {
@Override
protected void setUp() throws Exception {
+ System.setProperty("java.awt.headless", Boolean.TRUE.toString());
Review comment:
I was hoping that, if we integrated #2685, this change would no longer
be needed. But that is probably not true, as the branding would only be active
in integration tests of `nbcode` suite.
One would have to turn the branding on manually in the test...
##########
File path: java/java.lsp.server/vscode/src/test/suite/extension.test.ts
##########
@@ -97,6 +99,88 @@ class Main {
test("Compile workspace6", async() => demo(6));
// test("Compile workspace7", async() => demo(7));
// test("Compile workspace8", async() => demo(8));
+
+ /**
+ * Checks that maven-managed process can be started, and forcefully
terminated by vscode
+ * although it does not run in debugging mode.
+ */
+ async function mavenTerminateWithoutDebugger() {
+ let folder: string = assertWorkspace();
+
+ await fs.promises.writeFile(path.join(folder, 'pom.xml'), `
+ <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.netbeans.demo.vscode.t1</groupId>
+ <artifactId>basicapp</artifactId>
+ <version>1.0</version>
+ <properties>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ </properties>
+ </project>
+ `);
+
+ let pkg = path.join(folder, 'src', 'main', 'java', 'pkg');
+ let mainJava = path.join(pkg, 'Main.java');
+
+ await fs.promises.mkdir(pkg, { recursive: true });
+
+ await fs.promises.writeFile(mainJava, `
+ package pkg;
+ class Main {
+ public static void main(String... args) throws Exception {
+ System.out.println("Endless wait...");
+ while (true) {
+ Thread.sleep(1000);
+ }
+ }
+ }
+ `);
+ vscode.workspace.saveAll();
+ let u : Uri = vscode.Uri.file(mainJava);
+ let doc : TextDocument = await vscode.workspace.openTextDocument(u);
+ let e : TextEditor = await vscode.window.showTextDocument(doc);
+
+ try {
+ let terminated = false;
+ let r = new Promise((resolve, reject) => {
+ function waitUserApplication(cnt : number, running: boolean,
cb : () => void) {
+ ps.lookup({
+ command: "^.*[/\\\\]java",
+ arguments: "pkg.Main"
+ }, (err, list ) => {
+ let success : boolean = (list && list.length > 0) ==
running;
+ if (success) {
+ cb();
+ } else {
+ if (cnt == 0) {
+ reject("Timeout waiting for user application");
+ return;
+ }
+ setTimeout(() => waitUserApplication(cnt - 1,
running, cb), 100);
Review comment:
Expecting the application gets started in 500ms? We'll see how well that
behaves on the CI servers.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists