FEAT: Let the on-premise web example take its port and data file from the environment - #663
Conversation
… the environment The shared Selenium contract tests drive each web example as an already running server. The on-premise example was fixed to port 8081, waited on Enter, and only read the data file from TestDataFile. It now honours PORT the same way the cloud example does, joining the server instead of waiting on stdin, and reads the data file from 51DEGREES_DD_PATH first, then TestDataFile, then the Lite file. A unit test pins that order.
Unit Tests - Ubuntu_Java_1121 tests 20 ✅ 27s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Unit Tests - Ubuntu_Java_1721 tests 20 ✅ 25s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Unit Tests - Ubuntu_Java_821 tests 20 ✅ 32s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Integration Tests - Ubuntu_Java_110 tests 0 ✅ 0s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Integration Tests - Ubuntu_Java_170 tests 0 ✅ 0s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Integration Tests - Ubuntu_Java_80 tests 0 ✅ 0s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Unit Tests - Windows_Java_821 tests 20 ✅ 29s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Integration Tests - Windows_Java_80 tests 0 ✅ 0s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Unit Tests - Windows_Java_1721 tests 20 ✅ 30s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Unit Tests - Windows_Java_1121 tests 20 ✅ 40s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Integration Tests - Windows_Java_170 tests 0 ✅ 0s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Integration Tests - Windows_Java_110 tests 0 ✅ 0s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Unit Tests - MacOS_X64_Java_1121 tests 21 ✅ 1m 44s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Integration Tests - MacOS_X64_Java_110 tests 0 ✅ 0s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Unit Tests - MacOS_Java_1121 tests 21 ✅ 39s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Integration Tests - MacOS_Java_110 tests 0 ✅ 0s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Unit Tests - MacOS_X64_Java_1721 tests 21 ✅ 41s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Integration Tests - MacOS_X64_Java_170 tests 0 ✅ 0s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Unit Tests - MacOS_Java_1721 tests 21 ✅ 41s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Integration Tests - MacOS_Java_170 tests 0 ✅ 0s ⏱️ Results for commit 8726d8d. ♻️ This comment has been updated with latest results. |
Problem
The shared Selenium contract tests in selenium-api-tests (category
Contract) drive each web example as an already running server, given byEXAMPLE_URL. The cloud web example supports this, but the on-premise web example (web/getting-started.onprem) did not, for three reasons.TestDataFile, not from the agreed51DEGREES_DD_PATHname.The script route (
/51Degrees.core.js) and the JSON route (/51Degrees.core.json) were already served by the pipeline filter, the same as in the cloud example, so nothing was needed there.Change
GettingStartedWebOnPrem.javahonoursPORTexactly asGettingStartedWebCloud.javaalready does. WhenPORTis set the server is joined instead of waiting on Enter. Without it, the example behaves as before.51Degrees-OnPrem.xmltakes the data file from51DEGREES_DD_PATH, thenTestDataFile, then the Lite file, written as${51DEGREES_DD_PATH:-${TestDataFile:-device-detection-data/51Degrees-LiteV4.1.hash}}.TestDataFilekeeps working.OnPremDataFileOptionTestpins that order. It uses system properties in place of environment variables, which the lookup reads as well, and skips itself if either environment variable is already set.README.mddescribes how to run the web examples withPORTand51DEGREES_DD_PATH, and corrects the on-premise GettingStarted (Web) row, which said it used the cloud service.Verification
mvnw -pl web/getting-started.onprem -am test -Dtest=OnPremDataFileOptionTestwith neither variable set gaveTests run: 3, Failures: 0, Errors: 0, Skipped: 0. With the configuration file frommainthe same run gave one failure (expected:<from-[dd-path].hash> but was:<from-[test-data-file].hash>), so the test detects the old behaviour.PORT=8098and51DEGREES_DD_PATHpointing at a Lite file. The page returned 200 and named that file,/51Degrees.core.jsreturned 200, and a POST to/51Degrees.core.jsonreturned 200 with device data. The process was then stopped.main. In run 35153491220 all 15 jobs that can run Selenium reportedPassed! - Failed: 0, Passed: 9, Skipped: 0, Total: 9for this on-premise example against the TAC data file, and the same for the cloud example. The Arm64 Linux job skips Selenium. The new unit test ran in every job (3 run, 0 skipped).Merge order
This pull request must merge first. The device-detection-java change (device-detection-java#589) clones this repository's
main, so it cannot start the on-premise example on a port until this change is there.CI on this branch, 17 September 2026
The "Pull Requests" workflow was dispatched on this branch with
dryrun=true,which builds the branch and merges nothing. Run
35161394140
ran on
cf5e69f, the head of this branch, and concluded success with all 14jobs green. In the
Ubuntu_Java_17job the Maven totals are 21 tests run, 0failures, 0 errors and 1 skipped, with no error lines in the log.
This branch is one commit behind
main, that commit being the automated packageupdate #664,
and it merges cleanly.
The nightly checks out the pull request, merges
maininto it and buildsthat before it merges anything, so the combination is tested there.