From 94cfcdca812be3feabd4ba15080812fe8797373f Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Fri, 20 Jun 2025 21:49:07 +0200 Subject: [PATCH 1/2] Make the CI Actions job Green --- .github/workflows/javadoc.yml | 5 ++-- .github/workflows/linux.yml | 3 +-- .github/workflows/mac.yml | 5 ++-- .github/workflows/windows.yml | 3 +-- .../java/org/netbeans/html/boot/fx/KOFx.java | 22 ++++++++++++++-- .../org/netbeans/html/boot/fx/PopupTest.java | 16 ++++++------ .../org/netbeans/html/boot/fx/TitleTest.java | 20 ++++++--------- ecj-test/pom.xml | 1 + .../netbeans/html/ecjtest/dummy/Dummy.java | 25 +++++++++++++++++++ pom.xml | 5 ++-- 10 files changed, 69 insertions(+), 36 deletions(-) create mode 100644 ecj-test/src/main/java/org/netbeans/html/ecjtest/dummy/Dummy.java diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml index e443ac0e6..c41e0848f 100644 --- a/.github/workflows/javadoc.yml +++ b/.github/workflows/javadoc.yml @@ -31,8 +31,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - java: [ '16', '17' ] - os: [ ubuntu-20.04 ] + java: [ '17' ] + os: [ ubuntu-22.04 ] steps: - uses: actions/checkout@v2 @@ -41,7 +41,6 @@ jobs: with: distribution: 'zulu' java-version: ${{ matrix.java }} - cache: maven - name: Build run: mvn -q install -DskipTests diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 3bb5a022b..5267b1a8e 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -32,7 +32,7 @@ jobs: strategy: matrix: java: [ '8', '11', '17', '21' ] - os: [ ubuntu-20.04 ] + os: [ ubuntu-22.04 ] steps: - uses: actions/checkout@v2 @@ -41,7 +41,6 @@ jobs: with: distribution: 'zulu' java-version: ${{ matrix.java }} - cache: maven - name: Build with Maven run: mvn -q install -DskipTests diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index a70fd01c6..d20c71b83 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -31,8 +31,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - java: [ '8', '11', '17', '21' ] - os: [ macos-13 ] + java: [ '11', '17', '21' ] + os: [ macos-14 ] steps: - uses: actions/checkout@v2 @@ -41,7 +41,6 @@ jobs: with: distribution: 'zulu' java-version: ${{ matrix.java }} - cache: maven - name: Build with Maven run: mvn -q install -DskipTests diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index bdde66a92..c244fed56 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -32,7 +32,7 @@ jobs: strategy: matrix: java: [ '8', '11', '17', '21' ] - os: [ windows-2019 ] + os: [ windows-2022 ] steps: - uses: actions/checkout@v2 @@ -41,7 +41,6 @@ jobs: with: distribution: 'zulu' java-version: ${{ matrix.java }} - cache: maven - name: Build with Maven run: mvn -q install -DskipTests diff --git a/boot-fx/src/test/java/org/netbeans/html/boot/fx/KOFx.java b/boot-fx/src/test/java/org/netbeans/html/boot/fx/KOFx.java index 42d3de0c0..189f0e70b 100644 --- a/boot-fx/src/test/java/org/netbeans/html/boot/fx/KOFx.java +++ b/boot-fx/src/test/java/org/netbeans/html/boot/fx/KOFx.java @@ -22,8 +22,12 @@ import java.lang.reflect.Method; import java.util.Timer; import java.util.TimerTask; +import java.util.logging.Level; +import java.util.logging.Logger; import javafx.application.Platform; +import javafx.stage.Stage; import org.netbeans.html.boot.spi.Fn; +import static org.testng.Assert.fail; import org.testng.IHookCallBack; import org.testng.IHookable; import org.testng.ITest; @@ -36,7 +40,7 @@ */ public final class KOFx implements ITest, IHookable, Runnable { private static final Timer SCHEDULER = new Timer("Fx Scheduler"); - + private final Fn.Presenter p; private final Method m; private Object result; @@ -99,7 +103,7 @@ public synchronized void run() { public void run(IHookCallBack ihcb, ITestResult itr) { ihcb.runTestMethod(itr); } - + private static void schedule(Runnable task, long delay) { SCHEDULER.schedule(new TimerTask() { @Override @@ -108,4 +112,18 @@ public void run() { } }, delay); } + + static void assertTitle(Stage s, String expTitle, String msg) { + for (var i = 0; i < 100; i++) { + var title = s.getTitle(); + if (expTitle.equals(title)) { + return; + } + try { + Thread.sleep(50); + } catch (InterruptedException ex) { + } + } + fail(msg + " expecting: " + expTitle + " but was: " + s.getTitle()); + } } diff --git a/boot-fx/src/test/java/org/netbeans/html/boot/fx/PopupTest.java b/boot-fx/src/test/java/org/netbeans/html/boot/fx/PopupTest.java index ae5292251..b07c038cd 100644 --- a/boot-fx/src/test/java/org/netbeans/html/boot/fx/PopupTest.java +++ b/boot-fx/src/test/java/org/netbeans/html/boot/fx/PopupTest.java @@ -26,6 +26,7 @@ import net.java.html.BrwsrCtx; import net.java.html.boot.BrowserBuilder; import net.java.html.js.JavaScriptBody; +import static org.netbeans.html.boot.fx.KOFx.assertTitle; import org.netbeans.html.boot.spi.Fn; import static org.testng.Assert.*; import org.testng.annotations.Test; @@ -84,23 +85,20 @@ public void run() { assertNotNull(lastWebView[0], "A WebView created"); Stage s = (Stage) lastWebView[0].getScene().getWindow(); - assertEquals(s.getTitle(), "FX Presenter Harness"); + assertTitle(s, "FX Presenter Harness", "Initial title value read from HTML page"); final Object[] window = new Object[1]; final CountDownLatch openWindow = new CountDownLatch(1); - when.ctx.execute(new Runnable() { - @Override - public void run() { - TitleTest.changeTitle("First window"); - window[0] = openSecondaryWindow("second.html"); - openWindow.countDown(); - } + when.ctx.execute(() -> { + TitleTest.changeTitle("First window"); + window[0] = openSecondaryWindow("second.html"); + openWindow.countDown(); }); openWindow.await(5, TimeUnit.SECONDS); assertNotNull(window[0], "Second window opened"); - assertEquals(s.getTitle(), "First window", "The title is kept"); + assertTitle(s, "First window", "The title is kept"); } } diff --git a/boot-fx/src/test/java/org/netbeans/html/boot/fx/TitleTest.java b/boot-fx/src/test/java/org/netbeans/html/boot/fx/TitleTest.java index 3974c8fd8..8a5c9d421 100644 --- a/boot-fx/src/test/java/org/netbeans/html/boot/fx/TitleTest.java +++ b/boot-fx/src/test/java/org/netbeans/html/boot/fx/TitleTest.java @@ -21,13 +21,13 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.scene.web.WebView; import javafx.stage.Stage; import net.java.html.BrwsrCtx; import net.java.html.boot.BrowserBuilder; import net.java.html.js.JavaScriptBody; +import static org.netbeans.html.boot.fx.KOFx.assertTitle; import org.netbeans.html.boot.spi.Fn; import static org.testng.Assert.*; import org.testng.annotations.Test; @@ -88,25 +88,19 @@ public void run() { assertNotNull(lastWebView[0], "A WebView created"); Stage s = (Stage) lastWebView[0].getScene().getWindow(); - assertEquals(s.getTitle(), "FX Presenter Harness"); + assertTitle(s, "FX Presenter Harness", "Initial title is read from HTML page"); final CountDownLatch propChange = new CountDownLatch(1); - s.titleProperty().addListener(new ChangeListener() { - @Override - public void changed(ObservableValue ov, String t, String t1) { - propChange.countDown(); - } + s.titleProperty().addListener((ObservableValue ov, String t, String t1) -> { + propChange.countDown(); }); - when.ctx.execute(new Runnable() { - @Override - public void run() { - changeTitle("New title"); - } + when.ctx.execute(() -> { + changeTitle("New title"); }); propChange.await(5, TimeUnit.SECONDS); - assertEquals(s.getTitle(), "New title"); + assertTitle(s, "New title", "Title is dynamically updated"); } final void doCheckReload() throws Exception { diff --git a/ecj-test/pom.xml b/ecj-test/pom.xml index cd2b6059f..c99da0fac 100644 --- a/ecj-test/pom.xml +++ b/ecj-test/pom.xml @@ -51,6 +51,7 @@ maven-javadoc-plugin + org.netbeans.html.ecjtest.dummy true diff --git a/ecj-test/src/main/java/org/netbeans/html/ecjtest/dummy/Dummy.java b/ecj-test/src/main/java/org/netbeans/html/ecjtest/dummy/Dummy.java new file mode 100644 index 000000000..0bc8a0a4f --- /dev/null +++ b/ecj-test/src/main/java/org/netbeans/html/ecjtest/dummy/Dummy.java @@ -0,0 +1,25 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + * + * http://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. + */package org.netbeans.html.ecjtest.dummy; + +/** Dummy class. + */ +public final class Dummy { + private Dummy() { + } +} diff --git a/pom.xml b/pom.xml index 519dfd6d1..1f3c30af9 100644 --- a/pom.xml +++ b/pom.xml @@ -36,6 +36,7 @@ RELEASE130 21.3.0 2.3.8 + 11.0.2 COPYING ${project.artifactId} @@ -393,13 +394,13 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context. org.openjfx javafx-web - 11 + ${openjfx.version} org.openjfx javafx-swing test - 11 + ${openjfx.version} com.vaadin.external.google From f094210e94ad9435a6ff06b558e2be88fb652fb6 Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Fri, 20 Jun 2025 22:15:51 +0200 Subject: [PATCH 2/2] WebKit presenter crashes on Mac JDK 21 --- .github/workflows/mac.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index d20c71b83..ceec85445 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -31,7 +31,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - java: [ '11', '17', '21' ] + java: [ '11', '17' ] os: [ macos-14 ] steps: