This is an automated email from the ASF dual-hosted git repository.
mridulpathak pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release24.09 by this push:
new 8f8ec408a4 Improved: Allow testIntegration to run with --portoffset
for concurrent test runs (OFBIZ-13518)
8f8ec408a4 is described below
commit 8f8ec408a44db64b68a68411ef088cb7b525d14b
Author: Mridul Pathak <[email protected]>
AuthorDate: Wed Sep 2 14:15:47 2026 +0530
Improved: Allow testIntegration to run with --portoffset for concurrent
test runs (OFBIZ-13518)
Backported from trunk. OFBiz's Start entrypoint already supports
--portoffset=<N>, which shifts every container's bound ports including the test
Catalina container, but testIntegration had no way to pass it through since it
hardcoded dependsOn 'ofbiz --test'. Added an optional -PportOffset Gradle
property that appends --portoffset=<N> to the underlying command when set, with
no change in behavior when omitted. Also fixed the same pre-existing
WidgetMacroLibraryTests bug present on thi [...]
---
build.gradle | 6 +++++-
.../ofbiz/widget/test/WidgetMacroLibraryTests.java | 19 ++++++++++++++-----
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/build.gradle b/build.gradle
index 8fdff486e7..2b33e9c70b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -364,7 +364,11 @@ task loadAll(group: ofbizServer) {
}
task testIntegration(group: ofbizServer) {
- dependsOn 'ofbiz --test'
+ def command = 'ofbiz --test'
+ if (project.hasProperty('portOffset')) {
+ command += " --portoffset=${project.property('portOffset')}"
+ }
+ dependsOn command
description = 'Run OFBiz integration tests; You must run loadAll before
running this task'
}
diff --git
a/framework/widget/src/main/java/org/apache/ofbiz/widget/test/WidgetMacroLibraryTests.java
b/framework/widget/src/main/java/org/apache/ofbiz/widget/test/WidgetMacroLibraryTests.java
index 197f9e1bd1..2f0e8fac20 100644
---
a/framework/widget/src/main/java/org/apache/ofbiz/widget/test/WidgetMacroLibraryTests.java
+++
b/framework/widget/src/main/java/org/apache/ofbiz/widget/test/WidgetMacroLibraryTests.java
@@ -34,7 +34,7 @@ import org.apache.tika.sax.BodyContentHandler;
public class WidgetMacroLibraryTests extends OFBizTestCase {
- private String screenUrl =
"https://localhost:8443/webtools/control/WebtoolsLayoutDemo"; //use existing
screen to present most of layout use case
+ private String screenUrl = buildScreenUrl();
private final String authentificationQuery =
"?USERNAME=admin&PASSWORD=ofbiz";
public WidgetMacroLibraryTests(String name) {
@@ -52,16 +52,25 @@ public class WidgetMacroLibraryTests extends OFBizTestCase {
return http;
}
+ /**
+ * Build the demo layout screen URL, accounting for --portoffset since each
+ * test method runs against a fresh instance and can't share a mutated
field.
+ */
+ private static String buildScreenUrl() {
+ String url =
"https://localhost:8443/webtools/control/WebtoolsLayoutDemo"; //use existing
screen to present most of layout use case
+ int portOffset = Start.getInstance().getConfig().getPortOffset();
+ if (portOffset != 0) {
+ url = url.replace("8443", String.valueOf(8443 + portOffset));
+ }
+ return url;
+ }
+
/**
* Test html macro library.
* @throws Exception the exception
*/
public void testHtmlMacroLibrary() throws Exception {
HttpClient http = initHttpClient();
- if (Start.getInstance().getConfig().getPortOffset() != 0) {
- Integer port = 8443 +
Start.getInstance().getConfig().getPortOffset();
- screenUrl = screenUrl.replace("8443", port.toString());
- }
http.setUrl(screenUrl.concat(authentificationQuery));
String screenOutString = http.post();
assertNotNull("Response failed from ofbiz", screenOutString);