diff --git a/README.md b/README.md
index 49fb2d9b5..47320b6f4 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,8 @@ The current version and release history of the JPO-ODE: [ODE Release Notes](
+
## 12. Kubernetes
The ODE can be run in a k8s environment.
See [this document](./docs/Kubernetes.md) for more details about this.
[Back to top](#toc)
+
+
## 13. Sonar Token Configuration
Generating and Using Tokens
Users can generate tokens that can be used to run analyses or invoke web services without access to the user's actual credentials.
USDOT-JPO-ODE SonarCloud Organization : https://sonarcloud.io/organizations/usdot-jpo-ode-1/
-## Generating a token
+### Generating a token
You can generate new tokens at User > My Account > Security.
The form at the bottom of the page allows you to generate new tokens. Once you click the Generate button, you will see the token value. Copy it immediately; once you dismiss the notification you will not be able to retrieve it.
-## Using a token
+### Using a token
SonarScanners running in GitHub Actions can automatically detect branches and pull requests being built so you don't need to specifically pass them as parameters to the scanner.
**To analyze your projects with GitHub Actions, you need to: **
@@ -632,5 +637,19 @@ Configure your workflow YAML file as below:
Commit and push your code to start the analysis.
-## Revoking a token
+### Revoking a token
You can revoke an existing token at User > My Account > Security by clicking the Revoke button next to the token.
+
+
+
+## 14. SNMP
+The ODE is capable of communicating with RSUs to:
+- Query TIMs
+- Deposit TIMs
+- Delete TIMs
+
+The following SNMP protocols are supported for communication with RSUs:
+- DSRC 4.1 (defined in 'Dedicated Short-Range Communications Roadside Unit Specifications')
+- NTCIP1218 (defined in 'National Transportation Communications for ITS Protocol')
+
+Additionally, the ODE supports the execution of PDM operations on RSUs. PDM operations are not defined in NTCIP1218, but are defined DSRC 4.1.
\ No newline at end of file
diff --git a/docs/Release_notes.md b/docs/Release_notes.md
index 25e1f6076..32c4b2f36 100644
--- a/docs/Release_notes.md
+++ b/docs/Release_notes.md
@@ -1,6 +1,22 @@
JPO-ODE Release Notes
----------------------------
+Version 1.5.0, released November 2023
+----------------------------------------
+
+### **Summary**
+The updates for the jpo-ode 1.5.0 release include CI configuration fixes, README updates and updated submodule references.
+- Fixed CI configuration command parameters.
+- Added README note for Windows users on the shared volume environment variable.
+- Updated submodule references
+- The supported operating systems in the README have been updated to more recent versions.
+- Updated all references to the test package from org.junit.Test to org.junit.jupiter.api.Test. Some tests are also updated to remove deprecated annotations.
+- Introduced changes that enable the ODE to establish communication with RSUs using both the NTCIP1218 protocol and the 4.1 DSRC protocol.
+
+Known Issues:
+- No known issues at this time.
+
+
Version 1.4.0, released July 5th 2023
----------------------------------------
diff --git a/jpo-ode-common/pom.xml b/jpo-ode-common/pom.xml
index 36948719f..17352e1b4 100644
--- a/jpo-ode-common/pom.xml
+++ b/jpo-ode-common/pom.xml
@@ -26,7 +26,7 @@
org.json
json
- 20230227
+ 20231013
com.fasterxml.jackson.core
diff --git a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPacketFunctionalTest.java b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPacketFunctionalTest.java
index 1478f35c7..f14fcf100 100644
--- a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPacketFunctionalTest.java
+++ b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPacketFunctionalTest.java
@@ -27,8 +27,8 @@
import java.net.UnknownHostException;
import java.util.Arrays;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import mockit.Capturing;
import us.dot.its.jpo.ode.util.CodecUtils;
@@ -44,7 +44,7 @@ public void testConstrcutor() throws UnknownHostException {
assertNull(pkt.getPayload());
}
- @Test @Ignore
+ @Test @Disabled
public void test() throws UnknownHostException {
test("127.0.0.1", 12, "01234567890".getBytes());
test("::1", 47561, "0123456789001234567890".getBytes());
diff --git a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPacketSenderTest.java b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPacketSenderTest.java
index 6960eae9e..9150eceff 100644
--- a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPacketSenderTest.java
+++ b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPacketSenderTest.java
@@ -32,9 +32,10 @@
import java.util.Arrays;
import us.dot.its.jpo.ode.eventlog.EventLogger;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import mockit.Capturing;
import us.dot.its.jpo.ode.util.CodecUtils;
@@ -65,7 +66,7 @@ private enum TestCase {
TestForwardPacketInbound, TestSendPacketOutbound, TestIPv6ForwardOutbound, TestIPv4ForwardOutboundForward, TestIPv4ForwardOutboundSend, TestIPv6SendOutbound, TestIPv4SendOutbound,
};
- @BeforeClass
+ @BeforeAll
public static void init() {
}
@@ -91,13 +92,13 @@ public void testForwardPacketInbound(String hostname)
checkBackgroundThreadAssertion();
}
- @Test @Ignore
+ @Test @Disabled
public void testSendPacketOutboundIPv4() throws UnknownHostException, InterruptedException, InetPacketException {
// Use case: Forwarder sends outgoing IPv4 packet out
testSendPacketOutbound(CLIENT_HOST_IPV4);
}
- @Test @Ignore
+ @Test @Disabled
public void testSendPacketOutboundIPv6() throws UnknownHostException, InterruptedException, InetPacketException {
// Use case: Forwarder sends outgoing IPv6 packet out
testSendPacketOutbound(CLIENT_HOST_IPV6);
@@ -150,7 +151,7 @@ public void testIPv4ForwardOutboundSend() throws InterruptedException, UnknownHo
checkBackgroundThreadAssertion();
}
- @Test @Ignore
+ @Test @Disabled
public void testIPv6SendOutbound() throws InterruptedException, UnknownHostException, InetPacketException {
// Use case: Transport or Data Sink send IPv6 message out directly
startUdpListener(CLIENT_PORT, TestCase.TestIPv6SendOutbound);
@@ -160,7 +161,7 @@ public void testIPv6SendOutbound() throws InterruptedException, UnknownHostExcep
checkBackgroundThreadAssertion();
}
- @Test @Ignore
+ @Test @Disabled
public void testIPv4SendOutbound() throws InterruptedException, UnknownHostException, InetPacketException {
// Use case: Transport or Data Sink send IPv4 message out directly
startUdpListener(CLIENT_PORT, TestCase.TestIPv4SendOutbound);
diff --git a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPacketTest.java b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPacketTest.java
index 0ff31a480..273647928 100644
--- a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPacketTest.java
+++ b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPacketTest.java
@@ -22,8 +22,8 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import mockit.Expectations;
import mockit.Mock;
@@ -40,7 +40,7 @@ public class InetPacketTest {
@Mocked InetAddress mockAddress;
- @Before
+ @BeforeEach
public void setup() {
new MockUp() {
@Mock InetAddress getByName(String host) {
diff --git a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPointTest.java b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPointTest.java
index 48f612299..df85098db 100644
--- a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPointTest.java
+++ b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/inet/InetPointTest.java
@@ -17,6 +17,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -25,7 +26,7 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Capturing;
import mockit.Expectations;
@@ -48,19 +49,21 @@ public void testStringConstructorCreatesAddress() {
}
}
- @Test(expected = AssertionError.class)
+ @Test
public void testStringConstructorFailsNullAddress() {
- try {
- new Expectations() {
- {
- InetAddress.getByName(anyString).getAddress();
- result = null;
- }
- };
- new InetPoint("something123", 5, true);
- } catch (UnknownHostException e) {
- fail("Unexpected exception: " + e);
- }
+ assertThrows(AssertionError.class, () -> {
+ try {
+ new Expectations() {
+ {
+ InetAddress.getByName(anyString).getAddress();
+ result = null;
+ }
+ };
+ new InetPoint("something123", 5, true);
+ } catch (UnknownHostException e) {
+ fail("Unexpected exception: " + e);
+ }
+ });
}
@Test
@@ -68,9 +71,13 @@ public void testByteConstructorCreatesAddress() {
new InetPoint(new byte[] { 1, 2, 3 }, 5, true);
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void testByteConstructorFailsNullAddress() {
- new InetPoint((byte[]) null, 5, true);
+ Exception err = assertThrows(IllegalArgumentException.class, () -> {
+ new InetPoint((byte[]) null, 5, true);
+ });
+
+ assertEquals("IP Address is required", err.getMessage());
}
@Test
@@ -78,9 +85,12 @@ public void testBBytePortConstructorCreatesAddress() {
new InetPoint(new byte[] { 1, 2, 3 }, 5);
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void testBytePortConstructorFailsNullAddress() {
- new InetPoint((byte[]) null, 5);
+ Exception err = assertThrows(IllegalArgumentException.class, () -> {
+ new InetPoint((byte[]) null, 5);
+ });
+ assertEquals("IP Address is required", err.getMessage());
}
@Test
diff --git a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/CodecUtilsTest.java b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/CodecUtilsTest.java
index 8bb3e482b..cfd3da9e7 100644
--- a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/CodecUtilsTest.java
+++ b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/CodecUtilsTest.java
@@ -22,7 +22,7 @@
import java.nio.ByteOrder;
import java.util.Arrays;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class CodecUtilsTest {
diff --git a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/CrcCccittTest.java b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/CrcCccittTest.java
index 148d13118..91da7cbf0 100644
--- a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/CrcCccittTest.java
+++ b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/CrcCccittTest.java
@@ -20,22 +20,22 @@
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class CrcCccittTest {
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
}
diff --git a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/DateTimeUtilsTest.java b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/DateTimeUtilsTest.java
index a04bd8e7a..079048d21 100644
--- a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/DateTimeUtilsTest.java
+++ b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/DateTimeUtilsTest.java
@@ -20,7 +20,7 @@
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import junit.framework.TestCase;
import us.dot.its.jpo.ode.util.DateTimeUtils;
diff --git a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/GeoUtilsTest.java b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/GeoUtilsTest.java
index 527e31523..9ed7f2789 100644
--- a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/GeoUtilsTest.java
+++ b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/GeoUtilsTest.java
@@ -17,8 +17,12 @@
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
+import java.util.stream.Stream;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import junit.framework.TestCase;
import us.dot.its.jpo.ode.util.GeoUtils;
@@ -29,19 +33,8 @@ public class GeoUtilsTest extends TestCase {
public void testNearestPointOnLine() {
}
- @Test
- public void testPointOffset() {
- assertOffset(5.0, 5.0, 10.0, 5.0, 5.0, 8.0); //0 deg
- assertOffset(5.0, 5.0, 10.0, 10.0, 2.878, 7.121); //45 deg
- assertOffset(5.0, 5.0, 5.0, 10.0, 2.0, 5.0); //90 deg
- assertOffset(5.0, 5.0, 0.0, 10.0, 2.878, 2.878); //135 deg
- assertOffset(5.0, 5.0, 0.0, 5.0, 5.0, 2.0); //180 deg
- assertOffset(5.0, 5.0, 0.0, 0.0, 7.121, 2.878); //225 deg
- assertOffset(5.0, 5.0, 5.0, 0.0, 8.0, 5.0); //270 deg
- assertOffset(5.0, 5.0, 10.0, 0.0, 7.121, 7.121); //315 deg
- }
-
- @Test
+ @ParameterizedTest
+ @MethodSource("provideArgs")
public void assertOffset(double ax, double ay, double bx, double by, double ox, double oy) {
Point2D a = new Point2D.Double(ax, ay);
Point2D b = new Point2D.Double(bx, by);
@@ -55,6 +48,19 @@ public void assertOffset(double ax, double ay, double bx, double by, double ox,
assertEquals((long) (ox * scale), p1x);
assertEquals((long) (oy * scale), p1y);
}
+
+ private static Stream provideArgs() {
+ return Stream.of(
+ Arguments.of(5.0, 5.0, 10.0, 5.0, 5.0, 8.0),
+ Arguments.of(5.0, 5.0, 10.0, 10.0, 2.878, 7.121),
+ Arguments.of(5.0, 5.0, 5.0, 10.0, 2.0, 5.0),
+ Arguments.of(5.0, 5.0, 0.0, 10.0, 2.878, 2.878),
+ Arguments.of(5.0, 5.0, 0.0, 5.0, 5.0, 2.0),
+ Arguments.of(5.0, 5.0, 0.0, 0.0, 7.121, 2.878),
+ Arguments.of(5.0, 5.0, 5.0, 0.0, 8.0, 5.0),
+ Arguments.of(5.0, 5.0, 10.0, 0.0, 7.121, 7.121)
+ );
+ }
@Test
public void testDistanceInMapCoordinates() {
@@ -107,4 +113,4 @@ public void testDistanceInLatLng() {
assertEquals(d1, d3, GeoUtils.ERROR_MARGIN);
}
-}
+}
\ No newline at end of file
diff --git a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/JsonUtilsTest.java b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/JsonUtilsTest.java
index 5487aacb4..de41c6e8f 100644
--- a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/JsonUtilsTest.java
+++ b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/JsonUtilsTest.java
@@ -25,7 +25,7 @@
import java.util.Iterator;
import java.util.Map.Entry;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/SerializationUtilsTest.java b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/SerializationUtilsTest.java
index 170fc42f3..04411ad88 100644
--- a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/SerializationUtilsTest.java
+++ b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/SerializationUtilsTest.java
@@ -19,7 +19,7 @@
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SerializationUtilsTest {
diff --git a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/XmlUtilsTest.java b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/XmlUtilsTest.java
index 380d07b31..d86b53e48 100644
--- a/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/XmlUtilsTest.java
+++ b/jpo-ode-common/src/test/java/us/dot/its/jpo/ode/util/XmlUtilsTest.java
@@ -2,7 +2,7 @@
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import us.dot.its.jpo.ode.util.XmlUtils.XmlUtilsException;
public class XmlUtilsTest {
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/CASClientTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/CASClientTest.java
index 9413c9392..5ad45488e 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/CASClientTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/CASClientTest.java
@@ -16,6 +16,7 @@
package us.dot.its.jpo.ode.dds;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.fail;
import java.util.Map;
@@ -25,7 +26,7 @@
import javax.net.ssl.SSLContext;
import javax.ws.rs.core.Response.Status;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Expectations;
@@ -46,8 +47,8 @@ public class CASClientTest {
/*
* For some very odd reason, just having mocked objects of Pattern and Matcher causes
- * surefile plug-in to report the following very odd and strange errors on all
- * subsequest test cases. Hence, we have to use real values so we don't have to mock
+ * surefire plug-in to report the following very odd and strange errors on all
+ * subsequent test cases. Hence, we have to use real values so we don't have to mock
* which is a better approach anyway.
*
-------------------------------------------------------
@@ -310,16 +311,18 @@ public void testConfigure() {
assertEquals(casClient.getDdsCasUsername(), casUser);
}
- @Test(expected = CASException.class)
+ @Test
public void testConfigureException()
throws CASException, HttpException {
- new Expectations() {
+ assertThrows(CASException.class, () -> {
+ new Expectations() {
{
HttpClientFactory.build((SSLContext) any);
result = new Exception();
}
};
CASClient.configure(sslContext, casUrl, casUser, casPass);
+ });
}
@SuppressWarnings("unchecked")
@@ -337,8 +340,8 @@ public void testLogin() throws HttpException {
/*
* For some very odd reason, just having mocked objects of Pattern and Matcher causes
- * surefile plug-in to report the followig very odd and strange errors on all
- * subsequest test cases. Hence, we have to use real values so we don't have to mock
+ * surefire plug-in to report the following very odd and strange errors on all
+ * subsequent test cases. Hence, we have to use real values so we don't have to mock
* which is a better approach anyway.
*/
// Pattern.compile(anyString);
@@ -391,137 +394,145 @@ public void testLogin() throws HttpException {
};
}
- @Test(expected = CASException.class)
+ @Test
public void testLoginExceptionInGetTicket1() throws HttpException, CASException {
- String websocketURL = "wss://url.websocket.com";
- Map cookies = new ConcurrentHashMap();
- cookies.put("JSESSIONID", "1bif45f-testSessionId");
- new Expectations() {
- {
- mockResponse.getStatusCode();
- result = Status.BAD_REQUEST;
- }
- };
-
- CASClient casClient;
+ assertThrows(CASException.class, () -> {
+ String websocketURL = "wss://url.websocket.com";
+ Map cookies = new ConcurrentHashMap();
+ cookies.put("JSESSIONID", "1bif45f-testSessionId");
+ new Expectations() {
+ {
+ mockResponse.getStatusCode();
+ result = Status.BAD_REQUEST;
+ }
+ };
+
+ CASClient casClient;
- casClient = CASClient.configure(sslContext, casUrl, casUser, casPass);
- casClient.login(websocketURL);
+ casClient = CASClient.configure(sslContext, casUrl, casUser, casPass);
+ casClient.login(websocketURL);
+ });
}
- @Test(expected = CASException.class)
+ @Test
public void testLoginExceptionInGetTicket2() throws HttpException, CASException {
- String websocketURL = "wss://url.websocket.com";
- Map cookies = new ConcurrentHashMap();
- cookies.put("JSESSIONID", "1bif45f-testSessionId");
- new Expectations() {
- {
- mockResponse.getStatusCode();
- result = Status.CREATED;
-
- /*
- * For some very odd reason, just having mocked objects of Pattern and Matcher causes
- * surefile plug-in to report the followig very odd and strange errors on all
- * subsequest test cases. Hence, we have to use real values so we don't have to mock
- * which is a better approach anyway.
- */
-// Pattern.compile(anyString);
-// result = mockPattern;
-//
-// mockPattern.matcher(anyString);
-// result = mockMatcher;
-//
-// mockMatcher.matches();
-// result = false;
- }
- };
+ assertThrows(CASException.class, () -> {
+ String websocketURL = "wss://url.websocket.com";
+ Map cookies = new ConcurrentHashMap();
+ cookies.put("JSESSIONID", "1bif45f-testSessionId");
+ new Expectations() {
+ {
+ mockResponse.getStatusCode();
+ result = Status.CREATED;
+
+ /*
+ * For some very odd reason, just having mocked objects of Pattern and Matcher causes
+ * surefire plug-in to report the following very odd and strange errors on all
+ * subsequent test cases. Hence, we have to use real values so we don't have to mock
+ * which is a better approach anyway.
+ */
+ // Pattern.compile(anyString);
+ // result = mockPattern;
+ //
+ // mockPattern.matcher(anyString);
+ // result = mockMatcher;
+ //
+ // mockMatcher.matches();
+ // result = false;
+ }
+ };
+
+ CASClient casClient;
- CASClient casClient;
-
- casClient = CASClient.configure(sslContext, casUrl, casUser, casPass);
- casClient.login(websocketURL);
+ casClient = CASClient.configure(sslContext, casUrl, casUser, casPass);
+ casClient.login(websocketURL);
+ });
}
- @Test(expected = CASException.class)
+ @Test
public void testLoginExceptionInGetServiceTicket()
throws HttpException, CASException {
- String websocketURL = "wss://url.websocket.com";
- Map cookies = new ConcurrentHashMap();
- cookies.put("JSESSIONID", "1bif45f-testSessionId");
- new Expectations() {
- {
- mockResponse.getStatusCode();
- result = Status.CREATED;
- result = Status.BAD_REQUEST;
+ assertThrows(CASException.class, () -> {
+ String websocketURL = "wss://url.websocket.com";
+ Map cookies = new ConcurrentHashMap();
+ cookies.put("JSESSIONID", "1bif45f-testSessionId");
+ new Expectations() {
+ {
+ mockResponse.getStatusCode();
+ result = Status.CREATED;
+ result = Status.BAD_REQUEST;
+
+ /*
+ * For some very odd reason, just having mocked objects of Pattern and Matcher causes
+ * surefire plug-in to report the following very odd and strange errors on all
+ * subsequent test cases. Hence, we have to use real values so we don't have to mock
+ * which is a better approach anyway.
+ */
+ // Pattern.compile(anyString);
+ // result = mockPattern;
+ //
+ // mockPattern.matcher(anyString);
+ // result = mockMatcher;
+ //
+ // mockMatcher.matches();
+ // result = true;
+ // mockMatcher.group(1);
+ // result = "TGT-1234-11112222333334444-cas01";
+
+ mockResponse.getBody();
+ result = "action=\"x/TGT-1234-11112222333334444-cas01\"";
+ result = "ST-1234-1111222233334444-cas01";
+ }
+ };
+
+ CASClient casClient;
- /*
- * For some very odd reason, just having mocked objects of Pattern and Matcher causes
- * surefile plug-in to report the followig very odd and strange errors on all
- * subsequest test cases. Hence, we have to use real values so we don't have to mock
- * which is a better approach anyway.
- */
-// Pattern.compile(anyString);
-// result = mockPattern;
-//
-// mockPattern.matcher(anyString);
-// result = mockMatcher;
-//
-// mockMatcher.matches();
-// result = true;
-// mockMatcher.group(1);
-// result = "TGT-1234-11112222333334444-cas01";
-
- mockResponse.getBody();
- result = "action=\"x/TGT-1234-11112222333334444-cas01\"";
- result = "ST-1234-1111222233334444-cas01";
- }
- };
-
- CASClient casClient;
-
- casClient = CASClient.configure(sslContext, casUrl, casUser, casPass);
- casClient.login(websocketURL);
+ casClient = CASClient.configure(sslContext, casUrl, casUser, casPass);
+ casClient.login(websocketURL);
+ });
}
- @Test(expected = CASException.class)
+ @Test
public void testLoginExceptionInGetServiceCall()
throws HttpException, CASException {
- String websocketURL = "wss://url.websocket.com";
- Map cookies = new ConcurrentHashMap();
- cookies.put("JSESSIONID", "1bif45f-testSessionId");
- new Expectations() {
- {
- mockResponse.getStatusCode();
- result = Status.CREATED;
- result = Status.OK;
- result = Status.BAD_REQUEST;
-
- /*
- * For some very odd reason, just having mocked objects of Pattern and Matcher causes
- * surefile plug-in to report the followig very odd and strange errors on all
- * subsequest test cases. Hence, we have to use real values so we don't have to mock
- * which is a better approach anyway.
- */
-// Pattern.compile(anyString);
-// result = mockPattern;
-//
-// mockPattern.matcher(anyString);
-// result = mockMatcher;
-//
-// mockMatcher.matches();
-// result = true;
-// mockMatcher.group(1);
-// result = "TGT-1234-11112222333334444-cas01";
-
- mockResponse.getBody();
- result = "action=\"x/TGT-1234-11112222333334444-cas01\"";
- result = "ST-1234-1111222233334444-cas01";
-
- }
- };
-
- CASClient casClient = CASClient.configure(sslContext, casUrl, casUser, casPass);
- casClient.login(websocketURL);
+ assertThrows(CASException.class, () -> {
+ String websocketURL = "wss://url.websocket.com";
+ Map cookies = new ConcurrentHashMap();
+ cookies.put("JSESSIONID", "1bif45f-testSessionId");
+ new Expectations() {
+ {
+ mockResponse.getStatusCode();
+ result = Status.CREATED;
+ result = Status.OK;
+ result = Status.BAD_REQUEST;
+
+ /*
+ * For some very odd reason, just having mocked objects of Pattern and Matcher causes
+ * surefire plug-in to report the following very odd and strange errors on all
+ * subsequent test cases. Hence, we have to use real values so we don't have to mock
+ * which is a better approach anyway.
+ */
+ // Pattern.compile(anyString);
+ // result = mockPattern;
+ //
+ // mockPattern.matcher(anyString);
+ // result = mockMatcher;
+ //
+ // mockMatcher.matches();
+ // result = true;
+ // mockMatcher.group(1);
+ // result = "TGT-1234-11112222333334444-cas01";
+
+ mockResponse.getBody();
+ result = "action=\"x/TGT-1234-11112222333334444-cas01\"";
+ result = "ST-1234-1111222233334444-cas01";
+
+ }
+ };
+
+ CASClient casClient = CASClient.configure(sslContext, casUrl, casUser, casPass);
+ casClient.login(websocketURL);
+ });
}
}
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsClientTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsClientTest.java
index 39fdac608..066046140 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsClientTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsClientTest.java
@@ -15,6 +15,8 @@
******************************************************************************/
package us.dot.its.jpo.ode.dds;
+import static org.junit.Assert.assertThrows;
+
import java.io.InputStream;
import java.net.URI;
import java.util.List;
@@ -22,8 +24,8 @@
import javax.net.ssl.SSLContext;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Expectations;
@@ -49,7 +51,7 @@ public class DdsClientTest {
String keystoreFile = "keystoreFile";
String keystorePass = "keystorePass";
- @Ignore
+ @Disabled
@Test
public void testConstructor() {
try {
@@ -82,11 +84,11 @@ public void testConstructor() {
}
}
- @Ignore
- @Test(expected = DdsClientException.class)
+ @Disabled
+ @Test
public void testConstructorException()
throws DdsClientException, CASException {
-
+ assertThrows(DdsClientException.class, () -> {
new Expectations() {
{
CASClient.configure((SSLContext) any, anyString, anyString, anyString);
@@ -95,10 +97,11 @@ public void testConstructorException()
};
new DdsClient(ddsCasUrl, ddsCasUsername, ddsCasPassword, websocketURL, keystoreFile, keystorePass);
+ });
}
@SuppressWarnings("unchecked")
- @Ignore
+ @Disabled
@Test
public void testLogin() {
try {
@@ -120,23 +123,24 @@ public void testLogin() {
}
}
- @Ignore
+ @Disabled
@SuppressWarnings("unchecked")
- @Test(expected = DdsClientException.class)
+ @Test
public void testLoginException()
throws DdsClientException, CASException {
+ assertThrows(DdsClientException.class, () -> {
+ new Expectations() {
+ {
+ mockCasClient.login(anyString);
+ new WebSocketEndpoint((URI) any, (SSLContext) any, null, (Map>) any,
+ (WebSocketMessageHandler) any, (List>>) any);
+ result = new DdsClientException(null);
+ }
+ };
- new Expectations() {
- {
- mockCasClient.login(anyString);
- new WebSocketEndpoint((URI) any, (SSLContext) any, null, (Map>) any,
- (WebSocketMessageHandler) any, (List>>) any);
- result = new DdsClientException(null);
- }
- };
-
- DdsClient ddsClient = new DdsClient(ddsCasUrl, ddsCasUsername, ddsCasPassword, websocketURL,
- keystoreFile, keystorePass);
- ddsClient.login(null, mockMessageHandler);
+ DdsClient ddsClient = new DdsClient(ddsCasUrl, ddsCasUsername, ddsCasPassword, websocketURL,
+ keystoreFile, keystorePass);
+ ddsClient.login(null, mockMessageHandler);
+ });
}
}
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsDepRequestTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsDepRequestTest.java
index 5989cb514..d2d7d3ff5 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsDepRequestTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsDepRequestTest.java
@@ -16,7 +16,7 @@
package us.dot.its.jpo.ode.dds;
import static org.junit.Assert.*;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DdsDepRequestTest {
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsRequestTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsRequestTest.java
index dd2fac010..cfd507e0f 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsRequestTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsRequestTest.java
@@ -17,9 +17,9 @@
import static org.junit.Assert.*;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import us.dot.its.jpo.ode.dds.DdsRequest.Dialog;
import us.dot.its.jpo.ode.dds.DdsRequest.EncodeType;
import us.dot.its.jpo.ode.dds.DdsRequest.SystemName;
@@ -28,12 +28,14 @@ public class DdsRequestTest {
private DdsRequest ddsRequest;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
- ddsRequest = new DdsRequest();
+ if (ddsRequest == null) {
+ ddsRequest = new DdsRequest();
+ }
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
}
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsStatusMessageDecoderTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsStatusMessageDecoderTest.java
index d6f0ed2e7..7bead5cd4 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsStatusMessageDecoderTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsStatusMessageDecoderTest.java
@@ -18,7 +18,7 @@
import static org.junit.Assert.*;
import javax.websocket.DecodeException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import us.dot.its.jpo.ode.model.StatusTag;
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsStatusMessageTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsStatusMessageTest.java
index b062e9c87..af62c8cfe 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsStatusMessageTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DdsStatusMessageTest.java
@@ -18,7 +18,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Mocked;
import us.dot.its.jpo.ode.dds.DdsRequest.Dialog;
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DepositResponseDecoderTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DepositResponseDecoderTest.java
index 845ad213c..59229c8de 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DepositResponseDecoderTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/DepositResponseDecoderTest.java
@@ -18,7 +18,7 @@
import static org.junit.Assert.*;
import javax.websocket.DecodeException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DepositResponseDecoderTest {
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/StatusMessageHandlerTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/StatusMessageHandlerTest.java
index 9462cde8f..a01f4be61 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/StatusMessageHandlerTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/dds/StatusMessageHandlerTest.java
@@ -20,7 +20,7 @@
import javax.websocket.CloseReason;
import javax.websocket.Session;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import ch.qos.logback.classic.Logger;
import mockit.Expectations;
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeBsmDataTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeBsmDataTest.java
index 36224cb53..dd8ef1555 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeBsmDataTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeBsmDataTest.java
@@ -1,6 +1,6 @@
package us.dot.its.jpo.ode.model;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
import com.networknt.schema.JsonSchema;
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeMapDataTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeMapDataTest.java
index 11872f588..62a141ae5 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeMapDataTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeMapDataTest.java
@@ -7,7 +7,7 @@
import com.networknt.schema.ValidationMessage;
import java.util.Set;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.junit.Assert.*;
import us.dot.its.jpo.ode.util.JsonUtils;
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeSpatDataTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeSpatDataTest.java
index ee270d285..bdc3359d3 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeSpatDataTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeSpatDataTest.java
@@ -7,7 +7,7 @@
import com.networknt.schema.ValidationMessage;
import java.util.Set;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.junit.Assert.*;
import us.dot.its.jpo.ode.util.JsonUtils;
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeSrmDataTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeSrmDataTest.java
index 5d104df20..9b8bfbea9 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeSrmDataTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeSrmDataTest.java
@@ -7,7 +7,7 @@
import com.networknt.schema.ValidationMessage;
import java.util.Set;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.junit.Assert.*;
import us.dot.its.jpo.ode.util.JsonUtils;
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeSsmDataTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeSsmDataTest.java
index cc54c39fa..3121a8131 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeSsmDataTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeSsmDataTest.java
@@ -7,7 +7,7 @@
import com.networknt.schema.ValidationMessage;
import java.util.Set;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.junit.Assert.*;
import us.dot.its.jpo.ode.util.JsonUtils;
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeTimDataTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeTimDataTest.java
index 621d5da29..a166002be 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeTimDataTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/OdeTimDataTest.java
@@ -10,7 +10,7 @@
import java.util.Set;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.junit.Assert.*;
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/SerialIdTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/SerialIdTest.java
index 30b6a3f03..2228e68f2 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/SerialIdTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/model/SerialIdTest.java
@@ -22,7 +22,7 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/snmp/SNMPTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/snmp/SNMPTest.java
index a4b280d35..2642da264 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/snmp/SNMPTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/snmp/SNMPTest.java
@@ -19,7 +19,7 @@
import java.text.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
//import mockit.integration.junit4.JMockit;
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/HttpClientFactoryTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/HttpClientFactoryTest.java
index df49842e0..d54217a1d 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/HttpClientFactoryTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/HttpClientFactoryTest.java
@@ -24,7 +24,7 @@
//import mockit.integration.junit4.JMockit;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import us.dot.its.jpo.ode.wrapper.HttpClientFactory.HttpException;
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/HttpClientTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/HttpClientTest.java
index 29158b533..188595d57 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/HttpClientTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/HttpClientTest.java
@@ -42,8 +42,8 @@
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.message.BasicStatusLine;
import org.apache.http.params.HttpParams;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Expectations;
@@ -63,7 +63,7 @@ public class HttpClientTest {
@Mocked
CloseableHttpClient closeableHttpClient;
- @Test @Ignore
+ @Test @Disabled
public void testGet() throws Exception {
{ // BEGIN Happy Path
URI uri = new URI("http://ip:port/path");
@@ -177,7 +177,7 @@ public void testGet() throws Exception {
}// END execute throws exception
}
- @Test @Ignore
+ @Test @Disabled
public void testPost() throws Exception {
{ // BEGIN Happy Path
URI uri = new URI("http://ip:port/path");
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/SSLBuilderTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/SSLBuilderTest.java
index c270abc6f..3be73091e 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/SSLBuilderTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/SSLBuilderTest.java
@@ -23,7 +23,7 @@
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.ssl.SSLContexts;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Expectations;
diff --git a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/WebSocketEndpointTest.java b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/WebSocketEndpointTest.java
index 40a7866fd..e9799e420 100644
--- a/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/WebSocketEndpointTest.java
+++ b/jpo-ode-core/src/test/java/us/dot/its/jpo/ode/wrapper/WebSocketEndpointTest.java
@@ -37,11 +37,11 @@
import javax.websocket.Session;
import javax.websocket.WebSocketContainer;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Expectations;
@@ -93,19 +93,19 @@ public void onError(Session session, Throwable t) {
}
};
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() throws Exception {
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
}
diff --git a/jpo-ode-plugins/src/main/java/us/dot/its/jpo/ode/plugin/RoadSideUnit.java b/jpo-ode-plugins/src/main/java/us/dot/its/jpo/ode/plugin/RoadSideUnit.java
index 92e4c76da..f293b1d85 100644
--- a/jpo-ode-plugins/src/main/java/us/dot/its/jpo/ode/plugin/RoadSideUnit.java
+++ b/jpo-ode-plugins/src/main/java/us/dot/its/jpo/ode/plugin/RoadSideUnit.java
@@ -18,126 +18,162 @@
import us.dot.its.jpo.ode.model.OdeObject;
public class RoadSideUnit {
- public static class RSU extends OdeObject {
-
- private static final long serialVersionUID = 3149576493038209597L;
-
- private String rsuTarget;
- private String rsuUsername;
- private String rsuPassword;
- private int rsuRetries;
- private int rsuTimeout;
- private int rsuIndex;
-
- public RSU() {
- super();
- }
-
- public RSU(String rsuTarget, String rsuUsername, String rsuPassword, int rsuRetries, int rsuTimeout) {
- super();
- this.rsuTarget = rsuTarget;
- this.rsuUsername = rsuUsername;
- this.rsuPassword = rsuPassword;
- this.rsuRetries = rsuRetries;
- this.rsuTimeout = rsuTimeout;
- }
-
- public String getRsuTarget() {
- return rsuTarget;
- }
-
- public void setRsuTarget(String rsuTarget) {
- this.rsuTarget = rsuTarget;
- }
-
- public String getRsuUsername() {
- return rsuUsername;
- }
-
- public void setRsuUsername(String rsuUsername) {
- this.rsuUsername = rsuUsername;
- }
-
- public String getRsuPassword() {
- return rsuPassword;
- }
-
- public void setRsuPassword(String rsuPassword) {
- this.rsuPassword = rsuPassword;
- }
-
- public int getRsuRetries() {
- return rsuRetries;
- }
-
- public void setRsuRetries(int rsuRetries) {
- this.rsuRetries = rsuRetries;
- }
-
- public int getRsuTimeout() {
- return rsuTimeout;
- }
-
- public void setRsuTimeout(int rsuTimeout) {
- this.rsuTimeout = rsuTimeout;
- }
-
- public int getRsuIndex() {
- return rsuIndex;
- }
-
- public void setRsuIndex(int rsuIndex) {
- this.rsuIndex = rsuIndex;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + rsuIndex;
- result = prime * result + ((rsuPassword == null) ? 0 : rsuPassword.hashCode());
- result = prime * result + rsuRetries;
- result = prime * result + ((rsuTarget == null) ? 0 : rsuTarget.hashCode());
- result = prime * result + rsuTimeout;
- result = prime * result + ((rsuUsername == null) ? 0 : rsuUsername.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- RSU other = (RSU) obj;
- if (rsuIndex != other.rsuIndex)
- return false;
- if (rsuPassword == null) {
- if (other.rsuPassword != null)
- return false;
- } else if (!rsuPassword.equals(other.rsuPassword))
- return false;
- if (rsuRetries != other.rsuRetries)
- return false;
- if (rsuTarget == null) {
- if (other.rsuTarget != null)
- return false;
- } else if (!rsuTarget.equals(other.rsuTarget))
- return false;
- if (rsuTimeout != other.rsuTimeout)
- return false;
- if (rsuUsername == null) {
- if (other.rsuUsername != null)
- return false;
- } else if (!rsuUsername.equals(other.rsuUsername))
- return false;
- return true;
- }
- }
-
- private RoadSideUnit() {
- throw new UnsupportedOperationException();
- }
+ public static class RSU extends OdeObject {
+
+ private static final long serialVersionUID = 3149576493038209597L;
+
+ private String rsuTarget;
+ private String rsuUsername;
+ private String rsuPassword;
+ private int rsuRetries;
+ private int rsuTimeout;
+ private int rsuIndex;
+ private SnmpProtocol snmpProtocol;
+
+ public RSU() {
+ super();
+
+ // default to 4.1 SNMP protocol
+ this.snmpProtocol = SnmpProtocol.FOURDOT1;
+ }
+
+ public RSU(String rsuTarget, String rsuUsername, String rsuPassword, int rsuRetries, int rsuTimeout) {
+ super();
+ this.rsuTarget = rsuTarget;
+ this.rsuUsername = rsuUsername;
+ this.rsuPassword = rsuPassword;
+ this.rsuRetries = rsuRetries;
+ this.rsuTimeout = rsuTimeout;
+
+ // default to 4.1 SNMP protocol
+ this.snmpProtocol = SnmpProtocol.FOURDOT1;
+ }
+
+ public RSU(String rsuTarget, String rsuUsername, String rsuPassword, int rsuRetries, int rsuTimeout, SnmpProtocol snmpProtocol) {
+ this(rsuTarget, rsuUsername, rsuPassword, rsuRetries, rsuTimeout);
+ this.snmpProtocol = snmpProtocol;
+ }
+
+ public String getRsuTarget() {
+ return rsuTarget;
+ }
+
+ public void setRsuTarget(String rsuTarget) {
+ this.rsuTarget = rsuTarget;
+ }
+
+ public String getRsuUsername() {
+ return rsuUsername;
+ }
+
+ public void setRsuUsername(String rsuUsername) {
+ this.rsuUsername = rsuUsername;
+ }
+
+ public String getRsuPassword() {
+ return rsuPassword;
+ }
+
+ public void setRsuPassword(String rsuPassword) {
+ this.rsuPassword = rsuPassword;
+ }
+
+ public int getRsuRetries() {
+ return rsuRetries;
+ }
+
+ public void setRsuRetries(int rsuRetries) {
+ this.rsuRetries = rsuRetries;
+ }
+
+ public int getRsuTimeout() {
+ return rsuTimeout;
+ }
+
+ public void setRsuTimeout(int rsuTimeout) {
+ this.rsuTimeout = rsuTimeout;
+ }
+
+ public int getRsuIndex() {
+ return rsuIndex;
+ }
+
+ public void setRsuIndex(int rsuIndex) {
+ this.rsuIndex = rsuIndex;
+ }
+
+ public SnmpProtocol getSnmpProtocol() {
+ return snmpProtocol;
+ }
+
+ public void setSnmpProtocol(SnmpProtocol snmpProtocol) {
+ this.snmpProtocol = snmpProtocol;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + rsuIndex;
+ result = prime * result + ((rsuPassword == null) ? 0 : rsuPassword.hashCode());
+ result = prime * result + rsuRetries;
+ result = prime * result + ((rsuTarget == null) ? 0 : rsuTarget.hashCode());
+ result = prime * result + rsuTimeout;
+ result = prime * result + ((rsuUsername == null) ? 0 : rsuUsername.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ RSU other = (RSU) obj;
+ if (rsuIndex != other.rsuIndex) {
+ return false;
+ }
+ if (rsuPassword == null) {
+ if (other.rsuPassword != null) {
+ return false;
+ }
+ }
+ else if (!rsuPassword.equals(other.rsuPassword)) {
+ return false;
+ }
+ if (rsuRetries != other.rsuRetries) {
+ return false;
+ }
+ if (rsuTarget == null) {
+ if (other.rsuTarget != null) {
+ return false;
+ }
+ }
+ else if (!rsuTarget.equals(other.rsuTarget)) {
+ return false;
+ }
+ if (rsuTimeout != other.rsuTimeout) {
+ return false;
+ }
+ if (rsuUsername == null) {
+ if (other.rsuUsername != null) {
+ return false;
+ }
+ }
+ else if (!rsuUsername.equals(other.rsuUsername)) {
+ return false;
+ }
+ return true;
+ }
+ }
+
+ private RoadSideUnit() {
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/jpo-ode-plugins/src/main/java/us/dot/its/jpo/ode/plugin/SnmpProtocol.java b/jpo-ode-plugins/src/main/java/us/dot/its/jpo/ode/plugin/SnmpProtocol.java
new file mode 100644
index 000000000..e2182692a
--- /dev/null
+++ b/jpo-ode-plugins/src/main/java/us/dot/its/jpo/ode/plugin/SnmpProtocol.java
@@ -0,0 +1,6 @@
+package us.dot.its.jpo.ode.plugin;
+
+public enum SnmpProtocol {
+ FOURDOT1,
+ NTCIP1218
+}
\ No newline at end of file
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/ODETest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/ODETest.java
index 9f06c4954..0b2999514 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/ODETest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/ODETest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import us.dot.its.jpo.ode.plugin.ServiceRequest;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/PluginFactoryTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/PluginFactoryTest.java
index b4134c8ab..feb555e77 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/PluginFactoryTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/PluginFactoryTest.java
@@ -16,9 +16,10 @@
package us.dot.its.jpo.ode.plugin.generic;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,43 +40,45 @@ public class PluginFactoryTest {
@Mocked//(stubOutClassInitialization = true)
final LoggerFactory unused = null;
- @Test(expected = ClassCastException.class)
+ @Test
public void testGetPluginByName(@Mocked Logger logger)
throws ClassNotFoundException, InstantiationException, IllegalAccessException {
+ assertThrows(ClassCastException.class, () -> {
+ String coderClassName = "us.dot.its.jpo.ode.plugin.generic.TestPlugin";
- String coderClassName = "us.dot.its.jpo.ode.plugin.generic.TestPlugin";
-
- OdePlugin result = PluginFactory.getPluginByName(coderClassName);
- assertNotNull(result);
- //assertTrue(result instanceof TestPlugin);
- new Verifications() {
- {
- logger.info("Getting Plugin: {}", coderClassName);
- logger.info("Classpath: {}", anyString);
- logger.info("Getting class: {}", anyString);
- logger.info("creating an instance of: {}", any);
- }
- };
+ OdePlugin result = PluginFactory.getPluginByName(coderClassName);
+ assertNotNull(result);
+ //assertTrue(result instanceof TestPlugin);
+ new Verifications() {
+ {
+ logger.info("Getting Plugin: {}", coderClassName);
+ logger.info("Classpath: {}", anyString);
+ logger.info("Getting class: {}", anyString);
+ logger.info("creating an instance of: {}", any);
+ }
+ };
+ });
}
- @Test(expected = ClassCastException.class)
+ @Test
public void testException(@Mocked Logger logger)
throws ClassNotFoundException, InstantiationException, IllegalAccessException {
+ assertThrows(ClassCastException.class, () -> {
+ String coderClassName = "bogus.BogusClass";
- String coderClassName = "bogus.BogusClass";
-
- OdePlugin result = PluginFactory.getPluginByName(coderClassName);
- assertNotNull(result);
- assertTrue(result instanceof J2735Bsm);
- new Verifications() {
- {
- logger.info("Getting Plugin: {}", coderClassName);
- logger.error(anyString, (Exception) any);
- logger.info("Classpath: {}", anyString);
- logger.info("Getting class: {}", anyString);
- logger.info("creating an instance of: {}", any);
- }
- };
+ OdePlugin result = PluginFactory.getPluginByName(coderClassName);
+ assertNotNull(result);
+ assertTrue(result instanceof J2735Bsm);
+ new Verifications() {
+ {
+ logger.info("Getting Plugin: {}", coderClassName);
+ logger.error(anyString, (Exception) any);
+ logger.info("Classpath: {}", anyString);
+ logger.info("Getting class: {}", anyString);
+ logger.info("creating an instance of: {}", any);
+ }
+ };
+ });
}
}
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/RoadSideUnitTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/RoadSideUnitTest.java
index 744204678..58a19a8f5 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/RoadSideUnitTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/RoadSideUnitTest.java
@@ -23,48 +23,105 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import mockit.Tested;
-//import mockit.integration.junit4.JMockit;
import us.dot.its.jpo.ode.plugin.RoadSideUnit;
+import us.dot.its.jpo.ode.plugin.SnmpProtocol;
+import us.dot.its.jpo.ode.util.JsonUtils;
import us.dot.its.jpo.ode.plugin.RoadSideUnit.RSU;
-//@RunWith(JMockit.class)
public class RoadSideUnitTest {
- @Tested
- RSU testRSU;
-
- @Test
- public void testGettersAndSetters() {
- String rsuTarget = "target";
- testRSU.setRsuTarget(rsuTarget);
- assertEquals(rsuTarget, testRSU.getRsuTarget());
- String rsuUsername = "name";
- testRSU.setRsuUsername(rsuUsername);
- assertEquals(rsuUsername, testRSU.getRsuUsername());
- String rsuPassword = "password";
- testRSU.setRsuPassword(rsuPassword);
- assertEquals(rsuPassword, testRSU.getRsuPassword());
- int rsuRetries = 2;
- testRSU.setRsuRetries(rsuRetries);
- assertEquals(rsuRetries, testRSU.getRsuRetries());
- int rsuTimeout = 10000;
- testRSU.setRsuTimeout(rsuTimeout);
- assertEquals(rsuTimeout, testRSU.getRsuTimeout());
- }
-
- @Test
- public void testConstructorIsPrivate() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
- Constructor constructor = RoadSideUnit.class.getDeclaredConstructor();
- assertTrue(Modifier.isPrivate(constructor.getModifiers()));
- constructor.setAccessible(true);
- try {
- constructor.newInstance();
- fail("Expected IllegalAccessException.class");
- } catch (Exception e) {
- assertEquals(InvocationTargetException.class, e.getClass());
- }
- }
+ @Tested
+ RSU testRSU;
+
+ @Test
+ public void testGettersAndSetters() {
+ String rsuTarget = "target";
+ testRSU.setRsuTarget(rsuTarget);
+ assertEquals(rsuTarget, testRSU.getRsuTarget());
+ String rsuUsername = "name";
+ testRSU.setRsuUsername(rsuUsername);
+ assertEquals(rsuUsername, testRSU.getRsuUsername());
+ String rsuPassword = "password";
+ testRSU.setRsuPassword(rsuPassword);
+ assertEquals(rsuPassword, testRSU.getRsuPassword());
+ int rsuRetries = 2;
+ testRSU.setRsuRetries(rsuRetries);
+ assertEquals(rsuRetries, testRSU.getRsuRetries());
+ int rsuTimeout = 10000;
+ testRSU.setRsuTimeout(rsuTimeout);
+ assertEquals(rsuTimeout, testRSU.getRsuTimeout());
+ SnmpProtocol snmpProtocol = SnmpProtocol.NTCIP1218;
+ testRSU.setSnmpProtocol(snmpProtocol);
+ assertEquals(snmpProtocol, testRSU.getSnmpProtocol());
+ }
+
+ @Test
+ public void testConstructorIsPrivate() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
+ Constructor constructor = RoadSideUnit.class.getDeclaredConstructor();
+ assertTrue(Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ try {
+ constructor.newInstance();
+ fail("Expected IllegalAccessException.class");
+ } catch (Exception e) {
+ assertEquals(InvocationTargetException.class, e.getClass());
+ }
+ }
+
+ @Test
+ public void testDeserializationFromJson() {
+ String defaultRSU = "{\"rsuTarget\":\"10.10.10.10\",\"rsuUsername\":\"user\",\"rsuPassword\":\"pass\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\"}";
+
+ RSU deserializedRSU = (RSU) JsonUtils.fromJson(defaultRSU, RSU.class);
+
+ assertEquals("10.10.10.10", deserializedRSU.getRsuTarget());
+ assertEquals("user", deserializedRSU.getRsuUsername());
+ assertEquals("pass", deserializedRSU.getRsuPassword());
+ assertEquals(3, deserializedRSU.getRsuRetries());
+ assertEquals(5000, deserializedRSU.getRsuTimeout());
+ }
+
+ @Test
+ public void testDeserializationFromJson_fourDot1RSU() {
+ String fourDot1RSU = "{\"rsuTarget\":\"10.10.10.10\",\"rsuUsername\":\"user\",\"rsuPassword\":\"pass\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\",\"snmpProtocol\":\"FOURDOT1\"}";
+
+ RSU deserializedRSU = (RSU) JsonUtils.fromJson(fourDot1RSU, RSU.class);
+
+ assertEquals("10.10.10.10", deserializedRSU.getRsuTarget());
+ assertEquals("user", deserializedRSU.getRsuUsername());
+ assertEquals("pass", deserializedRSU.getRsuPassword());
+ assertEquals(3, deserializedRSU.getRsuRetries());
+ assertEquals(5000, deserializedRSU.getRsuTimeout());
+ assertEquals(SnmpProtocol.FOURDOT1, deserializedRSU.getSnmpProtocol());
+ }
+
+ @Test
+ public void testDeserializationFromJson_ntcip1218RSU() {
+ String ntcip1218RSU = "{\"rsuTarget\":\"10.10.10.10\",\"rsuUsername\":\"user\",\"rsuPassword\":\"pass\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\",\"snmpProtocol\":\"NTCIP1218\"}";
+
+ RSU deserializedRSU = (RSU) JsonUtils.fromJson(ntcip1218RSU, RSU.class);
+
+ assertEquals("10.10.10.10", deserializedRSU.getRsuTarget());
+ assertEquals("user", deserializedRSU.getRsuUsername());
+ assertEquals("pass", deserializedRSU.getRsuPassword());
+ assertEquals(3, deserializedRSU.getRsuRetries());
+ assertEquals(5000, deserializedRSU.getRsuTimeout());
+ assertEquals(SnmpProtocol.NTCIP1218, deserializedRSU.getSnmpProtocol());
+ }
+
+ @Test
+ public void testDeserializationFromJson_unrecognizedProtocol_exception() {
+ String unrecognizedProtocolRSU = "{\"rsuTarget\":\"10.10.10.10\",\"rsuUsername\":\"user\",\"rsuPassword\":\"pass\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\",\"snmpProtocol\":\"banana\"}";
+
+ RSU deserializedRSU = null;
+ try {
+ deserializedRSU = (RSU) JsonUtils.fromJson(unrecognizedProtocolRSU, RSU.class);
+ }
+ catch(Exception e) {
+
+ }
+ assert(deserializedRSU == null);
+ }
}
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/SituationDataWarehouseTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/SituationDataWarehouseTest.java
index 8d281b58a..e12fda78b 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/SituationDataWarehouseTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/SituationDataWarehouseTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Tested;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/TimFieldValidatorTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/TimFieldValidatorTest.java
index ced1e4d2e..e5f912f0b 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/TimFieldValidatorTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/generic/TimFieldValidatorTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import us.dot.its.jpo.ode.plugin.j2735.OdePosition3D;
import us.dot.its.jpo.ode.plugin.j2735.TimFieldValidator;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/DdsAdvisoryDetailsTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/DdsAdvisoryDetailsTest.java
index 1ce89d0ec..57f5dd1c9 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/DdsAdvisoryDetailsTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/DdsAdvisoryDetailsTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.*;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Tested;
import us.dot.its.jpo.ode.plugin.ieee1609dot2.Ieee1609Dot2DataTag;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/DdsAdvisorySituationDataTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/DdsAdvisorySituationDataTest.java
index 0b8a00099..25d6fdf38 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/DdsAdvisorySituationDataTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/DdsAdvisorySituationDataTest.java
@@ -23,7 +23,7 @@
import java.text.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import us.dot.its.jpo.ode.plugin.SituationDataWarehouse;
import us.dot.its.jpo.ode.plugin.ieee1609dot2.Ieee1609Dot2DataTag;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/DsrcPosition3DTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/DsrcPosition3DTest.java
index 6bead0134..7ddab7b1e 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/DsrcPosition3DTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/DsrcPosition3DTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.*;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class DsrcPosition3DTest {
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735BsmPart2ContentTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735BsmPart2ContentTest.java
index 0e2d3e7d3..498155365 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735BsmPart2ContentTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735BsmPart2ContentTest.java
@@ -1,6 +1,6 @@
package us.dot.its.jpo.ode.plugin.j2735;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.junit.Assert.*;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735BsmTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735BsmTest.java
index 66fe10349..3b936af12 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735BsmTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735BsmTest.java
@@ -20,7 +20,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Mocked;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735ChoiceTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735ChoiceTest.java
index eeebd6e74..4aa849f53 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735ChoiceTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735ChoiceTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.*;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -62,18 +62,20 @@ public void testSetChosenField() {
@Mocked//(stubOutClassInitialization = true)
final LoggerFactory unused = null;
- @Test(expected = NoSuchFieldException.class)
+ @Test
public void testSetChosenFieldException2(@Mocked Logger logger) throws NoSuchFieldException {
- new Expectations() {
- {
- logger.error(anyString, (Exception) any);
- ;
- result = new NoSuchFieldException();
- }
- };
- j2735Choice.setChosenFieldName("childField");
- assertEquals("childField", j2735Choice.getChosenFieldName());
+ assertThrows(NoSuchFieldException.class, () -> {
+ new Expectations() {
+ {
+ logger.error(anyString, (Exception) any);
+ ;
+ result = new NoSuchFieldException();
+ }
+ };
+ j2735Choice.setChosenFieldName("childField");
+ assertEquals("childField", j2735Choice.getChosenFieldName());
- j2735Choice.setChosenField("wrongField", "childFieldValue");
+ j2735Choice.setChosenField("wrongField", "childFieldValue");
+ });
}
}
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735DirectionOfUseTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735DirectionOfUseTest.java
index cc28ae36e..e9d81dfa3 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735DirectionOfUseTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735DirectionOfUseTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.assertNotNull;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class J2735DirectionOfUseTest {
@Test
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735EmergencyDetailsTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735EmergencyDetailsTest.java
index 6d2bfe9a7..f52a4fd94 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735EmergencyDetailsTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735EmergencyDetailsTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Tested;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735EventDescriptionTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735EventDescriptionTest.java
index d5f3de8c6..9d681af0b 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735EventDescriptionTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735EventDescriptionTest.java
@@ -20,7 +20,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Tested;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735FullPositionVectorTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735FullPositionVectorTest.java
index 861e52513..0bcf9291b 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735FullPositionVectorTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735FullPositionVectorTest.java
@@ -19,7 +19,7 @@
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Tested;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735PathHistoryPointListTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735PathHistoryPointListTest.java
index 2b7d346c6..cfb32cad2 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735PathHistoryPointListTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735PathHistoryPointListTest.java
@@ -20,7 +20,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Tested;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735PathHistoryPointTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735PathHistoryPointTest.java
index 34714a122..9e002cc47 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735PathHistoryPointTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735PathHistoryPointTest.java
@@ -19,7 +19,7 @@
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Tested;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735ProbeDataManagmentTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735ProbeDataManagmentTest.java
index 0c2745b8f..570ade4bc 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735ProbeDataManagmentTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735ProbeDataManagmentTest.java
@@ -18,7 +18,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Tested;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735RTCMPackageTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735RTCMPackageTest.java
index 81b178b25..e1a2abb77 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735RTCMPackageTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735RTCMPackageTest.java
@@ -20,7 +20,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Tested;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735RegionalContentTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735RegionalContentTest.java
index 6b5144799..bc59fcaaa 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735RegionalContentTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735RegionalContentTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.*;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class J2735RegionalContentTest {
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735SpecialVehicleExtensionTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735SpecialVehicleExtensionTest.java
index 094448461..77b20c5f1 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735SpecialVehicleExtensionTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735SpecialVehicleExtensionTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Tested;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735SpeedProfileTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735SpeedProfileTest.java
index 85c400c63..b4fa21002 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735SpeedProfileTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735SpeedProfileTest.java
@@ -20,7 +20,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Tested;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735SupplementalVehicleExtensionsTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735SupplementalVehicleExtensionsTest.java
index 52986184e..7219e5e81 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735SupplementalVehicleExtensionsTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735SupplementalVehicleExtensionsTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Tested;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735TrailerDataTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735TrailerDataTest.java
index d85ed626e..a60196439 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735TrailerDataTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735TrailerDataTest.java
@@ -20,7 +20,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Tested;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735TrailerUnitDescriptionTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735TrailerUnitDescriptionTest.java
index e17f88e11..d2108ff68 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735TrailerUnitDescriptionTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735TrailerUnitDescriptionTest.java
@@ -22,7 +22,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Tested;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735TransmissionAndSpeedTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735TransmissionAndSpeedTest.java
index 9c60e650b..adfba17af 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735TransmissionAndSpeedTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735TransmissionAndSpeedTest.java
@@ -19,7 +19,7 @@
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
//import mockit.integration.junit4.JMockit;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735VehicleEventFlagTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735VehicleEventFlagTest.java
index e0aac8eb3..db49ff974 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735VehicleEventFlagTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735VehicleEventFlagTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.assertNotNull;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class J2735VehicleEventFlagTest {
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735VehicleStatusRequestTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735VehicleStatusRequestTest.java
index 134126266..717238e2b 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735VehicleStatusRequestTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/J2735VehicleStatusRequestTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Tested;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/OdeGeoRegionTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/OdeGeoRegionTest.java
index 71896efd9..471424696 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/OdeGeoRegionTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/OdeGeoRegionTest.java
@@ -23,8 +23,8 @@
import java.math.BigDecimal;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import us.dot.its.jpo.ode.plugin.j2735.OdeGeoRegion.GeoRegionException;
@@ -49,7 +49,7 @@ public class OdeGeoRegionTest {
private OdeGeoRegion testRegion;
- @Before
+ @BeforeEach
public void setup() throws GeoRegionException {
region1 = new OdeGeoRegion();
region2 = new OdeGeoRegion("44.44,-55.55 22.22, -33.33");
@@ -230,7 +230,7 @@ public void testContainsPosition3DPasses() throws GeoRegionException {
/**
* Create a known geo region (roughly Pennsylvania)
*/
- @Before
+ @BeforeEach
public void setupOdeGeoRegion() {
BigDecimal nwLat = BigDecimal.valueOf(42.0);
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/OdePosition3DTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/OdePosition3DTest.java
index 4c49e5a66..42a33fecc 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/OdePosition3DTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/OdePosition3DTest.java
@@ -21,7 +21,7 @@
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class OdePosition3DTest {
@Test
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/asn1c/OssTravelerMessageBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/asn1c/OssTravelerMessageBuilderTest.java
index 71f8fb499..5709f8314 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/asn1c/OssTravelerMessageBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/asn1c/OssTravelerMessageBuilderTest.java
@@ -25,7 +25,7 @@
//
//import javax.xml.bind.DatatypeConverter;
//
-//import org.junit.Test;
+//import org.junit.jupiter.api.Test;
//
//import us.dot.its.jpo.ode.j2735.dsrc.GeometricProjection;
//import us.dot.its.jpo.ode.j2735.dsrc.MsgCRC;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/AccelerationSet4WayBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/AccelerationSet4WayBuilderTest.java
index e6827b0df..c12a8fc96 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/AccelerationSet4WayBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/AccelerationSet4WayBuilderTest.java
@@ -22,7 +22,7 @@
import java.io.IOException;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/AngleBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/AngleBuilderTest.java
index 243f5b701..6155627a5 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/AngleBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/AngleBuilderTest.java
@@ -26,7 +26,7 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/AntennaOffsetSetBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/AntennaOffsetSetBuilderTest.java
index 097f5994c..e88909f26 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/AntennaOffsetSetBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/AntennaOffsetSetBuilderTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BitStringBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BitStringBuilderTest.java
index 931caf473..7fceb16f4 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BitStringBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BitStringBuilderTest.java
@@ -25,7 +25,7 @@
import java.lang.reflect.Modifier;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BrakeAppliedStatusNamesTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BrakeAppliedStatusNamesTest.java
index 035669da2..f2d1ba089 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BrakeAppliedStatusNamesTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BrakeAppliedStatusNamesTest.java
@@ -17,13 +17,13 @@
import java.io.IOException;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.core.JsonProcessingException;
public class BrakeAppliedStatusNamesTest {
- @Ignore
+ @Disabled
@Test
public void testBAS() throws JsonProcessingException, IOException {
// JsonNode testInput = 1;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BrakeSystemStatusBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BrakeSystemStatusBuilderTest.java
index cd6ff07b3..7d16b0a17 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BrakeSystemStatusBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BrakeSystemStatusBuilderTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BsmBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BsmBuilderTest.java
index 2c9b9bec6..90896989f 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BsmBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BsmBuilderTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.*;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BsmCoreDataBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BsmCoreDataBuilderTest.java
index 5141078a6..0c3a73459 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BsmCoreDataBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BsmCoreDataBuilderTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BsmPart2ContentBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BsmPart2ContentBuilderTest.java
index 7a2842e1b..ce7ab58ce 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BsmPart2ContentBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BsmPart2ContentBuilderTest.java
@@ -27,7 +27,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BumperHeightsBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BumperHeightsBuilderTest.java
index 57eebf475..600e7d94d 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BumperHeightsBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/BumperHeightsBuilderTest.java
@@ -22,7 +22,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
import us.dot.its.jpo.ode.plugin.j2735.J2735BumperHeights;
import us.dot.its.jpo.ode.util.XmlUtils;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/DDateTimeBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/DDateTimeBuilderTest.java
index 786432f9c..ddc9b04cd 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/DDateTimeBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/DDateTimeBuilderTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/DisabledVehicleBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/DisabledVehicleBuilderTest.java
index 8a8025b2e..e3affe98a 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/DisabledVehicleBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/DisabledVehicleBuilderTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ElevationBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ElevationBuilderTest.java
index 07db55d6f..b1ba6ce78 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ElevationBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ElevationBuilderTest.java
@@ -23,7 +23,7 @@
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/EmergencyDetailsBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/EmergencyDetailsBuilderTest.java
index 2e4063ecb..8ecce1da1 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/EmergencyDetailsBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/EmergencyDetailsBuilderTest.java
@@ -17,6 +17,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -24,7 +25,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -86,21 +87,21 @@ public void testOptionalFields() {
assertEquals(J2735ResponseType.SLOWMOVING, actualValue.getResponseType());
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void testOptionalFieldsWithInvalidSSPRights() {
-
- ObjectNode testInput = JsonUtils.newNode();
- testInput.put("sspRights", 8);
- testInput.set("sirenUse", JsonUtils.newNode().put("notInUse", true));
- testInput.set("lightsUse", JsonUtils.newNode().put("arrowSignsActive", true));
- testInput.set("multi", JsonUtils.newNode().put("singleVehicle", true));
-
- // optional fields
- testInput.set("events", JsonUtils.newNode().put("sspRights", 32).put("event", "001000"));
- testInput.set("responseType", JsonUtils.newNode().put("slowMoving", true));
-
- EmergencyDetailsBuilder.genericEmergencyDetails(testInput);
-
+ assertThrows(IllegalArgumentException.class, () -> {
+ ObjectNode testInput = JsonUtils.newNode();
+ testInput.put("sspRights", 8);
+ testInput.set("sirenUse", JsonUtils.newNode().put("notInUse", true));
+ testInput.set("lightsUse", JsonUtils.newNode().put("arrowSignsActive", true));
+ testInput.set("multi", JsonUtils.newNode().put("singleVehicle", true));
+
+ // optional fields
+ testInput.set("events", JsonUtils.newNode().put("sspRights", 32).put("event", "001000"));
+ testInput.set("responseType", JsonUtils.newNode().put("slowMoving", true));
+
+ EmergencyDetailsBuilder.genericEmergencyDetails(testInput);
+ });
}
@Test
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/EventDescriptionBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/EventDescriptionBuilderTest.java
index 5501f4cdc..05dd9ca96 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/EventDescriptionBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/EventDescriptionBuilderTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/FullPositionVectorBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/FullPositionVectorBuilderTest.java
index b9a3fe1de..873954c6a 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/FullPositionVectorBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/FullPositionVectorBuilderTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/GeoRegionBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/GeoRegionBuilderTest.java
index d205aa51f..bb83daa16 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/GeoRegionBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/GeoRegionBuilderTest.java
@@ -4,8 +4,8 @@
import java.math.BigDecimal;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -19,7 +19,7 @@ public class GeoRegionBuilderTest {
private OdeGeoRegion odeGeoRegion;
- @Before
+ @BeforeEach
public void setup() {
OdePosition3D nwCorner = new OdePosition3D(BigDecimal.ONE, BigDecimal.ONE, BigDecimal.ONE);
OdePosition3D seCorner = new OdePosition3D(BigDecimal.TEN, BigDecimal.TEN, BigDecimal.TEN);
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/HeadingBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/HeadingBuilderTest.java
index d879b4bdf..1135ea245 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/HeadingBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/HeadingBuilderTest.java
@@ -21,7 +21,7 @@
import java.io.IOException;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/IntersectionStateBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/IntersectionStateBuilderTest.java
index 871477351..f0ce440ef 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/IntersectionStateBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/IntersectionStateBuilderTest.java
@@ -3,7 +3,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/LaneWidthBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/LaneWidthBuilderTest.java
index 93891b3a2..4d94b9262 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/LaneWidthBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/LaneWidthBuilderTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class LaneWidthBuilderTest {
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/LatitudeBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/LatitudeBuilderTest.java
index 09b4c9bec..62ee9ba5e 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/LatitudeBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/LatitudeBuilderTest.java
@@ -25,7 +25,7 @@
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/LongitudeBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/LongitudeBuilderTest.java
index 85434de69..16346ed02 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/LongitudeBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/LongitudeBuilderTest.java
@@ -25,7 +25,7 @@
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ManeuverAssistBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ManeuverAssistBuilderTest.java
index f945310b8..6047e5d4b 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ManeuverAssistBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ManeuverAssistBuilderTest.java
@@ -3,7 +3,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MassOrWeightBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MassOrWeightBuilderTest.java
index 2ae4d46b2..b03d4f7b5 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MassOrWeightBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MassOrWeightBuilderTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MergeDivergeNodeAngleBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MergeDivergeNodeAngleBuilderTest.java
index f1c90ff03..0ae8d0183 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MergeDivergeNodeAngleBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MergeDivergeNodeAngleBuilderTest.java
@@ -4,7 +4,7 @@
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class MergeDivergeNodeAngleBuilderTest {
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MovementEventBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MovementEventBuilderTest.java
index 47085dfdb..0c5e1e246 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MovementEventBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MovementEventBuilderTest.java
@@ -3,7 +3,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MovementStateBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MovementStateBuilderTest.java
index 820139b21..8aabe7fe6 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MovementStateBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/MovementStateBuilderTest.java
@@ -3,7 +3,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/Node_XYBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/Node_XYBuilderTest.java
index 8ba39c54d..618fabcda 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/Node_XYBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/Node_XYBuilderTest.java
@@ -23,7 +23,7 @@
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ObstacleDetectionBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ObstacleDetectionBuilderTest.java
index a317f0cec..027affb26 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ObstacleDetectionBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ObstacleDetectionBuilderTest.java
@@ -25,7 +25,7 @@
import java.lang.reflect.Modifier;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/OffsetBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/OffsetBuilderTest.java
index 420b4045a..6c27be01b 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/OffsetBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/OffsetBuilderTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/OffsetLLBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/OffsetLLBuilderTest.java
index 3cf151318..15c1828df 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/OffsetLLBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/OffsetLLBuilderTest.java
@@ -4,7 +4,7 @@
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class OffsetLLBuilderTest {
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/OffsetXyBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/OffsetXyBuilderTest.java
index 427da1ab3..994511f86 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/OffsetXyBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/OffsetXyBuilderTest.java
@@ -4,7 +4,7 @@
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class OffsetXyBuilderTest {
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/PathHistoryBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/PathHistoryBuilderTest.java
index bf0686fe9..ff132b24d 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/PathHistoryBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/PathHistoryBuilderTest.java
@@ -4,7 +4,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/PathHistoryPointBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/PathHistoryPointBuilderTest.java
index f138efa26..980ed1d59 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/PathHistoryPointBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/PathHistoryPointBuilderTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/RTCMPackageBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/RTCMPackageBuilderTest.java
index cb8906249..a53554b7a 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/RTCMPackageBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/RTCMPackageBuilderTest.java
@@ -5,7 +5,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/RTCMheaderBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/RTCMheaderBuilderTest.java
index ecf4501e9..dc7fc43ae 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/RTCMheaderBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/RTCMheaderBuilderTest.java
@@ -4,7 +4,7 @@
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/RoadwayCrownAngleBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/RoadwayCrownAngleBuilderTest.java
index 7a3774321..01d6088fa 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/RoadwayCrownAngleBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/RoadwayCrownAngleBuilderTest.java
@@ -22,7 +22,7 @@
import java.io.IOException;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.core.JsonProcessingException;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ScaleB12BuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ScaleB12BuilderTest.java
index dd50e5da4..dd906c615 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ScaleB12BuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/ScaleB12BuilderTest.java
@@ -22,7 +22,7 @@
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ScaleB12BuilderTest {
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/SpeedOrVelocityBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/SpeedOrVelocityBuilderTest.java
index d1ded4bf4..76b9d07c0 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/SpeedOrVelocityBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/SpeedOrVelocityBuilderTest.java
@@ -22,7 +22,7 @@
import java.io.IOException;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/SpeedProfileBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/SpeedProfileBuilderTest.java
index 480827790..519f03291 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/SpeedProfileBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/SpeedProfileBuilderTest.java
@@ -5,7 +5,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/SupplementalVehicleExtensionsBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/SupplementalVehicleExtensionsBuilderTest.java
index 8471c9000..6ff061faa 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/SupplementalVehicleExtensionsBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/SupplementalVehicleExtensionsBuilderTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TimeOffsetBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TimeOffsetBuilderTest.java
index 4ff713785..c1057bcb3 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TimeOffsetBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TimeOffsetBuilderTest.java
@@ -25,7 +25,7 @@
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TimeStampConverterTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TimeStampConverterTest.java
index 50e8ddcd2..e4e26ae5c 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TimeStampConverterTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TimeStampConverterTest.java
@@ -17,9 +17,9 @@
import static org.junit.Assert.assertEquals;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,11 +36,11 @@ public class TimeStampConverterTest {
@Mocked
private Logger logger;
- @BeforeClass
+ @BeforeAll
public static void classSetup() {
}
- @Before
+ @BeforeEach
public void setup() {
new MockUp() {
@Mock
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TrailerHistoryPointBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TrailerHistoryPointBuilderTest.java
index e51506139..698bd0272 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TrailerHistoryPointBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TrailerHistoryPointBuilderTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TrailerUnitDescriptionBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TrailerUnitDescriptionBuilderTest.java
index 8efc1149f..d5da2ad83 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TrailerUnitDescriptionBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TrailerUnitDescriptionBuilderTest.java
@@ -23,7 +23,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TravelerMessageFromHumanToAsnConverterTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TravelerMessageFromHumanToAsnConverterTest.java
index 214c832bd..9c8e1da84 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TravelerMessageFromHumanToAsnConverterTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/TravelerMessageFromHumanToAsnConverterTest.java
@@ -24,8 +24,8 @@
import org.json.JSONException;
import org.json.JSONObject;
import org.json.XML;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,7 +43,7 @@ public class TravelerMessageFromHumanToAsnConverterTest {
@Mocked
private Logger logger;
- @Before
+ @BeforeEach
public void setup() {
new MockUp() {
@Mock
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VehicleClassificationBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VehicleClassificationBuilderTest.java
index 1fbc60b65..b6694cf66 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VehicleClassificationBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VehicleClassificationBuilderTest.java
@@ -23,7 +23,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VehicleSafetyExtensionsBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VehicleSafetyExtensionsBuilderTest.java
index 6ceac7586..2a92bc46f 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VehicleSafetyExtensionsBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VehicleSafetyExtensionsBuilderTest.java
@@ -25,7 +25,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VehicleSizeBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VehicleSizeBuilderTest.java
index e61485fac..66ade749a 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VehicleSizeBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VehicleSizeBuilderTest.java
@@ -18,7 +18,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VelocityBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VelocityBuilderTest.java
index b31b8e05c..98bd4fa89 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VelocityBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/VelocityBuilderTest.java
@@ -22,7 +22,7 @@
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class VelocityBuilderTest {
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/WeatherProbeBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/WeatherProbeBuilderTest.java
index 7382d2f43..0d5548136 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/WeatherProbeBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/WeatherProbeBuilderTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/WeatherReportBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/WeatherReportBuilderTest.java
index fa641d0e4..2e4558ae2 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/WeatherReportBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/WeatherReportBuilderTest.java
@@ -25,7 +25,7 @@
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/WiperSetBuilderTest.java b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/WiperSetBuilderTest.java
index 54b2ae809..7ee8aa595 100644
--- a/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/WiperSetBuilderTest.java
+++ b/jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/WiperSetBuilderTest.java
@@ -23,7 +23,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/pdm/PdmUtil.java b/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/pdm/PdmUtil.java
index 8294c6c49..f22a2e366 100644
--- a/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/pdm/PdmUtil.java
+++ b/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/pdm/PdmUtil.java
@@ -17,11 +17,10 @@
import org.snmp4j.PDU;
import org.snmp4j.ScopedPDU;
-import org.snmp4j.smi.Integer32;
-import org.snmp4j.smi.OID;
import org.snmp4j.smi.VariableBinding;
import us.dot.its.jpo.ode.plugin.j2735.J2735ProbeDataManagment;
+import us.dot.its.jpo.ode.snmp.SnmpFourDot1Protocol;
public class PdmUtil {
@@ -29,53 +28,29 @@ private PdmUtil() {
throw new UnsupportedOperationException();
}
+ /**
+ * Creates a ScopedPDU from a J2735ProbeDataManagment object. Uses the SnmpFourDot1Protocol class to get the OIDs since
+ * PDM operations are not defined in NTCIP1218.
+ */
public static ScopedPDU createPDU(J2735ProbeDataManagment params) {
-
ScopedPDU pdu = new ScopedPDU();
pdu.setType(PDU.SET);
// Add singular items to PDU
- VariableBinding rsuPDMSampleStart = new VariableBinding(new OID("1.0.15628.4.1.200.1"),
- new Integer32(params.getSampleStart()));
-
- VariableBinding rsuPDMSampleEnd = new VariableBinding(new OID("1.0.15628.4.1.200.2"),
- new Integer32(params.getSampleEnd()));
-
- VariableBinding rsuPDMDirections = new VariableBinding(new OID("1.0.15628.4.1.200.3"),
- new Integer32(params.getDirections()));
-
- VariableBinding rsuPDMTermChoice = new VariableBinding(new OID("1.0.15628.4.1.200.4"),
- new Integer32(params.getTermChoice()));
-
- VariableBinding rsuPDMTermTime = new VariableBinding(new OID("1.0.15628.4.1.200.5"),
- new Integer32(params.getTermTime()));
-
- VariableBinding rsuPDMTermDistance = new VariableBinding(new OID("1.0.15628.4.1.200.6"),
- new Integer32(params.getTermDistance()));
-
- VariableBinding rsuPDMSnapshotChoice = new VariableBinding(new OID("1.0.15628.4.1.200.7"),
- new Integer32(params.getSnapshotChoice()));
-
- VariableBinding rsuPDMMinSnapshotTime = new VariableBinding(new OID("1.0.15628.4.1.200.9"),
- new Integer32(params.getMinSnapshotTime()));
-
- VariableBinding rsuPDMMaxSnapshotTime = new VariableBinding(new OID("1.0.15628.4.1.200.10"),
- new Integer32(params.getMaxSnapshotTime()));
-
- VariableBinding rsuPDMMinSnapshotDistnace = new VariableBinding(new OID("1.0.15628.4.1.200.11"),
- new Integer32(params.getMinSnapshotDistance()));
-
- VariableBinding rsuPDMMaxSnapshotDistnace = new VariableBinding(new OID("1.0.15628.4.1.200.12"),
- new Integer32(params.getMaxSnapshotDistance()));
-
- VariableBinding rsuPDMSnapshotMinSpeed = new VariableBinding(new OID("1.0.15628.4.1.200.13"),
- new Integer32(params.getSnapshotMinSpeed()));
-
- VariableBinding rsuPDMSnapshotMaxSpeed = new VariableBinding(new OID("1.0.15628.4.1.200.14"),
- new Integer32(params.getSnapshotMaxSpeed()));
-
- VariableBinding rsuPDMTxInterval = new VariableBinding(new OID("1.0.15628.4.1.200.15"),
- new Integer32(params.getTxInterval()));
+ VariableBinding rsuPDMSampleStart = SnmpFourDot1Protocol.getVbRsuPdmSampleStart(params.getSampleStart());
+ VariableBinding rsuPDMSampleEnd = SnmpFourDot1Protocol.getVbRsuPdmSampleEnd(params.getSampleEnd());
+ VariableBinding rsuPDMDirections = SnmpFourDot1Protocol.getVbRsuPdmDirections(params.getDirections());
+ VariableBinding rsuPDMTermChoice = SnmpFourDot1Protocol.getVbRsuPdmTermChoice(params.getTermChoice());
+ VariableBinding rsuPDMTermTime = SnmpFourDot1Protocol.getVbRsuPdmTermTime(params.getTermTime());
+ VariableBinding rsuPDMTermDistance = SnmpFourDot1Protocol.getVbRsuPdmTermDistance(params.getTermDistance());
+ VariableBinding rsuPDMSnapshotChoice = SnmpFourDot1Protocol.getVbRsuPdmSnapshotChoice(params.getSnapshotChoice());
+ VariableBinding rsuPDMMinSnapshotTime = SnmpFourDot1Protocol.getVbRsuPdmMinSnapshotTime(params.getMinSnapshotTime());
+ VariableBinding rsuPDMMaxSnapshotTime = SnmpFourDot1Protocol.getVbRsuPdmMaxSnapshotTime(params.getMaxSnapshotTime());
+ VariableBinding rsuPDMMinSnapshotDistance = SnmpFourDot1Protocol.getVbRsuPdmMinSnapshotDistance(params.getMinSnapshotDistance());
+ VariableBinding rsuPDMMaxSnapshotDistance = SnmpFourDot1Protocol.getVbRsuPdmMaxSnapshotDistance(params.getMaxSnapshotDistance());
+ VariableBinding rsuPDMSnapshotMinSpeed = SnmpFourDot1Protocol.getVbRsuPdmSnapshotMinSpeed(params.getSnapshotMinSpeed());
+ VariableBinding rsuPDMSnapshotMaxSpeed = SnmpFourDot1Protocol.getVbRsuPdmSnapshotMaxSpeed(params.getSnapshotMaxSpeed());
+ VariableBinding rsuPDMTxInterval = SnmpFourDot1Protocol.getVbRsuPdmTxInterval(params.getTxInterval());
pdu.add(rsuPDMSampleStart);
pdu.add(rsuPDMSampleEnd);
@@ -86,30 +61,22 @@ public static ScopedPDU createPDU(J2735ProbeDataManagment params) {
pdu.add(rsuPDMSnapshotChoice);
pdu.add(rsuPDMMinSnapshotTime);
pdu.add(rsuPDMMaxSnapshotTime);
- pdu.add(rsuPDMMinSnapshotDistnace);
- pdu.add(rsuPDMMaxSnapshotDistnace);
+ pdu.add(rsuPDMMinSnapshotDistance);
+ pdu.add(rsuPDMMaxSnapshotDistance);
pdu.add(rsuPDMSnapshotMinSpeed);
pdu.add(rsuPDMSnapshotMaxSpeed);
pdu.add(rsuPDMTxInterval);
// Add request status list items to PDU
- for (int i = 0; i < params.getVehicleStatusRequestList().length; i++) {
-
- String currentOid = "1.0.15628.4.1.200.15." + i;
+ for (int index = 0; index < params.getVehicleStatusRequestList().length; index++) {
- VariableBinding rsuPDMVSReqTag = new VariableBinding(new OID(currentOid + ".1"),
- new Integer32(params.getVehicleStatusRequestList()[i].getTag()));
- VariableBinding rsuPDMVSReqSubTag = new VariableBinding(new OID(currentOid + ".2"),
- new Integer32(params.getVehicleStatusRequestList()[i].getSubTag()));
- VariableBinding rsuPDMVSReqLessThenValue = new VariableBinding(new OID(currentOid + ".3"),
- new Integer32(params.getVehicleStatusRequestList()[i].getLessThenValue()));
- VariableBinding rsuPDMVSReqMoreThenValue = new VariableBinding(new OID(currentOid + ".4"),
- new Integer32(params.getVehicleStatusRequestList()[i].getMoreThenValue()));
- VariableBinding rsuPDMVSReqSendAll = new VariableBinding(new OID(currentOid + ".5"),
- new Integer32(params.getVehicleStatusRequestList()[i].getSendAll()));
- VariableBinding rsuPDMVSReqStatus = new VariableBinding(new OID(currentOid + ".6"),
- new Integer32(params.getVehicleStatusRequestList()[i].getStatus()));
+ VariableBinding rsuPDMVSReqTag = SnmpFourDot1Protocol.getVbRsuPdmVsReqTag(index, params.getVehicleStatusRequestList()[index].getTag());
+ VariableBinding rsuPDMVSReqSubTag = SnmpFourDot1Protocol.getVbRsuPdmVsReqSubTag(index, params.getVehicleStatusRequestList()[index].getSubTag());
+ VariableBinding rsuPDMVSReqLessThenValue = SnmpFourDot1Protocol.getVbRsuPdmVsReqLessThen(index, params.getVehicleStatusRequestList()[index].getLessThenValue());
+ VariableBinding rsuPDMVSReqMoreThenValue = SnmpFourDot1Protocol.getVbRsuPdmVsReqMoreThen(index, params.getVehicleStatusRequestList()[index].getMoreThenValue());
+ VariableBinding rsuPDMVSReqSendAll = SnmpFourDot1Protocol.getVbRsuPdmVsReqSendAll(index, params.getVehicleStatusRequestList()[index].getSendAll());
+ VariableBinding rsuPDMVSReqStatus = SnmpFourDot1Protocol.getVbRsuPdmVsReqStatus(index, params.getVehicleStatusRequestList()[index].getStatus());
pdu.add(rsuPDMVSReqTag);
pdu.add(rsuPDMVSReqSubTag);
diff --git a/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/services/asn1/Asn1CommandManager.java b/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/services/asn1/Asn1CommandManager.java
index 9749828db..cc5c32ad0 100644
--- a/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/services/asn1/Asn1CommandManager.java
+++ b/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/services/asn1/Asn1CommandManager.java
@@ -42,14 +42,12 @@
import us.dot.its.jpo.ode.model.OdeAsdPayload;
import us.dot.its.jpo.ode.model.OdeMsgMetadata;
import us.dot.its.jpo.ode.model.OdeMsgPayload;
-import us.dot.its.jpo.ode.plugin.RoadSideUnit.RSU;
import us.dot.its.jpo.ode.plugin.SNMP;
import us.dot.its.jpo.ode.plugin.ServiceRequest;
import us.dot.its.jpo.ode.plugin.SituationDataWarehouse.SDW;
import us.dot.its.jpo.ode.plugin.j2735.DdsAdvisorySituationData;
import us.dot.its.jpo.ode.plugin.j2735.builders.GeoRegionBuilder;
import us.dot.its.jpo.ode.rsu.RsuDepositor;
-import us.dot.its.jpo.ode.snmp.SnmpSession;
import us.dot.its.jpo.ode.traveler.TimTransmogrifier;
import us.dot.its.jpo.ode.util.JsonUtils;
import us.dot.its.jpo.ode.util.JsonUtils.JsonUtilsException;
diff --git a/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/snmp/SnmpFourDot1Protocol.java b/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/snmp/SnmpFourDot1Protocol.java
new file mode 100644
index 000000000..039a49067
--- /dev/null
+++ b/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/snmp/SnmpFourDot1Protocol.java
@@ -0,0 +1,358 @@
+package us.dot.its.jpo.ode.snmp;
+
+import java.text.ParseException;
+
+import javax.xml.bind.DatatypeConverter;
+
+import org.snmp4j.smi.Integer32;
+import org.snmp4j.smi.OID;
+import org.snmp4j.smi.OctetString;
+import org.snmp4j.smi.VariableBinding;
+
+import us.dot.its.jpo.ode.plugin.SNMP;
+
+public class SnmpFourDot1Protocol {
+ private static String fourdot1prefix = "1.0.15628.4.";
+ private static String srm_prefix = "1.4.1.";
+ private static String pdm_prefix = "1.200.";
+ private static String pdm_vs_req_prefix = pdm_prefix + "15.";
+
+ // variable bindings
+ public static VariableBinding getVbRsuSrmPsid(int index, String rsuId) {
+ return SnmpSession.getPEncodedVariableBinding(
+ rsu_srm_psid_oid().concat(".").concat(Integer.toString(index)),
+ rsuId
+ );
+ }
+
+ public static VariableBinding getVbRsuSrmDsrcMsgId(int index, int msgId) {
+ return new VariableBinding(
+ new OID(rsu_srm_dsrc_msg_id_oid().concat(".").concat(Integer.toString(index))),
+ new Integer32(msgId)
+ );
+ }
+
+ public static VariableBinding getVbRsuSrmTxMode(int index, int mode) {
+ return new VariableBinding(
+ new OID(rsu_srm_tx_mode_oid().concat(".").concat(Integer.toString(index))),
+ new Integer32(mode)
+ );
+ }
+
+ public static VariableBinding getVbRsuSrmTxChannel(int index, int channel) {
+ return new VariableBinding(
+ new OID(rsu_srm_tx_channel_oid().concat(".").concat(Integer.toString(index))),
+ new Integer32(channel)
+ );
+ }
+
+ public static VariableBinding getVbRsuSrmTxInterval(int index, int interval) {
+ return new VariableBinding(
+ new OID(rsu_srm_tx_interval_oid().concat(".").concat(Integer.toString(index))),
+ new Integer32(interval)
+ );
+ }
+
+ public static VariableBinding getVbRsuSrmDeliveryStart(int index, String deliveryStart) throws ParseException {
+ return new VariableBinding(
+ new OID(rsu_srm_delivery_start_oid().concat(".").concat(Integer.toString(index))),
+ new OctetString(DatatypeConverter.parseHexBinary(SNMP.snmpTimestampFromIso(deliveryStart)))
+ );
+ }
+
+ public static VariableBinding getVbRsuSrmDeliveryStop(int index, String deliveryStop) throws ParseException {
+ return new VariableBinding(
+ new OID(rsu_srm_delivery_stop_oid().concat(".").concat(Integer.toString(index))),
+ new OctetString(DatatypeConverter.parseHexBinary(SNMP.snmpTimestampFromIso(deliveryStop)))
+ );
+ }
+
+ public static VariableBinding getVbRsuSrmPayload(int index, String payload) {
+ return new VariableBinding(
+ new OID(rsu_srm_payload_oid().concat(".").concat(Integer.toString(index))),
+ new OctetString(DatatypeConverter.parseHexBinary(payload))
+ );
+ }
+
+ public static VariableBinding getVbRsuSrmEnable(int index, int enable) {
+ return new VariableBinding(
+ new OID(rsu_srm_enable_oid().concat(".").concat(Integer.toString(index))),
+ new Integer32(enable)
+ );
+ }
+
+ public static VariableBinding getVbRsuSrmStatus(int index, int status) {
+ return new VariableBinding(
+ new OID(rsu_srm_status_oid().concat(".").concat(Integer.toString(index))),
+ new Integer32(status)
+ );
+ }
+
+ public static VariableBinding getVbRsuSrmStatus(int index) {
+ return new VariableBinding(
+ new OID(rsu_srm_status_oid().concat(".").concat(Integer.toString(index))
+ )
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmSampleStart(int sampleStart) {
+ return new VariableBinding(
+ new OID(rsu_pdm_sample_start_oid()),
+ new Integer32(sampleStart)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmSampleEnd(int sampleEnd) {
+ return new VariableBinding(
+ new OID(rsu_pdm_sample_end_oid()),
+ new Integer32(sampleEnd)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmDirections(int directions) {
+ return new VariableBinding(
+ new OID(rsu_pdm_directions_oid()),
+ new Integer32(directions)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmTermChoice(int termChoice) {
+ return new VariableBinding(
+ new OID(rsu_pdm_term_choice_oid()),
+ new Integer32(termChoice)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmTermTime(int termTime) {
+ return new VariableBinding(
+ new OID(rsu_pdm_term_time_oid()),
+ new Integer32(termTime)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmTermDistance(int termDistance) {
+ return new VariableBinding(
+ new OID(rsu_pdm_term_distance_oid()),
+ new Integer32(termDistance)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmSnapshotChoice(int snapshotChoice) {
+ return new VariableBinding(
+ new OID(rsu_pdm_snapshot_choice_oid()),
+ new Integer32(snapshotChoice)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmMinSnapshotTime(int minSnapshotTime) {
+ return new VariableBinding(
+ new OID(rsu_pdm_min_snapshot_time_oid()),
+ new Integer32(minSnapshotTime)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmMaxSnapshotTime(int maxSnapshotTime) {
+ return new VariableBinding(
+ new OID(rsu_pdm_max_snapshot_time_oid()),
+ new Integer32(maxSnapshotTime)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmMinSnapshotDistance(int minSnapshotDistance) {
+ return new VariableBinding(
+ new OID(rsu_pdm_min_snapshot_distance_oid()),
+ new Integer32(minSnapshotDistance)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmMaxSnapshotDistance(int maxSnapshotDistance) {
+ return new VariableBinding(
+ new OID(rsu_pdm_max_snapshot_distance_oid()),
+ new Integer32(maxSnapshotDistance)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmSnapshotMinSpeed(int snapshotMinSpeed) {
+ return new VariableBinding(
+ new OID(rsu_pdm_snapshot_min_speed_oid()),
+ new Integer32(snapshotMinSpeed)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmSnapshotMaxSpeed(int snapshotMaxSpeed) {
+ return new VariableBinding(
+ new OID(rsu_pdm_snapshot_max_speed_oid()),
+ new Integer32(snapshotMaxSpeed)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmTxInterval(int txInterval) {
+ return new VariableBinding(
+ new OID(rsu_pdm_tx_interval_oid()),
+ new Integer32(txInterval)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmVsReqTag(int index, int tag) {
+ return new VariableBinding(
+ new OID(rsu_pdm_vs_req_tag_oid().replace("{}", String.valueOf(index))),
+ new Integer32(tag)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmVsReqSubTag(int index, int subTag) {
+ return new VariableBinding(
+ new OID(rsu_pdm_vs_req_sub_tag_oid().replace("{}", String.valueOf(index))),
+ new Integer32(subTag)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmVsReqLessThen(int index, int lessThen) {
+ return new VariableBinding(
+ new OID(rsu_pdm_vs_req_less_then_oid().replace("{}", String.valueOf(index))),
+ new Integer32(lessThen)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmVsReqMoreThen(int index, int moreThen) {
+ return new VariableBinding(
+ new OID(rsu_pdm_vs_req_more_then_oid().replace("{}", String.valueOf(index))),
+ new Integer32(moreThen)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmVsReqSendAll(int index, int sendAll) {
+ return new VariableBinding(
+ new OID(rsu_pdm_vs_req_send_all_oid().replace("{}", String.valueOf(index))),
+ new Integer32(sendAll)
+ );
+ }
+
+ public static VariableBinding getVbRsuPdmVsReqStatus(int index, int status) {
+ return new VariableBinding(
+ new OID(rsu_pdm_vs_req_status_oid().replace("{}", String.valueOf(index))),
+ new Integer32(status)
+ );
+ }
+
+ // oids
+ private static String rsu_srm_psid_oid() {
+ return fourdot1prefix + srm_prefix + "2";
+ }
+
+ private static String rsu_srm_dsrc_msg_id_oid() {
+ return fourdot1prefix + srm_prefix + "3";
+ }
+
+ private static String rsu_srm_tx_mode_oid() {
+ return fourdot1prefix + srm_prefix + "4";
+ }
+
+ private static String rsu_srm_tx_channel_oid() {
+ return fourdot1prefix + srm_prefix + "5";
+ }
+
+ private static String rsu_srm_tx_interval_oid() {
+ return fourdot1prefix + srm_prefix + "6";
+ }
+
+ private static String rsu_srm_delivery_start_oid() {
+ return fourdot1prefix + srm_prefix + "7";
+ }
+
+ private static String rsu_srm_delivery_stop_oid() {
+ return fourdot1prefix + srm_prefix + "8";
+ }
+
+ private static String rsu_srm_payload_oid() {
+ return fourdot1prefix + srm_prefix + "9";
+ }
+
+ private static String rsu_srm_enable_oid() {
+ return fourdot1prefix + srm_prefix + "10";
+ }
+
+ private static String rsu_srm_status_oid() {
+ return fourdot1prefix + srm_prefix + "11";
+ }
+
+ private static String rsu_pdm_sample_start_oid() {
+ return fourdot1prefix + pdm_prefix + "1";
+ }
+
+ private static String rsu_pdm_sample_end_oid() {
+ return fourdot1prefix + pdm_prefix + "2";
+ }
+
+ private static String rsu_pdm_directions_oid() {
+ return fourdot1prefix + pdm_prefix + "3";
+ }
+
+ private static String rsu_pdm_term_choice_oid() {
+ return fourdot1prefix + pdm_prefix + "4";
+ }
+
+ private static String rsu_pdm_term_time_oid() {
+ return fourdot1prefix + pdm_prefix + "5";
+ }
+
+ private static String rsu_pdm_term_distance_oid() {
+ return fourdot1prefix + pdm_prefix + "6";
+ }
+
+ private static String rsu_pdm_snapshot_choice_oid() {
+ return fourdot1prefix + pdm_prefix + "7";
+ }
+
+ private static String rsu_pdm_min_snapshot_time_oid() {
+ return fourdot1prefix + pdm_prefix + "9";
+ }
+
+ private static String rsu_pdm_max_snapshot_time_oid() {
+ return fourdot1prefix + pdm_prefix + "10";
+ }
+
+ private static String rsu_pdm_min_snapshot_distance_oid() {
+ return fourdot1prefix + pdm_prefix + "11";
+ }
+
+ private static String rsu_pdm_max_snapshot_distance_oid() {
+ return fourdot1prefix + pdm_prefix + "12";
+ }
+
+ private static String rsu_pdm_snapshot_min_speed_oid() {
+ return fourdot1prefix + pdm_prefix + "13";
+ }
+
+ private static String rsu_pdm_snapshot_max_speed_oid() {
+ return fourdot1prefix + pdm_prefix + "14";
+ }
+
+ private static String rsu_pdm_tx_interval_oid() {
+ return fourdot1prefix + pdm_prefix + "15";
+ }
+
+ private static String rsu_pdm_vs_req_tag_oid() {
+ return fourdot1prefix + pdm_vs_req_prefix + "{}" + "." + "1";
+ }
+
+ private static String rsu_pdm_vs_req_sub_tag_oid() {
+ return fourdot1prefix + pdm_vs_req_prefix + "{}" + "." + "2";
+ }
+
+ private static String rsu_pdm_vs_req_less_then_oid() {
+ return fourdot1prefix + pdm_vs_req_prefix + "{}" + "." + "3";
+ }
+
+ private static String rsu_pdm_vs_req_more_then_oid() {
+ return fourdot1prefix + pdm_vs_req_prefix + "{}" + "." + "4";
+ }
+
+ private static String rsu_pdm_vs_req_send_all_oid() {
+ return fourdot1prefix + pdm_vs_req_prefix + "{}" + "." + "5";
+ }
+
+ private static String rsu_pdm_vs_req_status_oid() {
+ return fourdot1prefix + pdm_vs_req_prefix + "{}" + "." + "6";
+ }
+}
diff --git a/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/snmp/SnmpNTCIP1218Protocol.java b/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/snmp/SnmpNTCIP1218Protocol.java
new file mode 100644
index 000000000..e72eb72cb
--- /dev/null
+++ b/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/snmp/SnmpNTCIP1218Protocol.java
@@ -0,0 +1,137 @@
+package us.dot.its.jpo.ode.snmp;
+
+import java.text.ParseException;
+
+import javax.xml.bind.DatatypeConverter;
+
+import org.snmp4j.smi.Integer32;
+import org.snmp4j.smi.OID;
+import org.snmp4j.smi.OctetString;
+import org.snmp4j.smi.VariableBinding;
+
+import us.dot.its.jpo.ode.plugin.SNMP;
+
+public class SnmpNTCIP1218Protocol {
+ private static String ntcip1218prefix = "1.3.6.1.4.1.1206.4.2.18.";
+ private static String srm_prefix = "3.2.1"; // srm (defined in NTCIP1218 Section 5.4.2)
+
+ // variable bindings
+ public static VariableBinding getVbRsuMsgRepeatPsid(int index, String rsuId) {
+ return SnmpSession.getPEncodedVariableBinding(
+ rsu_msg_repeat_psid_oid().concat(".").concat(Integer.toString(index)),
+ rsuId
+ );
+ }
+
+ public static VariableBinding getVbRsuMsgRepeatTxChannel(int index, int channel) {
+ return new VariableBinding(
+ new OID(rsu_msg_repeat_tx_channel_oid().concat(".").concat(Integer.toString(index))),
+ new Integer32(channel)
+ );
+ }
+
+ public static VariableBinding getVbRsuMsgRepeatTxInterval(int index, int interval) {
+ return new VariableBinding(
+ new OID(rsu_msg_repeat_tx_interval_oid().concat(".").concat(Integer.toString(index))),
+ new Integer32(interval)
+ );
+ }
+
+ public static VariableBinding getVbRsuMsgRepeatDeliveryStart(int index, String deliveryStart) throws ParseException {
+ return new VariableBinding(
+ new OID(rsu_msg_repeat_delivery_start_oid().concat(".").concat(Integer.toString(index))),
+ new OctetString(DatatypeConverter.parseHexBinary(SNMP.snmpTimestampFromIso(deliveryStart)))
+ );
+ }
+
+ public static VariableBinding getVbRsuMsgRepeatDeliveryStop(int index, String deliveryStop) throws ParseException {
+ return new VariableBinding(
+ new OID(rsu_msg_repeat_delivery_stop_oid().concat(".").concat(Integer.toString(index))),
+ new OctetString(DatatypeConverter.parseHexBinary(SNMP.snmpTimestampFromIso(deliveryStop)))
+ );
+ }
+
+ public static VariableBinding getVbRsuMsgRepeatPayload(int index, String payload) {
+ return new VariableBinding(
+ new OID(rsu_msg_repeat_payload_oid().concat(".").concat(Integer.toString(index))),
+ new OctetString(DatatypeConverter.parseHexBinary(payload))
+ );
+ }
+
+ public static VariableBinding getVbRsuMsgRepeatEnable(int index, int enable) {
+ return new VariableBinding(
+ new OID(rsu_msg_repeat_enable_oid().concat(".").concat(Integer.toString(index))),
+ new Integer32(enable)
+ );
+ }
+
+ public static VariableBinding getVbRsuMsgRepeatStatus(int index, int status) {
+ return new VariableBinding(
+ new OID(rsu_msg_repeat_status_oid().concat(".").concat(Integer.toString(index))),
+ new Integer32(status)
+ );
+ }
+
+ public static VariableBinding getVbRsuMsgRepeatStatus(int index) {
+ return new VariableBinding(
+ new OID(rsu_msg_repeat_status_oid().concat(".").concat(Integer.toString(index)))
+ );
+ }
+
+ public static VariableBinding getVbRsuMsgRepeatPriority(int index) {
+ return new VariableBinding(
+ new OID(rsu_msg_repeat_priority_oid().concat(".").concat(Integer.toString(index))),
+ new Integer32(6)
+ );
+ }
+
+ public static VariableBinding getVbRsuMsgRepeatOptions(int index) {
+ return new VariableBinding(
+ new OID(rsu_msg_repeat_options_oid().concat(".").concat(Integer.toString(index))),
+ new OctetString("C0")
+ );
+ }
+
+ // oids
+ private static String rsu_msg_repeat_psid_oid() {
+ return ntcip1218prefix + srm_prefix + ".2";
+ }
+
+ private static String rsu_msg_repeat_tx_channel_oid() {
+ return ntcip1218prefix + srm_prefix + ".3";
+ }
+
+ private static String rsu_msg_repeat_tx_interval_oid() {
+ return ntcip1218prefix + srm_prefix + ".4";
+ }
+
+ private static String rsu_msg_repeat_delivery_start_oid() {
+ return ntcip1218prefix + srm_prefix + ".5";
+ }
+
+ private static String rsu_msg_repeat_delivery_stop_oid() {
+ return ntcip1218prefix + srm_prefix + ".6";
+ }
+
+ private static String rsu_msg_repeat_payload_oid() {
+ return ntcip1218prefix + srm_prefix + ".7";
+ }
+
+ private static String rsu_msg_repeat_enable_oid() {
+ return ntcip1218prefix + srm_prefix + ".8";
+ }
+
+ private static String rsu_msg_repeat_status_oid() {
+ return ntcip1218prefix + srm_prefix + ".9";
+ }
+
+ private static String rsu_msg_repeat_priority_oid() {
+ return ntcip1218prefix + srm_prefix + ".10";
+ }
+
+ private static String rsu_msg_repeat_options_oid() {
+ return ntcip1218prefix + srm_prefix + ".11";
+ }
+
+ // note: pdm is not defined in NTCIP1218
+}
diff --git a/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/snmp/SnmpSession.java b/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/snmp/SnmpSession.java
index f3b0b0fcb..c32eb2fa4 100644
--- a/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/snmp/SnmpSession.java
+++ b/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/snmp/SnmpSession.java
@@ -18,8 +18,6 @@
import java.io.IOException;
import java.text.ParseException;
-import javax.xml.bind.DatatypeConverter;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.snmp4j.PDU;
@@ -38,7 +36,6 @@
import org.snmp4j.security.UsmUser;
import org.snmp4j.smi.Address;
import org.snmp4j.smi.GenericAddress;
-import org.snmp4j.smi.Integer32;
import org.snmp4j.smi.OID;
import org.snmp4j.smi.OctetString;
import org.snmp4j.smi.VariableBinding;
@@ -46,6 +43,7 @@
import us.dot.its.jpo.ode.eventlog.EventLogger;
import us.dot.its.jpo.ode.plugin.RoadSideUnit.RSU;
+import us.dot.its.jpo.ode.plugin.SnmpProtocol;
import us.dot.its.jpo.ode.plugin.SNMP;
import us.dot.its.jpo.ode.plugin.ServiceRequest;
import us.dot.its.jpo.ode.plugin.ServiceRequest.OdeInternal.RequestVerb;
@@ -112,7 +110,6 @@ public SnmpSession(RSU rsu) throws IOException {
// Assert the ready flag so the user can begin sending messages
ready = true;
-
}
/**
@@ -207,7 +204,7 @@ public static ResponseEvent createAndSend(SNMP snmp, RSU rsu, String payload, Re
// Send the PDU
ResponseEvent response = null;
- ScopedPDU pdu = SnmpSession.createPDU(snmp, payload, rsu.getRsuIndex(), requestVerb);
+ ScopedPDU pdu = SnmpSession.createPDU(snmp, payload, rsu.getRsuIndex(), requestVerb, rsu.getSnmpProtocol());
response = session.set(pdu, session.getSnmp(), session.getTarget(), false);
String msg = "Message Sent to {}, index {}: {}";
EventLogger.logger.debug(msg, rsu.getRsuTarget(), rsu.getRsuIndex(), payload);
@@ -252,74 +249,16 @@ public void endSession() throws IOException {
* @return PDU
* @throws ParseException
*/
- public static ScopedPDU createPDU(SNMP snmp, String payload, int index, RequestVerb verb) throws ParseException {
-
- //////////////////////////////
- // - OID examples - //
- //////////////////////////////
- // rsuSRMStatus.3 = 4
- // --> 1.4.1.11.3 = 4
- // rsuSRMTxChannel.3 = 3
- // --> 1.4.1.5.3 = 178
- // rsuSRMTxMode.3 = 1
- // --> 1.4.1.4.3 = 1
- // rsuSRMPsid.3 x "8300"
- // --> 1.4.1.2.3 x "8300"
- // rsuSRMDsrcMsgId.3 = 31
- // --> 1.4.1.3.3 = 31
- // rsuSRMTxInterval.3 = 1
- // --> 1.4.1.6.3 = 1
- // rsuSRMDeliveryStart.3 x "010114111530"
- // --> 1.4.1.7.3 = "010114111530"
- // rsuSRMDeliveryStop.3 x "010114130000"
- // --> 1.4.1.8.3 = "010114130000"
- // rsuSRMPayload.3 x "0EFF82445566778899000000AABBCCDDEEFF00E00EA0C12A00"
- // --> 1.4.1.9.3 = "0EFF82445566778899000000AABBCCDDEEFF00E00EA0C12A00"
- // rsuSRMEnable.3 = 1
- // --> 1.4.1.10.3 = 1
- //////////////////////////////
-
- VariableBinding rsuSRMPsid = SnmpSession.getPEncodedVariableBinding(
- "1.0.15628.4.1.4.1.2.".concat(Integer.toString(index)),
- snmp.getRsuid());
- VariableBinding rsuSRMDsrcMsgId = new VariableBinding(
- new OID("1.0.15628.4.1.4.1.3.".concat(Integer.toString(index))), new Integer32(snmp.getMsgid()));
- VariableBinding rsuSRMTxMode = new VariableBinding(
- new OID("1.0.15628.4.1.4.1.4.".concat(Integer.toString(index))), new Integer32(snmp.getMode()));
- VariableBinding rsuSRMTxChannel = new VariableBinding(
- new OID("1.0.15628.4.1.4.1.5.".concat(Integer.toString(index))), new Integer32(snmp.getChannel()));
- VariableBinding rsuSRMTxInterval = new VariableBinding(
- new OID("1.0.15628.4.1.4.1.6.".concat(Integer.toString(index))), new Integer32(snmp.getInterval()));
- VariableBinding rsuSRMDeliveryStart = new VariableBinding(
- new OID("1.0.15628.4.1.4.1.7.".concat(Integer.toString(index))),
- new OctetString(DatatypeConverter.parseHexBinary(SNMP.snmpTimestampFromIso(snmp.getDeliverystart()))));
- VariableBinding rsuSRMDeliveryStop = new VariableBinding(
- new OID("1.0.15628.4.1.4.1.8.".concat(Integer.toString(index))),
- new OctetString(DatatypeConverter.parseHexBinary(SNMP.snmpTimestampFromIso(snmp.getDeliverystop()))));
- VariableBinding rsuSRMPayload = new VariableBinding(
- new OID("1.0.15628.4.1.4.1.9.".concat(Integer.toString(index))),
- new OctetString(DatatypeConverter.parseHexBinary(payload)));
- VariableBinding rsuSRMEnable = new VariableBinding(
- new OID("1.0.15628.4.1.4.1.10.".concat(Integer.toString(index))), new Integer32(snmp.getEnable()));
- VariableBinding rsuSRMStatus = new VariableBinding(
- new OID("1.0.15628.4.1.4.1.11.".concat(Integer.toString(index))), new Integer32(snmp.getStatus()));
-
- ScopedPDU pdu = new ScopedPDU();
- pdu.add(rsuSRMPsid);
- pdu.add(rsuSRMDsrcMsgId);
- pdu.add(rsuSRMTxMode);
- pdu.add(rsuSRMTxChannel);
- pdu.add(rsuSRMTxInterval);
- pdu.add(rsuSRMDeliveryStart);
- pdu.add(rsuSRMDeliveryStop);
- pdu.add(rsuSRMPayload);
- pdu.add(rsuSRMEnable);
- if (verb == ServiceRequest.OdeInternal.RequestVerb.POST) {
- pdu.add(rsuSRMStatus);
+ public static ScopedPDU createPDU(SNMP snmp, String payload, int index, RequestVerb verb, SnmpProtocol snmpProtocol) throws ParseException {
+ switch (snmpProtocol) {
+ case FOURDOT1:
+ return createPDUWithFourDot1Protocol(snmp, payload, index, verb);
+ case NTCIP1218:
+ return createPDUWithNTCIP1218Protocol(snmp, payload, index, verb);
+ default:
+ logger.error("Unknown SNMP protocol: {}", snmpProtocol);
+ return null;
}
- pdu.setType(PDU.SET);
-
- return pdu;
}
public static VariableBinding getPEncodedVariableBinding(String oid, String val) {
@@ -350,4 +289,116 @@ public static VariableBinding getPEncodedVariableBinding(String oid, String val)
}
return null;
}
+
+ private static ScopedPDU createPDUWithFourDot1Protocol(SNMP snmp, String payload, int index, RequestVerb verb) throws ParseException {
+ //////////////////////////////
+ // - OID examples - //
+ //////////////////////////////
+ // rsuSRMStatus.3 = 4
+ // --> 1.4.1.11.3 = 4
+ // rsuSRMTxChannel.3 = 3
+ // --> 1.4.1.5.3 = 178
+ // rsuSRMTxMode.3 = 1
+ // --> 1.4.1.4.3 = 1
+ // rsuSRMPsid.3 x "8003"
+ // --> 1.4.1.2.3 x "8003"
+ // rsuSRMDsrcMsgId.3 = 31
+ // --> 1.4.1.3.3 = 31
+ // rsuSRMTxInterval.3 = 10
+ // --> 1.4.1.6.3 = 10
+ // rsuSRMDeliveryStart.3 x "07e7051f0c000000"
+ // --> 1.4.1.7.3 = "07e7051f0c000000"
+ // rsuSRMDeliveryStop.3 x "07e7060f0c000000"
+ // --> 1.4.1.8.3 = "07e7060f0c000000"
+ // rsuSRMPayload.3 x "001f6020100000000000de8f834082729de80d80734d37862d2187864fc2099f1f4028407e53bd01b00e69a6f0c5a409c46c3c300118e69a26fa77a0104b8e69a2e86779e21981414e39a68fd29de697d804fb38e69a50e27796151013d81080020290"
+ // --> 1.4.1.9.3 = "001f6020100000000000de8f834082729de80d80734d37862d2187864fc2099f1f4028407e53bd01b00e69a6f0c5a409c46c3c300118e69a26fa77a0104b8e69a2e86779e21981414e39a68fd29de697d804fb38e69a50e27796151013d81080020290"
+ // rsuSRMEnable.3 = 1
+ // --> 1.4.1.10.3 = 1
+ //////////////////////////////
+
+ VariableBinding rsuSRMPsid = SnmpFourDot1Protocol.getVbRsuSrmPsid(index, snmp.getRsuid());
+ VariableBinding rsuSRMDsrcMsgId = SnmpFourDot1Protocol.getVbRsuSrmDsrcMsgId(index, snmp.getMsgid());
+ VariableBinding rsuSRMTxMode = SnmpFourDot1Protocol.getVbRsuSrmTxMode(index, snmp.getMode());
+ VariableBinding rsuSRMTxChannel = SnmpFourDot1Protocol.getVbRsuSrmTxChannel(index, snmp.getChannel());
+ VariableBinding rsuSRMTxInterval = SnmpFourDot1Protocol.getVbRsuSrmTxInterval(index, snmp.getInterval());
+ VariableBinding rsuSRMDeliveryStart = SnmpFourDot1Protocol.getVbRsuSrmDeliveryStart(index, snmp.getDeliverystart());
+ VariableBinding rsuSRMDeliveryStop = SnmpFourDot1Protocol.getVbRsuSrmDeliveryStop(index, snmp.getDeliverystop());
+ VariableBinding rsuSRMPayload = SnmpFourDot1Protocol.getVbRsuSrmPayload(index, payload);
+ VariableBinding rsuSRMEnable = SnmpFourDot1Protocol.getVbRsuSrmEnable(index, snmp.getEnable());
+ VariableBinding rsuSRMStatus = SnmpFourDot1Protocol.getVbRsuSrmStatus(index, snmp.getStatus());
+
+ ScopedPDU pdu = new ScopedPDU();
+ pdu.add(rsuSRMPsid);
+ pdu.add(rsuSRMDsrcMsgId);
+ pdu.add(rsuSRMTxMode);
+ pdu.add(rsuSRMTxChannel);
+ pdu.add(rsuSRMTxInterval);
+ pdu.add(rsuSRMDeliveryStart);
+ pdu.add(rsuSRMDeliveryStop);
+ pdu.add(rsuSRMPayload);
+ pdu.add(rsuSRMEnable);
+ if (verb == ServiceRequest.OdeInternal.RequestVerb.POST) {
+ pdu.add(rsuSRMStatus);
+ }
+ pdu.setType(PDU.SET);
+
+ return pdu;
+ }
+
+ private static ScopedPDU createPDUWithNTCIP1218Protocol(SNMP snmp, String payload, int index, RequestVerb verb) throws ParseException {
+ //////////////////////////////
+ // - OID examples - //
+ //////////////////////////////
+ // rsuMsgRepeatPsid.3 x "8003"
+ // --> 1.3.6.1.4.1.1206.4.2.18.3.2.1.2.3 x "8003"
+ // rsuMsgRepeatTxChannel.3 = 3
+ // --> 1.3.6.1.4.1.1206.4.2.18.3.2.1.3.3 = 183
+ // rsuMsgRepeatTxInterval.3 = 10
+ // --> 1.3.6.1.4.1.1206.4.2.18.3.2.1.4.3 = 10
+ // rsuMsgRepeatDeliveryStart.3 x "07e7051f0c000000"
+ // --> 1.3.6.1.4.1.1206.4.2.18.3.2.1.5.3 = "07e7051f0c000000"
+ // rsuMsgRepeatDeliveryStop.3 x "07e7060f0c000000"
+ // --> 1.3.6.1.4.1.1206.4.2.18.3.2.1.6.3 = "07e7060f0c000000"
+ // rsuMsgRepeatPayload.3 x "001f6020100000000000de8f834082729de80d80734d37862d2187864fc2099f1f4028407e53bd01b00e69a6f0c5a409c46c3c300118e69a26fa77a0104b8e69a2e86779e21981414e39a68fd29de697d804fb38e69a50e27796151013d81080020290"
+ // --> 1.3.6.1.4.1.1206.4.2.18.3.2.1.7.3 = "001f6020100000000000de8f834082729de80d80734d37862d2187864fc2099f1f4028407e53bd01b00e69a6f0c5a409c46c3c300118e69a26fa77a0104b8e69a2e86779e21981414e39a68fd29de697d804fb38e69a50e27796151013d81080020290"
+ // rsuMsgRepeatEnable.3 = 1
+ // --> 1.3.6.1.4.1.1206.4.2.18.3.2.1.8.3 = 1
+ // rsuMsgRepeatStatus.3 = 4
+ // --> 1.3.6.1.4.1.1206.4.2.18.3.2.1.9.3 = 4
+ // rsuMsgRepeatPriority.3 = 6
+ // --> 1.3.6.1.4.1.1206.4.2.18.3.2.1.10.3 = 6
+ // rsuMsgRepeatOptions.3 = "C0"
+ // --> 1.3.6.1.4.1.1206.4.2.18.3.2.1.11.3 = "C0"
+ //////////////////////////////
+
+ VariableBinding rsuMsgRepeatPsid = SnmpNTCIP1218Protocol.getVbRsuMsgRepeatPsid(index, snmp.getRsuid());
+ // note: dsrc_msg_id is not in NTCIP 1218
+ // note: tx_mode is not in NTCIP 1218
+ VariableBinding rsuMsgRepeatTxChannel = SnmpNTCIP1218Protocol.getVbRsuMsgRepeatTxChannel(index, snmp.getChannel());
+ VariableBinding rsuMsgRepeatTxInterval = SnmpNTCIP1218Protocol.getVbRsuMsgRepeatTxInterval(index, snmp.getInterval());
+ VariableBinding rsuMsgRepeatDeliveryStart = SnmpNTCIP1218Protocol.getVbRsuMsgRepeatDeliveryStart(index, snmp.getDeliverystart());
+ VariableBinding rsuMsgRepeatDeliveryStop = SnmpNTCIP1218Protocol.getVbRsuMsgRepeatDeliveryStop(index, snmp.getDeliverystop());
+ VariableBinding rsuMsgRepeatPayload = SnmpNTCIP1218Protocol.getVbRsuMsgRepeatPayload(index, payload);
+ VariableBinding rsuMsgRepeatEnable = SnmpNTCIP1218Protocol.getVbRsuMsgRepeatEnable(index, snmp.getEnable());
+ VariableBinding rsuMsgRepeatStatus = SnmpNTCIP1218Protocol.getVbRsuMsgRepeatStatus(index, snmp.getStatus());
+ VariableBinding rsuMsgRepeatPriority = SnmpNTCIP1218Protocol.getVbRsuMsgRepeatPriority(index);
+ VariableBinding rsuMsgRepeatOptions = SnmpNTCIP1218Protocol.getVbRsuMsgRepeatOptions(index);
+
+ ScopedPDU pdu = new ScopedPDU();
+ pdu.add(rsuMsgRepeatPsid);
+ pdu.add(rsuMsgRepeatTxChannel);
+ pdu.add(rsuMsgRepeatTxInterval);
+ pdu.add(rsuMsgRepeatDeliveryStart);
+ pdu.add(rsuMsgRepeatDeliveryStop);
+ pdu.add(rsuMsgRepeatPayload);
+ pdu.add(rsuMsgRepeatEnable);
+ if (verb == ServiceRequest.OdeInternal.RequestVerb.POST) {
+ pdu.add(rsuMsgRepeatStatus);
+ }
+ pdu.add(rsuMsgRepeatPriority);
+ pdu.add(rsuMsgRepeatOptions);
+ pdu.setType(PDU.SET);
+
+ return pdu;
+ }
}
\ No newline at end of file
diff --git a/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/traveler/TimDeleteController.java b/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/traveler/TimDeleteController.java
index a6760280f..2111a113f 100644
--- a/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/traveler/TimDeleteController.java
+++ b/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/traveler/TimDeleteController.java
@@ -35,7 +35,10 @@
import org.springframework.web.bind.annotation.RestController;
import us.dot.its.jpo.ode.OdeProperties;
+import us.dot.its.jpo.ode.plugin.SnmpProtocol;
import us.dot.its.jpo.ode.plugin.RoadSideUnit.RSU;
+import us.dot.its.jpo.ode.snmp.SnmpFourDot1Protocol;
+import us.dot.its.jpo.ode.snmp.SnmpNTCIP1218Protocol;
import us.dot.its.jpo.ode.snmp.SnmpSession;
import us.dot.its.jpo.ode.util.JsonUtils;
@@ -81,10 +84,31 @@ public ResponseEntity deleteTim(@RequestBody String jsonString,
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(JsonUtils.jsonKeyValue(ERRSTR, "Malformed JSON"));
}
- PDU pdu = new ScopedPDU();
- pdu.add(new VariableBinding(new OID("1.0.15628.4.1.4.1.11.".concat(Integer.toString(index))), new Integer32(6)));
- pdu.setType(PDU.SET);
+ SnmpProtocol snmpProtocol = queryTarget.getSnmpProtocol();
+
+ if (snmpProtocol == null) {
+ logger.error("No SNMP protocol specified.");
+ return ResponseEntity.status(HttpStatus.BAD_REQUEST)
+ .body(JsonUtils.jsonKeyValue(ERRSTR, "No SNMP protocol specified."));
+ }
+ PDU pdu = null;
+ if (snmpProtocol.equals(SnmpProtocol.FOURDOT1)) {
+ pdu = new ScopedPDU();
+ pdu.add(SnmpFourDot1Protocol.getVbRsuSrmStatus(index, 6));
+ pdu.setType(PDU.SET);
+ }
+ else if (snmpProtocol.equals(SnmpProtocol.NTCIP1218)) {
+ pdu = new ScopedPDU();
+ pdu.add(SnmpNTCIP1218Protocol.getVbRsuMsgRepeatStatus(index, 6));
+ pdu.setType(PDU.SET);
+ }
+ else {
+ logger.error("Unsupported SNMP protocol");
+ return ResponseEntity.status(HttpStatus.BAD_REQUEST)
+ .body(JsonUtils.jsonKeyValue(ERRSTR, "Unsupported SNMP protocol"));
+ }
+
ResponseEvent rsuResponse = null;
try {
rsuResponse = ss.set(pdu, ss.getSnmp(), ss.getTarget(), false);
diff --git a/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/traveler/TimQueryController.java b/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/traveler/TimQueryController.java
index dd260740a..73ef59562 100644
--- a/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/traveler/TimQueryController.java
+++ b/jpo-ode-svcs/src/main/java/us/dot/its/jpo/ode/traveler/TimQueryController.java
@@ -34,7 +34,10 @@
import org.springframework.web.bind.annotation.RestController;
import us.dot.its.jpo.ode.OdeProperties;
+import us.dot.its.jpo.ode.plugin.SnmpProtocol;
import us.dot.its.jpo.ode.plugin.RoadSideUnit.RSU;
+import us.dot.its.jpo.ode.snmp.SnmpFourDot1Protocol;
+import us.dot.its.jpo.ode.snmp.SnmpNTCIP1218Protocol;
import us.dot.its.jpo.ode.snmp.SnmpSession;
import us.dot.its.jpo.ode.util.JsonUtils;
@@ -68,7 +71,16 @@ public synchronized ResponseEntity bulkQuery(@RequestBody String jsonStr
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(JsonUtils.jsonKeyValue(ERRSTR, "Empty request."));
}
- RSU queryTarget = (RSU) JsonUtils.fromJson(jsonString, RSU.class);
+ RSU queryTarget = null;
+ try {
+ queryTarget = (RSU) JsonUtils.fromJson(jsonString, RSU.class);
+ }
+ catch(Exception e) {
+
+ }
+ if (queryTarget == null) {
+ return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(JsonUtils.jsonKeyValue(ERRSTR, "Unrecognized protocol"));
+ }
TimTransmogrifier.updateRsuCreds(queryTarget, odeProperties);
@@ -87,12 +99,36 @@ public synchronized ResponseEntity bulkQuery(@RequestBody String jsonStr
PDU pdu1 = new ScopedPDU();
pdu1.setType(PDU.GET);
- for (int i = 0; i < odeProperties.getRsuSrmSlots() - 50; i++) {
- pdu0.add(new VariableBinding(new OID("1.0.15628.4.1.4.1.11.".concat(Integer.toString(i)))));
+ SnmpProtocol snmpProtocol = queryTarget.getSnmpProtocol();
+
+ if (snmpProtocol == null) {
+ logger.error("No SNMP protocol specified.");
+ return ResponseEntity.status(HttpStatus.BAD_REQUEST)
+ .body(JsonUtils.jsonKeyValue(ERRSTR, "No SNMP protocol specified."));
}
- for (int i = 50; i < odeProperties.getRsuSrmSlots(); i++) {
- pdu1.add(new VariableBinding(new OID("1.0.15628.4.1.4.1.11.".concat(Integer.toString(i)))));
+ if (snmpProtocol == SnmpProtocol.FOURDOT1) {
+ for (int i = 0; i < odeProperties.getRsuSrmSlots() - 50; i++) {
+ pdu0.add(SnmpFourDot1Protocol.getVbRsuSrmStatus(i));
+ }
+
+ for (int i = 50; i < odeProperties.getRsuSrmSlots(); i++) {
+ pdu1.add(SnmpFourDot1Protocol.getVbRsuSrmStatus(i));
+ }
+ }
+ else if (snmpProtocol == SnmpProtocol.NTCIP1218) {
+ for (int i = 0; i < odeProperties.getRsuSrmSlots() - 50; i++) {
+ pdu0.add(SnmpNTCIP1218Protocol.getVbRsuMsgRepeatStatus(i));
+ }
+
+ for (int i = 50; i < odeProperties.getRsuSrmSlots(); i++) {
+ pdu1.add(SnmpNTCIP1218Protocol.getVbRsuMsgRepeatStatus(i));
+ }
+ }
+ else {
+ logger.error("Unsupported SNMP protocol: {}", snmpProtocol);
+ return ResponseEntity.status(HttpStatus.BAD_REQUEST)
+ .body(JsonUtils.jsonKeyValue(ERRSTR, "Unsupported SNMP protocol: " + snmpProtocol));
}
ResponseEvent response0 = null;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/OdePropertiesControllerTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/OdePropertiesControllerTest.java
index 7d2a20980..d98a60443 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/OdePropertiesControllerTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/OdePropertiesControllerTest.java
@@ -2,7 +2,7 @@
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Expectations;
import mockit.Injectable;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/OdePropertiesTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/OdePropertiesTest.java
index d5e5ec472..f39ea0a68 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/OdePropertiesTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/OdePropertiesTest.java
@@ -22,8 +22,8 @@
import java.util.HashSet;
import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.springframework.boot.info.BuildProperties;
import org.springframework.core.env.Environment;
@@ -45,7 +45,7 @@ public class OdePropertiesTest {
@Capturing
CommonUtils capturingCommonUtils;
- @Before
+ @BeforeEach
public void setup() {
new Expectations() {
{
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/SerializableMessageProducerPoolTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/SerializableMessageProducerPoolTest.java
index 98d1c7d39..96de098f2 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/SerializableMessageProducerPoolTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/SerializableMessageProducerPoolTest.java
@@ -24,8 +24,8 @@
import java.util.Set;
import org.apache.kafka.clients.producer.Producer;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Expectations;
@@ -44,7 +44,7 @@ public class SerializableMessageProducerPoolTest {
@Injectable
OdeProperties mockOdeProperties;
- @Before
+ @BeforeEach
public void setUp() {
new Expectations() {
{
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/SystemConfigTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/SystemConfigTest.java
index 9ce5a9377..fd998abb4 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/SystemConfigTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/SystemConfigTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
//import mockit.integration.junit4.JMockit;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/ByteArrayPublisherTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/ByteArrayPublisherTest.java
index 46d1c0ffb..3d4d132d6 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/ByteArrayPublisherTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/ByteArrayPublisherTest.java
@@ -15,7 +15,7 @@
******************************************************************************/
package us.dot.its.jpo.ode.coder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Capturing;
import mockit.Expectations;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeBsmDataCreatorHelperTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeBsmDataCreatorHelperTest.java
index 277ece6bf..6587fb028 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeBsmDataCreatorHelperTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeBsmDataCreatorHelperTest.java
@@ -6,7 +6,7 @@
import java.math.BigDecimal;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import us.dot.its.jpo.ode.model.OdeBsmData;
import us.dot.its.jpo.ode.model.OdeBsmPayload;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeDataPublisherTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeDataPublisherTest.java
index 87673a3b2..d6b297b4f 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeDataPublisherTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeDataPublisherTest.java
@@ -15,7 +15,7 @@
******************************************************************************/
package us.dot.its.jpo.ode.coder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Capturing;
import mockit.Expectations;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeMapDataCreatorHelperTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeMapDataCreatorHelperTest.java
index 3053e3d7e..a126f35bf 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeMapDataCreatorHelperTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeMapDataCreatorHelperTest.java
@@ -3,7 +3,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeSrmDataCreatorHelperTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeSrmDataCreatorHelperTest.java
index 5dd246052..a70582c9b 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeSrmDataCreatorHelperTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeSrmDataCreatorHelperTest.java
@@ -3,7 +3,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeSsmDataCreatorHelperTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeSsmDataCreatorHelperTest.java
index da0c746ae..014176828 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeSsmDataCreatorHelperTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeSsmDataCreatorHelperTest.java
@@ -3,7 +3,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeStringPublisherTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeStringPublisherTest.java
index a6f7f342f..5723a5c0b 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeStringPublisherTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/OdeStringPublisherTest.java
@@ -15,7 +15,7 @@
******************************************************************************/
package us.dot.its.jpo.ode.coder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Capturing;
import mockit.Expectations;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/stream/LogFileToAsn1CodecPublisherTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/stream/LogFileToAsn1CodecPublisherTest.java
index 0072e2a85..8daf0f30e 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/stream/LogFileToAsn1CodecPublisherTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/coder/stream/LogFileToAsn1CodecPublisherTest.java
@@ -16,6 +16,7 @@
package us.dot.its.jpo.ode.coder.stream;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -23,8 +24,8 @@
import java.io.ByteArrayInputStream;
import java.util.List;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import mockit.Expectations;
import mockit.Injectable;
@@ -51,7 +52,7 @@ public class LogFileToAsn1CodecPublisherTest {
@Injectable
StringPublisher injectableStringPublisher;
- @BeforeClass
+ @BeforeAll
public static void setupClass() {
OdeMsgMetadata.setStaticSchemaVersion(OdeProperties.OUTPUT_SCHEMA_VERSION);
}
@@ -94,38 +95,42 @@ public void testPublishEOF(@Mocked LogFileParser mockLogFileParser) throws Excep
assertTrue(dataList.isEmpty());
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void testPublishThrowsIllegalArgumentException() throws Exception {
- // If the filename does not follow expected filename pattern,
- // IllegalArgumentException should be thrown
- testLogFileToAsn1CodecPublisher.publish(new BufferedInputStream(new ByteArrayInputStream(new byte[0])),
- "fileName", ImporterFileType.LEAR_LOG_FILE);
- fail("Expected an IllegalArgumentException to be thrown");
+ assertThrows(IllegalArgumentException.class, () -> {
+ // If the filename does not follow expected filename pattern,
+ // IllegalArgumentException should be thrown
+ testLogFileToAsn1CodecPublisher.publish(new BufferedInputStream(new ByteArrayInputStream(new byte[0])),
+ "fileName", ImporterFileType.LEAR_LOG_FILE);
+ fail("Expected an IllegalArgumentException to be thrown");
+ });
}
- @Test(expected = LogFileToAsn1CodecPublisherException.class)
+ @Test
public void testPublishThrowsLogFileToAsn1CodecPublisherException(@Mocked LogFileParser mockLogFileParser)
throws Exception {
- new Expectations() {
- {
- LogFileParser.factory(anyString);
- result = mockLogFileParser;
-
- /*
- * If the embedded parser fails to parse a log file header, it may throw an
- * exception
- * which is then caught by the parser and re-thrown as
- * LogFileToAsn1CodecPublisherException.
- * This mocked object will simulate that eventuality.
- */
- mockLogFileParser.parseFile((BufferedInputStream) any, anyString);
- result = new LogFileToAsn1CodecPublisherException(anyString, (Exception) any);
- }
- };
-
- testLogFileToAsn1CodecPublisher.publish(new BufferedInputStream(new ByteArrayInputStream(new byte[0])),
- "fileName", ImporterFileType.LEAR_LOG_FILE);
- fail("Expected an LogFileToAsn1CodecPublisherException to be thrown");
+ assertThrows(LogFileToAsn1CodecPublisherException.class, () -> {
+ new Expectations() {
+ {
+ LogFileParser.factory(anyString);
+ result = mockLogFileParser;
+
+ /*
+ * If the embedded parser fails to parse a log file header, it may throw an
+ * exception
+ * which is then caught by the parser and re-thrown as
+ * LogFileToAsn1CodecPublisherException.
+ * This mocked object will simulate that eventuality.
+ */
+ mockLogFileParser.parseFile((BufferedInputStream) any, anyString);
+ result = new LogFileToAsn1CodecPublisherException(anyString, (Exception) any);
+ }
+ };
+
+ testLogFileToAsn1CodecPublisher.publish(new BufferedInputStream(new ByteArrayInputStream(new byte[0])),
+ "fileName", ImporterFileType.LEAR_LOG_FILE);
+ fail("Expected an LogFileToAsn1CodecPublisherException to be thrown");
+ });
}
@Test
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/dds/DdsDepositRequestManagerTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/dds/DdsDepositRequestManagerTest.java
index c2c7cf3f1..44788e469 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/dds/DdsDepositRequestManagerTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/dds/DdsDepositRequestManagerTest.java
@@ -24,8 +24,8 @@
import javax.websocket.Session;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import mockit.Expectations;
@@ -48,7 +48,7 @@ public class DdsDepositRequestManagerTest {
@Mocked OdeProperties mockOdeProperties;
@Mocked Logger mockLogger;
- @Before
+ @BeforeEach
public void setup() {
new Expectations() {
{
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/dds/DdsDepositorTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/dds/DdsDepositorTest.java
index d1bcdb4f9..73273415a 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/dds/DdsDepositorTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/dds/DdsDepositorTest.java
@@ -21,7 +21,7 @@
import javax.websocket.CloseReason;
import javax.websocket.Session;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import ch.qos.logback.classic.Logger;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/dds/DdsRequestManagerTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/dds/DdsRequestManagerTest.java
index 39485c9d0..573a26ff2 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/dds/DdsRequestManagerTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/dds/DdsRequestManagerTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Expectations;
import mockit.Mocked;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/ExporterTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/ExporterTest.java
index dcf5f6354..0229be360 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/ExporterTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/ExporterTest.java
@@ -22,7 +22,7 @@
import static org.junit.Assert.*;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import us.dot.its.jpo.ode.OdeProperties;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/StompContentTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/StompContentTest.java
index 440ac8aa4..ca8b06094 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/StompContentTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/StompContentTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import us.dot.its.jpo.ode.stomp.StompContent;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/StompStringExporterTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/StompStringExporterTest.java
index 8e9e48853..ac892bd65 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/StompStringExporterTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/StompStringExporterTest.java
@@ -16,7 +16,7 @@
package us.dot.its.jpo.ode.exporter;
import mockit.*;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import us.dot.its.jpo.ode.OdeProperties;
import us.dot.its.jpo.ode.wrapper.MessageConsumer;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/StompStringMessageDistributorTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/StompStringMessageDistributorTest.java
index 2f2e4c7c4..6413ba260 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/StompStringMessageDistributorTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/exporter/StompStringMessageDistributorTest.java
@@ -19,7 +19,7 @@
import static org.junit.Assert.fail;
import org.apache.kafka.clients.consumer.ConsumerRecord;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.messaging.simp.SimpMessagingTemplate;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/http/BadRequestExceptionTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/http/BadRequestExceptionTest.java
index 53162117f..9817e723e 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/http/BadRequestExceptionTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/http/BadRequestExceptionTest.java
@@ -15,7 +15,7 @@
******************************************************************************/
package us.dot.its.jpo.ode.http;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import us.dot.its.jpo.ode.http.BadRequestException;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/http/InternalServerErrorExceptionTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/http/InternalServerErrorExceptionTest.java
index 14aacd30b..2d9794a5c 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/http/InternalServerErrorExceptionTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/http/InternalServerErrorExceptionTest.java
@@ -17,7 +17,7 @@
import java.io.IOException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class InternalServerErrorExceptionTest {
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/ImporterDirectoryWatcherTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/ImporterDirectoryWatcherTest.java
index 76d011e42..fda515dd8 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/ImporterDirectoryWatcherTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/ImporterDirectoryWatcherTest.java
@@ -21,8 +21,7 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Capturing;
import mockit.Expectations;
@@ -60,7 +59,7 @@ public class ImporterDirectoryWatcherTest {
@Mocked
ScheduledExecutorService mockScheduledExecutorService;
- @Before
+ // @BeforeEach
public void testConstructor() throws IOException {
new Expectations() {
{
@@ -74,14 +73,21 @@ public void testConstructor() throws IOException {
}
@Test
- public void testRun() throws InterruptedException {
+ public void testRun() throws InterruptedException, IOException {
new Expectations() {
{
+ OdeFileUtils.createDirectoryRecursively((Path) any);
+ times = 3;
+
+ Executors.newScheduledThreadPool(1);
+ result = mockScheduledExecutorService;
+
mockScheduledExecutorService.scheduleWithFixedDelay((Runnable) any, anyLong, anyLong, TimeUnit.SECONDS);
mockScheduledExecutorService.awaitTermination(anyLong, TimeUnit.SECONDS);
}
};
+ testImporterDirectoryWatcher = new ImporterDirectoryWatcher(injectableOdeProperties, backupDir, failureDir, backupDir, injectableImporterFileType, timePeriod);
testImporterDirectoryWatcher.run();
}
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/ImporterDirectoryWatcherTestOld.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/ImporterDirectoryWatcherTestOld.java
index 698a8cbe8..3765d1a39 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/ImporterDirectoryWatcherTestOld.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/ImporterDirectoryWatcherTestOld.java
@@ -16,17 +16,20 @@
package us.dot.its.jpo.ode.importer;
import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTimeout;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.WatchEvent;
import java.nio.file.WatchEvent.Kind;
+import java.time.Duration;
import java.nio.file.WatchKey;
import java.nio.file.WatchService;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
import mockit.Capturing;
import mockit.Expectations;
@@ -35,7 +38,7 @@
import us.dot.its.jpo.ode.OdeProperties;
import us.dot.its.jpo.ode.importer.ImporterDirectoryWatcher.ImporterFileType;
-@Ignore
+@Disabled
public class ImporterDirectoryWatcherTestOld {
ImporterDirectoryWatcher testImporterDirectoryWatcher;
@@ -63,20 +66,22 @@ public class ImporterDirectoryWatcherTestOld {
@Capturing
ImporterProcessor capturingImporterProcessor;
- @Before
+ @BeforeEach
public void createTestObject() {
- try {
- new Expectations() {
- {
- OdeFileUtils.createDirectoryRecursively((Path) any);
- times = 3;
- }
- };
- } catch (IOException e) {
- fail("Unexpected exception in expectations block: " + e);
+ if (testImporterDirectoryWatcher == null) {
+ try {
+ new Expectations() {
+ {
+ OdeFileUtils.createDirectoryRecursively((Path) any);
+ times = 3;
+ }
+ };
+ } catch (IOException e) {
+ fail("Unexpected exception in expectations block: " + e);
+ }
+ testImporterDirectoryWatcher = new ImporterDirectoryWatcher(injectableOdeProperties, mockDir, backupDir, failureDir, ImporterFileType.LEAR_LOG_FILE, timePeriod);
+ testImporterDirectoryWatcher.setWatching(false);
}
- testImporterDirectoryWatcher = new ImporterDirectoryWatcher(injectableOdeProperties, mockDir, backupDir, failureDir, ImporterFileType.LEAR_LOG_FILE, timePeriod);
- testImporterDirectoryWatcher.setWatching(false);
}
@Test
@@ -94,34 +99,37 @@ public void testConstructorOdeUtilsException() {
new ImporterDirectoryWatcher(injectableOdeProperties, mockDir, backupDir, failureDir, ImporterFileType.LEAR_LOG_FILE, timePeriod);
}
- @Test(timeout = 4000)
+ @Test
public void runShouldCatchException() {
- try {
- new Expectations() {
- {
- mockDir.register((WatchService) any, (Kind>) any);
- result = null;
- }
- };
- } catch (IOException e) {
- fail("Unexpected exception in expectations block: " + e);
- }
- testImporterDirectoryWatcher.run();
+ assertTimeout(Duration.ofMillis(4000), () -> {
+ try {
+ new Expectations() {
+ {
+ mockDir.register((WatchService) any, (Kind>) any);
+ result = null;
+ }
+ };
+ } catch (IOException e) {
+ fail("Unexpected exception in expectations block: " + e);
+ }
+ testImporterDirectoryWatcher.run();
+ });
}
- @Test(timeout = 4000)
+ @Test
+ @Timeout(4)
public void shouldRunNoProblems() {
- try {
- new Expectations() {
- {
- mockDir.register((WatchService) any, (Kind>) any);
- result = mockWatchKey;
- }
- };
- } catch (IOException e) {
- fail("Unexpected exception in expectations block: " + e);
- }
- testImporterDirectoryWatcher.run();
+ try {
+ new Expectations() {
+ {
+ mockDir.register((WatchService) any, (Kind>) any);
+ result = mockWatchKey;
+ }
+ };
+ } catch (IOException e) {
+ fail("Unexpected exception in expectations block: " + e);
+ }
+ testImporterDirectoryWatcher.run();
}
}
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/ImporterProcessorTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/ImporterProcessorTest.java
index 381cd79d5..2d47a70b2 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/ImporterProcessorTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/ImporterProcessorTest.java
@@ -26,8 +26,8 @@
import java.nio.file.Path;
import java.util.Iterator;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import mockit.Capturing;
import mockit.Expectations;
@@ -68,7 +68,7 @@ public class ImporterProcessorTest {
Path injectableFailureDir;
- @Test @Ignore
+ @Test @Disabled
public void processExistingFilesShouldCatchExceptionFailedToCreateStream() {
try {
@@ -85,7 +85,7 @@ public void processExistingFilesShouldCatchExceptionFailedToCreateStream() {
testImporterProcessor.processDirectory(injectableDir, injectableBackupDir, injectableFailureDir);
}
- @Test @Ignore
+ @Test @Disabled
public void processExistingFilesShouldProcessOneFile(@Mocked DirectoryStream mockDirectoryStream,
@Mocked Iterator mockIterator) {
@@ -109,7 +109,7 @@ public void processExistingFilesShouldProcessOneFile(@Mocked DirectoryStream {
+ LogFileParser.factory("invalidFileName");
+ fail("Expected IllegalArgumentException");
+ });
}
@Test
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/PayloadParserTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/PayloadParserTest.java
index 104919ca1..03b444bdf 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/PayloadParserTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/PayloadParserTest.java
@@ -24,7 +24,7 @@
import java.io.IOException;
import org.apache.tomcat.util.buf.HexUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Injectable;
import mockit.Tested;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/RxMsgFileParserTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/RxMsgFileParserTest.java
index 7bac931d3..178109133 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/RxMsgFileParserTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/RxMsgFileParserTest.java
@@ -24,7 +24,7 @@
import java.io.IOException;
import org.apache.tomcat.util.buf.HexUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Injectable;
import mockit.Tested;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/SecResultCodeParserTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/SecResultCodeParserTest.java
index 10ebd6d0b..878028dac 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/SecResultCodeParserTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/SecResultCodeParserTest.java
@@ -23,7 +23,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Injectable;
import mockit.Tested;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/TimeParserTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/TimeParserTest.java
index 780c2c48a..f060bec4d 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/TimeParserTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/importer/parser/TimeParserTest.java
@@ -23,7 +23,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Injectable;
import mockit.Tested;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/pdm/J2735PdmRequestTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/pdm/J2735PdmRequestTest.java
index e9ba4ddc8..0af8c866b 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/pdm/J2735PdmRequestTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/pdm/J2735PdmRequestTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Tested;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/pdm/PdmControllerTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/pdm/PdmControllerTest.java
index b1332baf1..1f26f7cbb 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/pdm/PdmControllerTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/pdm/PdmControllerTest.java
@@ -19,7 +19,7 @@
import java.io.IOException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.snmp4j.PDU;
import org.snmp4j.Snmp;
import org.snmp4j.UserTarget;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/pdm/PdmUtilTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/pdm/PdmUtilTest.java
index 08e503fad..06a08cb26 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/pdm/PdmUtilTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/pdm/PdmUtilTest.java
@@ -24,7 +24,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.snmp4j.ScopedPDU;
import mockit.Expectations;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/rsu/RsuDepositorTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/rsu/RsuDepositorTest.java
index 9b660fd34..f0424570e 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/rsu/RsuDepositorTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/rsu/RsuDepositorTest.java
@@ -21,7 +21,7 @@
import java.io.IOException;
import java.text.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import mockit.Capturing;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/rsuHealth/RsuHealthControllerTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/rsuHealth/RsuHealthControllerTest.java
index 8c6ba10e8..43a6bab4a 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/rsuHealth/RsuHealthControllerTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/rsuHealth/RsuHealthControllerTest.java
@@ -20,7 +20,7 @@
import java.io.IOException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.snmp4j.Snmp;
import org.snmp4j.TransportMapping;
import org.snmp4j.security.SecurityModels;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/rsuHealth/RsuSnmpTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/rsuHealth/RsuSnmpTest.java
index 397c597b4..d852e4957 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/rsuHealth/RsuSnmpTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/rsuHealth/RsuSnmpTest.java
@@ -23,8 +23,8 @@
import java.io.IOException;
import java.util.Vector;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.snmp4j.PDU;
import org.snmp4j.Snmp;
@@ -39,7 +39,7 @@ public class RsuSnmpTest {
@Mock private Snmp mockSnmp;
- @Before
+ @BeforeEach
public void setUpSnmp() throws IOException {
//MockitoAnnotations.initMocks(this);
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/Asn1CommandManagerTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/Asn1CommandManagerTest.java
index 9d10bb25d..3de298270 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/Asn1CommandManagerTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/Asn1CommandManagerTest.java
@@ -18,7 +18,7 @@
import java.io.IOException;
import java.text.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Capturing;
import mockit.Expectations;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/Asn1DecodedDataRouterTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/Asn1DecodedDataRouterTest.java
index 0b0e58b89..a0ff1680d 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/Asn1DecodedDataRouterTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/Asn1DecodedDataRouterTest.java
@@ -20,9 +20,9 @@
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.json.JSONException;
import org.json.JSONObject;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import mockit.Capturing;
import mockit.Expectations;
@@ -66,7 +66,7 @@ public class Asn1DecodedDataRouterTest {
ConsumerRecord mockConsumerRecord;
@SuppressWarnings("unchecked")
- @Before @Ignore
+ @BeforeEach @Disabled
public void createMockProducers() {
new Expectations() {
@@ -81,7 +81,7 @@ public void createMockProducers() {
};
}
- @Test @Ignore
+ @Test @Disabled
public void testProcessBsmLogDuringEvent() throws XmlUtilsException {
try {
new Expectations() {
@@ -123,7 +123,7 @@ public void testProcessBsmLogDuringEvent() throws XmlUtilsException {
testAsn1DecodedDataRouter.process("testConsumedData");
}
- @Test @Ignore
+ @Test @Disabled
public void testProcessRxMsgBsm() throws XmlUtilsException {
try {
new Expectations() {
@@ -165,7 +165,7 @@ public void testProcessRxMsgBsm() throws XmlUtilsException {
testAsn1DecodedDataRouter.process("testConsumedData");
}
- @Test @Ignore
+ @Test @Disabled
public void testProcessTxMsgBsm() throws XmlUtilsException {
try {
new Expectations() {
@@ -207,7 +207,7 @@ public void testProcessTxMsgBsm() throws XmlUtilsException {
testAsn1DecodedDataRouter.process("testConsumedData");
}
- @Test @Ignore
+ @Test @Disabled
public void testProcessDnsTim() throws XmlUtilsException {
try {
new Expectations() {
@@ -249,7 +249,7 @@ public void testProcessDnsTim() throws XmlUtilsException {
testAsn1DecodedDataRouter.process("testConsumedData");
}
- @Test @Ignore
+ @Test @Disabled
public void testProcessRxTim() throws XmlUtilsException {
try {
new Expectations() {
@@ -291,7 +291,7 @@ public void testProcessRxTim() throws XmlUtilsException {
testAsn1DecodedDataRouter.process("testConsumedData");
}
- @Test @Ignore
+ @Test @Disabled
public void testProcessUnsupportedTim() throws XmlUtilsException {
try {
new Expectations() {
@@ -333,7 +333,7 @@ public void testProcessUnsupportedTim() throws XmlUtilsException {
testAsn1DecodedDataRouter.process("testConsumedData");
}
- @Test @Ignore
+ @Test @Disabled
public void testProcessUnsupportedBsm() throws XmlUtilsException {
try {
new Expectations() {
@@ -376,7 +376,7 @@ public void testProcessUnsupportedBsm() throws XmlUtilsException {
}
- @Test @Ignore
+ @Test @Disabled
public void testProcessXmlException() throws XmlUtilsException {
new Expectations() {
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/Asn1EncodedDataRouterTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/Asn1EncodedDataRouterTest.java
index c88dd6036..00f2b2953 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/Asn1EncodedDataRouterTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/Asn1EncodedDataRouterTest.java
@@ -18,8 +18,8 @@
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import mockit.Capturing;
import mockit.Expectations;
@@ -50,7 +50,7 @@ public class Asn1EncodedDataRouterTest {
// @Capturing
// XmlUtils capturingXmlUtils;
- @Test @Ignore
+ @Test @Disabled
public void testNoRequest(@Mocked JSONObject mockJSONObject) throws XmlUtilsException {
new Expectations() {{
XmlUtils.toJSONObject(anyString);
@@ -62,7 +62,7 @@ public void testNoRequest(@Mocked JSONObject mockJSONObject) throws XmlUtilsExce
testAsn1EncodedDataRouter.process("stringthing");
}
- @Test @Ignore
+ @Test @Disabled
public void testNoRsus(@Mocked JSONObject mockJSONObject) throws XmlUtilsException {
new Expectations() {{
XmlUtils.toJSONObject(anyString);
@@ -77,7 +77,7 @@ public void testNoRsus(@Mocked JSONObject mockJSONObject) throws XmlUtilsExcepti
testAsn1EncodedDataRouter.process("stringthing");
}
- @Test @Ignore
+ @Test @Disabled
public void testSingleRsu(@Mocked JSONObject mockJSONObject) throws XmlUtilsException {
try {
new Expectations() {{
@@ -103,7 +103,7 @@ public void testSingleRsu(@Mocked JSONObject mockJSONObject) throws XmlUtilsExce
testAsn1EncodedDataRouter.process("stringthing");
}
- @Test @Ignore
+ @Test @Disabled
public void testRsuArray(@Mocked JSONObject mockJSONObject) throws XmlUtilsException {
try {
new Expectations() {{
@@ -129,7 +129,7 @@ public void testRsuArray(@Mocked JSONObject mockJSONObject) throws XmlUtilsExcep
testAsn1EncodedDataRouter.process("stringthing");
}
- @Test @Ignore
+ @Test @Disabled
public void testWithASD(@Mocked JSONObject mockJSONObject) throws XmlUtilsException {
try {
new Expectations() {{
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/AsnCodecRouterServiceControllerTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/AsnCodecRouterServiceControllerTest.java
index bdd0b02bf..3cad9e9e1 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/AsnCodecRouterServiceControllerTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/asn1/AsnCodecRouterServiceControllerTest.java
@@ -17,8 +17,8 @@
import static org.junit.Assert.assertNotNull;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import mockit.Capturing;
import mockit.Expectations;
@@ -40,7 +40,7 @@ public class AsnCodecRouterServiceControllerTest {
@Injectable
OdeProperties injectableOdeProperties;
- @Test @Ignore
+ @Test @Disabled
public void shouldStartTwoConsumers() {
new Expectations() {
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/json/ToJsonConverterTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/json/ToJsonConverterTest.java
index 07551089f..44d736835 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/json/ToJsonConverterTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/json/ToJsonConverterTest.java
@@ -15,7 +15,7 @@
******************************************************************************/
package us.dot.its.jpo.ode.services.json;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import mockit.Expectations;
import mockit.Injectable;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/json/ToJsonServiceControllerTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/json/ToJsonServiceControllerTest.java
index 4e3f481aa..b703558d3 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/json/ToJsonServiceControllerTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/services/json/ToJsonServiceControllerTest.java
@@ -14,8 +14,8 @@
* the License.
******************************************************************************/
package us.dot.its.jpo.ode.services.json;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import mockit.Capturing;
import mockit.Expectations;
@@ -34,7 +34,7 @@ public class ToJsonServiceControllerTest {
// @Capturing
// MessageConsumer, ?> capturingMessageConsumer;
- @Test @Ignore
+ @Test @Disabled
public void test() {
new Expectations() {
{
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/snmp/SnmpSessionTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/snmp/SnmpSessionTest.java
index 23c3da503..1a88ff699 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/snmp/SnmpSessionTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/snmp/SnmpSessionTest.java
@@ -16,13 +16,14 @@
package us.dot.its.jpo.ode.snmp;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.text.ParseException;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.snmp4j.PDU;
import org.snmp4j.ScopedPDU;
@@ -37,6 +38,7 @@
import mockit.Injectable;
import mockit.Mocked;
import us.dot.its.jpo.ode.plugin.RoadSideUnit.RSU;
+import us.dot.its.jpo.ode.plugin.SnmpProtocol;
import us.dot.its.jpo.ode.plugin.SNMP;
import us.dot.its.jpo.ode.plugin.ServiceRequest.OdeInternal.RequestVerb;
@@ -47,7 +49,7 @@ public class SnmpSessionTest {
@Injectable
USM mockUSM;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
String testUsername = "testUser";
String testPassword = "testPass";
@@ -57,19 +59,19 @@ public void setUp() throws Exception {
snmpSession = new SnmpSession(testProps);
}
- @Test(expected = IOException.class)
+ @Test
public void constructorShouldWithIOException(@Mocked DefaultUdpTransportMapping mockDefaultUdpTransportMapping)
throws IOException {
-
- new Expectations() {
- {
- new DefaultUdpTransportMapping();
- result = new IOException();
- }
- };
-
- new SnmpSession(testProps);
-
+ assertThrows(IOException.class, () -> {
+ new Expectations() {
+ {
+ new DefaultUdpTransportMapping();
+ result = new IOException();
+ }
+ };
+
+ new SnmpSession(testProps);
+ });
}
@Test
@@ -106,35 +108,37 @@ public void testGetSetMethods(@Mocked Snmp mockSnmp, @Mocked TransportMapping mo
assertEquals(mockUserTarget, snmpSession.getTarget());
}
- @Test(expected = IOException.class)
+ @Test
public void testResponseEventUDPException(@Mocked Snmp mockSnmp, @Mocked TransportMapping mockTransportMapping,
@Mocked UserTarget mockUserTarget, @Mocked PDU mockPDU) throws IOException {
-
- new Expectations() {
- {
- mockTransportMapping.listen();
- result = new IOException();
- }
- };
- snmpSession.setTransport(mockTransportMapping);
- snmpSession.set(mockPDU, mockSnmp, mockUserTarget, false);
+ assertThrows(IOException.class, () -> {
+ new Expectations() {
+ {
+ mockTransportMapping.listen();
+ result = new IOException();
+ }
+ };
+ snmpSession.setTransport(mockTransportMapping);
+ snmpSession.set(mockPDU, mockSnmp, mockUserTarget, false);
+ });
}
- @Test(expected = IOException.class)
+ @Test
public void testResponseEventSNMPException(@Mocked Snmp mockSnmp, @Mocked UserTarget mockUserTarget,
@Mocked PDU mockPDU) throws IOException {
-
- new Expectations() {
- {
- mockSnmp.set(mockPDU, mockUserTarget);
- result = new IOException();
- }
- };
- snmpSession.set(mockPDU, mockSnmp, mockUserTarget, false);
+ assertThrows(IOException.class, () -> {
+ new Expectations() {
+ {
+ mockSnmp.set(mockPDU, mockUserTarget);
+ result = new IOException();
+ }
+ };
+ snmpSession.set(mockPDU, mockSnmp, mockUserTarget, false);
+ });
}
@Test
- public void shouldCreatePDU() throws ParseException {
+ public void shouldCreatePDUWithFourDot1Protocol() throws ParseException {
String expectedResult = "[1.0.15628.4.1.4.1.2.3 = 80:03, 1.0.15628.4.1.4.1.3.3 = 2, 1.0.15628.4.1.4.1.4.3 = 3, 1.0.15628.4.1.4.1.5.3 = 4, 1.0.15628.4.1.4.1.6.3 = 5, 1.0.15628.4.1.4.1.7.3 = 07:e1:0c:02:11:2f, 1.0.15628.4.1.4.1.8.3 = 07:e1:0c:02:11:2f, 1.0.15628.4.1.4.1.9.3 = 88, 1.0.15628.4.1.4.1.10.3 = 9, 1.0.15628.4.1.4.1.11.3 = 10]";
String expectedResult2 = "[1.0.15628.4.1.4.1.2.3 = 80:03, 1.0.15628.4.1.4.1.3.3 = 2, 1.0.15628.4.1.4.1.4.3 = 3, 1.0.15628.4.1.4.1.5.3 = 4, 1.0.15628.4.1.4.1.6.3 = 5, 1.0.15628.4.1.4.1.7.3 = 07:e1:0c:02:11:2f, 1.0.15628.4.1.4.1.8.3 = 07:e1:0c:02:11:2f, 1.0.15628.4.1.4.1.9.3 = 88, 1.0.15628.4.1.4.1.10.3 = 9]";
@@ -151,12 +155,38 @@ public void shouldCreatePDU() throws ParseException {
SNMP testParams = new SNMP(rsuSRMPsid, rsuSRMDsrcMsgId, rsuSRMTxMode, rsuSRMTxChannel, rsuSRMTxInterval,
"2017-12-02T17:47:11-05:00", "2017-12-02T17:47:11-05:00", rsuSRMEnable, rsuSRMStatus);
- ScopedPDU result = SnmpSession.createPDU(testParams, rsuSRMPayload, 3, RequestVerb.POST);
+ ScopedPDU result = SnmpSession.createPDU(testParams, rsuSRMPayload, 3, RequestVerb.POST, SnmpProtocol.FOURDOT1);
+
+ assertEquals("Incorrect type, expected PDU.SET (-93)", -93, result.getType());
+ assertEquals(expectedResult, result.getVariableBindings().toString());
+
+ ScopedPDU result2 = SnmpSession.createPDU(testParams, rsuSRMPayload, 3, RequestVerb.GET, SnmpProtocol.FOURDOT1);
+
+ assertEquals("Incorrect type, expected PDU.SET (-93)", -93, result2.getType());
+ assertEquals(expectedResult2, result2.getVariableBindings().toString());
+ }
+
+ @Test
+ public void shouldCreatePDUWithNTCIP1218Protocol() throws ParseException {
+ String expectedResult = "[1.3.6.1.4.1.1206.4.2.18.3.2.1.2.3 = 80:03, 1.3.6.1.4.1.1206.4.2.18.3.2.1.3.3 = 4, 1.3.6.1.4.1.1206.4.2.18.3.2.1.4.3 = 5, 1.3.6.1.4.1.1206.4.2.18.3.2.1.5.3 = 07:e1:0c:02:11:2f, 1.3.6.1.4.1.1206.4.2.18.3.2.1.6.3 = 07:e1:0c:02:11:2f, 1.3.6.1.4.1.1206.4.2.18.3.2.1.7.3 = 88, 1.3.6.1.4.1.1206.4.2.18.3.2.1.8.3 = 9, 1.3.6.1.4.1.1206.4.2.18.3.2.1.9.3 = 10, 1.3.6.1.4.1.1206.4.2.18.3.2.1.10.3 = 6, 1.3.6.1.4.1.1206.4.2.18.3.2.1.11.3 = C0]";
+ String expectedResult2 = "[1.3.6.1.4.1.1206.4.2.18.3.2.1.2.3 = 80:03, 1.3.6.1.4.1.1206.4.2.18.3.2.1.3.3 = 4, 1.3.6.1.4.1.1206.4.2.18.3.2.1.4.3 = 5, 1.3.6.1.4.1.1206.4.2.18.3.2.1.5.3 = 07:e1:0c:02:11:2f, 1.3.6.1.4.1.1206.4.2.18.3.2.1.6.3 = 07:e1:0c:02:11:2f, 1.3.6.1.4.1.1206.4.2.18.3.2.1.7.3 = 88, 1.3.6.1.4.1.1206.4.2.18.3.2.1.8.3 = 9, 1.3.6.1.4.1.1206.4.2.18.3.2.1.10.3 = 6, 1.3.6.1.4.1.1206.4.2.18.3.2.1.11.3 = C0]";
+
+ String rsuSRMPsid = "00000083";
+ int rsuSRMTxChannel = 4;
+ int rsuSRMTxInterval = 5;
+ String rsuSRMPayload = "88";
+ int rsuSRMEnable = 9;
+ int rsuSRMStatus = 10;
+
+ SNMP testParams = new SNMP(rsuSRMPsid, 0, 0, rsuSRMTxChannel, rsuSRMTxInterval, "2017-12-02T17:47:11-05:00",
+ "2017-12-02T17:47:11-05:00", rsuSRMEnable, rsuSRMStatus);
+
+ ScopedPDU result = SnmpSession.createPDU(testParams, rsuSRMPayload, 3, RequestVerb.POST, SnmpProtocol.NTCIP1218);
assertEquals("Incorrect type, expected PDU.SET (-93)", -93, result.getType());
assertEquals(expectedResult, result.getVariableBindings().toString());
- ScopedPDU result2 = SnmpSession.createPDU(testParams, rsuSRMPayload, 3, RequestVerb.GET);
+ ScopedPDU result2 = SnmpSession.createPDU(testParams, rsuSRMPayload, 3, RequestVerb.GET, SnmpProtocol.NTCIP1218);
assertEquals("Incorrect type, expected PDU.SET (-93)", -93, result2.getType());
assertEquals(expectedResult2, result2.getVariableBindings().toString());
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/stomp/RegistrationMessageTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/stomp/RegistrationMessageTest.java
index 0d7abb4d3..218c98405 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/stomp/RegistrationMessageTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/stomp/RegistrationMessageTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import us.dot.its.jpo.ode.stomp.RegistrationMessage;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/stomp/StompControllerTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/stomp/StompControllerTest.java
index d869c9123..aabdf2244 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/stomp/StompControllerTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/stomp/StompControllerTest.java
@@ -18,7 +18,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.messaging.simp.SimpMessagingTemplate;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/stomp/WebSocketConfigTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/stomp/WebSocketConfigTest.java
index b2e4a98a6..ff6183eb0 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/stomp/WebSocketConfigTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/stomp/WebSocketConfigTest.java
@@ -15,7 +15,7 @@
******************************************************************************/
package us.dot.its.jpo.ode.stomp;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/storage/FileSystemStorageServiceTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/storage/FileSystemStorageServiceTest.java
index 59132c5e0..a703eceed 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/storage/FileSystemStorageServiceTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/storage/FileSystemStorageServiceTest.java
@@ -28,9 +28,9 @@
import java.nio.file.Files;
import java.nio.file.Path;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.UrlResource;
@@ -48,7 +48,7 @@ public class FileSystemStorageServiceTest {
@Mocked
OdeProperties mockOdeProperties;
- @Before
+ @BeforeEach
public void setupOdePropertiesExpectations() {
new Expectations() {
{
@@ -69,7 +69,7 @@ public void shouldConstruct(@Mocked final Logger mockLogger, @Mocked LoggerFacto
}
- @Test @Ignore
+ @Test @Disabled
public void storeShouldThrowExceptionUnknownType(@Mocked MultipartFile mockMultipartFile) {
String unknownType = "test123";
@@ -90,7 +90,7 @@ public void storeShouldThrowExceptionUnknownType(@Mocked MultipartFile mockMulti
}
- @Test @Ignore
+ @Test @Disabled
public void storeShouldTryToResolveBsmFilename(@Mocked MultipartFile mockMultipartFile) {
String testType = "obulog";
@@ -119,7 +119,7 @@ public void storeShouldTryToResolveBsmFilename(@Mocked MultipartFile mockMultipa
};
}
- @Test @Ignore
+ @Test @Disabled
public void storeShouldThrowAnErrorEmptyFile(@Mocked MultipartFile mockMultipartFile) {
String testType = "obulog";
@@ -148,7 +148,7 @@ public void storeShouldThrowAnErrorEmptyFile(@Mocked MultipartFile mockMultipart
};
}
- @Test @Ignore
+ @Test @Disabled
public void storeShouldRethrowDeleteException(@Mocked MultipartFile mockMultipartFile, @Mocked Files unused) {
String testType = "obulog";
@@ -189,7 +189,7 @@ public void storeShouldRethrowDeleteException(@Mocked MultipartFile mockMultipar
};
}
- @Test @Ignore
+ @Test @Disabled
public void storeShouldRethrowCopyException(@Mocked MultipartFile mockMultipartFile, @Mocked Files unusedFiles,
@Mocked final Logger mockLogger, @Mocked LoggerFactory unusedLogger, @Mocked InputStream mockInputStream) {
@@ -234,7 +234,7 @@ public void storeShouldRethrowCopyException(@Mocked MultipartFile mockMultipartF
};
}
- @Test @Ignore
+ @Test @Disabled
public void loadAllShouldRethrowException(/**@Mocked Files unused**/) {
try {
new Expectations() {
@@ -262,7 +262,7 @@ public void loadAllShouldRethrowException(/**@Mocked Files unused**/) {
};
}
- @Test @Ignore
+ @Test @Disabled
public void loadAsResourceShouldThrowExceptionWhenFileNotExists(
@Mocked Path mockRootPath,
@Mocked Path mockResolvedPath,
@@ -298,7 +298,7 @@ public void loadAsResourceShouldThrowExceptionWhenFileNotExists(
}
}
- @Test @Ignore
+ @Test @Disabled
public void loadAsResourceShouldThrowExceptionWhenFileNotReadable(@Mocked Path mockRootPath,
@Mocked Path mockResolvedPath, @Mocked UrlResource mockUrlResource) {
@@ -335,7 +335,7 @@ public void loadAsResourceShouldThrowExceptionWhenFileNotReadable(@Mocked Path m
}
}
- @Test @Ignore
+ @Test @Disabled
public void loadAsResourceShouldRethrowMalformedURLException(@Mocked Path mockRootPath,
@Mocked Path mockResolvedPath, @Mocked UrlResource mockUrlResource) {
@@ -366,7 +366,7 @@ public void loadAsResourceShouldRethrowMalformedURLException(@Mocked Path mockRo
}
}
- @Test @Ignore
+ @Test @Disabled
public void loadAsResourceShouldReturnResource(@Mocked Path mockRootPath, @Mocked Path mockResolvedPath,
@Mocked UrlResource mockUrlResource) {
@@ -400,7 +400,7 @@ public void loadAsResourceShouldReturnResource(@Mocked Path mockRootPath, @Mocke
}
}
- @Test @Ignore
+ @Test @Disabled
public void initShouldCreateDirectories(@Mocked final Files unused) {
new FileSystemStorageService(mockOdeProperties).init();
@@ -417,7 +417,7 @@ public void initShouldCreateDirectories(@Mocked final Files unused) {
}
}
- @Test @Ignore
+ @Test @Disabled
public void initShouldRethrowAndLogException(@Mocked final Files unused) {
try {
@@ -446,7 +446,7 @@ public void initShouldRethrowAndLogException(@Mocked final Files unused) {
};
}
- @Test @Ignore
+ @Test @Disabled
public void deleteAllShouldDeleteRecursivelyAndLog(@Mocked final FileSystemUtils unused) {
new FileSystemStorageService(mockOdeProperties).deleteAll();
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/BadRequestExceptionTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/BadRequestExceptionTest.java
index a2b27bbf2..11dcd78b1 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/BadRequestExceptionTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/BadRequestExceptionTest.java
@@ -15,7 +15,7 @@
******************************************************************************/
package us.dot.its.jpo.ode.traveler;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import us.dot.its.jpo.ode.http.BadRequestException;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimDeleteControllerTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimDeleteControllerTest.java
index a6d63cd34..1721cda64 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimDeleteControllerTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimDeleteControllerTest.java
@@ -20,7 +20,7 @@
import java.io.IOException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.snmp4j.PDU;
import org.snmp4j.Snmp;
import org.snmp4j.UserTarget;
@@ -49,7 +49,20 @@ public class TimDeleteControllerTest {
@Mocked
ResponseEvent mockResponseEvent;
-
+
+ private String defaultRSUNullUserPass = "{\"rsuTarget\":\"10.10.10.10\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\"}";
+ private String fourDot1RSUNullUserPass = "{\"rsuTarget\":\"10.10.10.10\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\",\"snmpProtocol\":\"FOURDOT1\"}";
+ private String ntcip1218RSUNullUserPass = "{\"rsuTarget\":\"10.10.10.10\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\",\"snmpProtocol\":\"NTCIP1218\"}";
+
+ private String defaultRSUNotNullUserPass = "{\"rsuTarget\":\"10.10.10.10\",\"rsuUsername\":\"user\",\"rsuPassword\":\"pass\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\"}";
+ private String fourDot1RSUNotNullUserPass = "{\"rsuTarget\":\"10.10.10.10\",\"rsuUsername\":\"user\",\"rsuPassword\":\"pass\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\",\"snmpProtocol\":\"FOURDOT1\"}";
+ private String ntcip1218RSUNotNullUserPass = "{\"rsuTarget\":\"10.10.10.10\",\"rsuUsername\":\"user\",\"rsuPassword\":\"pass\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\",\"snmpProtocol\":\"NTCIP1218\"}";
+
+ private String defaultRSUBlankUserPass = "{\"rsuTarget\":\"10.10.10.10\",\"rsuUsername\":\"\",\"rsuPassword\":\"\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\"}";
+ private String fourDot1RSUBlankUserPass = "{\"rsuTarget\":\"10.10.10.10\",\"rsuUsername\":\"\",\"rsuPassword\":\"\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\",\"snmpProtocol\":\"FOURDOT1\"}";
+ private String ntcip1218RSUBlankUserPass = "{\"rsuTarget\":\"10.10.10.10\",\"rsuUsername\":\"\",\"rsuPassword\":\"\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\",\"snmpProtocol\":\"NTCIP1218\"}";
+
+
@Test
public void deleteShouldReturnBadRequestWhenNull() {
assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim(null, 42).getStatusCode());
@@ -67,7 +80,37 @@ public void deleteShouldCatchSessionIOException() {
} catch (IOException e) {
fail("Unexpected Exception in expectations block: " + e);
}
- assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, testTimDeleteController.deleteTim("{\"rsuTarget\":\"127.0.0.1\",\"rsuRetries\":\"1\",\"rsuTimeout\":\"2000\"}", 42).getStatusCode());
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, testTimDeleteController.deleteTim(defaultRSUNullUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteShouldCatchSessionIOException_fourDot1RSU() {
+ try {
+ new Expectations() {
+ {
+ new SnmpSession((RSU) any);
+ result = new IOException("testException123");
+ }
+ };
+ } catch (IOException e) {
+ fail("Unexpected Exception in expectations block: " + e);
+ }
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, testTimDeleteController.deleteTim(fourDot1RSUNullUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteShouldCatchSessionIOException_ntcip1218RSU() {
+ try {
+ new Expectations() {
+ {
+ new SnmpSession((RSU) any);
+ result = new IOException("testException123");
+ }
+ };
+ } catch (IOException e) {
+ fail("Unexpected Exception in expectations block: " + e);
+ }
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, testTimDeleteController.deleteTim(ntcip1218RSUNullUserPass, 42).getStatusCode());
}
@Test
@@ -82,7 +125,37 @@ public void deleteShouldCatchSessionNullPointerException() {
} catch (IOException e) {
fail("Unexpected Exception in expectations block: " + e);
}
- assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim("{\"rsuTarget\":\"127.0.0.1\",\"rsuRetries\":\"1\",\"rsuTimeout\":\"2000\"}", 42).getStatusCode());
+ assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim(defaultRSUNullUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteShouldCatchSessionNullPointerException_fourDot1RSU() {
+ try {
+ new Expectations() {
+ {
+ new SnmpSession((RSU) any);
+ result = new NullPointerException("testException123");
+ }
+ };
+ } catch (IOException e) {
+ fail("Unexpected Exception in expectations block: " + e);
+ }
+ assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim(fourDot1RSUNullUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteShouldCatchSessionNullPointerException_ntcip1218RSU() {
+ try {
+ new Expectations() {
+ {
+ new SnmpSession((RSU) any);
+ result = new NullPointerException("testException123");
+ }
+ };
+ } catch (IOException e) {
+ fail("Unexpected Exception in expectations block: " + e);
+ }
+ assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim(ntcip1218RSUNullUserPass, 42).getStatusCode());
}
@Test
@@ -92,7 +165,27 @@ public void deleteShouldCatchSnmpSetException() throws IOException {
result = new IOException("testSnmpException123");
}};
- assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, testTimDeleteController.deleteTim("{\"rsuTarget\":\"127.0.0.1\",\"rsuRetries\":\"1\",\"rsuTimeout\":\"2000\"}", 42).getStatusCode());
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, testTimDeleteController.deleteTim(defaultRSUNullUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteShouldCatchSnmpSetException_fourDot1RSU() throws IOException {
+ new Expectations() {{
+ capturingSnmpSession.set((PDU) any, (Snmp) any, (UserTarget) any, anyBoolean);
+ result = new IOException("testSnmpException123");
+ }};
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, testTimDeleteController.deleteTim(fourDot1RSUNullUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteShouldCatchSnmpSetException_ntcip1218RSU() throws IOException {
+ new Expectations() {{
+ capturingSnmpSession.set((PDU) any, (Snmp) any, (UserTarget) any, anyBoolean);
+ result = new IOException("testSnmpException123");
+ }};
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, testTimDeleteController.deleteTim(ntcip1218RSUNullUserPass, 42).getStatusCode());
}
@Test
@@ -102,7 +195,27 @@ public void deleteTestTimeout1() throws IOException {
result = null;
}};
- assertEquals(HttpStatus.REQUEST_TIMEOUT, testTimDeleteController.deleteTim("{\"rsuTarget\":\"127.0.0.1\",\"rsuRetries\":\"1\",\"rsuTimeout\":\"2000\"}", 42).getStatusCode());
+ assertEquals(HttpStatus.REQUEST_TIMEOUT, testTimDeleteController.deleteTim(defaultRSUNullUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteTestTimeout1_fourDot1RSU() throws IOException {
+ new Expectations() {{
+ capturingSnmpSession.set((PDU) any, (Snmp) any, (UserTarget) any, anyBoolean);
+ result = null;
+ }};
+
+ assertEquals(HttpStatus.REQUEST_TIMEOUT, testTimDeleteController.deleteTim(fourDot1RSUNullUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteTestTimeout1_ntcip1218RSU() throws IOException {
+ new Expectations() {{
+ capturingSnmpSession.set((PDU) any, (Snmp) any, (UserTarget) any, anyBoolean);
+ result = null;
+ }};
+
+ assertEquals(HttpStatus.REQUEST_TIMEOUT, testTimDeleteController.deleteTim(ntcip1218RSUNullUserPass, 42).getStatusCode());
}
@Test
@@ -115,9 +228,35 @@ public void deleteTestTimeout2() throws IOException {
result = null;
}};
- assertEquals(HttpStatus.REQUEST_TIMEOUT, testTimDeleteController.deleteTim("{\"rsuTarget\":\"127.0.0.1\",\"rsuRetries\":\"1\",\"rsuTimeout\":\"2000\"}", 42).getStatusCode());
+ assertEquals(HttpStatus.REQUEST_TIMEOUT, testTimDeleteController.deleteTim(defaultRSUNullUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteTestTimeout2_fourDot1RSU() throws IOException {
+ new Expectations() {{
+ capturingSnmpSession.set((PDU) any, (Snmp) any, (UserTarget) any, anyBoolean);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse();
+ result = null;
+ }};
+
+ assertEquals(HttpStatus.REQUEST_TIMEOUT, testTimDeleteController.deleteTim(fourDot1RSUNullUserPass, 42).getStatusCode());
}
+ @Test
+ public void deleteTestTimeout2_ntcip1218RSU() throws IOException {
+ new Expectations() {{
+ capturingSnmpSession.set((PDU) any, (Snmp) any, (UserTarget) any, anyBoolean);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse();
+ result = null;
+ }};
+
+ assertEquals(HttpStatus.REQUEST_TIMEOUT, testTimDeleteController.deleteTim(ntcip1218RSUNullUserPass, 42).getStatusCode());
+ }
+
@Test
public void deleteTestOK() throws IOException {
new Expectations() {{
@@ -129,11 +268,47 @@ public void deleteTestOK() throws IOException {
}};
//rsuUsername and rsuPassword are null
- assertEquals(HttpStatus.OK, testTimDeleteController.deleteTim("{\"rsuTarget\":\"127.0.0.1\",\"rsuRetries\":\"1\",\"rsuTimeout\":\"2000\"}", 42).getStatusCode());
+ assertEquals(HttpStatus.OK, testTimDeleteController.deleteTim(defaultRSUNullUserPass, 42).getStatusCode());
+ //rsuUsername and rsuPassword are not-null
+ assertEquals(HttpStatus.OK, testTimDeleteController.deleteTim(defaultRSUNotNullUserPass, 42).getStatusCode());
+ //rsuUsername and rsuPassword are blank
+ assertEquals(HttpStatus.OK, testTimDeleteController.deleteTim(defaultRSUBlankUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteTestOK_fourDot1RSU() throws IOException {
+ new Expectations() {{
+ capturingSnmpSession.set((PDU) any, (Snmp) any, (UserTarget) any, anyBoolean);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse().getErrorStatus();
+ result = 0;
+ }};
+
+ //rsuUsername and rsuPassword are null
+ assertEquals(HttpStatus.OK, testTimDeleteController.deleteTim(fourDot1RSUNullUserPass, 42).getStatusCode());
+ //rsuUsername and rsuPassword are not-null
+ assertEquals(HttpStatus.OK, testTimDeleteController.deleteTim(fourDot1RSUNotNullUserPass, 42).getStatusCode());
+ //rsuUsername and rsuPassword are blank
+ assertEquals(HttpStatus.OK, testTimDeleteController.deleteTim(fourDot1RSUBlankUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteTestOK_ntcip1218RSU() throws IOException {
+ new Expectations() {{
+ capturingSnmpSession.set((PDU) any, (Snmp) any, (UserTarget) any, anyBoolean);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse().getErrorStatus();
+ result = 0;
+ }};
+
+ //rsuUsername and rsuPassword are null
+ assertEquals(HttpStatus.OK, testTimDeleteController.deleteTim(ntcip1218RSUNullUserPass, 42).getStatusCode());
//rsuUsername and rsuPassword are not-null
- assertEquals(HttpStatus.OK, testTimDeleteController.deleteTim("{\"rsuTarget\":\"127.0.0.1\",\"rsuRetries\":\"1\",\"rsuTimeout\":\"2000\", \"rsuUsername\": \"v3user\", \"rsuPassword\": \"password\"}", 42).getStatusCode());
+ assertEquals(HttpStatus.OK, testTimDeleteController.deleteTim(ntcip1218RSUNotNullUserPass, 42).getStatusCode());
//rsuUsername and rsuPassword are blank
- assertEquals(HttpStatus.OK, testTimDeleteController.deleteTim("{\"rsuTarget\":\"127.0.0.1\",\"rsuRetries\":\"1\",\"rsuTimeout\":\"2000\", \"rsuUsername\": \"\", \"rsuPassword\": \"\"}", 42).getStatusCode());
+ assertEquals(HttpStatus.OK, testTimDeleteController.deleteTim(ntcip1218RSUBlankUserPass, 42).getStatusCode());
}
@Test
@@ -146,7 +321,33 @@ public void deleteTestMessageAlreadyExists() throws IOException {
result = 12;
}};
- assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim("{\"rsuTarget\":\"127.0.0.1\",\"rsuRetries\":\"1\",\"rsuTimeout\":\"2000\"}", 42).getStatusCode());
+ assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim(defaultRSUNullUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteTestMessageAlreadyExists_fourDot1RSU() throws IOException {
+ new Expectations() {{
+ capturingSnmpSession.set((PDU) any, (Snmp) any, (UserTarget) any, anyBoolean);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse().getErrorStatus();
+ result = 12;
+ }};
+
+ assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim(fourDot1RSUNullUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteTestMessageAlreadyExists_ntcip1218RSU() throws IOException {
+ new Expectations() {{
+ capturingSnmpSession.set((PDU) any, (Snmp) any, (UserTarget) any, anyBoolean);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse().getErrorStatus();
+ result = 12;
+ }};
+
+ assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim(ntcip1218RSUNullUserPass, 42).getStatusCode());
}
@Test
@@ -159,7 +360,33 @@ public void deleteTestInvalidIndex() throws IOException {
result = 10;
}};
- assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim("{\"rsuTarget\":\"127.0.0.1\",\"rsuRetries\":\"1\",\"rsuTimeout\":\"2000\"}", 42).getStatusCode());
+ assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim(defaultRSUNullUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteTestInvalidIndex_fourDot1RSU() throws IOException {
+ new Expectations() {{
+ capturingSnmpSession.set((PDU) any, (Snmp) any, (UserTarget) any, anyBoolean);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse().getErrorStatus();
+ result = 10;
+ }};
+
+ assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim(fourDot1RSUNullUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteTestInvalidIndex_ntcip1218RSU() throws IOException {
+ new Expectations() {{
+ capturingSnmpSession.set((PDU) any, (Snmp) any, (UserTarget) any, anyBoolean);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse().getErrorStatus();
+ result = 10;
+ }};
+
+ assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim(ntcip1218RSUNullUserPass, 42).getStatusCode());
}
@Test
@@ -172,7 +399,33 @@ public void deleteTestUnknownErrorCode() throws IOException {
result = 5;
}};
- assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim("{\"rsuTarget\":\"127.0.0.1\",\"rsuRetries\":\"1\",\"rsuTimeout\":\"2000\"}", 42).getStatusCode());
+ assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim(defaultRSUNullUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteTestUnknownErrorCode_fourDot1RSU() throws IOException {
+ new Expectations() {{
+ capturingSnmpSession.set((PDU) any, (Snmp) any, (UserTarget) any, anyBoolean);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse().getErrorStatus();
+ result = 5;
+ }};
+
+ assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim(fourDot1RSUNullUserPass, 42).getStatusCode());
+ }
+
+ @Test
+ public void deleteTestUnknownErrorCode_ntcip1218RSU() throws IOException {
+ new Expectations() {{
+ capturingSnmpSession.set((PDU) any, (Snmp) any, (UserTarget) any, anyBoolean);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse().getErrorStatus();
+ result = 5;
+ }};
+
+ assertEquals(HttpStatus.BAD_REQUEST, testTimDeleteController.deleteTim(ntcip1218RSUNullUserPass, 42).getStatusCode());
}
}
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimDepositControllerTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimDepositControllerTest.java
index 5c61a856b..5af303706 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimDepositControllerTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimDepositControllerTest.java
@@ -18,7 +18,7 @@
import static org.junit.Assert.assertEquals;
import org.apache.commons.io.IOUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.springframework.http.ResponseEntity;
import com.fasterxml.jackson.databind.JsonNode;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimQueryControllerTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimQueryControllerTest.java
index 6be9d755d..f5a417461 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimQueryControllerTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimQueryControllerTest.java
@@ -22,7 +22,7 @@
import java.io.IOException;
import java.util.Vector;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.snmp4j.PDU;
import org.snmp4j.Snmp;
import org.snmp4j.UserTarget;
@@ -59,6 +59,8 @@ public class TimQueryControllerTest {
PDU mockPDU;
private String defaultRSU = "{\"rsuTarget\":\"10.10.10.10\",\"rsuUsername\":\"user\",\"rsuPassword\":\"pass\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\"}";
+ private String fourDot1RSU = "{\"rsuTarget\":\"10.10.10.10\",\"rsuUsername\":\"user\",\"rsuPassword\":\"pass\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\",\"snmpProtocol\":\"FOURDOT1\"}";
+ private String ntcip1218RSU = "{\"rsuTarget\":\"10.10.10.10\",\"rsuUsername\":\"user\",\"rsuPassword\":\"pass\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\",\"snmpProtocol\":\"NTCIP1218\"}";
@Test
public void nullRequestShouldReturnError() {
@@ -92,6 +94,42 @@ public void snmpSessionExceptionShouldReturnError() {
assertTrue(actualResponse.getBody().contains("Failed to create SNMP session."));
}
+ @Test
+ public void snmpSessionExceptionShouldReturnError_fourDot1RSU() {
+ try {
+ new Expectations() {
+ {
+ new SnmpSession((RSU) any);
+ result = new IOException("testException123");
+ }
+ };
+ } catch (IOException e) {
+ fail("Unexpected exception in expectations block: " + e);
+ }
+
+ ResponseEntity actualResponse = testTimQueryController.bulkQuery(fourDot1RSU);
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, actualResponse.getStatusCode());
+ assertTrue(actualResponse.getBody().contains("Failed to create SNMP session."));
+ }
+
+ @Test
+ public void snmpSessionExceptionShouldReturnError_ntcip1218RSU() {
+ try {
+ new Expectations() {
+ {
+ new SnmpSession((RSU) any);
+ result = new IOException("testException123");
+ }
+ };
+ } catch (IOException e) {
+ fail("Unexpected exception in expectations block: " + e);
+ }
+
+ ResponseEntity actualResponse = testTimQueryController.bulkQuery(ntcip1218RSU);
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, actualResponse.getStatusCode());
+ assertTrue(actualResponse.getBody().contains("Failed to create SNMP session."));
+ }
+
@Test
public void snmpSessionListenExceptionShouldReturnError() {
try {
@@ -110,6 +148,42 @@ public void snmpSessionListenExceptionShouldReturnError() {
assertTrue(actualResponse.getBody().contains("Failed to create SNMP session."));
}
+ @Test
+ public void snmpSessionListenExceptionShouldReturnError_fourDot1RSU() {
+ try {
+ new Expectations() {
+ {
+ capturingSnmpSession.startListen();
+ result = new IOException("testException123");
+ }
+ };
+ } catch (IOException e) {
+ fail("Unexpected exception in expectations block: " + e);
+ }
+
+ ResponseEntity actualResponse = testTimQueryController.bulkQuery(fourDot1RSU);
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, actualResponse.getStatusCode());
+ assertTrue(actualResponse.getBody().contains("Failed to create SNMP session."));
+ }
+
+ @Test
+ public void snmpSessionListenExceptionShouldReturnError_ntcip1218RSU() {
+ try {
+ new Expectations() {
+ {
+ capturingSnmpSession.startListen();
+ result = new IOException("testException123");
+ }
+ };
+ } catch (IOException e) {
+ fail("Unexpected exception in expectations block: " + e);
+ }
+
+ ResponseEntity actualResponse = testTimQueryController.bulkQuery(ntcip1218RSU);
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, actualResponse.getStatusCode());
+ assertTrue(actualResponse.getBody().contains("Failed to create SNMP session."));
+ }
+
@Test
public void testNullResponseReturnsTimeout() throws IOException {
new Expectations() {
@@ -130,6 +204,46 @@ public void testNullResponseReturnsTimeout() throws IOException {
assertTrue(actualResponse.getBody().contains("Timeout, no response from RSU."));
}
+ @Test
+ public void testNullResponseReturnsTimeout_fourDot1RSU() throws IOException {
+ new Expectations() {
+ {
+ mockOdeProperties.getRsuSrmSlots();
+ result = 1;
+
+ capturingSnmpSession.getSnmp();
+ result = mockSnmp;
+
+ mockSnmp.send((PDU) any, (UserTarget) any);
+ result = null;
+ }
+ };
+
+ ResponseEntity actualResponse = testTimQueryController.bulkQuery(fourDot1RSU);
+ assertEquals(HttpStatus.BAD_REQUEST, actualResponse.getStatusCode());
+ assertTrue(actualResponse.getBody().contains("Timeout, no response from RSU."));
+ }
+
+ @Test
+ public void testNullResponseReturnsTimeout_ntcip1218RSU() throws IOException {
+ new Expectations() {
+ {
+ mockOdeProperties.getRsuSrmSlots();
+ result = 1;
+
+ capturingSnmpSession.getSnmp();
+ result = mockSnmp;
+
+ mockSnmp.send((PDU) any, (UserTarget) any);
+ result = null;
+ }
+ };
+
+ ResponseEntity actualResponse = testTimQueryController.bulkQuery(ntcip1218RSU);
+ assertEquals(HttpStatus.BAD_REQUEST, actualResponse.getStatusCode());
+ assertTrue(actualResponse.getBody().contains("Timeout, no response from RSU."));
+ }
+
@Test
public void testNullResponseResponseReturnsTimeout() throws IOException {
new Expectations() {
@@ -153,6 +267,52 @@ public void testNullResponseResponseReturnsTimeout() throws IOException {
assertTrue(actualResponse.getBody().contains("Timeout, no response from RSU."));
}
+ @Test
+ public void testNullResponseResponseReturnsTimeout_fourDot1RSU() throws IOException {
+ new Expectations() {
+ {
+ mockOdeProperties.getRsuSrmSlots();
+ result = 1;
+
+ capturingSnmpSession.getSnmp();
+ result = mockSnmp;
+
+ mockSnmp.send((PDU) any, (UserTarget) any);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse();
+ result = null;
+ }
+ };
+
+ ResponseEntity actualResponse = testTimQueryController.bulkQuery(fourDot1RSU);
+ assertEquals(HttpStatus.BAD_REQUEST, actualResponse.getStatusCode());
+ assertTrue(actualResponse.getBody().contains("Timeout, no response from RSU."));
+ }
+
+ @Test
+ public void testNullResponseResponseReturnsTimeout_ntcip1218RSU() throws IOException {
+ new Expectations() {
+ {
+ mockOdeProperties.getRsuSrmSlots();
+ result = 1;
+
+ capturingSnmpSession.getSnmp();
+ result = mockSnmp;
+
+ mockSnmp.send((PDU) any, (UserTarget) any);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse();
+ result = null;
+ }
+ };
+
+ ResponseEntity actualResponse = testTimQueryController.bulkQuery(ntcip1218RSU);
+ assertEquals(HttpStatus.BAD_REQUEST, actualResponse.getStatusCode());
+ assertTrue(actualResponse.getBody().contains("Timeout, no response from RSU."));
+ }
+
@Test
public void testSuccessfulQuery() throws IOException {
new Expectations() {
@@ -179,6 +339,58 @@ public void testSuccessfulQuery() throws IOException {
assertTrue(actualResponse.getBody().contains("indicies_set"));
}
+ @Test
+ public void testSuccessfulQuery_fourDot1RSU() throws IOException {
+ new Expectations() {
+ {
+ mockOdeProperties.getRsuSrmSlots();
+ result = 1;
+
+ capturingSnmpSession.getSnmp();
+ result = mockSnmp;
+
+ mockSnmp.send((PDU) any, (UserTarget) any);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse();
+ result = mockPDU;
+
+ mockPDU.getVariableBindings();
+ result = new Vector();
+ }
+ };
+
+ ResponseEntity actualResponse = testTimQueryController.bulkQuery(fourDot1RSU);
+ assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
+ assertTrue(actualResponse.getBody().contains("indicies_set"));
+ }
+
+ @Test
+ public void testSuccessfulQuery_ntcip1218RSU() throws IOException {
+ new Expectations() {
+ {
+ mockOdeProperties.getRsuSrmSlots();
+ result = 1;
+
+ capturingSnmpSession.getSnmp();
+ result = mockSnmp;
+
+ mockSnmp.send((PDU) any, (UserTarget) any);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse();
+ result = mockPDU;
+
+ mockPDU.getVariableBindings();
+ result = new Vector();
+ }
+ };
+
+ ResponseEntity actualResponse = testTimQueryController.bulkQuery(ntcip1218RSU);
+ assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
+ assertTrue(actualResponse.getBody().contains("indicies_set"));
+ }
+
@Test
public void testSuccessfulPopulatedQuery() throws IOException {
new Expectations() {
@@ -207,4 +419,72 @@ public void testSuccessfulPopulatedQuery() throws IOException {
assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
assertTrue(actualResponse.getBody().contains("indicies_set"));
}
+
+ @Test
+ public void testSuccessfulPopulatedQuery_fourDot1RSU() throws IOException {
+ new Expectations() {
+ {
+ mockOdeProperties.getRsuSrmSlots();
+ result = 1;
+
+ capturingSnmpSession.getSnmp();
+ result = mockSnmp;
+
+ mockSnmp.send((PDU) any, (UserTarget) any);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse();
+ result = mockPDU;
+
+ Vector fakeVector = new Vector();
+ fakeVector.add(new VariableBinding());
+
+ mockPDU.getVariableBindings();
+ result = fakeVector;
+ }
+ };
+
+ ResponseEntity actualResponse = testTimQueryController.bulkQuery(fourDot1RSU);
+ assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
+ assertTrue(actualResponse.getBody().contains("indicies_set"));
+ }
+
+ @Test
+ public void testSuccessfulPopulatedQuery_ntcip1218RSU() throws IOException {
+ new Expectations() {
+ {
+ mockOdeProperties.getRsuSrmSlots();
+ result = 1;
+
+ capturingSnmpSession.getSnmp();
+ result = mockSnmp;
+
+ mockSnmp.send((PDU) any, (UserTarget) any);
+ result = mockResponseEvent;
+
+ mockResponseEvent.getResponse();
+ result = mockPDU;
+
+ Vector fakeVector = new Vector();
+ fakeVector.add(new VariableBinding());
+
+ mockPDU.getVariableBindings();
+ result = fakeVector;
+ }
+ };
+
+ ResponseEntity actualResponse = testTimQueryController.bulkQuery(ntcip1218RSU);
+ assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
+ assertTrue(actualResponse.getBody().contains("indicies_set"));
+ }
+
+ @Test
+ public void testPopulatedQuery_unrecognizedProtocol() throws IOException {
+ String unrecognizedProtocolRSU = "{\"rsuTarget\":\"10.10.10.10\",\"rsuUsername\":\"user\",\"rsuPassword\":\"pass\",\"rsuRetries\":\"3\",\"rsuTimeout\":\"5000\",\"snmpProtocol\":\"banana\"}";
+
+ ResponseEntity actualResponse = testTimQueryController.bulkQuery(unrecognizedProtocolRSU);
+ assertEquals(HttpStatus.BAD_REQUEST, actualResponse.getStatusCode());
+ assertTrue(actualResponse.getBody().contains("Unrecognized protocol"));
+ }
+
}
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimTransmogrifierTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimTransmogrifierTest.java
index f03260e18..6b8def1cb 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimTransmogrifierTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/traveler/TimTransmogrifierTest.java
@@ -12,7 +12,7 @@
import java.lang.reflect.Modifier;
import org.json.JSONObject;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/udp/bsm/BsmComparatorTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/udp/bsm/BsmComparatorTest.java
index d235e96dc..35decb55d 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/udp/bsm/BsmComparatorTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/udp/bsm/BsmComparatorTest.java
@@ -17,7 +17,7 @@
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import us.dot.its.jpo.ode.plugin.j2735.J2735Bsm;
import us.dot.its.jpo.ode.plugin.j2735.J2735BsmCoreData;
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/udp/controller/UdpServiceThreadFactoryTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/udp/controller/UdpServiceThreadFactoryTest.java
index 9db4be056..440f60b86 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/udp/controller/UdpServiceThreadFactoryTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/udp/controller/UdpServiceThreadFactoryTest.java
@@ -17,8 +17,8 @@
import static org.junit.Assert.assertEquals;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import mockit.Injectable;
import mockit.Tested;
@@ -32,18 +32,18 @@ public class UdpServiceThreadFactoryTest {
@Injectable
String expectedName = "testName123";
- @Test @Ignore
+ @Test @Disabled
public void constructorShouldSetName() {
assertEquals(expectedName, testUdpServiceThreadFactory.getThreadName());
}
- @Test @Ignore
+ @Test @Disabled
public void shouldReturnNamedThread(@Injectable Thread testThread) {
Thread actualThread = testUdpServiceThreadFactory.newThread(testThread);
assertEquals(expectedName, actualThread.getName());
}
- @Test @Ignore
+ @Test @Disabled
public void shouldSetThreadName(@Injectable Thread testThreadTwo) {
Thread actualThreadTwo = testUdpServiceThreadFactory.newThread(testThreadTwo);
testUdpServiceThreadFactory.setThreadName(expectedName);
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/upload/FileUploadControllerTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/upload/FileUploadControllerTest.java
index 14c7416b2..c83b30afd 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/upload/FileUploadControllerTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/upload/FileUploadControllerTest.java
@@ -21,8 +21,9 @@
import mockit.Mock;
import mockit.MockUp;
import mockit.Mocked;
-import org.junit.Before;
-import org.junit.Test;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.springframework.http.HttpStatus;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.web.multipart.MultipartFile;
@@ -62,7 +63,7 @@ public class FileUploadControllerTest {
@Mocked
MultipartFile mockMultipartFile;
- @Before
+ @BeforeEach
public void constructorShouldLaunchSevenThreads() {
new Expectations() {
{
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/upload/FileUploadIntegrationTests.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/upload/FileUploadIntegrationTests.java
index db3ddd30b..e9fcdfe5c 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/upload/FileUploadIntegrationTests.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/upload/FileUploadIntegrationTests.java
@@ -20,8 +20,8 @@
import static org.mockito.BDDMockito.then;
import static org.mockito.Matchers.any;
-import org.junit.Test;
-import org.junit.Ignore;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -52,7 +52,7 @@ public class FileUploadIntegrationTests {
@LocalServerPort
private int port;
- @Ignore
+ @Disabled
@Test
public void shouldUploadFile() throws Exception {
ClassPathResource resource = new ClassPathResource("testupload.txt", getClass());
@@ -66,7 +66,7 @@ public void shouldUploadFile() throws Exception {
then(storageService).should().store(any(MultipartFile.class), "obulog");
}
- @Ignore
+ @Disabled
@Test
public void shouldDownloadFile() throws Exception {
ClassPathResource resource = new ClassPathResource("testupload.txt", getClass());
diff --git a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/wrapper/MessageProducerTest.java b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/wrapper/MessageProducerTest.java
index a43603975..86b939d0e 100644
--- a/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/wrapper/MessageProducerTest.java
+++ b/jpo-ode-svcs/src/test/java/us/dot/its/jpo/ode/wrapper/MessageProducerTest.java
@@ -24,9 +24,9 @@
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import mockit.Expectations;
import mockit.Injectable;
@@ -43,7 +43,7 @@ public class MessageProducerTest {
@Injectable
ProducerRecord mockProducerRecord;
- @Before
+ @BeforeEach
public void setUp() {
new Expectations() {
{
@@ -52,14 +52,14 @@ public void setUp() {
};
}
- @Test @Ignore
+ @Test @Disabled
public void shouldConstruct() {
new MessageProducer("testBrokers", null,
"testPartitioner", mockProps, Collections.singleton("testTopic"));
}
- @Test @Ignore
+ @Test @Disabled
public void testSendNoTopic() {
MessageProducer testMessageProducer =
@@ -68,7 +68,7 @@ public void testSendNoTopic() {
testMessageProducer.send(mockProducerRecord);
}
- @Test @Ignore
+ @Test @Disabled
public void testSendWithTopic() {
MessageProducer testMessageProducer =
@@ -79,7 +79,7 @@ public void testSendWithTopic() {
testMessageProducer.send("testTopic", "testKey", "testValue");
}
- @Test @Ignore
+ @Test @Disabled
public void testSendWithTopicNullKey() {
MessageProducer testMessageProducer =
@@ -90,7 +90,7 @@ public void testSendWithTopicNullKey() {
assertEquals(KafkaProducer.class, testMessageProducer.getProducer().getClass());
}
- @Test @Ignore
+ @Test @Disabled
public void testClose() {
MessageProducer testMessageProducer =
@@ -99,7 +99,7 @@ public void testClose() {
testMessageProducer.close();
}
- @Test @Ignore
+ @Test @Disabled
public void testDefaultStringMessageProducer() {
String testBrokers = "bootstrap.servers";
diff --git a/pom.xml b/pom.xml
index af7d485df..9577783d9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,10 +86,10 @@
test
- junit
- junit
- 4.13.2
- test
+ org.junit.jupiter
+ junit-jupiter-api
+ 5.9.3
+ test
@@ -144,9 +144,9 @@
- org.apache.maven.surefire
- surefire-junit47
- 3.0.0-M5
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.1.2