@Test public void testPrintGlobalStats () throws IOException { Collector c = new Collector (); c.readLogMessagesFromFile("TestLogFile.log"); StringWriter out = new StringWriter(); c.printGlobalStats(new PrintWriter(out, true)); String actualOutput = out.toString(); assertTrue(actualOutput.contains("Start Time: 2010-05-26 12:12:40,883")); assertTrue(actualOutput.contains("End Time: 2010-06-01 08:45:12,104")); assertTrue(actualOutput.contains("Duration: 5d20h32m31.221s")); assertTrue(actualOutput.contains("Total Services: 5")); assertTrue(actualOutput.contains("Threads Used: 5")); }
public void printGlobalStats(PrintWriter out) { SimpleDateFormat f = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss,S"); out.println("Start Time: " + f.format(this.getStartTime())); out.println("End Time: " + f.format(this.getEndTime())); out.println("Duration: "+ Collector.formatDuration(this.getDuration())); out.println("Total Services: "+this.getServiceCount()); out.println("Threads Used: " + this.getThreadCount()); }
Collector { public void printGlobalStats(PrintWriter out) { SimpleDateFormat f = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss,S"); out.println("Start Time: " + f.format(this.getStartTime())); out.println("End Time: " + f.format(this.getEndTime())); out.println("Duration: "+ Collector.formatDuration(this.getDuration())); out.println("Total Services: "+this.getServiceCount()); out.println("Threads Used: " + this.getThreadCount()); } }
Collector { public void printGlobalStats(PrintWriter out) { SimpleDateFormat f = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss,S"); out.println("Start Time: " + f.format(this.getStartTime())); out.println("End Time: " + f.format(this.getEndTime())); out.println("Duration: "+ Collector.formatDuration(this.getDuration())); out.println("Total Services: "+this.getServiceCount()); out.println("Threads Used: " + this.getThreadCount()); }  }
Collector { public void printGlobalStats(PrintWriter out) { SimpleDateFormat f = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss,S"); out.println("Start Time: " + f.format(this.getStartTime())); out.println("End Time: " + f.format(this.getEndTime())); out.println("Duration: "+ Collector.formatDuration(this.getDuration())); out.println("Total Services: "+this.getServiceCount()); out.println("Threads Used: " + this.getThreadCount()); }  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 printGlobalStats(PrintWriter out) { SimpleDateFormat f = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss,S"); out.println("Start Time: " + f.format(this.getStartTime())); out.println("End Time: " + f.format(this.getEndTime())); out.println("Duration: "+ Collector.formatDuration(this.getDuration())); out.println("Total Services: "+this.getServiceCount()); out.println("Threads Used: " + this.getThreadCount()); }  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; }