File tree Expand file tree Collapse file tree
acp-quarkus-integration-tests/src
test/java/com/agentclientprotocol/sdk/quarkus/it Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1663,6 +1663,13 @@ Found by measuring coverage with JaCoCo; each has a test.
16631663
16641664### Build
16651665
1666+ - ** The Quarkus tests no longer bind the fixed port 8081.** Quarkus serves ` @QuarkusTest ` and
1667+ ` QuarkusUnitTest ` applications on ` quarkus.http.test-port ` , 8081 by default, so two builds on one
1668+ machine (or anything else on 8081) failed with "Port already bound: 8081". The deployment
1669+ module's tests now run with ` quarkus.http.test-port=0 ` , a random port, and the integration tests
1670+ on a free port a test resource picks (the client bean's URI is read at startup, before a random
1671+ port is known). The tests read the bound port through ` @TestHTTPResource ` .
1672+
16661673- ** Spring Boot's configuration metadata is written on JDK 21 and later too.** The ` errorprone `
16671674 profile (JDK 21+) sets the compiler's processor path to Error Prone and NullAway, which turns off
16681675 discovering processors on the classpath, so ` acp-spring-boot-autoconfigure ` built on JDK 21 had
Original file line number Diff line number Diff line change 112112 <configuration >
113113 <systemPropertyVariables >
114114 <java .util.logging.manager>org.jboss.logmanager.LogManager</java .util.logging.manager>
115+ <!-- A random port, not Quarkus's fixed test port 8081, so that parallel
116+ builds on one machine do not collide; the tests read the port the
117+ server bound (@TestHTTPResource). -->
118+ <quarkus .http.test-port>0</quarkus .http.test-port>
115119 </systemPropertyVariables >
116120 </configuration >
117121 </plugin >
Original file line number Diff line number Diff line change 11greeting.prefix =Hello from Quarkus
22# The packaged application (prod) is a stdio agent; @QuarkusTest serves the same agent over HTTP.
33%test.quarkus.acp.agent.transport.type =http
4- # The client bean, in tests: a Quarkus ACP client of the same application's agent.
4+ # The client bean, in tests: a Quarkus ACP client of the same application's agent. The test port
5+ # is a free one FreeTestPort picks, not Quarkus's fixed 8081, so that parallel builds do not collide.
56%test.quarkus.acp.client.transport.http.uri =http://localhost:${quarkus.http.test-port}/acp
Original file line number Diff line number Diff line change 88
99import com .agentclientprotocol .sdk .client .AcpSyncClient ;
1010import com .agentclientprotocol .sdk .spec .AcpSchema ;
11+ import io .quarkus .test .common .TestResourceScope ;
12+ import io .quarkus .test .common .WithTestResource ;
1113import io .quarkus .test .junit .QuarkusTest ;
1214import jakarta .inject .Inject ;
1315import org .junit .jupiter .api .Test ;
1921 * and customized by a bean, against the application's own agent over Streamable HTTP.
2022 */
2123@ QuarkusTest
24+ @ WithTestResource (value = FreeTestPort .class , scope = TestResourceScope .GLOBAL )
2225class ClientBeanTest {
2326
2427 @ Inject
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2025-2026 the original author or authors.
3+ */
4+
5+ package com .agentclientprotocol .sdk .quarkus .it ;
6+
7+ import java .io .IOException ;
8+ import java .io .UncheckedIOException ;
9+ import java .net .ServerSocket ;
10+ import java .util .Map ;
11+
12+ import io .quarkus .test .common .QuarkusTestResourceLifecycleManager ;
13+
14+ /**
15+ * Serves the tests on a free port instead of Quarkus's fixed test port 8081, so that two builds on
16+ * one machine do not collide. Not {@code quarkus.http.test-port=0}: the client bean's URI,
17+ * {@code quarkus.acp.client.transport.http.uri}, is read when the application starts, before the
18+ * server has bound a random port, so it would name port 0. A port picked here is known to both.
19+ */
20+ public class FreeTestPort implements QuarkusTestResourceLifecycleManager {
21+
22+ @ Override
23+ public Map <String , String > start () {
24+ try (ServerSocket socket = new ServerSocket (0 )) {
25+ return Map .of ("quarkus.http.test-port" , String .valueOf (socket .getLocalPort ()));
26+ }
27+ catch (IOException ex ) {
28+ throw new UncheckedIOException (ex );
29+ }
30+ }
31+
32+ @ Override
33+ public void stop () {
34+ }
35+
36+ }
You can’t perform that action at this time.
0 commit comments