Skip to content

Commit 94cfcdc

Browse files
committed
Make the CI Actions job Green
1 parent 3967480 commit 94cfcdc

File tree

10 files changed

+69
-36
lines changed

10 files changed

+69
-36
lines changed

.github/workflows/javadoc.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ jobs:
3131
runs-on: ${{ matrix.os }}
3232
strategy:
3333
matrix:
34-
java: [ '16', '17' ]
35-
os: [ ubuntu-20.04 ]
34+
java: [ '17' ]
35+
os: [ ubuntu-22.04 ]
3636

3737
steps:
3838
- uses: actions/checkout@v2
@@ -41,7 +41,6 @@ jobs:
4141
with:
4242
distribution: 'zulu'
4343
java-version: ${{ matrix.java }}
44-
cache: maven
4544

4645
- name: Build
4746
run: mvn -q install -DskipTests

.github/workflows/linux.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
strategy:
3333
matrix:
3434
java: [ '8', '11', '17', '21' ]
35-
os: [ ubuntu-20.04 ]
35+
os: [ ubuntu-22.04 ]
3636

3737
steps:
3838
- uses: actions/checkout@v2
@@ -41,7 +41,6 @@ jobs:
4141
with:
4242
distribution: 'zulu'
4343
java-version: ${{ matrix.java }}
44-
cache: maven
4544

4645
- name: Build with Maven
4746
run: mvn -q install -DskipTests

.github/workflows/mac.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ jobs:
3131
runs-on: ${{ matrix.os }}
3232
strategy:
3333
matrix:
34-
java: [ '8', '11', '17', '21' ]
35-
os: [ macos-13 ]
34+
java: [ '11', '17', '21' ]
35+
os: [ macos-14 ]
3636

3737
steps:
3838
- uses: actions/checkout@v2
@@ -41,7 +41,6 @@ jobs:
4141
with:
4242
distribution: 'zulu'
4343
java-version: ${{ matrix.java }}
44-
cache: maven
4544

4645
- name: Build with Maven
4746
run: mvn -q install -DskipTests

.github/workflows/windows.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
strategy:
3333
matrix:
3434
java: [ '8', '11', '17', '21' ]
35-
os: [ windows-2019 ]
35+
os: [ windows-2022 ]
3636

3737
steps:
3838
- uses: actions/checkout@v2
@@ -41,7 +41,6 @@ jobs:
4141
with:
4242
distribution: 'zulu'
4343
java-version: ${{ matrix.java }}
44-
cache: maven
4544

4645
- name: Build with Maven
4746
run: mvn -q install -DskipTests

boot-fx/src/test/java/org/netbeans/html/boot/fx/KOFx.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@
2222
import java.lang.reflect.Method;
2323
import java.util.Timer;
2424
import java.util.TimerTask;
25+
import java.util.logging.Level;
26+
import java.util.logging.Logger;
2527
import javafx.application.Platform;
28+
import javafx.stage.Stage;
2629
import org.netbeans.html.boot.spi.Fn;
30+
import static org.testng.Assert.fail;
2731
import org.testng.IHookCallBack;
2832
import org.testng.IHookable;
2933
import org.testng.ITest;
@@ -36,7 +40,7 @@
3640
*/
3741
public final class KOFx implements ITest, IHookable, Runnable {
3842
private static final Timer SCHEDULER = new Timer("Fx Scheduler");
39-
43+
4044
private final Fn.Presenter p;
4145
private final Method m;
4246
private Object result;
@@ -99,7 +103,7 @@ public synchronized void run() {
99103
public void run(IHookCallBack ihcb, ITestResult itr) {
100104
ihcb.runTestMethod(itr);
101105
}
102-
106+
103107
private static void schedule(Runnable task, long delay) {
104108
SCHEDULER.schedule(new TimerTask() {
105109
@Override
@@ -108,4 +112,18 @@ public void run() {
108112
}
109113
}, delay);
110114
}
115+
116+
static void assertTitle(Stage s, String expTitle, String msg) {
117+
for (var i = 0; i < 100; i++) {
118+
var title = s.getTitle();
119+
if (expTitle.equals(title)) {
120+
return;
121+
}
122+
try {
123+
Thread.sleep(50);
124+
} catch (InterruptedException ex) {
125+
}
126+
}
127+
fail(msg + " expecting: " + expTitle + " but was: " + s.getTitle());
128+
}
111129
}

boot-fx/src/test/java/org/netbeans/html/boot/fx/PopupTest.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import net.java.html.BrwsrCtx;
2727
import net.java.html.boot.BrowserBuilder;
2828
import net.java.html.js.JavaScriptBody;
29+
import static org.netbeans.html.boot.fx.KOFx.assertTitle;
2930
import org.netbeans.html.boot.spi.Fn;
3031
import static org.testng.Assert.*;
3132
import org.testng.annotations.Test;
@@ -84,23 +85,20 @@ public void run() {
8485

8586
assertNotNull(lastWebView[0], "A WebView created");
8687
Stage s = (Stage) lastWebView[0].getScene().getWindow();
87-
assertEquals(s.getTitle(), "FX Presenter Harness");
88+
assertTitle(s, "FX Presenter Harness", "Initial title value read from HTML page");
8889

8990
final Object[] window = new Object[1];
9091
final CountDownLatch openWindow = new CountDownLatch(1);
91-
when.ctx.execute(new Runnable() {
92-
@Override
93-
public void run() {
94-
TitleTest.changeTitle("First window");
95-
window[0] = openSecondaryWindow("second.html");
96-
openWindow.countDown();
97-
}
92+
when.ctx.execute(() -> {
93+
TitleTest.changeTitle("First window");
94+
window[0] = openSecondaryWindow("second.html");
95+
openWindow.countDown();
9896
});
9997

10098
openWindow.await(5, TimeUnit.SECONDS);
10199

102100
assertNotNull(window[0], "Second window opened");
103101

104-
assertEquals(s.getTitle(), "First window", "The title is kept");
102+
assertTitle(s, "First window", "The title is kept");
105103
}
106104
}

boot-fx/src/test/java/org/netbeans/html/boot/fx/TitleTest.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
import java.util.concurrent.CountDownLatch;
2222
import java.util.concurrent.Executors;
2323
import java.util.concurrent.TimeUnit;
24-
import javafx.beans.value.ChangeListener;
2524
import javafx.beans.value.ObservableValue;
2625
import javafx.scene.web.WebView;
2726
import javafx.stage.Stage;
2827
import net.java.html.BrwsrCtx;
2928
import net.java.html.boot.BrowserBuilder;
3029
import net.java.html.js.JavaScriptBody;
30+
import static org.netbeans.html.boot.fx.KOFx.assertTitle;
3131
import org.netbeans.html.boot.spi.Fn;
3232
import static org.testng.Assert.*;
3333
import org.testng.annotations.Test;
@@ -88,25 +88,19 @@ public void run() {
8888

8989
assertNotNull(lastWebView[0], "A WebView created");
9090
Stage s = (Stage) lastWebView[0].getScene().getWindow();
91-
assertEquals(s.getTitle(), "FX Presenter Harness");
91+
assertTitle(s, "FX Presenter Harness", "Initial title is read from HTML page");
9292

9393
final CountDownLatch propChange = new CountDownLatch(1);
94-
s.titleProperty().addListener(new ChangeListener<String>() {
95-
@Override
96-
public void changed(ObservableValue<? extends String> ov, String t, String t1) {
97-
propChange.countDown();
98-
}
94+
s.titleProperty().addListener((ObservableValue<? extends String> ov, String t, String t1) -> {
95+
propChange.countDown();
9996
});
10097

101-
when.ctx.execute(new Runnable() {
102-
@Override
103-
public void run() {
104-
changeTitle("New title");
105-
}
98+
when.ctx.execute(() -> {
99+
changeTitle("New title");
106100
});
107101

108102
propChange.await(5, TimeUnit.SECONDS);
109-
assertEquals(s.getTitle(), "New title");
103+
assertTitle(s, "New title", "Title is dynamically updated");
110104
}
111105

112106
final void doCheckReload() throws Exception {

ecj-test/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<plugin>
5252
<artifactId>maven-javadoc-plugin</artifactId>
5353
<configuration>
54+
<subpackages>org.netbeans.html.ecjtest.dummy</subpackages>
5455
<skip>true</skip>
5556
</configuration>
5657
</plugin>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/package org.netbeans.html.ecjtest.dummy;
19+
20+
/** Dummy class.
21+
*/
22+
public final class Dummy {
23+
private Dummy() {
24+
}
25+
}

pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<netbeans.version>RELEASE130</netbeans.version>
3737
<graalvm.version>21.3.0</graalvm.version>
3838
<grizzly.version>2.3.8</grizzly.version>
39+
<openjfx.version>11.0.2</openjfx.version>
3940
<license>COPYING</license>
4041
<publicPackages />
4142
<bundleSymbolicName>${project.artifactId}</bundleSymbolicName>
@@ -393,13 +394,13 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context.
393394
<dependency>
394395
<groupId>org.openjfx</groupId>
395396
<artifactId>javafx-web</artifactId>
396-
<version>11</version>
397+
<version>${openjfx.version}</version>
397398
</dependency>
398399
<dependency>
399400
<groupId>org.openjfx</groupId>
400401
<artifactId>javafx-swing</artifactId>
401402
<scope>test</scope>
402-
<version>11</version>
403+
<version>${openjfx.version}</version>
403404
</dependency>
404405
<dependency>
405406
<groupId>com.vaadin.external.google</groupId>

0 commit comments

Comments
 (0)