This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-4.4.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.4.x by this push: new c7d5621d446 CAMEL-21048: Add required dot in MLLP ACK timestamp pattern. (#15030) c7d5621d446 is described below commit c7d5621d446220ad44287ec5811116f4aa10c629 Author: deibl <david.eibl...@gmail.com> AuthorDate: Tue Aug 6 17:01:41 2024 +0200 CAMEL-21048: Add required dot in MLLP ACK timestamp pattern. (#15030) Co-authored-by: David Eibl <david.e...@raya-diagnostics.com> --- .../org/apache/camel/component/mllp/internal/Hl7Util.java | 2 +- .../org/apache/camel/component/mllp/internal/Hl7UtilTest.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/Hl7Util.java b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/Hl7Util.java index 838a3d5f924..355c42357ef 100644 --- a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/Hl7Util.java +++ b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/Hl7Util.java @@ -35,7 +35,7 @@ public final class Hl7Util { public static final Map<Character, String> CHARACTER_REPLACEMENTS; - public static final SimpleDateFormat TIMESTAMP_FORMAT = new SimpleDateFormat("yyyyMMddHHmmssSSSZZZZ"); + public static final SimpleDateFormat TIMESTAMP_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss.SSSZZZZ"); static final int STRING_BUFFER_PAD_SIZE = 100; diff --git a/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/internal/Hl7UtilTest.java b/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/internal/Hl7UtilTest.java index 182f0d57bf9..f4b17f64d01 100644 --- a/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/internal/Hl7UtilTest.java +++ b/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/internal/Hl7UtilTest.java @@ -29,6 +29,7 @@ import static org.apache.camel.component.mllp.MllpExceptionTestSupport.LOG_PHI_T import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.startsWith; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.matchesPattern; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -208,6 +209,16 @@ public class Hl7UtilTest { assertThat(actual, endsWith(EXPECTED_ACKNOWLEDGEMENT_PAYLOAD_END)); } + @Test + public void testGenerateAcknowledgementPayloadTimestamp() throws Exception { + MllpSocketBuffer mllpSocketBuffer = new MllpSocketBuffer(new MllpEndpointStub()); + hl7util.generateAcknowledgementPayload(mllpSocketBuffer, TEST_MESSAGE.getBytes(), "AA"); + + String actualMsh7Field = mllpSocketBuffer.toString().split("\\|")[6]; + + assertThat(actualMsh7Field, matchesPattern("\\d{14}\\.\\d{3}[+-]\\d{4}")); + } + /** * Description of test. *