@Test public void testPublishNonLearLogFile() throws Exception { String filename = RecordType.rxMsg.name() + GZ; String jsonData = "{\"fakeJsonKey\":\"fakeJsonValue\""; byte[] buf = jsonData.getBytes(); BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(buf )); List<OdeData> dataList = testLogFileToAsn1CodecPublisher.publish(bis, filename, ImporterFileType.JSON_FILE); assertTrue(dataList.isEmpty()); }
public List<OdeData> publish(BufferedInputStream bis, String fileName, ImporterFileType fileType) throws LogFileToAsn1CodecPublisherException { XmlUtils xmlUtils = new XmlUtils(); ParserStatus status; List<OdeData> dataList = new ArrayList<>(); if (fileType == ImporterFileType.LEAR_LOG_FILE) { fileParser = LogFileParser.factory(fileName); do { try { status = fileParser.parseFile(bis, fileName); if (status == ParserStatus.COMPLETE) { addDataToList(dataList); } else if (status == ParserStatus.EOF) { publishList(xmlUtils, dataList); } else if (status == ParserStatus.INIT) { logger.error("Failed to parse the header bytes."); } else { logger.error("Failed to decode ASN.1 data"); } } catch (Exception e) { throw new LogFileToAsn1CodecPublisherException("Error parsing or publishing data.", e); } } while (status == ParserStatus.COMPLETE); } return dataList; }
LogFileToAsn1CodecPublisher implements Asn1CodecPublisher { public List<OdeData> publish(BufferedInputStream bis, String fileName, ImporterFileType fileType) throws LogFileToAsn1CodecPublisherException { XmlUtils xmlUtils = new XmlUtils(); ParserStatus status; List<OdeData> dataList = new ArrayList<>(); if (fileType == ImporterFileType.LEAR_LOG_FILE) { fileParser = LogFileParser.factory(fileName); do { try { status = fileParser.parseFile(bis, fileName); if (status == ParserStatus.COMPLETE) { addDataToList(dataList); } else if (status == ParserStatus.EOF) { publishList(xmlUtils, dataList); } else if (status == ParserStatus.INIT) { logger.error("Failed to parse the header bytes."); } else { logger.error("Failed to decode ASN.1 data"); } } catch (Exception e) { throw new LogFileToAsn1CodecPublisherException("Error parsing or publishing data.", e); } } while (status == ParserStatus.COMPLETE); } return dataList; } }
LogFileToAsn1CodecPublisher implements Asn1CodecPublisher { public List<OdeData> publish(BufferedInputStream bis, String fileName, ImporterFileType fileType) throws LogFileToAsn1CodecPublisherException { XmlUtils xmlUtils = new XmlUtils(); ParserStatus status; List<OdeData> dataList = new ArrayList<>(); if (fileType == ImporterFileType.LEAR_LOG_FILE) { fileParser = LogFileParser.factory(fileName); do { try { status = fileParser.parseFile(bis, fileName); if (status == ParserStatus.COMPLETE) { addDataToList(dataList); } else if (status == ParserStatus.EOF) { publishList(xmlUtils, dataList); } else if (status == ParserStatus.INIT) { logger.error("Failed to parse the header bytes."); } else { logger.error("Failed to decode ASN.1 data"); } } catch (Exception e) { throw new LogFileToAsn1CodecPublisherException("Error parsing or publishing data.", e); } } while (status == ParserStatus.COMPLETE); } return dataList; } LogFileToAsn1CodecPublisher(StringPublisher dataPub); }
LogFileToAsn1CodecPublisher implements Asn1CodecPublisher { public List<OdeData> publish(BufferedInputStream bis, String fileName, ImporterFileType fileType) throws LogFileToAsn1CodecPublisherException { XmlUtils xmlUtils = new XmlUtils(); ParserStatus status; List<OdeData> dataList = new ArrayList<>(); if (fileType == ImporterFileType.LEAR_LOG_FILE) { fileParser = LogFileParser.factory(fileName); do { try { status = fileParser.parseFile(bis, fileName); if (status == ParserStatus.COMPLETE) { addDataToList(dataList); } else if (status == ParserStatus.EOF) { publishList(xmlUtils, dataList); } else if (status == ParserStatus.INIT) { logger.error("Failed to parse the header bytes."); } else { logger.error("Failed to decode ASN.1 data"); } } catch (Exception e) { throw new LogFileToAsn1CodecPublisherException("Error parsing or publishing data.", e); } } while (status == ParserStatus.COMPLETE); } return dataList; } LogFileToAsn1CodecPublisher(StringPublisher dataPub); List<OdeData> publish(BufferedInputStream bis, String fileName, ImporterFileType fileType); boolean isDriverAlertRecord(); boolean isBsmRecord(); }
LogFileToAsn1CodecPublisher implements Asn1CodecPublisher { public List<OdeData> publish(BufferedInputStream bis, String fileName, ImporterFileType fileType) throws LogFileToAsn1CodecPublisherException { XmlUtils xmlUtils = new XmlUtils(); ParserStatus status; List<OdeData> dataList = new ArrayList<>(); if (fileType == ImporterFileType.LEAR_LOG_FILE) { fileParser = LogFileParser.factory(fileName); do { try { status = fileParser.parseFile(bis, fileName); if (status == ParserStatus.COMPLETE) { addDataToList(dataList); } else if (status == ParserStatus.EOF) { publishList(xmlUtils, dataList); } else if (status == ParserStatus.INIT) { logger.error("Failed to parse the header bytes."); } else { logger.error("Failed to decode ASN.1 data"); } } catch (Exception e) { throw new LogFileToAsn1CodecPublisherException("Error parsing or publishing data.", e); } } while (status == ParserStatus.COMPLETE); } return dataList; } LogFileToAsn1CodecPublisher(StringPublisher dataPub); List<OdeData> publish(BufferedInputStream bis, String fileName, ImporterFileType fileType); boolean isDriverAlertRecord(); boolean isBsmRecord();  }