Skip to content

Commit

Permalink
Merge branch 'develop' into keycloak-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob6838 committed Dec 6, 2024
2 parents ba6b432 + 4bd9712 commit 32d094d
Show file tree
Hide file tree
Showing 40 changed files with 916 additions and 113 deletions.
62 changes: 37 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,42 +52,54 @@ FROM maven:3.8-eclipse-temurin-21-alpine as jbuilder

WORKDIR /home

ARG MAVEN_GITHUB_TOKEN
ARG MAVEN_GITHUB_ORG

ENV MAVEN_GITHUB_TOKEN=$MAVEN_GITHUB_TOKEN
ENV MAVEN_GITHUB_ORG=$MAVEN_GITHUB_ORG

# Copy only the files needed to avoid putting all sorts of junk from your local env on to the image
COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/pom.xml ./jpo-ode/
COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-common/pom.xml ./jpo-ode/jpo-ode-common/
COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-common/src ./jpo-ode/jpo-ode-common/src
COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-plugins/pom.xml ./jpo-ode/jpo-ode-plugins/
COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-plugins/src ./jpo-ode/jpo-ode-plugins/src
COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-core/pom.xml ./jpo-ode/jpo-ode-core/
COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-core/src ./jpo-ode/jpo-ode-core/src/
COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-svcs/pom.xml ./jpo-ode/jpo-ode-svcs/
COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-svcs/src ./jpo-ode/jpo-ode-svcs/src

COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-geojsonconverter/pom.xml ./jpo-geojsonconverter/
COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-geojsonconverter/src ./jpo-geojsonconverter/src

COPY ./jpo-conflictmonitor/jpo-conflictmonitor/pom.xml ./jpo-conflictmonitor/
COPY ./jpo-conflictmonitor/jpo-conflictmonitor/src ./jpo-conflictmonitor/src
# COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/pom.xml ./jpo-ode/
# COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-common/pom.xml ./jpo-ode/jpo-ode-common/
# COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-common/src ./jpo-ode/jpo-ode-common/src
# COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-plugins/pom.xml ./jpo-ode/jpo-ode-plugins/
# COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-plugins/src ./jpo-ode/jpo-ode-plugins/src
# COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-core/pom.xml ./jpo-ode/jpo-ode-core/
# COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-core/src ./jpo-ode/jpo-ode-core/src/
# COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-svcs/pom.xml ./jpo-ode/jpo-ode-svcs/
# COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-ode/jpo-ode-svcs/src ./jpo-ode/jpo-ode-svcs/src

# COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-geojsonconverter/pom.xml ./jpo-geojsonconverter/
# COPY ./jpo-conflictmonitor/jpo-geojsonconverter/jpo-geojsonconverter/src ./jpo-geojsonconverter/src

# COPY ./jpo-conflictmonitor/jpo-conflictmonitor/pom.xml ./jpo-conflictmonitor/
# COPY ./jpo-conflictmonitor/jpo-conflictmonitor/src ./jpo-conflictmonitor/src

COPY ./jpo-conflictvisualizer-api/pom.xml ./jpo-conflictvisualizer-api/
COPY ./jpo-conflictvisualizer-api/src ./jpo-conflictvisualizer-api/src
COPY ./jpo-conflictvisualizer-api/settings.xml ./jpo-conflictvisualizer-api/

WORKDIR /home/jpo-conflictvisualizer-api
RUN mvn -s settings.xml dependency:resolve

WORKDIR /home/jpo-ode
COPY ./jpo-conflictvisualizer-api/src ./src
RUN mvn -s settings.xml install -DskipTests

RUN mvn install -DskipTests
# WORKDIR /home/jpo-ode

WORKDIR /home/jpo-geojsonconverter
# RUN mvn install -DskipTests

RUN mvn clean install -DskipTests
# WORKDIR /home/jpo-geojsonconverter

WORKDIR /home/jpo-conflictmonitor
# RUN mvn clean install -DskipTests

RUN mvn clean install -DskipTests
# WORKDIR /home/jpo-conflictmonitor

WORKDIR /home/jpo-conflictvisualizer-api
# RUN mvn clean install -DskipTests

# WORKDIR /home/jpo-conflictvisualizer-api

RUN mvn clean package -DskipTests
ENTRYPOINT ["tail", "-f", "/dev/null"]
# RUN mvn clean package -DskipTests
# ENTRYPOINT ["tail", "-f", "/dev/null"]


# # === RUNTIME IMAGE for Java and ACM ===
Expand Down
1 change: 0 additions & 1 deletion jpo-conflictmonitor
Submodule jpo-conflictmonitor deleted from 88afe5
73 changes: 67 additions & 6 deletions jpo-conflictvisualizer-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<sonar.language>java</sonar.language>
<!-- <thymeleaf.version>3.0.3.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.2.1</thymeleaf-layout-dialect.version> -->
<!-- Allow override of github organization when publishing artifacts to github -->
<github_organization>usdot-jpo-ode</github_organization>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -107,27 +109,42 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode-core</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode-plugins</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode-svcs</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-geojsonconverter</artifactId>
<version>1.4.2-SNAPSHOT</version>
<classifier>jpo-geojsonconverter</classifier>
<version>1.4.2</version>
<!-- Allow using newer streams version than geojsonconverter -->
<exclusions>
<exclusion>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-streams</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-streams-test-utils</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-conflictmonitor</artifactId>
<version>1.4.1-SNAPSHOT</version>
<classifier>jpo-conflictmonitor</classifier>
<version>1.5.0</version>
<!-- <classifier>jpo-conflictmonitor</classifier> -->
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -303,5 +320,49 @@
</plugin>
</plugins>
</build>
<!-- profile to output only source code and not include any spring boot dependencies in
published jar -->
<profiles>
<profile>
<id>package-jar</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>
us.dot.its.jpo.ode.api.ConflictApiApplication</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>repackage</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<!-- GitHub Artifact publishing configuration -->
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/${github_organization}/jpo-conflictvisualizer</url>
</repository>
</distributionManagement>

</project>
67 changes: 67 additions & 0 deletions jpo-conflictvisualizer-api/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<activeProfiles>
<activeProfile>default</activeProfile>
</activeProfiles>
<servers>
<server>
<id>github</id>
<username>jpo_conflictvisualizer</username>
<password>${env.MAVEN_GITHUB_TOKEN}</password>
</server>
<server>
<id>github_jpo_ode</id>
<username>jpo_conflictvisualizer</username>
<password>${env.MAVEN_GITHUB_TOKEN}</password>
</server>
<server>
<id>github_jpo_geojsonconverter</id>
<username>jpo_conflictvisualizer</username>
<password>${env.MAVEN_GITHUB_TOKEN}</password>
</server>
<server>
<id>github_jpo_conflictmonitor</id>
<username>jpo_conflictvisualizer</username>
<password>${env.MAVEN_GITHUB_TOKEN}</password>
</server>
</servers>
<profiles>
<profile>
<id>default</id>
<repositories>
<repository>
<id>github</id>
<name>GitHub Apache Maven Packages</name>
<url>https://maven.pkg.github.com/${env.MAVEN_GITHUB_ORG}/jpo-ode</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>github_jpo_ode</id>
<name>GitHub JPO ODE</name>
<url>https://maven.pkg.github.com/${env.MAVEN_GITHUB_ORG}/jpo-ode</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>github_jpo_geojsonconverter</id>
<name>GitHub JPO GeojsonConverter</name>
<url>https://maven.pkg.github.com/${env.MAVEN_GITHUB_ORG}/jpo-geojsonconverter</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>github_jpo_conflictmonitor</id>
<name>GitHub JPO ConflictMonitor</name>
<url>https://maven.pkg.github.com/${env.MAVEN_GITHUB_ORG}/jpo-conflictmonitor</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
</settings>
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ public APIServiceController(
try {

logger.info("Starting {}", this.getClass().getSimpleName());

System.out.println("Controller is Null" + stompController != null);

SpatSocketForwardTopology spatSocketForwardTopology = new SpatSocketForwardTopology(
"topic.ProcessedSpat",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public class ConflictMonitorApiProperties {
private String securitySvcsSignatureEndpoint = "sign";



private int lingerMs = 0;


@Autowired
Expand Down Expand Up @@ -195,6 +195,15 @@ public void setKafkaBrokers(String kafkaBrokers) {
this.kafkaBrokers = kafkaBrokers;
}

@Value("${kafka.linger_ms}")
public void setKafkaLingerMs(int lingerMs) {
this.lingerMs = lingerMs;
}

public int getKafkaLingerMs() {
return lingerMs;
}

public String getKafkaProducerType() {
return kafkaProducerType;
}
Expand Down Expand Up @@ -267,6 +276,8 @@ public void setKafkaTopicsDisabledSet(Set<String> kafkaTopicsDisabledSet) {
this.kafkaTopicsDisabledSet = kafkaTopicsDisabledSet;
}




@Bean
public ObjectMapper defaultMapper() {
Expand Down Expand Up @@ -390,7 +401,11 @@ public Properties createStreamProperties(String name) {
streamProps.put(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG, FIVE_MINUTES_MS);

// Disable batching
streamProps.put(ProducerConfig.BATCH_SIZE_CONFIG, 0);
// streamProps.put(ProducerConfig.BATCH_SIZE_CONFIG, 0);

streamProps.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, "zstd");
streamProps.put(ProducerConfig.LINGER_MS_CONFIG, getKafkaLingerMs());


if (confluentCloudEnabled) {
streamProps.put("ssl.endpoint.identification.algorithm", "https");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,29 @@ public class MongoConfig extends AbstractMongoClientConfiguration{
@Value("${spring.data.mongodb.password}")
private String password;

@Value("${spring.data.mongodb.authenticationDatabase}")
private String authenticationDatabase;

@Value("${spring.data.mongodb.uri}")
private String overrideURI;

@Override
protected String getDatabaseName() {
return db;
}

@Override
public void configureClientSettings(MongoClientSettings.Builder builder) {
// customization hook
String uri = "mongodb://"+username+":"+password+"@"+host+":"+port+"/"+db;

String uri = "";

if(overrideURI != null && !overrideURI.isEmpty() && !overrideURI.equals("null")){
uri = overrideURI;
}else{
uri = "mongodb://"+username+":"+password+"@"+host+":"+port+"/"+db + "?authSource="+authenticationDatabase;
}


// String uri = "mongodb://"+host+":"+port+"/"+db;
System.out.println("Connecting to MongoDB at: " + uri);
builder.applyConnectionString(new ConnectionString(uri));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ public void addSpatBroadcastRateDistribution(List<IDCount> data, Long startTime,
for(IDCount elem : data){
int index = Integer.parseInt(elem.getId()) / 10;
output.get(index).setCount(elem.getCount());
System.out.println(elem);
}

// Convert to Chart Data and generate graph
Expand Down Expand Up @@ -348,7 +347,6 @@ public void addMapBroadcastRateDistribution(List<IDCount> data, Long startTime,
for(IDCount elem : data){
int index = Integer.parseInt(elem.getId());
output.get(index).setCount(elem.getCount());
System.out.println(elem);
}

// Convert to Chart Data and generate graph
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package us.dot.its.jpo.ode.api.accessors.events.BsmMessageCountProgressionEventRepository;

import java.util.List;

import org.springframework.data.mongodb.core.query.Query;
import us.dot.its.jpo.ode.api.models.IDCount;
import us.dot.its.jpo.ode.api.models.DataLoader;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.BsmMessageCountProgressionEvent;

public interface BsmMessageCountProgressionEventRepository extends DataLoader<BsmMessageCountProgressionEvent>{
Query getQuery(Integer intersectionID, Long startTime, Long endTime, boolean latest);

long getQueryResultCount(Query query);

long getQueryFullCount(Query query);

List<BsmMessageCountProgressionEvent> find(Query query);

List<IDCount> getBsmBroadcastRateEventsByDay(int intersectionID, Long startTime, Long endTime);
}
Loading

0 comments on commit 32d094d

Please sign in to comment.