Skip to content

Commit

Permalink
test: add missing SRM test case to GenericReceiverTest
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Cook <[email protected]>
  • Loading branch information
mcook42 committed Dec 10, 2024
1 parent b40a2c4 commit 79c411c
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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
Expand All @@ -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));
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 79c411c

Please sign in to comment.