@Test public void testReadLogMessagesFromFile () throws IOException { Collector c = new Collector(); c.readLogMessagesFromFile("TestLogFile.log"); assertEquals(7144,c.getAverageCollectionTimePerService("24/216.216.217.254/SNMP")); assertEquals(0,c.getAverageCollectionTimePerService("19/209.61.128.9/SNMP")); assertEquals(513,c.getAverageCollectionTimePerService("60/172.20.1.202/SNMP")); assertEquals(0,c.getAverageCollectionTimePerService("86/172.20.1.25/WMI")); assertEquals(0,c.getAverageCollectionTimePerService("58/172.20.1.201/SNMP")); }
public void readLogMessagesFromFile(String fileName) throws IOException { File logFile = new File(fileName); BufferedReader r = new BufferedReader(new FileReader(logFile)); String logMessage = r.readLine(); while(logMessage != null){ this.addLog(logMessage); logMessage = r.readLine(); } r.close(); }
Collector { public void readLogMessagesFromFile(String fileName) throws IOException { File logFile = new File(fileName); BufferedReader r = new BufferedReader(new FileReader(logFile)); String logMessage = r.readLine(); while(logMessage != null){ this.addLog(logMessage); logMessage = r.readLine(); } r.close(); } }
Collector { public void readLogMessagesFromFile(String fileName) throws IOException { File logFile = new File(fileName); BufferedReader r = new BufferedReader(new FileReader(logFile)); String logMessage = r.readLine(); while(logMessage != null){ this.addLog(logMessage); logMessage = r.readLine(); } r.close(); }  }
Collector { public void readLogMessagesFromFile(String fileName) throws IOException { File logFile = new File(fileName); BufferedReader r = new BufferedReader(new FileReader(logFile)); String logMessage = r.readLine(); while(logMessage != null){ this.addLog(logMessage); logMessage = r.readLine(); } r.close(); }  void setSearchString(String searchString); void setSortColumn(SortColumn sortFlag); void setSortOrder(SortOrder sortOrder); Collector.SortColumn getSortColumn(); String getSearchString(); static void setDurationsMs(boolean durationsMs); static boolean getDurationsMs(); void addLog(String logMessage); Date getStartTime(); LogMessage getFirstValidLogMessage(); LogMessage getLastValidLogMessage(); Date getEndTime(); long getDuration(); String getFormattedDuration(); int getServiceCount(); Map<String, ServiceCollector> getm_ServiceCollectors(); int compareLongs(long l1, long l2); Set<String> getServices(); List<ServiceCollector> getServiceCollectors(); Comparator<ServiceCollector> getColumnComparator(); int getThreadCount(); int getCollectionsPerService(String serviceID); long getAverageCollectionTimePerService(String serviceID); long getTotalCollectionTimePerService(String serviceID); void readLogMessagesFromFile(String fileName); void printGlobalStats(PrintWriter out); static String formatDuration(long millis); void printServiceHeader(PrintWriter out); void printReport(PrintWriter out); void printServiceStats(String serviceID, PrintWriter out); }
Collector { public void readLogMessagesFromFile(String fileName) throws IOException { File logFile = new File(fileName); BufferedReader r = new BufferedReader(new FileReader(logFile)); String logMessage = r.readLine(); while(logMessage != null){ this.addLog(logMessage); logMessage = r.readLine(); } r.close(); }  void setSearchString(String searchString); void setSortColumn(SortColumn sortFlag); void setSortOrder(SortOrder sortOrder); Collector.SortColumn getSortColumn(); String getSearchString(); static void setDurationsMs(boolean durationsMs); static boolean getDurationsMs(); void addLog(String logMessage); Date getStartTime(); LogMessage getFirstValidLogMessage(); LogMessage getLastValidLogMessage(); Date getEndTime(); long getDuration(); String getFormattedDuration(); int getServiceCount(); Map<String, ServiceCollector> getm_ServiceCollectors(); int compareLongs(long l1, long l2); Set<String> getServices(); List<ServiceCollector> getServiceCollectors(); Comparator<ServiceCollector> getColumnComparator(); int getThreadCount(); int getCollectionsPerService(String serviceID); long getAverageCollectionTimePerService(String serviceID); long getTotalCollectionTimePerService(String serviceID); void readLogMessagesFromFile(String fileName); void printGlobalStats(PrintWriter out); static String formatDuration(long millis); void printServiceHeader(PrintWriter out); void printReport(PrintWriter out); void printServiceStats(String serviceID, PrintWriter out); static final String SERVICE_TITLE_FORMAT; static final String SERVICE_DATA_FORMAT; }