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

jungm pushed a commit to branch ee11
in repository https://gitbox.apache.org/repos/asf/tomee-tck.git

commit 5d8b73a366863201d048f274ed3346cc99621558
Author: Markus Jung <[email protected]>
AuthorDate: Sun Jul 19 16:29:11 2026 +0200

    Select free ports per standalone runner and guard the chosen ones
    
    run-standalone-suite.sh keeps a per-id table of the ports each runner
    binds, selects free ones at branch start, and appends them as the existing
    -D overrides; a caller-supplied -D wins and its value seeds the later
    picks' avoid lists. The parent pom asserts the chosen TomEE ports free at
    validate, gated by tck.tomee.ports.guard.skip so TomEE-less modules opt
    out, and the validation/cdi/cdi-ee arquillian.xml gain the httpsPort knob
    so the always-bound TLS connector is movable.
---
 .../cdi-ee/src/test/resources/arquillian.xml       |  1 +
 .../cdi/src/test/resources/arquillian.xml          |  1 +
 runner-standalone/persistence/pom.xml              |  5 ++
 runner-standalone/pom.xml                          | 22 ++++++-
 runner-standalone/run-standalone-suite.sh          | 69 +++++++++++++++++++---
 .../validation/src/test/resources/arquillian.xml   |  1 +
 6 files changed, 91 insertions(+), 8 deletions(-)

diff --git a/runner-standalone/cdi-ee/src/test/resources/arquillian.xml 
b/runner-standalone/cdi-ee/src/test/resources/arquillian.xml
index 7c25660..de771a3 100644
--- a/runner-standalone/cdi-ee/src/test/resources/arquillian.xml
+++ b/runner-standalone/cdi-ee/src/test/resources/arquillian.xml
@@ -17,6 +17,7 @@
       <property name="host">localhost</property>
       <property name="httpPort">${tomee.http.port}</property>
       <property name="stopPort">${tomee.shutdown.port}</property>
+      <property name="httpsPort">${tomee.https.port}</property>
       <property name="cleanOnStartUp">true</property>
       <property name="removeUnusedWebapps">true</property>
       <property name="simpleLog">true</property>
diff --git a/runner-standalone/cdi/src/test/resources/arquillian.xml 
b/runner-standalone/cdi/src/test/resources/arquillian.xml
index e6773e1..1ddf57c 100644
--- a/runner-standalone/cdi/src/test/resources/arquillian.xml
+++ b/runner-standalone/cdi/src/test/resources/arquillian.xml
@@ -17,6 +17,7 @@
       <property name="host">localhost</property>
       <property name="httpPort">${tomee.http.port}</property>
       <property name="stopPort">${tomee.shutdown.port}</property>
+      <property name="httpsPort">${tomee.https.port}</property>
       <property name="cleanOnStartUp">true</property>
       <property name="removeUnusedWebapps">true</property>
       <property name="simpleLog">true</property>
diff --git a/runner-standalone/persistence/pom.xml 
b/runner-standalone/persistence/pom.xml
index 238a701..0a20c65 100644
--- a/runner-standalone/persistence/pom.xml
+++ b/runner-standalone/persistence/pom.xml
@@ -31,6 +31,11 @@
   </description>
 
   <properties>
+    <!-- The persistence suite runs the SE vehicle against EclipseLink; TomEE
+         jars are staged onto the classpath but no server starts, so the
+         TomEE port guard does not apply (Derby remains its only port, still
+         guarded by require-free-derby-port). -->
+    <tck.tomee.ports.guard.skip>true</tck.tomee.ports.guard.skip>
     <persistence.tck.version>3.2.1</persistence.tck.version>
     
<persistence.tck.zip>jakarta-persistence-tck-${persistence.tck.version}.zip</persistence.tck.zip>
     
<persistence.tck.url>https://download.eclipse.org/jakartaee/persistence/3.2/${persistence.tck.zip}</persistence.tck.url>
diff --git a/runner-standalone/pom.xml b/runner-standalone/pom.xml
index 331101f..83cdf39 100644
--- a/runner-standalone/pom.xml
+++ b/runner-standalone/pom.xml
@@ -69,9 +69,14 @@
     <tck.standalone.skip>true</tck.standalone.skip>
     <!-- Modules that only run local signature checks set this to true. -->
     
<tck.standalone.container.skip>${tck.standalone.skip}</tck.standalone.container.skip>
+    <!-- Guards the TomEE ports at validate; modules that stage but never
+         start TomEE (persistence) override this to true. -->
+    
<tck.tomee.ports.guard.skip>${tck.standalone.container.skip}</tck.tomee.ports.guard.skip>
     <!-- Harness catalog defaults for the TomEE container; the remote
          adapter otherwise attaches to whatever already answers on the http
-         port. Modules that pin fixed ports simply ignore these. -->
+         port. run-standalone-suite.sh selects free values when the defaults
+         are busy and passes them as -D overrides. Modules that pin fixed
+         ports simply ignore these. -->
     <tomee.http.port>8080</tomee.http.port>
     <tomee.https.port>8443</tomee.https.port>
     <tomee.shutdown.port>8005</tomee.shutdown.port>
@@ -225,6 +230,21 @@
                 <classpathScope>test</classpathScope>
               </configuration>
             </execution>
+            <execution>
+              <id>require-free-tomee-ports</id>
+              <phase>validate</phase>
+              <goals><goal>exec</goal></goals>
+              <configuration>
+                <skip>${tck.tomee.ports.guard.skip}</skip>
+                <executable>sh</executable>
+                <arguments>
+                  
<argument>${maven.multiModuleProjectDirectory}/environment/tomee/require-tomee-ports-free.sh</argument>
+                  <argument>${tomee.http.port}</argument>
+                  <argument>${tomee.https.port}</argument>
+                  <argument>${tomee.shutdown.port}</argument>
+                </arguments>
+              </configuration>
+            </execution>
             <execution>
               <id>generate-test-certificates</id>
               <phase>generate-test-resources</phase>
diff --git a/runner-standalone/run-standalone-suite.sh 
b/runner-standalone/run-standalone-suite.sh
index c4393ff..ecfed2b 100755
--- a/runner-standalone/run-standalone-suite.sh
+++ b/runner-standalone/run-standalone-suite.sh
@@ -9,13 +9,15 @@
 #
 #   runner-standalone/run-standalone-suite.sh <id> [extra mvn args]
 #
-# Container-based runners default to ports 8080/8443/8005/1527; run one at
-# a time. -Dtck.derby.port overrides the Derby port everywhere, and the
-# container-based runners honor -Dtomee.http.port/-Dtomee.https.port/
-# -Dtomee.shutdown.port for side-by-side runs (the security, authentication,
-# and faces source reactors still assume the fixed ports). Use the overrides
-# whenever anything else may hold 8080: the Arquillian adapter silently
-# attaches to any server already on the port.
+# Container-based runners default to ports 8080/8443/8005/1527. At branch
+# start the script selects free ports for exactly what the chosen runner
+# binds and passes them as the documented -D overrides
+# (-Dtomee.http.port/-Dtomee.https.port/-Dtomee.shutdown.port for the TomEE
+# container, -Dtck.derby.port for Derby, -Dtck.harness.log.port for the
+# JavaTest harness log listener); a caller-supplied -D always wins. The
+# security source reactor still assumes its fixed ports. Selection matters
+# because the Arquillian adapter silently attaches to any server already on
+# the port, so a foreign server on 8080 would make a runner look green.
 # TOMEE_CLASSIFIER selects the distribution (default: plume).
 # The reviewed exclusion list in runner-standalone/exclusions/<id>.txt is
 # applied by default; append -Dtck.exclusions.file=... to override (see
@@ -58,6 +60,59 @@ if [ -f "$SCRIPT_DIR/$ID-install/pom.xml" ]; then
 fi
 
 shift
+
+# Select free ports for exactly what this runner binds and append them as -D
+# overrides. A caller-supplied -D for the same knob always wins; its value
+# still seeds the later picks' avoid lists so a selection can never return a
+# port the caller reserved for another knob. Last match wins, like Maven.
+SELECT_PORT="$ROOT_DIR/environment/ports/select-free-port.sh"
+arg_value() { prefix=$1; shift; v=''; for a in "$@"; do case $a in "$prefix"*) 
v=${a#"$prefix"} ;; esac; done; printf '%s' "$v"; }
+
+NEED_TOMEE=no NEED_DERBY=no NEED_HARNESS=no NEED_HTTP_ONLY=no HARNESS_PREF=2000
+case "$ID" in
+  concurrency|data|servlet|pages|rest|validation|websocket|cdi|cdi-ee) 
NEED_TOMEE=yes; NEED_DERBY=yes ;;
+  persistence) NEED_DERBY=yes ;;
+  transactions|faces-old) NEED_TOMEE=yes; NEED_HARNESS=yes ;;
+  security-old) NEED_TOMEE=yes; NEED_DERBY=yes; NEED_HARNESS=yes; 
HARNESS_PREF=2100 ;;
+  authentication|faces) NEED_HTTP_ONLY=yes ;;
+  # security: the downloaded reactor pins 8080/8443/8005/33389; its pom
+  # asserts them free instead (no selection possible).
+  # annotations, di, el, jsonp, jsonb, debugging: no ports.
+esac
+
+selected=no
+if [ "$NEED_TOMEE" = yes ] || [ "$NEED_HTTP_ONLY" = yes ]; then
+  HTTP=$(arg_value -Dtomee.http.port= "$@")
+  if [ -z "$HTTP" ]; then
+    HTTP=$(sh "$SELECT_PORT" 8080); set -- "$@" "-Dtomee.http.port=$HTTP"; 
selected=yes
+  fi
+fi
+if [ "$NEED_TOMEE" = yes ]; then
+  HTTPS=$(arg_value -Dtomee.https.port= "$@")
+  if [ -z "$HTTPS" ]; then
+    HTTPS=$(sh "$SELECT_PORT" 8443 ${HTTP:-}); set -- "$@" 
"-Dtomee.https.port=$HTTPS"; selected=yes
+  fi
+  SHUTDOWN=$(arg_value -Dtomee.shutdown.port= "$@")
+  if [ -z "$SHUTDOWN" ]; then
+    SHUTDOWN=$(sh "$SELECT_PORT" 8005 ${HTTP:-} ${HTTPS:-}); set -- "$@" 
"-Dtomee.shutdown.port=$SHUTDOWN"; selected=yes
+  fi
+fi
+if [ "$NEED_DERBY" = yes ]; then
+  DERBY=$(arg_value -Dtck.derby.port= "$@")
+  if [ -z "$DERBY" ]; then
+    DERBY=$(sh "$SELECT_PORT" 1527 ${HTTP:-} ${HTTPS:-} ${SHUTDOWN:-}); set -- 
"$@" "-Dtck.derby.port=$DERBY"; selected=yes
+  fi
+fi
+if [ "$NEED_HARNESS" = yes ]; then
+  HARNESS=$(arg_value -Dtck.harness.log.port= "$@")
+  if [ -z "$HARNESS" ]; then
+    HARNESS=$(sh "$SELECT_PORT" "$HARNESS_PREF" ${HTTP:-} ${HTTPS:-} 
${SHUTDOWN:-} ${DERBY:-}); set -- "$@" "-Dtck.harness.log.port=$HARNESS"; 
selected=yes
+  fi
+fi
+if [ "$selected" = yes ]; then
+  echo "run-standalone-suite: selected ports http=${HTTP:-} https=${HTTPS:-} 
shutdown=${SHUTDOWN:-} derby=${DERBY:-} harness=${HARNESS:-}" >&2
+fi
+
 exec "$ROOT_DIR/mvnw" -B -ntp \
   -pl "$MODULES" -am \
   -Dtck.standalone=true \
diff --git a/runner-standalone/validation/src/test/resources/arquillian.xml 
b/runner-standalone/validation/src/test/resources/arquillian.xml
index 53e2aed..3be7d95 100644
--- a/runner-standalone/validation/src/test/resources/arquillian.xml
+++ b/runner-standalone/validation/src/test/resources/arquillian.xml
@@ -17,6 +17,7 @@
       <property name="host">localhost</property>
       <property name="httpPort">${tomee.http.port}</property>
       <property name="stopPort">${tomee.shutdown.port}</property>
+      <property name="httpsPort">${tomee.https.port}</property>
       <property name="cleanOnStartUp">true</property>
       <property name="removeUnusedWebapps">true</property>
       <property name="simpleLog">true</property>

Reply via email to