Skip to content

Commit

Permalink
Merge branch 'ode-587' of https://github.com/usdot-jpo-ode/jpo-ode in…
Browse files Browse the repository at this point in the history
…to ode-587
  • Loading branch information
tonychen091 committed Oct 19, 2017
2 parents 649398d + aef6eec commit a10a6e6
Show file tree
Hide file tree
Showing 21 changed files with 75 additions and 59 deletions.
3 changes: 3 additions & 0 deletions adm.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Kafka group.
group.id=0

# ACM operation type specification; default is decode if left out.
acm.type=decode

# Kafka topics for ASN.1 Parsing
asn1.j2735.topic.consumer=topic.Asn1DecoderInput
asn1.j2735.topic.producer=topic.Asn1DecoderOutput
Expand Down
3 changes: 3 additions & 0 deletions aem.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Kafka group.
group.id=0

# ACM operation type specification; default is decode if left out.
acm.type=encode

# Kafka topics for ASN.1 Parsing
asn1.j2735.topic.consumer=topic.Asn1EncoderInput
asn1.j2735.topic.producer=topic.Asn1EncoderOutput
Expand Down
1 change: 1 addition & 0 deletions asn1_codec
Submodule asn1_codec added at 7a6866
2 changes: 1 addition & 1 deletion clean-build-and-deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
docker-compose stop
docker-compose rm -f -v
mvn clean install
mvn -DskipTests clean install
docker-compose up --build -d
docker-compose ps
2 changes: 1 addition & 1 deletion docker-run-adm.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docker run -it -v %DOCKER_SHARED_VOLUME%:/asn1_codec -e DOCKER_HOST_IP=%DOCKER_HOST_IP% -e ACM_CONFIG_FILE=adm.properties -e ACM_FUNCTION=decode jpoode_acm:latest %1
docker run -it -v %DOCKER_SHARED_VOLUME%:/asn1_codec -e DOCKER_HOST_IP=%DOCKER_HOST_IP% -e ACM_CONFIG_FILE=adm.properties jpoode_acm:latest %1
2 changes: 1 addition & 1 deletion docker-run-aem.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docker run -it -v %DOCKER_SHARED_VOLUME%:/asn1_codec -e DOCKER_HOST_IP=%DOCKER_HOST_IP% -e ACM_CONFIG_FILE=aem.properties -e ACM_FUNCTION=encode jpoode_acm:latest %1
docker run -it -v %DOCKER_SHARED_VOLUME%:/asn1_codec -e DOCKER_HOST_IP=%DOCKER_HOST_IP% -e ACM_CONFIG_FILE=aem.properties jpoode_acm:latest %1
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ public void testBigDecimal() throws JsonProcessingException, IOException {

BigDecimal testInput = new BigDecimal(1.0);

Longitude expectedValue = new Longitude(10000000);

assertEquals(expectedValue, LongitudeBuilder.longitude(testInput));
assertEquals(10000000, LongitudeBuilder.longitude(testInput));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void testRealJson() throws JsonProcessingException, IOException {

JsonNode deTranslatedTim = TravelerMessageFromHumanToAsnConverter.changeTravelerInformationToAsnValues(testJson);

assertEquals("string", deTranslatedTim);
assertEquals("{\"index\":\"13\",\"msgCnt\":\"1\",\"timeStamp\":23174,\"urlB\":\"null\",\"dataframes\":[{\"startDateTime\":\"2017-08-02T22:25:00.000Z\",\"durationTime\":1,\"frameType\":{\"advisory\":null},\"sspTimRights\":\"0\",\"priority\":\"0\",\"sspLocationRights\":\"3\",\"regions\":[{\"scale\":\"0\",\"offset\":{\"offset\":{\"ll\":[{\"nodeLong\":\"0.0031024\",\"nodeLat\":\"0.0014506\",\"delta\":\"node-LL3\"},{\"nodeLong\":\"0.0030974\",\"nodeLat\":\"0.0014568\",\"delta\":\"node-LL3\"},{\"nodeLong\":\"0.0030983\",\"nodeLat\":\"0.0014559\",\"delta\":\"node-LL3\"},{\"nodeLong\":\"0.0030980\",\"nodeLat\":\"0.0014563\",\"delta\":\"node-LL3\"},{\"nodeLong\":\"0.0030982\",\"nodeLat\":\"0.0014562\",\"delta\":\"node-LL3\"}]}}}],\"sspMsgTypes\":\"2\",\"sspMsgContent\":\"3\",\"content\":{\"advisory\":{\"SEQUENCE\":[{\"text\":513}]}},\"url\":\"null\",\"startYear\":2017,\"startMinute\":21733,\"msgID\":{\"roadSignID\":{\"position\":{\"lat\":410000000,\"long\":-1080000000,\"elevation\":9170},\"viewAngle\":\"1010101010101010\",\"mutcdCode\":\"5\",\"crc\":\"0000000000000000\"}}}]}", deTranslatedTim.toString());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class OssAsn1CoderTest {
public void testUPER_DecodeBsmHex() {
String inputString = "401480CA4000000000000000000000000000000000000000000000000000000000000000F800D9EFFFB7FFF00000000000000000000000000000000000000000000000000000001FE07000000000000000000000000000000000001FF0";

String expectedValue = "{\"coreData\":{\"msgCnt\":0,\"id\":\"52032900\",\"secMark\":0,\"position\":{\"latitude\":-90.0000000,\"longitude\":-179.9999999},\"accelSet\":{\"accelLat\":-20.00,\"accelLong\":-20.00,\"accelYaw\":-327.67},\"accuracy\":{\"semiMajor\":0.00,\"semiMinor\":0.00,\"orientation\":0E-10},\"transmission\":\"NEUTRAL\",\"speed\":0.00,\"heading\":0.0000,\"angle\":-189.0,\"brakes\":{\"wheelBrakes\":{\"leftFront\":false,\"rightFront\":false,\"unavailable\":false,\"leftRear\":false,\"rightRear\":false},\"traction\":\"unavailable\",\"abs\":\"unavailable\",\"scs\":\"unavailable\",\"brakeBoost\":\"unavailable\",\"auxBrakes\":\"unavailable\"},\"size\":{\"length\":31}},\"partII\":[{\"id\":\"VEHICLESAFETYEXT\",\"value\":{\"events\":{\"eventReserved1\":true,\"eventLightsChanged\":true,\"eventStabilityControlactivated\":true,\"eventHazardousMaterials\":true,\"eventWipersChanged\":true,\"eventHazardLights\":true,\"eventTractionControlLoss\":true,\"eventABSactivated\":true,\"eventAirBagDeployment\":true,\"eventFlatTire\":true,\"eventDisabledVehicle\":true,\"eventHardBraking\":true,\"eventStopLineViolation\":true},\"pathHistory\":{\"initialPosition\":{\"position\":{\"latitude\":-90.0000000,\"longitude\":-179.9999999},\"heading\":0.0000,\"posAccuracy\":{\"semiMajor\":0.00,\"semiMinor\":0.00,\"orientation\":0E-10},\"posConfidence\":{\"pos\":\"UNAVAILABLE\",\"elevation\":\"UNAVAILABLE\"},\"speed\":{\"speed\":0.00,\"transmisson\":\"NEUTRAL\"},\"speedConfidence\":{\"heading\":\"UNAVAILABLE\",\"speed\":\"UNAVAILABLE\",\"throttle\":\"UNAVAILABLE\"},\"timeConfidence\":\"UNAVAILABLE\",\"utcTime\":{\"hour\":0,\"minute\":0,\"offset\":-840,\"second\":0}},\"currGNSSstatus\":{\"localCorrectionsPresent\":true,\"baseStationType\":true,\"inViewOfUnder5\":true,\"unavailable\":true,\"aPDOPofUnder5\":true,\"isMonitored\":true,\"isHealthy\":true,\"networkCorrectionsPresent\":true},\"crumbData\":[{\"heading\":0.0,\"posAccuracy\":{\"semiMajor\":0.00,\"semiMinor\":0.00,\"orientation\":0E-10},\"speed\":0.00,\"timeOffset\":0.01}]},\"pathPrediction\":{\"confidence\":0.0,\"radiusOfCurve\":-3276.7},\"lights\":{\"daytimeRunningLightsOn\":true,\"automaticLightControlOn\":true,\"rightTurnSignalOn\":true,\"parkingLightsOn\":true,\"lowBeamHeadlightsOn\":true,\"hazardSignalOn\":true,\"highBeamHeadlightsOn\":true,\"leftTurnSignalOn\":true,\"fogLightOn\":true}}}]}";
String expectedValue = "{\"coreData\":{\"msgCnt\":0,\"id\":\"52032900\",\"secMark\":0,\"position\":{\"latitude\":-90.0000000,\"longitude\":-179.9999999},\"accelSet\":{\"accelLat\":-20.00,\"accelLong\":-20.00,\"accelYaw\":-327.67},\"accuracy\":{\"semiMajor\":0.00,\"semiMinor\":0.00,\"orientation\":0E-10},\"transmission\":\"NEUTRAL\",\"speed\":0.00,\"heading\":0.0000,\"angle\":-189.0,\"brakes\":{\"wheelBrakes\":{\"leftFront\":false,\"rightFront\":false,\"unavailable\":false,\"leftRear\":false,\"rightRear\":false},\"traction\":\"unavailable\",\"abs\":\"unavailable\",\"scs\":\"unavailable\",\"brakeBoost\":\"unavailable\",\"auxBrakes\":\"unavailable\"},\"size\":{\"length\":31}},\"partII\":[{\"id\":\"VehicleSafetyExtensions\",\"value\":{\"events\":{\"eventReserved1\":true,\"eventLightsChanged\":true,\"eventStabilityControlactivated\":true,\"eventHazardousMaterials\":true,\"eventWipersChanged\":true,\"eventHazardLights\":true,\"eventTractionControlLoss\":true,\"eventABSactivated\":true,\"eventAirBagDeployment\":true,\"eventFlatTire\":true,\"eventDisabledVehicle\":true,\"eventHardBraking\":true,\"eventStopLineViolation\":true},\"pathHistory\":{\"initialPosition\":{\"position\":{\"latitude\":-90.0000000,\"longitude\":-179.9999999},\"heading\":0.0000,\"posAccuracy\":{\"semiMajor\":0.00,\"semiMinor\":0.00,\"orientation\":0E-10},\"posConfidence\":{\"pos\":\"UNAVAILABLE\",\"elevation\":\"UNAVAILABLE\"},\"speed\":{\"speed\":0.00,\"transmisson\":\"NEUTRAL\"},\"speedConfidence\":{\"heading\":\"UNAVAILABLE\",\"speed\":\"UNAVAILABLE\",\"throttle\":\"UNAVAILABLE\"},\"timeConfidence\":\"UNAVAILABLE\",\"utcTime\":{\"hour\":0,\"minute\":0,\"offset\":-840,\"second\":0}},\"currGNSSstatus\":{\"localCorrectionsPresent\":true,\"baseStationType\":true,\"inViewOfUnder5\":true,\"unavailable\":true,\"aPDOPofUnder5\":true,\"isMonitored\":true,\"isHealthy\":true,\"networkCorrectionsPresent\":true},\"crumbData\":[{\"heading\":0.0,\"posAccuracy\":{\"semiMajor\":0.00,\"semiMinor\":0.00,\"orientation\":0E-10},\"speed\":0.00,\"timeOffset\":0.01}]},\"pathPrediction\":{\"confidence\":0.0,\"radiusOfCurve\":-3276.7},\"lights\":{\"daytimeRunningLightsOn\":true,\"automaticLightControlOn\":true,\"rightTurnSignalOn\":true,\"parkingLightsOn\":true,\"lowBeamHeadlightsOn\":true,\"hazardSignalOn\":true,\"highBeamHeadlightsOn\":true,\"leftTurnSignalOn\":true,\"fogLightOn\":true}}}]}";
assertEquals(expectedValue, coder.decodeUPERBsmHex(inputString).toJson(false));
}

Expand All @@ -53,7 +53,7 @@ public void testUPER_DecodeMessageFrameHex() {

String inputString = "001480ad59afa8400023efe717087d9665fde4ad0cfffffffff0006451fdfa1fa1007fff8000000000020214c1c10011fffff0be19ee101727ffff05c22d6101d840067046268210391404fbffe380210290c04bdffe3ea6102ffc05d9ffe48921033940927ffe62be102a9c07d1ffe6a521025640809ffe6eda1022bc07a9ffe6fb61ffffc00bffff0fde1fffffffff0fd56061fffffffff0e76dc61fffffffff0c9724e1ffffc008d0cd7802fffe0000";

String expectedValue = "{\"messageId\":\"BASICSAFETYMESSAGE\",\"value\":{\"coreData\":{\"msgCnt\":102,\"id\":\"BEA10000\",\"secMark\":36799,\"position\":{\"latitude\":41.1641851,\"longitude\":-104.8434230,\"elevation\":1896.9},\"accelSet\":{\"accelYaw\":0.00},\"accuracy\":{},\"speed\":0.00,\"heading\":321.0125,\"brakes\":{\"wheelBrakes\":{\"leftFront\":false,\"rightFront\":false,\"unavailable\":true,\"leftRear\":false,\"rightRear\":false},\"traction\":\"unavailable\",\"abs\":\"unavailable\",\"scs\":\"unavailable\",\"brakeBoost\":\"unavailable\",\"auxBrakes\":\"unavailable\"},\"size\":{}},\"partII\":[{\"id\":\"VEHICLESAFETYEXT\",\"value\":{\"pathHistory\":{\"crumbData\":[{\"elevationOffset\":9.5,\"latOffset\":0.0000035,\"lonOffset\":0.0131071,\"timeOffset\":33.20},{\"elevationOffset\":4.6,\"latOffset\":0.0000740,\"lonOffset\":0.0131071,\"timeOffset\":44.60},{\"elevationOffset\":3.5,\"latOffset\":0.0000944,\"lonOffset\":0.0000051,\"timeOffset\":49.30},{\"elevationOffset\":204.7,\"latOffset\":0.0001826,\"lonOffset\":0.0000637,\"timeOffset\":71.70},{\"elevationOffset\":204.7,\"latOffset\":0.0001313,\"lonOffset\":0.0000606,\"timeOffset\":80.20},{\"elevationOffset\":204.7,\"latOffset\":0.0001535,\"lonOffset\":0.0000748,\"timeOffset\":92.90},{\"elevationOffset\":204.7,\"latOffset\":0.0001650,\"lonOffset\":0.0001171,\"timeOffset\":126.40},{\"elevationOffset\":204.7,\"latOffset\":0.0001363,\"lonOffset\":0.0001000,\"timeOffset\":136.10},{\"elevationOffset\":204.7,\"latOffset\":0.0001196,\"lonOffset\":0.0001028,\"timeOffset\":141.90},{\"elevationOffset\":204.7,\"latOffset\":0.0001111,\"lonOffset\":0.0000980,\"timeOffset\":143.00},{\"elevationOffset\":204.7,\"latOffset\":0.0131071,\"lonOffset\":0.0000095,\"timeOffset\":348.00},{\"elevationOffset\":12.6,\"latOffset\":0.0131071,\"lonOffset\":0.0131071,\"timeOffset\":437.80},{\"elevationOffset\":11.5,\"latOffset\":0.0131071,\"lonOffset\":0.0131071,\"timeOffset\":468.20},{\"elevationOffset\":10.0,\"latOffset\":0.0131071,\"lonOffset\":0.0131071,\"timeOffset\":474.00},{\"elevationOffset\":10.2,\"latOffset\":0.0131071,\"lonOffset\":0.0000070,\"timeOffset\":481.30}]},\"pathPrediction\":{\"confidence\":0.0,\"radiusOfCurve\":0.0}}}]}}";
String expectedValue = "{\"messageId\":\"BasicSafetyMessage\",\"value\":{\"coreData\":{\"msgCnt\":102,\"id\":\"BEA10000\",\"secMark\":36799,\"position\":{\"latitude\":41.1641851,\"longitude\":-104.8434230,\"elevation\":1896.9},\"accelSet\":{\"accelYaw\":0.00},\"accuracy\":{},\"speed\":0.00,\"heading\":321.0125,\"brakes\":{\"wheelBrakes\":{\"leftFront\":false,\"rightFront\":false,\"unavailable\":true,\"leftRear\":false,\"rightRear\":false},\"traction\":\"unavailable\",\"abs\":\"unavailable\",\"scs\":\"unavailable\",\"brakeBoost\":\"unavailable\",\"auxBrakes\":\"unavailable\"},\"size\":{}},\"partII\":[{\"id\":\"VehicleSafetyExtensions\",\"value\":{\"pathHistory\":{\"crumbData\":[{\"elevationOffset\":9.5,\"latOffset\":0.0000035,\"lonOffset\":0.0131071,\"timeOffset\":33.20},{\"elevationOffset\":4.6,\"latOffset\":0.0000740,\"lonOffset\":0.0131071,\"timeOffset\":44.60},{\"elevationOffset\":3.5,\"latOffset\":0.0000944,\"lonOffset\":0.0000051,\"timeOffset\":49.30},{\"elevationOffset\":204.7,\"latOffset\":0.0001826,\"lonOffset\":0.0000637,\"timeOffset\":71.70},{\"elevationOffset\":204.7,\"latOffset\":0.0001313,\"lonOffset\":0.0000606,\"timeOffset\":80.20},{\"elevationOffset\":204.7,\"latOffset\":0.0001535,\"lonOffset\":0.0000748,\"timeOffset\":92.90},{\"elevationOffset\":204.7,\"latOffset\":0.0001650,\"lonOffset\":0.0001171,\"timeOffset\":126.40},{\"elevationOffset\":204.7,\"latOffset\":0.0001363,\"lonOffset\":0.0001000,\"timeOffset\":136.10},{\"elevationOffset\":204.7,\"latOffset\":0.0001196,\"lonOffset\":0.0001028,\"timeOffset\":141.90},{\"elevationOffset\":204.7,\"latOffset\":0.0001111,\"lonOffset\":0.0000980,\"timeOffset\":143.00},{\"elevationOffset\":204.7,\"latOffset\":0.0131071,\"lonOffset\":0.0000095,\"timeOffset\":348.00},{\"elevationOffset\":12.6,\"latOffset\":0.0131071,\"lonOffset\":0.0131071,\"timeOffset\":437.80},{\"elevationOffset\":11.5,\"latOffset\":0.0131071,\"lonOffset\":0.0131071,\"timeOffset\":468.20},{\"elevationOffset\":10.0,\"latOffset\":0.0131071,\"lonOffset\":0.0131071,\"timeOffset\":474.00},{\"elevationOffset\":10.2,\"latOffset\":0.0131071,\"lonOffset\":0.0000070,\"timeOffset\":481.30}]},\"pathPrediction\":{\"confidence\":0.0,\"radiusOfCurve\":0.0}}}]}}";

assertEquals(expectedValue, coder.decodeUPERMessageFrameHex(inputString).toJson(false));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ public void shouldCreateVehicleClassification() {
Integer expectedBasicVehicleClass = 0;

Integer testBasicVehicleRole = 0;
String expectedBasicVehicleRole = "BASICVEHICLE";
String expectedBasicVehicleRole = "basicVehicle";

Integer testIso3833VehicleType = 0;
Integer expectedVCIso3833VehicleType = 0;

Integer testVehicleType = 0;
String expectedVehicleType = "NONE";
String expectedVehicleType = "none";

Integer testVehicleGroupAffected = 9217;
String expectedVehicleGroupAffected = "all-vehicles";
Expand All @@ -116,10 +116,10 @@ public void shouldCreateVehicleClassification() {
String expectedIncidentResponseEquipment = "ground-fire-suppression";

Integer testResponderGroupAffected = 9729;
String expectedResponderGroupAffected = "EMERGENCY_VEHICLE_UNITS";
String expectedResponderGroupAffected = "emergency_vehicle_units";

Integer testFuelType = 0;
String expectedFuelType = "UNKNOWNFUEL";
String expectedFuelType = "unknownFuel";

VehicleClassification testVehicleClassification = new VehicleClassification(
new BasicVehicleClass(testBasicVehicleClass),
Expand Down
Loading

0 comments on commit a10a6e6

Please sign in to comment.