LinuxSyslog5424ParserBase extends LinuxSyslogLineParser { @Override public boolean parseLine(String line) { if (parseLine(pattern, RFC5424_HEADER_TIMESTAMP_GROUP, RFC5424_HEADER_HOSTNAME_GROUP, RFC5424_HEADER_APPNAME_GROUP, RFC5424_HEADER_PROCID_GROUP, MSG_GROUP, line)) { if (m_component.equals("-")) { m_component = ""; } if (m_pid.equals("-")) { m_pid = ""; } return true; } ; return false; }  @Override Date toDate(String source, String s); @Override DateTime getLastDeterminedDateTime(); @Override boolean parseLine(String line); static final String RFC5424_TIMESTAMP; }
@Test public void testParseLineWithABadString() { assertEquals("Giving ParseLine a bad string ",false,ls5424pb.parseLine("bad string")); }
@Test public void testParseLineWithASyslog() { String example5424Syslog = "<46>1 2014-05-30T08:52:40.620950-04:00 host-name rsyslogd - - rsyslogd's groupid changed to 103"; assertEquals("Input is an example syslog ",true,ls5424pb.parseLine(example5424Syslog)); }
@Test public void testParseLineWithASyslogThatHasNilComponent() { String syslogWithNilComponent = "<46>1 2014-05-30T08:52:40.620950-04:00 host-name - - - rsyslogd's groupid changed to 103"; assertEquals("Testing for correct handling of nil component ",true,ls5424pb.parseLine(syslogWithNilComponent)); }
@Test public void testParseLineWithASyslogThatHasNilPid() { String syslogWithNilPid = "<46>1 2014-05-30T08:52:40.620950-04:00 host-name rsyslogd - - - rsyslogd's groupid changed to 103"; assertEquals("Testing for correct handling of nil Pid ",true,ls5424pb.parseLine(syslogWithNilPid)); }