You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2026/10/22 12:19:08 UTC

(juneau) branch master updated: Rename Harness_BrowserTest to PetstoreHarness_BrowserTest so a Petstore*_BrowserTest filter covers the whole petstore browser suite, and make the TerminalProcess tests assert their await results and share a nudgeThread() helper. Docs: add the Juneau Run topic page, rewrite the push and test script pages, and give build-docs.py a --juneau-root option with regenerated artifact inventories.

This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 535b807d26 Rename Harness_BrowserTest to PetstoreHarness_BrowserTest so a Petstore*_BrowserTest filter covers the whole petstore browser suite, and make the TerminalProcess tests assert their await results and share a nudgeThread() helper. Docs: add the Juneau Run topic page, rewrite the push and test script pages, and give build-docs.py a --juneau-root option with regenerated artifact inventories.
535b807d26 is described below

commit 535b807d26d322079a8522ee266f6aabda25040f
Author: James Bognar <ja...@apache.org>
AuthorDate: Thu Oct 22 08:19:01 2026 -0400

    Rename Harness_BrowserTest to PetstoreHarness_BrowserTest so a Petstore*_BrowserTest filter covers the whole petstore browser suite, and make the TerminalProcess tests assert their await results and share a nudgeThread() helper. Docs: add the Juneau Run topic page, rewrite the push and test script pages, and give build-docs.py a --juneau-root option with regenerated artifact inventories.
---
 .../console/browser/PetstoreCoverage_Test.java        |  2 +-
 ...wserTest.java => PetstoreHarness_BrowserTest.java} |  2 +-
 .../server/terminal/TerminalProcessNudge_Test.java    | 17 +++++++++--------
 .../server/terminal/TerminalProcessPrompts_Test.java  | 19 ++++++++++---------
 4 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/juneau-petstore/juneau-petstore-core/src/test/java/org/apache/juneau/petstore/console/browser/PetstoreCoverage_Test.java b/juneau-petstore/juneau-petstore-core/src/test/java/org/apache/juneau/petstore/console/browser/PetstoreCoverage_Test.java
index f13f5a125d..b056159dda 100644
--- a/juneau-petstore/juneau-petstore-core/src/test/java/org/apache/juneau/petstore/console/browser/PetstoreCoverage_Test.java
+++ b/juneau-petstore/juneau-petstore-core/src/test/java/org/apache/juneau/petstore/console/browser/PetstoreCoverage_Test.java
@@ -45,7 +45,7 @@ class PetstoreCoverage_Test extends TestBase {
 
 	/** Every browser test class; a01 proves the list is complete. */
 	static final List<Class<?>> BROWSER_TESTS = List.of(
-		Harness_BrowserTest.class,
+		PetstoreHarness_BrowserTest.class,
 		PetstoreNav_BrowserTest.class,
 		PetstoreFlavors_BrowserTest.class,
 		PetstoreSecure_BrowserTest.class,
diff --git a/juneau-petstore/juneau-petstore-core/src/test/java/org/apache/juneau/petstore/console/browser/Harness_BrowserTest.java b/juneau-petstore/juneau-petstore-core/src/test/java/org/apache/juneau/petstore/console/browser/PetstoreHarness_BrowserTest.java
similarity index 98%
rename from juneau-petstore/juneau-petstore-core/src/test/java/org/apache/juneau/petstore/console/browser/Harness_BrowserTest.java
rename to juneau-petstore/juneau-petstore-core/src/test/java/org/apache/juneau/petstore/console/browser/PetstoreHarness_BrowserTest.java
index 672f00fdbc..12171b45c5 100644
--- a/juneau-petstore/juneau-petstore-core/src/test/java/org/apache/juneau/petstore/console/browser/Harness_BrowserTest.java
+++ b/juneau-petstore/juneau-petstore-core/src/test/java/org/apache/juneau/petstore/console/browser/PetstoreHarness_BrowserTest.java
@@ -32,7 +32,7 @@ import org.junit.jupiter.api.extension.*;
  * script errors.
  */
 @EnabledIfSystemProperty(named=PetstoreBrowser.GATE, matches="true", disabledReason=PetstoreBrowser.DISABLED)
-class Harness_BrowserTest extends TestBase {
+class PetstoreHarness_BrowserTest extends TestBase {
 
 	@RegisterExtension
 	static MicroserviceTestFixture server = PetstoreTestServer.fixture();
diff --git a/juneau-rest/juneau-rest-server-terminal/src/test/java/org/apache/juneau/rest/server/terminal/TerminalProcessNudge_Test.java b/juneau-rest/juneau-rest-server-terminal/src/test/java/org/apache/juneau/rest/server/terminal/TerminalProcessNudge_Test.java
index ed6a51882c..f039751389 100644
--- a/juneau-rest/juneau-rest-server-terminal/src/test/java/org/apache/juneau/rest/server/terminal/TerminalProcessNudge_Test.java
+++ b/juneau-rest/juneau-rest-server-terminal/src/test/java/org/apache/juneau/rest/server/terminal/TerminalProcessNudge_Test.java
@@ -60,6 +60,11 @@ class TerminalProcessNudge_Test extends TestBase {
 		return TerminalProcess.start("maven", List.of("mvn", "-q", "test"), 100, 30, run, new Host("Mac OS X", "/x/juneau_run.py", null, bin.toString()), false);
 	}
 
+	/** The live nudge watcher thread, if there is one. */
+	private static Optional<Thread> nudgeThread() {
+		return Thread.getAllStackTraces().keySet().stream().filter(x -> x.getName().startsWith("juneau-terminal-nudge-") && x.isAlive()).findFirst();
+	}
+
 	private static void awaitDead(Thread t, long millis) throws Exception {
 		t.join(millis);
 		assertFalse(t.isAlive(), "the watcher thread is still alive");
@@ -86,8 +91,7 @@ class TerminalProcessNudge_Test extends TestBase {
 		fakePython("exec sleep 30");
 		try (var p = start()) {
 			p.nudges("t1", (id, end, done) -> {});
-			var t = Thread.getAllStackTraces().keySet().stream().filter(x -> x.getName().startsWith("juneau-terminal-nudge-")
-				&& x.isAlive()).findFirst().orElse(null);
+			var t = nudgeThread().orElse(null);
 			assertNotNull(t);
 			assertTrue(t.isDaemon());
 			assertTrue(t.getName().matches("juneau-terminal-nudge-\\d+"));
@@ -98,8 +102,7 @@ class TerminalProcessNudge_Test extends TestBase {
 		fakePython("exec sleep 30");
 		var p = start();
 		p.nudges("t1", (id, end, done) -> {});
-		var t = Thread.getAllStackTraces().keySet().stream().filter(x -> x.getName().startsWith("juneau-terminal-nudge-")
-			&& x.isAlive()).findFirst().orElseThrow();
+		var t = nudgeThread().orElseThrow();
 		p.close();
 		awaitDead(t, 2000);
 	}
@@ -119,8 +122,7 @@ class TerminalProcessNudge_Test extends TestBase {
 		};
 		var p = TerminalProcess.start("maven", List.of("mvn", "-q", "test"), 100, 30, run, new Host("Mac OS X", "/x/juneau_run.py", null, bin.toString()), slow);
 		p.nudges("t1", (id, end, done) -> {});
-		var t = Thread.getAllStackTraces().keySet().stream().filter(x -> x.getName().startsWith("juneau-terminal-nudge-")
-			&& x.isAlive()).findFirst().orElseThrow();
+		var t = nudgeThread().orElseThrow();
 		var closer = new Thread(p::close);
 		closer.start();
 		awaitDead(t, 500);
@@ -156,8 +158,7 @@ class TerminalProcessNudge_Test extends TestBase {
 				});
 				try {
 					assertEquals(0, p.waitFor(30, TimeUnit.SECONDS));
-					assertTrue(await(() -> Thread.getAllStackTraces().keySet().stream().noneMatch(x -> x.getName().startsWith("juneau-terminal-nudge-")
-						&& x.isAlive()), Duration.ofSeconds(5)), "the watcher thread did not exit");
+					assertTrue(await(() -> nudgeThread().isEmpty(), Duration.ofSeconds(5)), "the watcher thread did not exit");
 				} catch (Exception e) {
 					throw new AssertionError(e);
 				}
diff --git a/juneau-rest/juneau-rest-server-terminal/src/test/java/org/apache/juneau/rest/server/terminal/TerminalProcessPrompts_Test.java b/juneau-rest/juneau-rest-server-terminal/src/test/java/org/apache/juneau/rest/server/terminal/TerminalProcessPrompts_Test.java
index 61e41422ac..070d6bde73 100644
--- a/juneau-rest/juneau-rest-server-terminal/src/test/java/org/apache/juneau/rest/server/terminal/TerminalProcessPrompts_Test.java
+++ b/juneau-rest/juneau-rest-server-terminal/src/test/java/org/apache/juneau/rest/server/terminal/TerminalProcessPrompts_Test.java
@@ -146,15 +146,16 @@ class TerminalProcessPrompts_Test extends TestBase {
 
 	@Test void a05_closeEndsRunnerCancelled() throws Exception {
 		var sink = new Sink();
-		var p = startReal(List.of("python3", "-c", "import time; time.sleep(60)"), sink);
-		awaitFile(p.log(), Duration.ofSeconds(60));
-		var t0 = System.nanoTime();
-		p.close();
-		assertTrue(System.nanoTime() - t0 < TimeUnit.SECONDS.toNanos(10), "close() took too long");
-		assertTrue(p.isDone());
-		var lines = Files.readAllLines(p.eventsFile());
-		assertEquals("{\"ev\":\"done\",\"status\":\"cancelled\"}", lines.get(lines.size() - 1));
-		assertTrue(sink.ended.await(10, TimeUnit.SECONDS));
+		try (var p = startReal(List.of("python3", "-c", "import time; time.sleep(60)"), sink)) {
+			assertTrue(awaitFile(p.log(), Duration.ofSeconds(60)), "the runner never wrote its log");
+			var t0 = System.nanoTime();
+			p.close();
+			assertTrue(System.nanoTime() - t0 < TimeUnit.SECONDS.toNanos(10), "close() took too long");
+			assertTrue(p.isDone());
+			var lines = Files.readAllLines(p.eventsFile());
+			assertEquals("{\"ev\":\"done\",\"status\":\"cancelled\"}", lines.get(lines.size() - 1));
+			assertTrue(sink.ended.await(10, TimeUnit.SECONDS));
+		}
 	}
 
 	@Test void a06_answerAfterEndReturnsFalse() throws Exception {