@Test public void testBuildASDNullTimeRethrowsTimeParsingExceptionFromSNMP() throws TimTransmogrifierException { ServiceRequest inputServiceRequest = new ServiceRequest(); inputServiceRequest.setSdw(new SDW()); inputServiceRequest.setSnmp(new SNMP()); try { TimTransmogrifier.buildASD(inputServiceRequest); fail("Expected TimTransmogrifierException"); } catch (Exception e) { assertTrue(e instanceof TimTransmogrifierException); } }
public static DdsAdvisorySituationData buildASD(ServiceRequest serviceRequest) throws TimTransmogrifierException { Ieee1609Dot2DataTag ieeeDataTag = new Ieee1609Dot2DataTag(); Ieee1609Dot2Data ieee = new Ieee1609Dot2Data(); Ieee1609Dot2Content ieeeContent = new Ieee1609Dot2Content(); J2735MessageFrame j2735Mf = new J2735MessageFrame(); MessageFrame mf = new MessageFrame(); mf.setMessageFrame(j2735Mf); ieeeContent.setUnsecuredData(mf); ieee.setContent(ieeeContent); ieeeDataTag.setIeee1609Dot2Data(ieee); byte sendToRsu = serviceRequest.getRsus() != null ? DdsAdvisorySituationData.RSU : DdsAdvisorySituationData.NONE; byte distroType = (byte) (DdsAdvisorySituationData.IP | sendToRsu); SNMP snmp = serviceRequest.getSnmp(); SDW sdw = serviceRequest.getSdw(); DdsAdvisorySituationData asd = null; if (null != sdw) { try { if (null != snmp) { asd = new DdsAdvisorySituationData() .setAsdmDetails(snmp.getDeliverystart(), snmp.getDeliverystop(), distroType, ieeeDataTag) .setServiceRegion(GeoRegionBuilder.ddsGeoRegion(sdw.getServiceRegion())) .setTimeToLive(sdw.getTtl()).setGroupID(sdw.getGroupID()).setRecordID(sdw.getRecordId()); } else { asd = new DdsAdvisorySituationData() .setAsdmDetails(sdw.getDeliverystart(), sdw.getDeliverystop(), distroType, ieeeDataTag) .setServiceRegion(GeoRegionBuilder.ddsGeoRegion(sdw.getServiceRegion())) .setTimeToLive(sdw.getTtl()).setGroupID(sdw.getGroupID()).setRecordID(sdw.getRecordId()); } } catch (Exception e) { throw new TimTransmogrifierException("Failed to build AdvisorySituationData: " + e.getMessage()); } } return asd; }
TimTransmogrifier { public static DdsAdvisorySituationData buildASD(ServiceRequest serviceRequest) throws TimTransmogrifierException { Ieee1609Dot2DataTag ieeeDataTag = new Ieee1609Dot2DataTag(); Ieee1609Dot2Data ieee = new Ieee1609Dot2Data(); Ieee1609Dot2Content ieeeContent = new Ieee1609Dot2Content(); J2735MessageFrame j2735Mf = new J2735MessageFrame(); MessageFrame mf = new MessageFrame(); mf.setMessageFrame(j2735Mf); ieeeContent.setUnsecuredData(mf); ieee.setContent(ieeeContent); ieeeDataTag.setIeee1609Dot2Data(ieee); byte sendToRsu = serviceRequest.getRsus() != null ? DdsAdvisorySituationData.RSU : DdsAdvisorySituationData.NONE; byte distroType = (byte) (DdsAdvisorySituationData.IP | sendToRsu); SNMP snmp = serviceRequest.getSnmp(); SDW sdw = serviceRequest.getSdw(); DdsAdvisorySituationData asd = null; if (null != sdw) { try { if (null != snmp) { asd = new DdsAdvisorySituationData() .setAsdmDetails(snmp.getDeliverystart(), snmp.getDeliverystop(), distroType, ieeeDataTag) .setServiceRegion(GeoRegionBuilder.ddsGeoRegion(sdw.getServiceRegion())) .setTimeToLive(sdw.getTtl()).setGroupID(sdw.getGroupID()).setRecordID(sdw.getRecordId()); } else { asd = new DdsAdvisorySituationData() .setAsdmDetails(sdw.getDeliverystart(), sdw.getDeliverystop(), distroType, ieeeDataTag) .setServiceRegion(GeoRegionBuilder.ddsGeoRegion(sdw.getServiceRegion())) .setTimeToLive(sdw.getTtl()).setGroupID(sdw.getGroupID()).setRecordID(sdw.getRecordId()); } } catch (Exception e) { throw new TimTransmogrifierException("Failed to build AdvisorySituationData: " + e.getMessage()); } } return asd; } }
TimTransmogrifier { public static DdsAdvisorySituationData buildASD(ServiceRequest serviceRequest) throws TimTransmogrifierException { Ieee1609Dot2DataTag ieeeDataTag = new Ieee1609Dot2DataTag(); Ieee1609Dot2Data ieee = new Ieee1609Dot2Data(); Ieee1609Dot2Content ieeeContent = new Ieee1609Dot2Content(); J2735MessageFrame j2735Mf = new J2735MessageFrame(); MessageFrame mf = new MessageFrame(); mf.setMessageFrame(j2735Mf); ieeeContent.setUnsecuredData(mf); ieee.setContent(ieeeContent); ieeeDataTag.setIeee1609Dot2Data(ieee); byte sendToRsu = serviceRequest.getRsus() != null ? DdsAdvisorySituationData.RSU : DdsAdvisorySituationData.NONE; byte distroType = (byte) (DdsAdvisorySituationData.IP | sendToRsu); SNMP snmp = serviceRequest.getSnmp(); SDW sdw = serviceRequest.getSdw(); DdsAdvisorySituationData asd = null; if (null != sdw) { try { if (null != snmp) { asd = new DdsAdvisorySituationData() .setAsdmDetails(snmp.getDeliverystart(), snmp.getDeliverystop(), distroType, ieeeDataTag) .setServiceRegion(GeoRegionBuilder.ddsGeoRegion(sdw.getServiceRegion())) .setTimeToLive(sdw.getTtl()).setGroupID(sdw.getGroupID()).setRecordID(sdw.getRecordId()); } else { asd = new DdsAdvisorySituationData() .setAsdmDetails(sdw.getDeliverystart(), sdw.getDeliverystop(), distroType, ieeeDataTag) .setServiceRegion(GeoRegionBuilder.ddsGeoRegion(sdw.getServiceRegion())) .setTimeToLive(sdw.getTtl()).setGroupID(sdw.getGroupID()).setRecordID(sdw.getRecordId()); } } catch (Exception e) { throw new TimTransmogrifierException("Failed to build AdvisorySituationData: " + e.getMessage()); } } return asd; } private  TimTransmogrifier(); }
TimTransmogrifier { public static DdsAdvisorySituationData buildASD(ServiceRequest serviceRequest) throws TimTransmogrifierException { Ieee1609Dot2DataTag ieeeDataTag = new Ieee1609Dot2DataTag(); Ieee1609Dot2Data ieee = new Ieee1609Dot2Data(); Ieee1609Dot2Content ieeeContent = new Ieee1609Dot2Content(); J2735MessageFrame j2735Mf = new J2735MessageFrame(); MessageFrame mf = new MessageFrame(); mf.setMessageFrame(j2735Mf); ieeeContent.setUnsecuredData(mf); ieee.setContent(ieeeContent); ieeeDataTag.setIeee1609Dot2Data(ieee); byte sendToRsu = serviceRequest.getRsus() != null ? DdsAdvisorySituationData.RSU : DdsAdvisorySituationData.NONE; byte distroType = (byte) (DdsAdvisorySituationData.IP | sendToRsu); SNMP snmp = serviceRequest.getSnmp(); SDW sdw = serviceRequest.getSdw(); DdsAdvisorySituationData asd = null; if (null != sdw) { try { if (null != snmp) { asd = new DdsAdvisorySituationData() .setAsdmDetails(snmp.getDeliverystart(), snmp.getDeliverystop(), distroType, ieeeDataTag) .setServiceRegion(GeoRegionBuilder.ddsGeoRegion(sdw.getServiceRegion())) .setTimeToLive(sdw.getTtl()).setGroupID(sdw.getGroupID()).setRecordID(sdw.getRecordId()); } else { asd = new DdsAdvisorySituationData() .setAsdmDetails(sdw.getDeliverystart(), sdw.getDeliverystop(), distroType, ieeeDataTag) .setServiceRegion(GeoRegionBuilder.ddsGeoRegion(sdw.getServiceRegion())) .setTimeToLive(sdw.getTtl()).setGroupID(sdw.getGroupID()).setRecordID(sdw.getRecordId()); } } catch (Exception e) { throw new TimTransmogrifierException("Failed to build AdvisorySituationData: " + e.getMessage()); } } return asd; } private  TimTransmogrifier(); static String obfuscateRsuPassword(String message); static DdsAdvisorySituationData buildASD(ServiceRequest serviceRequest); static String convertToXml(DdsAdvisorySituationData asd, ObjectNode encodableTidObj,
         OdeMsgMetadata timMetadata, SerialId serialIdJ2735); static void updateRsuCreds(RSU rsu, OdeProperties odeProperties); static JsonNode buildEncodingNode(String name, String type, EncodingRule rule); static JSONObject createOdeTimData(JSONObject timData); }
TimTransmogrifier { public static DdsAdvisorySituationData buildASD(ServiceRequest serviceRequest) throws TimTransmogrifierException { Ieee1609Dot2DataTag ieeeDataTag = new Ieee1609Dot2DataTag(); Ieee1609Dot2Data ieee = new Ieee1609Dot2Data(); Ieee1609Dot2Content ieeeContent = new Ieee1609Dot2Content(); J2735MessageFrame j2735Mf = new J2735MessageFrame(); MessageFrame mf = new MessageFrame(); mf.setMessageFrame(j2735Mf); ieeeContent.setUnsecuredData(mf); ieee.setContent(ieeeContent); ieeeDataTag.setIeee1609Dot2Data(ieee); byte sendToRsu = serviceRequest.getRsus() != null ? DdsAdvisorySituationData.RSU : DdsAdvisorySituationData.NONE; byte distroType = (byte) (DdsAdvisorySituationData.IP | sendToRsu); SNMP snmp = serviceRequest.getSnmp(); SDW sdw = serviceRequest.getSdw(); DdsAdvisorySituationData asd = null; if (null != sdw) { try { if (null != snmp) { asd = new DdsAdvisorySituationData() .setAsdmDetails(snmp.getDeliverystart(), snmp.getDeliverystop(), distroType, ieeeDataTag) .setServiceRegion(GeoRegionBuilder.ddsGeoRegion(sdw.getServiceRegion())) .setTimeToLive(sdw.getTtl()).setGroupID(sdw.getGroupID()).setRecordID(sdw.getRecordId()); } else { asd = new DdsAdvisorySituationData() .setAsdmDetails(sdw.getDeliverystart(), sdw.getDeliverystop(), distroType, ieeeDataTag) .setServiceRegion(GeoRegionBuilder.ddsGeoRegion(sdw.getServiceRegion())) .setTimeToLive(sdw.getTtl()).setGroupID(sdw.getGroupID()).setRecordID(sdw.getRecordId()); } } catch (Exception e) { throw new TimTransmogrifierException("Failed to build AdvisorySituationData: " + e.getMessage()); } } return asd; } private  TimTransmogrifier(); static String obfuscateRsuPassword(String message); static DdsAdvisorySituationData buildASD(ServiceRequest serviceRequest); static String convertToXml(DdsAdvisorySituationData asd, ObjectNode encodableTidObj,
         OdeMsgMetadata timMetadata, SerialId serialIdJ2735); static void updateRsuCreds(RSU rsu, OdeProperties odeProperties); static JsonNode buildEncodingNode(String name, String type, EncodingRule rule); static JSONObject createOdeTimData(JSONObject timData); static final String RSUS_STRING; static final String REQUEST_STRING; }