From 79c411ca267f8de7bcd8390d7396acde24045929 Mon Sep 17 00:00:00 2001 From: Matt Cook Date: Tue, 10 Dec 2024 14:04:00 -0700 Subject: [PATCH] test: add missing SRM test case to GenericReceiverTest Signed-off-by: Matt Cook --- .../ode/udp/generic/GenericReceiverTest.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/udp/generic/GenericReceiverTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/udp/generic/GenericReceiverTest.java index 13c717380..684cedc3a 100644 --- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/udp/generic/GenericReceiverTest.java +++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/udp/generic/GenericReceiverTest.java @@ -43,7 +43,8 @@ "ode.kafka.topics.raw-encoded-json.psm=topic.GenericReceiverTestPSM", "ode.kafka.topics.raw-encoded-json.spat=topic.GenericReceiverTestSPAT", "ode.kafka.topics.raw-encoded-json.ssm=topic.GenericReceiverTestSSM", - "ode.kafka.topics.raw-encoded-json.tim=topic.GenericReceiverTestTIM" + "ode.kafka.topics.raw-encoded-json.tim=topic.GenericReceiverTestTIM", + "ode.kafka.topics.raw-encoded-json.srm=topic.GenericReceiverTestSRM" } ) @ContextConfiguration(classes = { @@ -73,7 +74,8 @@ void testRun() throws Exception { new NewTopic(rawEncodedJsonTopics.getSpat(), 1, (short) 1), new NewTopic(rawEncodedJsonTopics.getSrm(), 1, (short) 1), new NewTopic(rawEncodedJsonTopics.getSsm(), 1, (short) 1), - new NewTopic(rawEncodedJsonTopics.getTim(), 1, (short) 1) + new NewTopic(rawEncodedJsonTopics.getTim(), 1, (short) 1), + new NewTopic(rawEncodedJsonTopics.getSrm(), 1, (short) 1) ); } catch (Exception e) { // Ignore topic creation exceptions @@ -99,7 +101,8 @@ void testRun() throws Exception { rawEncodedJsonTopics.getPsm(), rawEncodedJsonTopics.getSpat(), rawEncodedJsonTopics.getTim(), - rawEncodedJsonTopics.getBsm() + rawEncodedJsonTopics.getBsm(), + rawEncodedJsonTopics.getSrm() ); DateTimeUtils.setClock(Clock.fixed(Instant.parse("2024-11-26T23:53:21.120Z"), ZoneOffset.UTC)); @@ -164,6 +167,17 @@ void testRun() throws Exception { var timRecord = KafkaTestUtils.getSingleRecord(consumer, rawEncodedJsonTopics.getTim()); assertExpected("Produced TIM message does not match expected", timRecord.value(), expectedTim); + + String srmFileContent = Files.readString( + Paths.get("src/test/resources/us/dot/its/jpo/ode/udp/srm/SrmReceiverTest_ValidData.txt") + ); + String expectedSrm = Files.readString( + Paths.get("src/test/resources/us/dot/its/jpo/ode/udp/srm/SrmReceiverTest_ExpectedOutput.json") + ); + udpClient.send(srmFileContent); + + var srmRecord = KafkaTestUtils.getSingleRecord(consumer, rawEncodedJsonTopics.getSrm()); + assertExpected("Produced SRM message does not match expected", srmRecord.value(), expectedSrm); } private static void assertExpected(String failureMsg, String actual, String expected) {