Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
fe59c5a
test: disable broken test Asn1DecodedDataRouterTIMDataFlow with Disab…
pmonington Apr 9, 2026
c3ec53d
tool: use rewrite recipe to update dependencies and plugins in pom fi…
pmonington Apr 14, 2026
d53aeda
test: refactor RawEncodedTIMJsonRouterTest to use @EmbeddedKafka and …
pmonington Mar 26, 2026
2b2316a
test: refactor RawEncodedSSMJsonRouterTest to use @EmbeddedKafka and …
pmonington Mar 26, 2026
cfed20b
test: refactor RawEncodedSRMJsonRouterTest to use EmbeddedKafka and C…
pmonington Mar 26, 2026
2bd4a54
test: refactor MapReceiverTest to use @EmbeddedKafka and @KafkaListener
pmonington Mar 26, 2026
4ce1ee7
refactor: update related imports for Spring updates
pmonington Mar 26, 2026
5086432
refactor: replace io.netty UnsupportedMessageTypeException with custo…
pmonington Apr 14, 2026
ae07690
fix: update EmbeddedKafkaHolder to use EmbeddedKafkaKraftBroker inste…
pmonington Mar 23, 2026
32348bc
test: refactor SrmReceiverTest to use @EmbeddedKafka and @KafkaListen…
pmonington Mar 26, 2026
f5f2d02
test: refactor SsmReceiverTest to use @EmbeddedKafka and @KafkaListen…
pmonington Mar 26, 2026
1d0831c
test: refactor RtcmReceiverTest to use @EmbeddedKafka and @KafkaListe…
pmonington Mar 26, 2026
71c481d
test: refactor SdsmReceiverTest to use @EmbeddedKafka and @KafkaListe…
pmonington Mar 26, 2026
71559e4
test: refactor PsmReceiverTest to use @EmbeddedKafka and @KafkaListen…
pmonington Mar 26, 2026
bcd51cc
test: refactor SpatReceiverTest to use @EmbeddedKafka and @KafkaListe…
pmonington Mar 26, 2026
5eb8e03
test: remove EmbeddedKafkaHolder usage in SpatReceiverTest
pmonington Mar 26, 2026
43ff246
test: refactor RawEncodedSRMJsonRouterTest to use @EmbeddedKafka and …
pmonington Mar 26, 2026
3fc9477
test: remove unused imports in RawEncodedSRMJsonRouterTest
pmonington Mar 26, 2026
352f139
test: refactor RawEncodedBSMJsonRouterTest to use @EmbeddedKafka and …
pmonington Mar 24, 2026
bf831a0
chore: remove obsolete kafka_2.11 dependency from pom.xml
pmonington Mar 23, 2026
43583a9
test: replace EmbeddedKafkaHolder with @EmbeddedKafka and @KafkaListe…
pmonington Mar 25, 2026
cacd39d
test: refactor RsmReceiverTest to use @EmbeddedKafka and @KafkaListen…
pmonington Mar 26, 2026
8f73dfa
refactor(test): update KafkaProperties import paths to align with Spr…
pmonington Apr 14, 2026
1bd9860
test: replace EmbeddedKafkaHolder with @EmbeddedKafka in Asn1EncodedD…
pmonington Apr 15, 2026
69c7179
test: replace EmbeddedKafkaHolder with @EmbeddedKafka in Asn1DecodedD…
pmonington Apr 15, 2026
65a81c0
refactor: add @Getter annotation to ensure proper serialization of is…
pmonington Apr 16, 2026
8d2fcfd
test: replace EmbeddedKafkaHolder with @EmbeddedKafka in TimDepositCo…
pmonington Apr 16, 2026
ea39409
test: replace EmbeddedKafkaHolder with @EmbeddedKafka in KafkaProduce…
pmonington Apr 17, 2026
f4ada6d
tool: add lombok configuration to copy Jackson annotations to accessors
pmonington Apr 17, 2026
ea24e34
Revert "refactor: add @Getter annotation to ensure proper serializati…
pmonington Apr 17, 2026
00cc4f9
test: remove test topics from kafka listener
pmonington Apr 17, 2026
f96e89c
test: simplify @EmbeddedKafka usage by removing topic and partition c…
pmonington Apr 21, 2026
6c416e3
test: remove depreciated `KafkaTestUtils.consumerProps` to use update…
pmonington Apr 21, 2026
ec7a850
chore: remove redundant imports and comments across test and controll…
pmonington Apr 21, 2026
cd6dd26
test: replace `Path.of` with `Paths.get` in UDP receiver test classes
pmonington Apr 21, 2026
5974153
test: remove unused @Autowired fields, redundant imports, and outdate…
pmonington Apr 21, 2026
acb3827
chore: move jakarta annotation imports to before java.util imports
pmonington Apr 21, 2026
1b7b13a
chore: add checkout step with recursive submodules in Azure pipeline
payneBrandon Apr 21, 2026
9b8242e
tool: add lombok.config to enable copying Jackson annotations to acce…
pmonington Apr 23, 2026
1e30b07
Revert "tool: add lombok.config to enable copying Jackson annotations…
pmonington Apr 23, 2026
0954019
chore: downgrade Lombok version to 1.18.30 to fix compatibility issue…
pmonington Apr 23, 2026
d99effd
docs: add comments to pom.xml explaining Lombok upgrade consideration…
pmonington Apr 24, 2026
49215c1
chore: bump project version to 6.0.0 and update compatibility matrix …
pmonington Apr 27, 2026
481c0e6
test: fix formatting in @TestPropertySource annotation in RawEncodedS…
pmonington Apr 27, 2026
22e42fc
test: remove redundant @ContextConfiguration annotations in test classes
pmonington Apr 27, 2026
33cf993
chore: remove redundant version tags for Spring Boot dependencies in …
pmonington Apr 27, 2026
83bbc9f
test: reduce latch timeout from 10s to 3s across test classes
pmonington Apr 27, 2026
d281b06
docs: update compatibility matrix to reflect pending migration for ve…
pmonington Apr 27, 2026
5988459
test: remove unused @Slf4j annotation from MapReceiverTest
pmonington May 1, 2026
c1f06d8
test: remove unused `ode.kafka.topics.raw-encoded-json.bsm` property …
pmonington May 1, 2026
49f5643
test: replace field injection with constructor injection in RawEncode…
pmonington May 1, 2026
9035c2f
test: replace CountDownLatch with CompletableFuture in test classes f…
pmonington May 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .azure/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ pool:
vmImage: ubuntu-latest

steps:
- checkout: self
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not related to the spring upgrade, but is instead needed to be able to build and deploy the ode.

submodules: recursive

- task: CopyFiles@2
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Expand Down
23 changes: 12 additions & 11 deletions docs/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
This table serves as a guide, suggesting which versions of individual submodules are best suited to accompany each version of the main module. It helps users ensure compatibility and smooth integration by recommending specific submodule versions for their chosen main module version.

| [ODE (this project)](https://github.com/usdot-jpo-ode/jpo-ode/releases) | [ACM](https://github.com/usdot-jpo-ode/asn1_codec/releases) | [PPM](https://github.com/usdot-jpo-ode/jpo-cvdp/releases) | [SEC](https://github.com/usdot-jpo-ode/jpo-security-svcs/releases) | [SDWD](https://github.com/usdot-jpo-ode/jpo-sdw-depositor/releases) | [S3D](https://github.com/usdot-jpo-ode/jpo-s3-deposit/releases) | [GJConverter](https://github.com/usdot-jpo-ode/jpo-geojsonconverter/releases) | [CMonitor](https://github.com/usdot-jpo-ode/jpo-conflictmonitor/releases) | [CVisualizer](https://github.com/usdot-jpo-ode/jpo-conflictvisualizer/releases) | [CVManager](https://github.com/usdot-jpo-ode/jpo-cvmanager/releases) | [MEC](https://github.com/usdot-jpo-ode/jpo-mec-deposit/releases) |
|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
| 5.1.0 | 3.2.0 | 1.6.0 | 1.7.0 | 1.10.0 | 1.7.1 | 3.2.0 | 3.1.0 | N/A | 2.0.0 | 1.0.0 |
| 4.1.2 | 3.1.0 | 1.5.0 | 1.6.0 | 1.9.1 | 1.7.1 | 2.1.0 | 2.1.0 | 1.5.0 | 1.6.0 | N/A |
| 4.0.0 | 3.0.0 | 1.5.0 | 1.5.0 | 1.9.0 | 1.7.0 | 2.0.0 | 2.0.0 | 1.5.0 | 1.5.0 | N/A |
| 3.0.0 | 2.2.0 | 1.4.0 | 1.5.0 | 1.8.0 | 1.6.0 | 1.4.2 | 1.4.2 | 1.4.1 | 1.4.0 | N/A |
| 2.1.0 | 2.1.0 | 1.3.0 | 1.4.0 | 1.7.0 | 1.5.0 | 1.3.0 | 1.3.0 | 1.3.0 | 1.3.0 | N/A |
| 2.0.x | 2.0.0 | 1.3.0 | 1.4.0 | 1.6.0 | 1.4.0 | 1.2.0 | 1.2.0 | 1.2.0 | 1.2.0 | N/A |
| 1.5.1 | 1.5.0 | 1.2.0 | 1.3.0 | 1.5.0 | 1.3.0 | 1.1.0 | 1.1.0 | 1.1.0 | 1.1.0 | N/A |
| 1.4.1 | 1.4.1 | 1.1.1 | 1.2.1 | 1.4.1 | 1.2.1 | 1.0.0 | 1.0.1 | 1.0.1 | 1.0.1 | N/A |
| 1.4.0 | 1.4.0 | 1.1.0 | 1.2.0 | 1.4.0 | 1.2.0 | N/A | N/A | N/A | N/A | N/A |
| 1.3.0 | 1.3.0 | 1.0.0 | 1.0.1 | 1.3.0 | 1.1.0 | N/A | N/A | N/A | N/A | N/A |
|-------------------------------------------------------------------------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
| 6.0.0 | TBD - migration pending | TBD - migration pending | TBD - migration pending | TBD - migration pending | TBD - migration pending |TBD - migration pending | TBD - migration pending | TBD - migration pending | TBD - migration pending | TBD - migration pending |
| 5.1.0 | 3.2.0 | 1.6.0 | 1.7.0 | 1.10.0 | 1.7.1 | 3.2.0 | 3.1.0 | N/A | 2.0.0 | 1.0.0 |
| 4.1.2 | 3.1.0 | 1.5.0 | 1.6.0 | 1.9.1 | 1.7.1 | 2.1.0 | 2.1.0 | 1.5.0 | 1.6.0 | N/A |
| 4.0.0 | 3.0.0 | 1.5.0 | 1.5.0 | 1.9.0 | 1.7.0 | 2.0.0 | 2.0.0 | 1.5.0 | 1.5.0 | N/A |
| 3.0.0 | 2.2.0 | 1.4.0 | 1.5.0 | 1.8.0 | 1.6.0 | 1.4.2 | 1.4.2 | 1.4.1 | 1.4.0 | N/A |
| 2.1.0 | 2.1.0 | 1.3.0 | 1.4.0 | 1.7.0 | 1.5.0 | 1.3.0 | 1.3.0 | 1.3.0 | 1.3.0 | N/A |
| 2.0.x | 2.0.0 | 1.3.0 | 1.4.0 | 1.6.0 | 1.4.0 | 1.2.0 | 1.2.0 | 1.2.0 | 1.2.0 | N/A |
| 1.5.1 | 1.5.0 | 1.2.0 | 1.3.0 | 1.5.0 | 1.3.0 | 1.1.0 | 1.1.0 | 1.1.0 | 1.1.0 | N/A |
| 1.4.1 | 1.4.1 | 1.1.1 | 1.2.1 | 1.4.1 | 1.2.1 | 1.0.0 | 1.0.1 | 1.0.1 | 1.0.1 | N/A |
| 1.4.0 | 1.4.0 | 1.1.0 | 1.2.0 | 1.4.0 | 1.2.0 | N/A | N/A | N/A | N/A | N/A |
| 1.3.0 | 1.3.0 | 1.0.0 | 1.0.1 | 1.3.0 | 1.1.0 | N/A | N/A | N/A | N/A | N/A |

For example, if you're using ODE version 2.0.1, it's recommended to use ACM 2.0.0, PPM 1.3.0, SEC 1.4.0, SDWD 1.6.0, S3D 1.4.0, GJConverter 1.2.0, CMonitor 1.2.0, CVisualizer 1.2.0, and CVManager 1.2.0. While other combinations may work, these versions are suggested for the best compatibility.

Expand Down
9 changes: 4 additions & 5 deletions jpo-ode-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode</artifactId>
<version>5.1.0</version>
<version>6.0.0</version>
</parent>

<artifactId>jpo-ode-common</artifactId>
Expand Down Expand Up @@ -39,12 +39,11 @@
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.0</version>
<version>4.0.5</version>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-client-api</artifactId>
<version>1.1</version>
<groupId>jakarta.websocket</groupId>
<artifactId>jakarta.websocket-client-api</artifactId>
</dependency>
<dependency>
<groupId>com.esotericsoftware</groupId>
Expand Down
21 changes: 3 additions & 18 deletions jpo-ode-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode</artifactId>
<version>5.1.0</version>
<version>6.0.0</version>
</parent>

<artifactId>jpo-ode-core</artifactId>
Expand All @@ -25,12 +25,12 @@
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode-common</artifactId>
<version>5.1.0</version>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode-plugins</artifactId>
<version>5.1.0</version>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
Expand All @@ -57,21 +57,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.11</artifactId>
<version>0.10.1.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-streams</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions jpo-ode-plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode</artifactId>
<version>5.1.0</version>
<version>6.0.0</version>
</parent>
<properties>
<!-- SonarQube Properties -->
Expand All @@ -27,7 +27,7 @@
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode-common</artifactId>
<version>5.1.0</version>
<version>6.0.0</version>
</dependency>
<!-- TODO open-ode
<dependency>
Expand Down
31 changes: 15 additions & 16 deletions jpo-ode-svcs/pom.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode</artifactId>
<version>5.1.0</version>
<version>6.0.0</version>
</parent>
<artifactId>jpo-ode-svcs</artifactId>
<packaging>jar</packaging>
Expand Down Expand Up @@ -50,11 +50,11 @@
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.0</version>
<version>4.0.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.restdocs</groupId>
Expand All @@ -71,8 +71,12 @@
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-restclient</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
Expand Down Expand Up @@ -100,8 +104,7 @@
<!-- WEB UI Boot Dependencies -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>0.40</version>
<artifactId>webjars-locator-lite</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
Expand All @@ -127,12 +130,12 @@
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode-core</artifactId>
<version>5.1.0</version>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode-plugins</artifactId>
<version>5.1.0</version>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand All @@ -147,11 +150,7 @@
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.networknt</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import io.micrometer.core.instrument.MeterRegistry;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
import org.springframework.boot.micrometer.metrics.autoconfigure.MeterRegistryCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand All @@ -28,12 +28,12 @@ public MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() {

private String getHostName() {
try {
// Get hostname from environment variable if running in Kubernetes
// Get the hostname from the environment variable if running in Kubernetes
String hostFromEnv = System.getenv("HOSTNAME");
if (hostFromEnv != null && !hostFromEnv.isEmpty()) {
return hostFromEnv;
}
// Fallback to system hostname for local deployments in Docker
// Fallback to the system hostname for local deployments in Docker
return InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
return "unknown";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.HashMap;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
import org.springframework.boot.kafka.autoconfigure.KafkaProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.annotation.EnableKafka;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.Map;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.common.serialization.StringSerializer;
import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
import org.springframework.boot.kafka.autoconfigure.KafkaProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.annotation.EnableKafka;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package us.dot.its.jpo.ode.udp.controller;

import jakarta.annotation.PreDestroy;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import javax.annotation.PreDestroy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package us.dot.its.jpo.ode.udp.generic;

import io.netty.handler.codec.UnsupportedMessageTypeException;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After upgrading to springboot 4, this package is no longer included and we only use the import here. This is also the only place that throws and catches this exception since the method that is throwing it is a private method and the method that catches it just logs that there was an unsupported message. Instead of including it back into the project, I adjusted the class to throw and subsequentially catch a custom UnsupportedMessageTypeException. I'm not sure if we wanted to switch this to an IllegalArgumentException instead, but I felt it doesn't really fit the situation a 100 percent.

import java.net.DatagramPacket;
import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.util.buf.HexUtils;
Expand Down Expand Up @@ -152,4 +151,18 @@ private void routeMessageByMessageType(
default -> throw new UnsupportedMessageTypeException(messageType);
}
}
}

/**
* Exception class for Unsupported Message Types.
*/
public static class UnsupportedMessageTypeException extends Exception {
/**
* Constructs a new UnsupportedMessageTypeException with the specified detail message.
*
* @param message the detail message
*/
public UnsupportedMessageTypeException(String message) {
super(message);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
import org.springframework.boot.kafka.autoconfigure.KafkaProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.context.annotation.Bean;
Expand All @@ -27,6 +27,7 @@
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.core.ProducerFactory;
import org.springframework.kafka.test.context.EmbeddedKafka;
import org.springframework.kafka.test.EmbeddedKafkaBroker;
import org.springframework.kafka.test.utils.KafkaTestUtils;
import org.springframework.test.annotation.DirtiesContext;
Expand All @@ -35,11 +36,11 @@
import us.dot.its.jpo.ode.kafka.OdeKafkaProperties.Producer;
import us.dot.its.jpo.ode.kafka.producer.KafkaProducerConfig;
import us.dot.its.jpo.ode.model.OdeObject;
import us.dot.its.jpo.ode.test.utilities.EmbeddedKafkaHolder;

@Slf4j
@ExtendWith(SpringExtension.class)
@DirtiesContext
@EmbeddedKafka
@EnableConfigurationProperties({ KafkaProperties.class })
@Import({ KafkaProducerConfigTest.KafkaProducerConfigTestConfig.class, SerializationConfig.class })
class KafkaProducerConfigTest {
Expand All @@ -50,13 +51,12 @@ class KafkaProducerConfigTest {
@Autowired
@Qualifier("testOdeKafkaProperties")
OdeKafkaProperties odeKafkaProperties;
@Autowired
@Qualifier("testMeterRegistry")
MeterRegistry meterRegistry;

XmlMapper xmlMapper;
ObjectMapper objectMapper = new ObjectMapper();

EmbeddedKafkaBroker embeddedKafka = EmbeddedKafkaHolder.getEmbeddedKafka();
@Autowired
EmbeddedKafkaBroker embeddedKafka;

@Test
void odeDataProducerFactory_shouldReturnNonNull() {
Expand All @@ -73,10 +73,14 @@ void odeDataProducerFactory_shouldReturnDefaultKafkaProducerFactory() {

@Test
void kafkaTemplateInterceptorPreventsSendingToDisabledTopics() {
EmbeddedKafkaHolder.addTopics(odeKafkaProperties.getDisabledTopics().toArray(new String[0]));
var consumerProps = KafkaTestUtils.consumerProps("interceptor-disabled",
"false",
embeddedKafka);
for (String topic : odeKafkaProperties.getDisabledTopics()) {
if (!Set.of(embeddedKafka.getTopics()).contains(topic)) {
embeddedKafka.addTopics(topic);
}
}
var consumerProps = KafkaTestUtils.consumerProps(embeddedKafka,
"interceptor-disabled",
false);
var cf = new DefaultKafkaConsumerFactory<>(consumerProps,
new StringDeserializer(), new StringDeserializer());
var consumer = cf.createConsumer();
Expand All @@ -102,9 +106,11 @@ void kafkaTemplateInterceptorPreventsSendingToDisabledTopics() {
@Test
void kafkaTemplateInterceptorAllowsSendingToTopicsNotInDisabledSet() {
String enabledTopic = "topic.enabled" + this.getClass().getSimpleName();
EmbeddedKafkaHolder.addTopics(enabledTopic);
if (!Set.of(embeddedKafka.getTopics()).contains(enabledTopic)) {
embeddedKafka.addTopics(enabledTopic);
}

var consumerProps = KafkaTestUtils.consumerProps("interceptor-enabled", "false", embeddedKafka);
var consumerProps = KafkaTestUtils.consumerProps(embeddedKafka, "interceptor-enabled", false);
var cf = new DefaultKafkaConsumerFactory<>(consumerProps,
new StringDeserializer(), new StringDeserializer());
var consumer = cf.createConsumer();
Expand All @@ -124,10 +130,12 @@ void kafkaTemplateInterceptorAllowsSendingToTopicsNotInDisabledSet() {

@Test
void kafkaTemplateInterceptorCanSendAfterAttemptToSendToDisabledTopic() {
String enabledTopic = "topic.enabled" + this.getClass().getSimpleName();
EmbeddedKafkaHolder.addTopics(enabledTopic);
String enabledTopic = "topic.enabled" + this.getClass().getSimpleName() + "2";
if (!Set.of(embeddedKafka.getTopics()).contains(enabledTopic)) {
embeddedKafka.addTopics(enabledTopic);
}

var consumerProps = KafkaTestUtils.consumerProps("send-after", "false", embeddedKafka);
var consumerProps = KafkaTestUtils.consumerProps(embeddedKafka, "send-after", false);
var cf = new DefaultKafkaConsumerFactory<>(consumerProps,
new StringDeserializer(), new StringDeserializer());
var consumer = cf.createConsumer();
Expand Down
Loading
Loading