@Test public void testCollectWithoutErrors() throws IOException { final Counter counter = createCounter(); final Counter jspCounter = new Counter(Counter.JSP_COUNTER_NAME, null); final Counter strutsCounter = new Counter(Counter.STRUTS_COUNTER_NAME, null); final Counter jobCounter = new Counter(Counter.JOB_COUNTER_NAME, null); final Collector collector = new Collector(TEST, Arrays.asList(counter, jspCounter, strutsCounter, jobCounter)); if (collector.getCounters().size() == 0) { fail("getCounters"); } counter.addRequest("test1", 0, 0, 0, false, 1000); counter.addRequest("test5", 10000, 200, 200, true, 10000); jspCounter.addRequest("test2", 0, 0, 0, false, 0); strutsCounter.addRequest("test3", 0, 0, 0, false, 0); jobCounter.addRequest("test4", 0, 0, 0, false, 0); collector.collectWithoutErrors(Collections.singletonList(new JavaInformations(null, true))); counter.addRequest("test2", 0, 0, 0, false, 1000); counter.addRequest("test3", 1000, 500, 500, false, 1000); counter.addRequest("test4", 10000, 200, 200, true, 10000); counter.addRequest("test5", 10000, 200, 200, true, 10000); counter.addRequest("test5", 10000, 200, 200, true, 10000); collector .collectWithoutErrors(Collections.singletonList(new JavaInformations(null, false))); final Counter buildsCounter = new Counter(Counter.BUILDS_COUNTER_NAME, null); new Collector(TEST, Collections.singletonList(buildsCounter)) .collectWithoutErrors(Collections.singletonList(new JavaInformations(null, false))); setProperty(Parameter.NO_DATABASE, "true"); try { new Collector(TEST, Collections.singletonList(counter)).collectWithoutErrors( Collections.singletonList(new JavaInformations(null, false))); } finally { setProperty(Parameter.NO_DATABASE, null); } if (collector.getLastCollectDuration() == 0) { fail("getLastCollectDuration"); } if (collector.getCounterJRobins().size() == 0) { fail("getCounterJRobins"); } final Range range = Period.JOUR.getRange(); for (final JRobin jrobin : collector.getCounterJRobins()) { final JRobin robin = collector.getJRobin(jrobin.getName()); assertNotNull("getJRobin non null", robin); jrobin.graph(range, 80, 80); robin.deleteFile(); } for (final JRobin jrobin : collector.getOtherJRobins()) { final JRobin robin = collector.getJRobin(jrobin.getName()); assertNotNull("getJRobin non null", robin); robin.deleteFile(); } for (final CounterRequest request : counter.getRequests()) { final JRobin robin = collector.getJRobin(request.getId()); if ("test5".equals(request.getName())) { assertNotNull("getJRobin non null", robin); robin.deleteFile(); } else { assertNull("getJRobin null", robin); } } assertNull("getJRobin null", collector.getJRobin("n'importe quoi")); }
public void collectWithoutErrors(List<JavaInformations> javaInformationsList) { assert javaInformationsList != null; final long start = System.currentTimeMillis(); try { estimatedMemorySize = collect(javaInformationsList); lastCollectorException = null; } catch (final Throwable t) { lastCollectorException = t; LOG.warn("exception while collecting data: " + t, t); } lastCollectDuration = Math.max(0, System.currentTimeMillis() - start); }
Collector { public void collectWithoutErrors(List<JavaInformations> javaInformationsList) { assert javaInformationsList != null; final long start = System.currentTimeMillis(); try { estimatedMemorySize = collect(javaInformationsList); lastCollectorException = null; } catch (final Throwable t) { lastCollectorException = t; LOG.warn("exception while collecting data: " + t, t); } lastCollectDuration = Math.max(0, System.currentTimeMillis() - start); } }
Collector { public void collectWithoutErrors(List<JavaInformations> javaInformationsList) { assert javaInformationsList != null; final long start = System.currentTimeMillis(); try { estimatedMemorySize = collect(javaInformationsList); lastCollectorException = null; } catch (final Throwable t) { lastCollectorException = t; LOG.warn("exception while collecting data: " + t, t); } lastCollectDuration = Math.max(0, System.currentTimeMillis() - start); } Collector(String application, List<Counter> counters);  Collector(String application, List<Counter> counters,
			SamplingProfiler samplingProfiler); }
Collector { public void collectWithoutErrors(List<JavaInformations> javaInformationsList) { assert javaInformationsList != null; final long start = System.currentTimeMillis(); try { estimatedMemorySize = collect(javaInformationsList); lastCollectorException = null; } catch (final Throwable t) { lastCollectorException = t; LOG.warn("exception while collecting data: " + t, t); } lastCollectDuration = Math.max(0, System.currentTimeMillis() - start); } Collector(String application, List<Counter> counters);  Collector(String application, List<Counter> counters,
			SamplingProfiler samplingProfiler); String getApplication(); SamplingProfiler getSamplingProfiler(); List<SampledMethod> getHotspots(); Map<String, Date> getDatesByWebappVersions(); List<Counter> getCounters(); Counter getCounterByName(String counterName); Counter getCounterByRequestId(CounterRequest request); List<CounterRequestContext> getRootCurrentContexts(List<Counter> newParentCounters); long getLastCollectDuration(); Throwable getLastCollectorException(); long getEstimatedMemorySize(); long getDiskUsage(); List<Counter> getRangeCounters(Range range); List<Counter> getRangeCountersToBeDisplayed(Range range); Counter getRangeCounter(Range range, String counterName); void collectLocalContextWithoutErrors(); void collectWithoutErrors(List<JavaInformations> javaInformationsList); JRobin getJRobin(String graphName); Collection<JRobin> getCounterJRobins(); Collection<JRobin> getDisplayedCounterJRobins(); Collection<JRobin> getDisplayedOtherJRobins(); boolean isStorageUsedByMultipleInstances(); void stop(); boolean isStopped(); static void stopJRobin(); static void detachVirtualMachine(); @Override String toString(); }
Collector { public void collectWithoutErrors(List<JavaInformations> javaInformationsList) { assert javaInformationsList != null; final long start = System.currentTimeMillis(); try { estimatedMemorySize = collect(javaInformationsList); lastCollectorException = null; } catch (final Throwable t) { lastCollectorException = t; LOG.warn("exception while collecting data: " + t, t); } lastCollectDuration = Math.max(0, System.currentTimeMillis() - start); } Collector(String application, List<Counter> counters);  Collector(String application, List<Counter> counters,
			SamplingProfiler samplingProfiler); String getApplication(); SamplingProfiler getSamplingProfiler(); List<SampledMethod> getHotspots(); Map<String, Date> getDatesByWebappVersions(); List<Counter> getCounters(); Counter getCounterByName(String counterName); Counter getCounterByRequestId(CounterRequest request); List<CounterRequestContext> getRootCurrentContexts(List<Counter> newParentCounters); long getLastCollectDuration(); Throwable getLastCollectorException(); long getEstimatedMemorySize(); long getDiskUsage(); List<Counter> getRangeCounters(Range range); List<Counter> getRangeCountersToBeDisplayed(Range range); Counter getRangeCounter(Range range, String counterName); void collectLocalContextWithoutErrors(); void collectWithoutErrors(List<JavaInformations> javaInformationsList); JRobin getJRobin(String graphName); Collection<JRobin> getCounterJRobins(); Collection<JRobin> getDisplayedCounterJRobins(); Collection<JRobin> getDisplayedOtherJRobins(); boolean isStorageUsedByMultipleInstances(); void stop(); boolean isStopped(); static void stopJRobin(); static void detachVirtualMachine(); @Override String toString();  }