From 19e541b65d233db1736b0bbe99599e45ae729634 Mon Sep 17 00:00:00 2001 From: Mitch Gaffigan Date: Wed, 25 Nov 2026 11:02:41 -0600 Subject: [PATCH 1/9] Fix gradle smoke test run Signed-off-by: Mitch Gaffigan --- smoketest/build.gradle | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/smoketest/build.gradle b/smoketest/build.gradle index c71faf3d6..91306ef6a 100644 --- a/smoketest/build.gradle +++ b/smoketest/build.gradle @@ -7,9 +7,11 @@ apply plugin: 'distribution' apply from: 'generate-smoke-tests.gradle' -// The harness runs with the server's whole staged distribution +// The harness runs with the server's whole staged distribution, the engine's own jars +// first (see ci/run-harness.sh) def stagedServer = files([ - project(':server').fileTree('setup/server-lib') { include '**/*.jar' }, + project(':server').fileTree('setup/server-lib') { include 'mirth-*.jar' }, + project(':server').fileTree('setup/server-lib') { include '**/*.jar'; exclude 'mirth-*.jar' }, project(':server').fileTree('setup/extensions') { include '**/*.jar' }]) { builtBy ':server:createSetup' } @@ -35,6 +37,9 @@ tasks.named('test') { // Only run our tests if a live server URL is provided // `./gradlew :smoketest:test -Doie.baseUrl=https://localhost:8443` onlyIf { System.getProperty('oie.baseUrl') != null } + classpath = stagedServer + sourceSets.test.runtimeClasspath + jvmArgs "@${project(':server').file('setup/conf/default_modules.vmoptions')}" + systemProperty 'oie.cliHome', project(':server').file('setup').path systemProperties System.getProperties().findAll { it.key.toString().startsWith('oie.') } } From 197a6c2049947c55798960d711f6b658b374df28 Mon Sep 17 00:00:00 2001 From: Mitch Gaffigan Date: Wed, 25 Nov 2026 11:05:51 -0600 Subject: [PATCH 2/9] Comment the empty default password Config files only keep the first occurrence of each property. Keep the first occurrence commented so appending to the end of the file will have an effect. Signed-off-by: Mitch Gaffigan --- server/conf/mirth.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/conf/mirth.properties b/server/conf/mirth.properties index 4c9894277..28bd664b0 100644 --- a/server/conf/mirth.properties +++ b/server/conf/mirth.properties @@ -56,7 +56,7 @@ server.api.accesscontrolmaxage = # Password for the admin user, only applied when the database is first created. # If blank, a random password is generated and written to the log once on first startup. -server.initialadminpassword = +# server.initialadminpassword = # Determines whether or not channels are deployed on server startup. server.startupdeploy = true From 5d4ef87e96dcd357e1312cc47c10c75073f80f9f Mon Sep 17 00:00:00 2001 From: Mitch Gaffigan Date: Wed, 25 Nov 2026 11:23:41 -0600 Subject: [PATCH 3/9] Ensure server is healthy before running tests Signed-off-by: Mitch Gaffigan --- .../smoketest/CommandLineClient.java | 4 +-- .../smoketest/CommandLineInterfaceTest.java | 16 +++++---- .../smoketest/OieServer.java | 35 +++++++++++++++++++ .../smoketest/WebServiceListenerTest.java | 2 +- 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/smoketest/src/test/java/org/openintegrationengine/smoketest/CommandLineClient.java b/smoketest/src/test/java/org/openintegrationengine/smoketest/CommandLineClient.java index a0e6c85be..0e39d4612 100644 --- a/smoketest/src/test/java/org/openintegrationengine/smoketest/CommandLineClient.java +++ b/smoketest/src/test/java/org/openintegrationengine/smoketest/CommandLineClient.java @@ -31,8 +31,8 @@ private CommandLineClient() { /** Runs the CLI against the server under test, feeding it {@code statements} as a script. */ static Result runScript(String... statements) throws Exception { - return runScriptAgainst(HarnessConfig.BASE_URL, HarnessConfig.USERNAME, HarnessConfig.PASSWORD, - statements); + OieServer server = SharedServer.get(); + return runScriptAgainst(server.baseUrl(), server.username(), server.password(), statements); } /** As {@link #runScript}, against an address and credentials of the caller's choosing. */ diff --git a/smoketest/src/test/java/org/openintegrationengine/smoketest/CommandLineInterfaceTest.java b/smoketest/src/test/java/org/openintegrationengine/smoketest/CommandLineInterfaceTest.java index 0f77909b2..ef1078718 100644 --- a/smoketest/src/test/java/org/openintegrationengine/smoketest/CommandLineInterfaceTest.java +++ b/smoketest/src/test/java/org/openintegrationengine/smoketest/CommandLineInterfaceTest.java @@ -42,13 +42,14 @@ void printsUsageForHelp() throws Exception { void logsInAndReportsServerVersion() throws Exception { // Read over the API, so a match proves the CLI reached this server rather than // echoing back the address it was given. - String version = SharedServer.get().version(); + OieServer server = SharedServer.get(); + String version = server.version(); CommandLineClient.Result result = CommandLineClient.runScript("status"); assertEquals(0, result.exitCode(), () -> "the CLI did not exit cleanly: " + result); - assertTrue(result.output().contains("Server @ " + HarnessConfig.BASE_URL + " (" + version + ")"), - () -> "the CLI did not report a connection to " + HarnessConfig.BASE_URL + assertTrue(result.output().contains("Server @ " + server.baseUrl() + " (" + version + ")"), + () -> "the CLI did not report a connection to " + server.baseUrl() + " running " + version + ": " + result); // A failed logout prints "Error: ..." and then "Disconnected from server." anyway. assertFalse(result.output().contains("Error:"), @@ -63,7 +64,7 @@ void exitsWhenServerIsUnreachable() throws Exception { // The client's connection monitor is a non-daemon thread: a CLI that leaves it // running never exits, and this fails on the timeout rather than an assertion. CommandLineClient.Result result = CommandLineClient.runScriptAgainst( - "https://127.0.0.1:1", HarnessConfig.USERNAME, HarnessConfig.PASSWORD, "status"); + "https://127.0.0.1:1", "admin", "unused", "status"); assertFalse(result.output().contains("Server @ "), () -> "the CLI reported a connection it could not have made: " + result); @@ -75,11 +76,12 @@ void exitsWhenServerIsUnreachable() throws Exception { @Test @DisplayName("runs read-only commands against the live server") void runsReadOnlyCommands() throws Exception { + OieServer server = SharedServer.get(); CommandLineClient.Result result = CommandLineClient.runScript("status", "channel list", "user list"); assertEquals(0, result.exitCode(), () -> "the CLI did not exit cleanly: " + result); - assertTrue(result.output().contains("Server @ " + HarnessConfig.BASE_URL), + assertTrue(result.output().contains("Server @ " + server.baseUrl()), () -> "the CLI never reported a connection: " + result); assertTrue(result.output().contains("Status\t\tName"), @@ -88,8 +90,8 @@ void runsReadOnlyCommands() throws Exception { () -> "no channel listing: " + result); assertTrue(result.output().contains("User Name"), () -> "no user listing: " + result); - assertTrue(result.output().contains(HarnessConfig.USERNAME), - () -> "user listing omits " + HarnessConfig.USERNAME + ": " + result); + assertTrue(result.output().contains(server.username()), + () -> "user listing omits " + server.username() + ": " + result); // A failed statement prints "Error: ..." or a stack trace, and does not change the exit code. assertFalse(result.output().contains("Error:"), diff --git a/smoketest/src/test/java/org/openintegrationengine/smoketest/OieServer.java b/smoketest/src/test/java/org/openintegrationengine/smoketest/OieServer.java index 962eabba0..2a9700994 100644 --- a/smoketest/src/test/java/org/openintegrationengine/smoketest/OieServer.java +++ b/smoketest/src/test/java/org/openintegrationengine/smoketest/OieServer.java @@ -18,6 +18,7 @@ import com.mirth.connect.model.LoginStatus; import com.mirth.connect.model.converters.ObjectXMLSerializer; import com.mirth.connect.model.filters.MessageFilter; +import com.mirth.connect.server.controllers.ConfigurationController; import com.mirth.connect.util.MirthSSLUtil; /** @@ -46,6 +47,7 @@ static OieServer connect() { Client client = newClient(); try { + awaitHealthy(client); LoginStatus status = client.login(HarnessConfig.USERNAME, HarnessConfig.PASSWORD); if (status == null || !status.isSuccess()) { throw new IllegalStateException("Login as " + HarnessConfig.USERNAME + " failed: " @@ -63,6 +65,39 @@ static OieServer connect() { return new OieServer(client); } + /** + * Waits for the server's unauthenticated status endpoint to report it has started, so the + * harness can be launched alongside the server. + */ + private static void awaitHealthy(Client client) throws Exception { + Harness.awaitAsserted(() -> { + int status; + try { + status = client.getStatus(); + } catch (ClientException e) { + throw new AssertionError("Could not reach " + HarnessConfig.BASE_URL, e); + } + if (status != ConfigurationController.STATUS_OK) { + throw new AssertionError("Server at " + HarnessConfig.BASE_URL + " has status " + status); + } + }); + } + + /** The base URL of the server this is connected to. */ + public String baseUrl() { + return HarnessConfig.BASE_URL; + } + + /** The user this is logged in as. */ + public String username() { + return HarnessConfig.USERNAME; + } + + /** The password of {@link #username()}, for a client that needs its own session. */ + public String password() { + return HarnessConfig.PASSWORD; + } + /** * Creates a client for the server under test that has not logged in, for tests that need a * session other than the shared one. diff --git a/smoketest/src/test/java/org/openintegrationengine/smoketest/WebServiceListenerTest.java b/smoketest/src/test/java/org/openintegrationengine/smoketest/WebServiceListenerTest.java index 63de56155..9f6fffa60 100644 --- a/smoketest/src/test/java/org/openintegrationengine/smoketest/WebServiceListenerTest.java +++ b/smoketest/src/test/java/org/openintegrationengine/smoketest/WebServiceListenerTest.java @@ -58,7 +58,7 @@ static void undeploy() { @Test @DisplayName("accepts a SOAP request") void acceptsSoapRequest() throws Exception { - URI endpoint = new URI("http", null, URI.create(HarnessConfig.BASE_URL).getHost(), PORT, + URI endpoint = new URI("http", null, URI.create(SharedServer.get().baseUrl()).getHost(), PORT, "/services/" + SERVICE, null, null); HttpRequest request = HttpRequest.newBuilder(endpoint) From 0d547944462a31e8386726c5837b013abd46030e Mon Sep 17 00:00:00 2001 From: Mitch Gaffigan Date: Wed, 25 Nov 2026 11:36:36 -0600 Subject: [PATCH 4/9] Fix build error on windows due to javadoc Signed-off-by: Mitch Gaffigan --- server/build.gradle | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/build.gradle b/server/build.gradle index 1356c2301..c2612bdf4 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -504,10 +504,14 @@ def userApiJavadoc = tasks.register('userApiJavadoc') { dependsOn syncDonkeyLibs doLast { outDir.mkdirs() + // The classpath goes in an argfile: on Windows it exceeds the command-line limit. + def classpathFile = new File(temporaryDir, 'classpath.args') + def classpath = (configurations.compileClasspath + fileTree(dir: 'lib', include: '**/*.jar')).asPath + classpathFile.text = "-classpath \"${classpath.replace('\\', '/')}\"\n" def cmd = [new File(System.getProperty('java.home'), 'bin/javadoc').absolutePath, '-d', outDir.absolutePath, '-notimestamp', - '-classpath', (configurations.compileClasspath + fileTree(dir: 'lib', include: '**/*.jar')).asPath, + '@' + classpathFile.absolutePath, '-sourcepath', file('src/main/java').absolutePath, '-link', 'https://docs.oracle.com/en/java/javase/17/docs/api/', '-bottom', '\n\t\t\t\tLicensed under the Mozilla Public License 2.0.\n\t\t\t', From bf23430a13fdc6e647c3a3b24b9691783173dd77 Mon Sep 17 00:00:00 2001 From: Mitch Gaffigan Date: Wed, 25 Nov 2026 11:48:11 -0600 Subject: [PATCH 5/9] Fix smoke test failure on windows due to EOL Signed-off-by: Mitch Gaffigan --- .../smoketest/MessageAssertions.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/smoketest/src/test/java/org/openintegrationengine/smoketest/MessageAssertions.java b/smoketest/src/test/java/org/openintegrationengine/smoketest/MessageAssertions.java index b99ca9a28..e087a979d 100644 --- a/smoketest/src/test/java/org/openintegrationengine/smoketest/MessageAssertions.java +++ b/smoketest/src/test/java/org/openintegrationengine/smoketest/MessageAssertions.java @@ -195,13 +195,21 @@ private static void assertMatches(String label, String expected, String actual) if (actual == null) { throw new AssertionError("Expected " + label + " content but the server stored none"); } - if (!toPattern(expected).matcher(actual).matches()) { + if (!toPattern(normalizeLineEndings(expected)).matcher(normalizeLineEndings(actual)).matches()) { throw new AssertionError("Content mismatch for " + label + "\n expected: " + describe(expected) + "\n actual: " + describe(actual)); } } + /** + * The server's XML serializers break lines with the platform's separator, so CRLF matches + * LF. A lone CR stays significant: it separates HL7 segments. + */ + private static String normalizeLineEndings(String content) { + return content.replace("\r\n", "\n"); + } + /** Quotes the fixture text, leaving {@value #ANY_WILDCARD} as a lazy match-anything. */ private static Pattern toPattern(String expected) { StringBuilder regex = new StringBuilder(); From 6e891926376cc80dfed02d71481699bd80f60cfb Mon Sep 17 00:00:00 2001 From: Mitch Gaffigan Date: Wed, 25 Nov 2026 11:52:32 -0600 Subject: [PATCH 6/9] Add windows smoke test Signed-off-by: Mitch Gaffigan --- .github/workflows/build.yaml | 43 +++++++++++++++++++++++++++++++++++- ci/README.md | 5 ++++- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index cc3954b35..fea1a244b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -106,8 +106,49 @@ jobs: path: | ci/test-results/**/*.xml + windows: + runs-on: windows-latest + timeout-minutes: 30 + + defaults: + run: + shell: pwsh + + steps: + # Fixtures are compared byte-for-byte; keep the repository's line endings + # instead of the runner's default core.autocrlf=true. + - run: git config --global core.autocrlf false + + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + # Same JDK as .sdkmanrc; the client needs JavaFX. + - uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 + with: + distribution: zulu + java-version: '17.0.17' + java-package: jdk+fx + cache: gradle + + - name: Build and run unit tests + run: .\gradlew.bat build -PdisableSigning=true + + # The server runs from server\setup, so don't let Gradle re-stage it. + - name: Run smoke tests + run: | + Add-Content server\setup\conf\mirth.properties 'server.initialadminpassword = ci-smoke-admin' + server\setup\oieserver.ps1 & + .\gradlew.bat :smoketest:test -x :server:createSetup -PdisableSigning=true "-Doie.baseUrl=https://localhost:8443" "-Doie.password=ci-smoke-admin" "-Doie.configuration=windows-zulu17-derby" + + - name: Upload Test Results + if: (!cancelled()) + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: Test Results (windows) + path: | + **/build/test-results/**/*.xml + test-results: - needs: [build, integration-test] + needs: [build, integration-test, windows] if: (!cancelled()) runs-on: ubuntu-latest diff --git a/ci/README.md b/ci/README.md index 1fd3f24e9..8c6e795f8 100644 --- a/ci/README.md +++ b/ci/README.md @@ -63,7 +63,7 @@ The rest are optional assertions against the message the channel produced: `NN` is the destination connector's metadata ID: `dest01` is the first destination, `dest02` the second, and so on. Metadata files are YAML mappings; list -only the keys that matter to the test. Content assertions are byte-for-byte, except +only the keys that matter to the test. Content assertions are line-by-line, except that `((ANY))` matches variable content such as generated IDs or timestamps. A fixture case runs in every configuration by default. To limit it, add a @@ -74,6 +74,9 @@ alpine-temurin21-postgres ubuntu-temurin21-postgres ``` +The `windows` CI job also runs the smoke tests, as `windows-zulu17-derby`, against +a server outside of a container. + ### Parse Batch If you are using "Parse Batch" mode, put each expected message's assertion From 4c85c9da98c66a79176ecee86a3e169c615824a0 Mon Sep 17 00:00:00 2001 From: Mitch Gaffigan Date: Wed, 25 Nov 2026 11:59:15 -0600 Subject: [PATCH 7/9] Replace the shell javadoc invocation with gradle Signed-off-by: Mitch Gaffigan --- server/build.gradle | 49 ++++++++++++--------------------------------- 1 file changed, 13 insertions(+), 36 deletions(-) diff --git a/server/build.gradle b/server/build.gradle index c2612bdf4..8acd64015 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -488,43 +488,20 @@ def createServerExtensions = tasks.register('createServerExtensions') { // Javadocs (user API), part of the distributed docs // --------------------------------------------------------------------- -// Invokes the javadoc tool directly: the multiline -bottom argument -// (whitespace from the old build.xml CDATA block) cannot pass through -// Gradle's javadoc options file, and the generated HTML should be -// identical to the Ant build's. -def userApiJavadoc = tasks.register('userApiJavadoc') { +def userApiJavadoc = tasks.register('userApiJavadoc', Javadoc) { description = 'Generates the user API javadocs into docs/javadocs/user-api.' - def outDir = file('docs/javadocs/user-api') - inputs.files(fileTree('src/main/java') { - include 'com/mirth/connect/server/userutil/**' - include 'com/mirth/connect/userutil/**' - include 'com/mirth/connect/plugins/httpauth/userutil/**' - }) - outputs.dir outDir - dependsOn syncDonkeyLibs - doLast { - outDir.mkdirs() - // The classpath goes in an argfile: on Windows it exceeds the command-line limit. - def classpathFile = new File(temporaryDir, 'classpath.args') - def classpath = (configurations.compileClasspath + fileTree(dir: 'lib', include: '**/*.jar')).asPath - classpathFile.text = "-classpath \"${classpath.replace('\\', '/')}\"\n" - def cmd = [new File(System.getProperty('java.home'), 'bin/javadoc').absolutePath, - '-d', outDir.absolutePath, - '-notimestamp', - '@' + classpathFile.absolutePath, - '-sourcepath', file('src/main/java').absolutePath, - '-link', 'https://docs.oracle.com/en/java/javase/17/docs/api/', - '-bottom', '\n\t\t\t\tLicensed under the Mozilla Public License 2.0.\n\t\t\t', - '--add-modules=java.sql.rowset', - '--add-exports=java.sql.rowset/com.sun.rowset=ALL-UNNAMED', - 'com.mirth.connect.server.userutil', - 'com.mirth.connect.userutil', - 'com.mirth.connect.plugins.httpauth.userutil'] - def proc = new ProcessBuilder(cmd).redirectErrorStream(true).start() - def out = proc.inputStream.text - if (proc.waitFor() != 0) { - throw new GradleException("javadoc failed:\n${out}") - } + source = fileTree('src/main/java') { + include 'com/mirth/connect/server/userutil/*.java' + include 'com/mirth/connect/userutil/*.java' + include 'com/mirth/connect/plugins/httpauth/userutil/*.java' + } + classpath = sourceSets.main.output + sourceSets.main.compileClasspath + destinationDir = file('docs/javadocs/user-api') + title = null + options { + noTimestamp = true + links 'https://docs.oracle.com/en/java/javase/17/docs/api/' + bottom = 'Licensed under the Mozilla Public License 2.0.' } } From 917d1e973fa3dbe5ddcc7cc69f1458d8987360a9 Mon Sep 17 00:00:00 2001 From: Mitch Gaffigan Date: Wed, 25 Nov 2026 12:12:48 -0600 Subject: [PATCH 8/9] Fix gradle caching on windows. Collect logs Signed-off-by: Mitch Gaffigan --- .github/workflows/build.yaml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fea1a244b..7d4c59687 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -136,8 +136,14 @@ jobs: - name: Run smoke tests run: | Add-Content server\setup\conf\mirth.properties 'server.initialadminpassword = ci-smoke-admin' - server\setup\oieserver.ps1 & + $server = server\setup\oieserver.ps1 & .\gradlew.bat :smoketest:test -x :server:createSetup -PdisableSigning=true "-Doie.baseUrl=https://localhost:8443" "-Doie.password=ci-smoke-admin" "-Doie.configuration=windows-zulu17-derby" + $testExit = $LASTEXITCODE + Stop-Job $server + "::group::Server output" + Receive-Job $server 2>&1 | Out-String + "::endgroup::" + exit $testExit - name: Upload Test Results if: (!cancelled()) @@ -147,6 +153,11 @@ jobs: path: | **/build/test-results/**/*.xml + # The daemon holds locks in the Gradle cache, which setup-java then cannot save. + - name: Stop Gradle + if: always() + run: .\gradlew.bat --stop + test-results: needs: [build, integration-test, windows] if: (!cancelled()) From a9759d675c22ecbfd9efcf065e07b99e8f3966e3 Mon Sep 17 00:00:00 2001 From: Mitch Gaffigan Date: Tue, 1 Dec 2026 16:18:31 -0600 Subject: [PATCH 9/9] Apply suggestion from @NicoPiel Co-authored-by: Nico Piel Signed-off-by: Mitch Gaffigan --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7d4c59687..071aade2f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -141,7 +141,7 @@ jobs: $testExit = $LASTEXITCODE Stop-Job $server "::group::Server output" - Receive-Job $server 2>&1 | Out-String + Receive-Job $server -ErrorAction Continue 2>&1 | Out-String "::endgroup::" exit $testExit