LinuxSyslogLineParser { public abstract boolean parseLine(String line);  static boolean isSyslogNgRestarted(String compId, String body); static boolean isSyslogNgRestarted(IMessageInstance mi); static Pattern getSysLogSuppressionPattern(); abstract boolean parseLine(String line); final LinuxAdeExtProperties getLinuxAdeExtProperties(); abstract Date toDate(String source, String s); abstract DateTime getLastDeterminedDateTime(); final Date getMsgTime(); final String getSource(); final String getComponent(); final Severity getSeverity(); final String getPid(); final String getMessageBody(); final void setParseQualityReport(IParsingQualityReporter parsingQualityReport); @Override String toString(); static final String SYSLOG_NG_COMPONENT_NAME; static final String SYSLOG_NG_STARTING; static final Pattern SYSLOG_NG_STARTING_PATTERN; static final String SYSLOG_MESSAGE_SUPPRESSION; static final Pattern SYSLOG_MESSAGE_SUPPRESSION_PATTERN; }
@Test public void testParseLineWithBadPattern() { Pattern pattern = Pattern.compile("^([(][^)]+[)])? CMD [(](.*)[)] ?$"); assertEquals("Pattern doesnt match ",false,lslp.parseLine(pattern,1,2,3,4,5,"() CMD ()")); }
@Test public void testParseLineWithMatchingPattern() { Pattern pattern = Pattern.compile("^([^:]+):.*COMMAND=(.*)$"); assertEquals("Pattern matches for all parameters ",true,lslp.parseLine(pattern,1,2,2,2,2,"(username):.COMMAND=nub")); }
@Test public void testParseLineWith255CharacterHostname() { Pattern pattern = Pattern.compile("^([^:]+):.*COMMAND=(.*)$"); assertEquals("Pattern matches but hostname has over 255 chars ",true,lslp.parseLine(pattern,1,1,1,1,1,longString + ":.COMMAND=nub")); }
@Test public void testParseLineWith255CharacterHostnameSecondTime() { Pattern pattern = Pattern.compile("^([^:]+):.*COMMAND=(.*)$"); lslp.parseLine(pattern,1,1,1,1,1,longString + ":.COMMAND=nub"); assertEquals("Hostname over 255 characters but we go through parseLine twice to skip the logging " ,true,lslp.parseLine(pattern,1,1,1,1,1,longString + ":.COMMAND=nub")); }