Skip to content

Commit

Permalink
Merge pull request #64 from usdot-jpo-ode/candidate_r1
Browse files Browse the repository at this point in the history
Merge candidate_r1 into master
  • Loading branch information
dan-du-car authored Feb 26, 2024
2 parents 2d04678 + aeebb9d commit 9309f8c
Show file tree
Hide file tree
Showing 107 changed files with 3,270 additions and 5,281 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM maven:3.8.1-openjdk-11 as builder
FROM maven:3.8-eclipse-temurin-21-alpine as builder

WORKDIR /home

Expand Down Expand Up @@ -38,7 +38,7 @@ WORKDIR /home/jpo-conflictvisualizer-api

RUN mvn clean package -DskipTests
# ENTRYPOINT ["tail", "-f", "/dev/null"]
FROM openjdk:11-jre
FROM eclipse-temurin:21-jre-alpine

WORKDIR /home

Expand Down
2 changes: 1 addition & 1 deletion jpo-conflictmonitor
Submodule jpo-conflictmonitor updated from 2d22f5 to 3b6020
97 changes: 74 additions & 23 deletions jpo-conflictvisualizer-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.8</version>
<version>3.1.3</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>usdot.jpo.ode</groupId>
Expand All @@ -15,7 +15,11 @@
<name>jpo-conflictvisualizer-api</name>
<description>Conflict Visualizer</description>
<properties>
<java.version>11</java.version>
<java.version>21</java.version>
<jacoco.version>0.8.7</jacoco.version>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<sonar.language>java</sonar.language>
<!-- <thymeleaf.version>3.0.3.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.2.1</thymeleaf-layout-dialect.version> -->
</properties>
Expand Down Expand Up @@ -48,7 +52,7 @@
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.14.2</version>
<version>2.15.2</version>
<exclusions>
<exclusion>
<groupId>javax.ws.rs</groupId>
Expand All @@ -67,7 +71,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<version>1.18.30</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -87,7 +91,7 @@
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode-core</artifactId>
<version>1.3.0</version>
<version>2.0.0-SNAPSHOT</version>
<!-- required exclusion to preserve keycloak versions -->
<exclusions>
<exclusion>
Expand All @@ -99,29 +103,29 @@
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode-plugins</artifactId>
<version>1.3.0</version>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-geojsonconverter</artifactId>
<version>1.0.0</version>
<version>1.2.0-SNAPSHOT</version>
<classifier>jpo-geojsonconverter</classifier>
</dependency>
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-conflictmonitor</artifactId>
<version>1.0.0</version>
<version>1.2.0-SNAPSHOT</version>
<classifier>jpo-conflictmonitor</classifier>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.14</version>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -142,19 +146,33 @@
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-spring-boot-starter</artifactId>
<version>21.0.2</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.keycloak</groupId>-->
<!-- <artifactId>keycloak-spring-boot-starter</artifactId>-->
<!-- <version>21.0.2</version>-->
<!-- &lt;!&ndash; <version>20.0.3</version> &ndash;&gt;-->
<!-- </dependency>-->
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-admin-client</artifactId>
<version>21.0.2</version>
<version>23.0.6</version>
<!-- <version>20.0.3</version> -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
Expand All @@ -163,17 +181,17 @@
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf</artifactId>
<version>9.1.20</version>
<version>9.5.1</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13</version>
<version>5.5.13.3</version>
</dependency>
<dependency>
<groupId>org.knowm.xchart</groupId>
<artifactId>xchart</artifactId>
<version>3.8.3</version>
<version>3.8.7</version>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
Expand All @@ -184,17 +202,46 @@
<dependency>
<groupId>com.sendgrid</groupId>
<artifactId>sendgrid-java</artifactId>
<version>4.6.0</version>
<version>4.10.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.postmarkapp/postmark -->
<dependency>
<groupId>com.postmarkapp</groupId>
<artifactId>postmark</artifactId>
<version>1.10.21</version>
<version>1.11.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>generate-report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/site/jacoco</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
Expand All @@ -205,27 +252,31 @@
<artifactId>lombok</artifactId>
</exclude>
</excludes>
<fork>false</fork>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<version>3.2.5</version>
<configuration>
<enableProcessChecker>all</enableProcessChecker>
<shutdown>exit</shutdown>
<!-- Prevent JDK 21 warnings related to Mockito during tests. -->
<!-- See: https://github.com/mockito/mockito/issues/3037 -->
<argLine>
-XX:+EnableDynamicAgentLoading
</argLine>
</configuration>
<dependencies>
<dependency>
<!-- Force test to use junit4.7 -->
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>3.0.0-M7</version>
<version>3.2.5</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@
import us.dot.its.jpo.ode.api.accessors.notifications.SpatBroadcastRateNotification.SpatBroadcastRateNotificationRepository;
import us.dot.its.jpo.ode.api.accessors.spat.OdeSpatDataRepository;
import us.dot.its.jpo.ode.api.accessors.spat.ProcessedSpatRepository;
import us.dot.its.jpo.ode.api.controllers.StompController;
import us.dot.its.jpo.ode.api.topologies.BsmSocketForwardTopology;
import us.dot.its.jpo.ode.api.topologies.DataLoaderTopology;
import us.dot.its.jpo.ode.api.topologies.MapSocketForwardTopology;
import us.dot.its.jpo.ode.api.topologies.SpatSocketForwardTopology;
import lombok.Getter;

/**
Expand Down Expand Up @@ -120,12 +124,34 @@ public APIServiceController(
SpatBroadcastRateNotificationRepository spatBroadcastRateNotificationRepo,
ConnectionOfTravelNotificationRepository connectionOfTravelNotificationRepo,
BsmEventRepository bsmEventRepo,
ActiveNotificationRepository activeNotificationRepo) {
ActiveNotificationRepository activeNotificationRepo,
StompController stompController) {

try {

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

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

SpatSocketForwardTopology spatSocketForwardTopology = new SpatSocketForwardTopology(
"topic.ProcessedSpat",
stompController,
props.createStreamProperties("processedSpat")
);

MapSocketForwardTopology mapSocketForwardTopology = new MapSocketForwardTopology(
"topic.ProcessedMap",
stompController,
props.createStreamProperties("processedMap")
);

BsmSocketForwardTopology bsmSocketForwardTopology = new BsmSocketForwardTopology(
"topic.CmBsmIntersection",
stompController,
props.createStreamProperties("bsm")
);


if (props.getLoad()) {

ArrayList<String> topics = new ArrayList<>();
Expand Down Expand Up @@ -244,7 +270,7 @@ public APIServiceController(

DataLoaderTopology<StopLinePassageAssessment> signalStateEventAssessmentTopology = new DataLoaderTopology<StopLinePassageAssessment>(
"topic.CmSignalStateEventAssessment",
JsonSerdes.SignalStateEventAssessment(),
JsonSerdes.StopLinePassageAssessment(),
signalStateEventAssessmentRepo,
props.createStreamProperties("signalStateEventAssessment"));
topics.add("topic.CmSignalStateEventAssessment");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,17 @@ public static void main(String[] args) {

}

@Bean

public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
ConflictMonitorApiProperties props = new ConflictMonitorApiProperties();
registry.addMapping("/**").allowedOrigins(props.getCors());
// registry.addMapping("/**").allowedMethods("*");
}
};
}
// @Bean
// public WebMvcConfigurer corsConfigurer() {
// return new WebMvcConfigurer() {
// @Override
// public void addCorsMappings(CorsRegistry registry) {
// ConflictMonitorApiProperties props = new ConflictMonitorApiProperties();
// registry.addMapping("/**").allowedOrigins(props.getCors());
// // registry.addMapping("/**").allowedMethods("*");
// }
// };
// }



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.Arrays;
import java.util.Properties;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -71,6 +71,7 @@ public class ConflictMonitorApiProperties {
private String kafkaProducerType = AppContext.DEFAULT_KAFKA_PRODUCER_TYPE;
private Boolean verboseJson = false;
private Boolean load = false;
private String cmServerURL = "";
private String emailBroker = "";
private String emailFromAddress = "noreply@cimms.com";
private int importProcessorBufferSize = OdePlugin.INPUT_STREAM_BUFFER_SIZE;
Expand Down Expand Up @@ -138,6 +139,15 @@ public void setLoad(boolean load) {
this.load = load;
}

public String getCmServerURL() {
return cmServerURL;
}

@Value("${cmServerURL}")
public void setCmServerURL(String cmServerUrl) {
this.cmServerURL = cmServerUrl;
}

public String getEmailBroker() {
return emailBroker;
}
Expand Down
Loading

0 comments on commit 9309f8c

Please sign in to comment.