Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ public ResponseEntity<List<TimUpdateModel>> GetExpiringActiveTims() {
else {
log.warn("Could not set frame type from value {} for active tim id {}. Assuming Advisory.", frameTypeValue,
activeTim.getActiveTimId());
// assume advisory
activeTim.setFrameType(TravelerInfoType.advisory);
// assume roadSignage
activeTim.setFrameType(TravelerInfoType.roadSignage);
}

activeTim.setDfContent(ContentEnum.advisory);
Expand Down Expand Up @@ -155,8 +155,8 @@ public ResponseEntity<TimUpdateModel> GetUpdateModelFromActiveTimId(@PathVariabl
}
else {
log.warn("Could not set frame type from value {} for active tim id {}. Assuming Advisory.", frameTypeValue, activeTimId);
// assume advisory
activeTim.setFrameType(TravelerInfoType.advisory);
// assume roadSignage
activeTim.setFrameType(TravelerInfoType.roadSignage);
}

activeTim.setDfContent(ContentEnum.advisory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void GetUpdateModelFromActiveTimId_SUCCESS() throws SQLException {
// we only set one property to verify its returned
when(mockRs.getLong("ACTIVE_TIM_ID")).thenReturn(999L);
when(mockRs.getInt(any())).thenReturn(0);
when(mockRs.getInt("FRAME_TYPE")).thenReturn(FrameType.TravelerInfoType.advisory.ordinal());
when(mockRs.getInt("FRAME_TYPE")).thenReturn(FrameType.TravelerInfoType.roadSignage.ordinal());

String selectStatement = "SELECT atim.*, tt.type AS tim_type_name, tt.description AS tim_type_description";
selectStatement += ", t.msg_cnt, t.url_b, t.is_satellite, t.sat_record_id, t.packet_id";
Expand All @@ -148,7 +148,7 @@ public void GetUpdateModelFromActiveTimId_SUCCESS() throws SQLException {
Assertions.assertEquals(HttpStatus.OK, tum.getStatusCode());
Assertions.assertNotNull(tum.getBody());
Assertions.assertEquals(Long.valueOf(999), tum.getBody().getActiveTimId());
Assertions.assertEquals(FrameType.TravelerInfoType.advisory, tum.getBody().getFrameType());
Assertions.assertEquals(FrameType.TravelerInfoType.roadSignage, tum.getBody().getFrameType());
verify(mockStatement).executeQuery(selectStatement);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@ public void InjectDependencies(Utility _utility) {
*
* @param wydotTim The WydotTim object containing the data for the TIM.
* @param genProps The TimGenerationProps object containing the generation properties.
* @param frameType The TravelerInfoType object representing the frame type of the TIM.
* @param allMileposts The list of Milepost objects representing all mileposts.
* @param reducedMileposts The list of Milepost objects representing reduced mileposts.
* @param anchor The Milepost object representing the anchor milepost.
* @return The WydotTravelerInputData object containing the built TIM.
*/
public WydotTravelerInputData buildTim(WydotTim wydotTim, TimGenerationProps genProps,
TravelerInfoType frameType, List<Milepost> allMileposts, List<Milepost> reducedMileposts, Milepost anchor) {
List<Milepost> allMileposts, List<Milepost> reducedMileposts, Milepost anchor) {

ContentEnum content = ContentEnum.advisory;

Expand All @@ -73,7 +72,9 @@ public WydotTravelerInputData buildTim(WydotTim wydotTim, TimGenerationProps gen
dataFrame.setPriority(5);

dataFrame.setContent(content.getStringValue());
dataFrame.setFrameType(frameType);
// Per CTW, FrameType should be set to roadSignage when state or local deployment agency is generating the message
// which is all messages coming through the TIMM so always set to roadSignage
dataFrame.setFrameType(TravelerInfoType.roadSignage);
dataFrame.setUrl("null");
// add itis codes to tim
dataFrame.setItems(wydotTim.getItisCodes().toArray(new String[wydotTim.getItisCodes().size()]));
Expand All @@ -84,7 +85,7 @@ public WydotTravelerInputData buildTim(WydotTim wydotTim, TimGenerationProps gen
anchorPosition.setLongitude(anchor.getLongitude());

// build msgId
MsgId msgId = buildMsgId(anchorPosition, content, frameType);
MsgId msgId = buildMsgId(anchorPosition, content, TravelerInfoType.roadSignage);
dataFrame.setMsgId(msgId);

// set regions. note that we now support multiple regions in a single TIM package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public OdeLogMetadata convertTimMetadataJsonToJava(String value) {
// check for null rxSource for Distress Notifications
if (receivedMessageDetailsNode != null) {
String rxSource = mapper.treeToValue(receivedMessageDetailsNode.get("rxSource"), String.class);
if (rxSource.equals("")) {
if (rxSource.isEmpty()) {
((ObjectNode) receivedMessageDetailsNode).remove("rxSource");
((ObjectNode) metaDataNode).replace("receivedMessageDetails", receivedMessageDetailsNode);
}
Expand Down Expand Up @@ -463,7 +463,7 @@ public OdeTimPayload convertTmcTimTopicJsonToJava(String value) {
JsonNode timeStampNode = timNode.get("timeStamp");
if (timeStampNode != null) {
LocalDateTime timeStampDate = firstDay.atStartOfDay().plus(timeStampNode.asInt(), ChronoUnit.MINUTES);
tim.setTimeStamp(timeStampDate.toString() + "Z");
tim.setTimeStamp(timeStampDate + "Z");
}

JsonNode travelerDataFrameArray = timNode.findValue("dataFrames");
Expand Down Expand Up @@ -517,25 +517,16 @@ public OdeTimPayload convertTmcTimTopicJsonToJava(String value) {
itemsList.add(item);
}

// TravelerInfoType.valueOf();
JsonNode frameTypeNode = travelerDataFrame.get("frameType");
if (frameTypeNode != null && frameTypeNode.fieldNames().hasNext()) {
TravelerInfoType frameType = TravelerInfoType.valueOf(frameTypeNode.fieldNames().next());
dataFrame.setFrameType(frameType);
} else {
log.warn("frameType not found in TravelerDataFrame when converting TMC TIM. Defaulting to 'advisory'");
dataFrame.setFrameType(TravelerInfoType.advisory);
}

JsonNode startTimeNode = travelerDataFrame.get("startTime");
JsonNode durationNode = travelerDataFrame.get("durationTime");
JsonNode priorityNode = travelerDataFrame.get("priority");

LocalDateTime startDate = firstDay.atStartOfDay().plus(startTimeNode.asInt(), ChronoUnit.MINUTES);

dataFrame.setStartDateTime(startDate.toString() + "Z");
dataFrame.setStartDateTime(startDate + "Z");
dataFrame.setDurationTime(durationNode.asInt());
dataFrame.setPriority(priorityNode.asInt());
dataFrame.setFrameType(TravelerInfoType.roadSignage);

String[] items = new String[itemsList.size()];
items = itemsList.toArray(items);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class TimUpdateModel extends ActiveTim {

public BigDecimal getLaneWidth() {
return laneWidth;
// DataFrame df;df.setFrameType(frameType);
}

public String getRegionDirection() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import us.dot.its.jpo.ode.plugin.j2735.OdeGeoRegion;
import us.dot.its.jpo.ode.plugin.j2735.OdePosition3D;
import us.dot.its.jpo.ode.plugin.j2735.OdeTravelerInformationMessage.DataFrame;
import us.dot.its.jpo.ode.plugin.j2735.timstorage.FrameType.TravelerInfoType;

@Component
public class WydotTimService {
Expand Down Expand Up @@ -112,11 +111,11 @@ public void InjectDependencies(EmailProps _emailProps, OdeProps _odeProps, TimGe
DateTimeFormatter utcformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");

public WydotTravelerInputData createTim(WydotTim wydotTim, String timTypeStr, String startDateTime,
String endDateTime, TravelerInfoType frameType, List<Milepost> allMileposts,
String endDateTime, List<Milepost> allMileposts,
List<Milepost> reducedMileposts, Milepost anchor, String dotGnisId) {

// build base TIM
WydotTravelerInputData timToSend = createBaseTimUtil.buildTim(wydotTim, genProps, frameType,
WydotTravelerInputData timToSend = createBaseTimUtil.buildTim(wydotTim, genProps,
allMileposts, reducedMileposts, anchor);

if (timToSend == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,23 @@ public void buildTim_EndpointSUCCESS() {
wydotTim.setItisCodes(itisCodes);
wydotTim.setClientId("testclientid");

var frameType = TravelerInfoType.advisory;

// Act
var data = uut.buildTim(wydotTim, genProps, frameType, allMileposts, milepostsReduced, anchor);
var data = uut.buildTim(wydotTim, genProps, allMileposts, milepostsReduced, anchor);

// Assert
// validate dataFrame
var dataFrame = data.getTim().getDataframes()[0];
Assertions.assertNotNull(dataFrame);
Assertions.assertEquals("advisory", dataFrame.getContent());
Assertions.assertEquals(32000, dataFrame.getDurationTime());
Assertions.assertEquals(TravelerInfoType.roadSignage, dataFrame.getFrameType());

var region = dataFrame.getRegions()[0];
Assertions.assertNotNull(region);

// validate anchor
var anchor = region.getAnchorPosition();
Assertions.assertNotNull(anchor);
Assertions.assertEquals(anchor.getLatitude(), anchor.getLatitude());
Assertions.assertEquals(anchor.getLongitude(), anchor.getLongitude());

// validate path
var path = region.getPath();
Expand Down Expand Up @@ -153,26 +150,23 @@ public void buildTim_singlePointSUCCESS() {
wydotTim.setItisCodes(itisCodes);
wydotTim.setClientId("testclientid");

var frameType = TravelerInfoType.advisory;

// Act
var data = uut.buildTim(wydotTim, genProps, frameType, allMileposts, milepostsReduced, anchor);
var data = uut.buildTim(wydotTim, genProps, allMileposts, milepostsReduced, anchor);

// Assert
// validate dataFrame
var dataFrame = data.getTim().getDataframes()[0];
Assertions.assertNotNull(dataFrame);
Assertions.assertEquals("advisory", dataFrame.getContent());
Assertions.assertEquals(32000, dataFrame.getDurationTime());
Assertions.assertEquals(TravelerInfoType.roadSignage, dataFrame.getFrameType());

var region = dataFrame.getRegions()[0];
Assertions.assertNotNull(region);

// validate anchor
var anchor = region.getAnchorPosition();
Assertions.assertNotNull(anchor);
Assertions.assertEquals(anchor.getLatitude(), anchor.getLatitude());
Assertions.assertEquals(anchor.getLongitude(), anchor.getLongitude());

// validate path
var path = region.getPath();
Expand Down Expand Up @@ -201,10 +195,8 @@ public void buildTim_singleRegion_SUCCESS() {
wydotTim.setItisCodes(itisCodes);
wydotTim.setClientId("testclientid");

var frameType = TravelerInfoType.advisory;

// Act
var data = uut.buildTim(wydotTim, genProps, frameType, allMileposts, milepostsReduced, anchor);
var data = uut.buildTim(wydotTim, genProps, allMileposts, milepostsReduced, anchor);

// Assert
Assertions.assertEquals(1, data.getTim().getDataframes()[0].getRegions().length);
Expand All @@ -231,10 +223,8 @@ public void buildTim_twoRegions_SUCCESS() {
wydotTim.setItisCodes(itisCodes);
wydotTim.setClientId("testclientid");

var frameType = TravelerInfoType.advisory;

// Act
var data = uut.buildTim(wydotTim, genProps, frameType, allMileposts, milepostsReduced, anchor);
var data = uut.buildTim(wydotTim, genProps, allMileposts, milepostsReduced, anchor);

// Assert
Assertions.assertEquals(2, data.getTim().getDataframes()[0].getRegions().length);
Expand Down Expand Up @@ -273,10 +263,8 @@ public void buildTim_threeRegions_SUCCESS() {
wydotTim.setItisCodes(itisCodes);
wydotTim.setClientId("testclientid");

var frameType = TravelerInfoType.advisory;

// Act
var data = uut.buildTim(wydotTim, genProps, frameType, allMileposts, milepostsReduced, anchor);
var data = uut.buildTim(wydotTim, genProps, allMileposts, milepostsReduced, anchor);

// Assert
Assertions.assertEquals(3, data.getTim().getDataframes()[0].getRegions().length);
Expand Down
Loading
Loading