@Test public void testWriteAllCurrentRequestsAsPart() throws IOException { final ByteArrayOutputStream output = new ByteArrayOutputStream(); final PdfOtherReport pdfOtherReport = new PdfOtherReport(TEST_APP, output); final Counter counter = new Counter("services", null); final Collector collector = new Collector(TEST_APP, Arrays.asList(counter)); final long timeOfSnapshot = System.currentTimeMillis(); final List<CounterRequestContext> requests = Collections.emptyList(); final JavaInformations javaInformations = new JavaInformations(null, true); final Map<JavaInformations, List<CounterRequestContext>> currentRequests = Collections .singletonMap(javaInformations, requests); pdfOtherReport.writeAllCurrentRequestsAsPart(currentRequests, collector, collector.getCounters(), timeOfSnapshot); assertNotEmptyAndClear(output); }
public void writeAllCurrentRequestsAsPart( Map<JavaInformations, List<CounterRequestContext>> currentRequests, Collector collector, List<Counter> counters, long timeOfSnapshot) throws IOException { try { document.open(); final List<CounterRequestContext> allCurrentRequests = new ArrayList<CounterRequestContext>(); for (final List<CounterRequestContext> rootCurrentContexts : currentRequests.values()) { allCurrentRequests.addAll(rootCurrentContexts); } CounterRequestContext.replaceParentCounters(allCurrentRequests, counters); final List<PdfCounterReport> pdfCounterReports = new ArrayList<PdfCounterReport>(); final Range range = Period.TOUT.getRange(); for (final Counter counter : counters) { final PdfCounterReport pdfCounterReport = new PdfCounterReport(collector, counter, range, false, document); pdfCounterReports.add(pdfCounterReport); } final Font normalFont = PdfFonts.NORMAL.getFont(); for (final Map.Entry<JavaInformations, List<CounterRequestContext>> entry : currentRequests .entrySet()) { final JavaInformations javaInformations = entry.getKey(); final List<CounterRequestContext> rootCurrentContexts = entry.getValue(); addParagraph(getString("Requetes_en_cours"), "hourglass.png"); if (rootCurrentContexts.isEmpty()) { addToDocument(new Phrase(getString("Aucune_requete_en_cours"), normalFont)); } else { final PdfCounterRequestContextReport pdfCounterRequestContextReport = new PdfCounterRequestContextReport( rootCurrentContexts, pdfCounterReports, javaInformations.getThreadInformationsList(), javaInformations.isStackTraceEnabled(), pdfDocumentFactory, document); pdfCounterRequestContextReport.setTimeOfSnapshot(timeOfSnapshot); pdfCounterRequestContextReport.writeContextDetails(); } } } catch (final DocumentException e) { throw createIOException(e); } document.close(); }
PdfOtherReport { public void writeAllCurrentRequestsAsPart( Map<JavaInformations, List<CounterRequestContext>> currentRequests, Collector collector, List<Counter> counters, long timeOfSnapshot) throws IOException { try { document.open(); final List<CounterRequestContext> allCurrentRequests = new ArrayList<CounterRequestContext>(); for (final List<CounterRequestContext> rootCurrentContexts : currentRequests.values()) { allCurrentRequests.addAll(rootCurrentContexts); } CounterRequestContext.replaceParentCounters(allCurrentRequests, counters); final List<PdfCounterReport> pdfCounterReports = new ArrayList<PdfCounterReport>(); final Range range = Period.TOUT.getRange(); for (final Counter counter : counters) { final PdfCounterReport pdfCounterReport = new PdfCounterReport(collector, counter, range, false, document); pdfCounterReports.add(pdfCounterReport); } final Font normalFont = PdfFonts.NORMAL.getFont(); for (final Map.Entry<JavaInformations, List<CounterRequestContext>> entry : currentRequests .entrySet()) { final JavaInformations javaInformations = entry.getKey(); final List<CounterRequestContext> rootCurrentContexts = entry.getValue(); addParagraph(getString("Requetes_en_cours"), "hourglass.png"); if (rootCurrentContexts.isEmpty()) { addToDocument(new Phrase(getString("Aucune_requete_en_cours"), normalFont)); } else { final PdfCounterRequestContextReport pdfCounterRequestContextReport = new PdfCounterRequestContextReport( rootCurrentContexts, pdfCounterReports, javaInformations.getThreadInformationsList(), javaInformations.isStackTraceEnabled(), pdfDocumentFactory, document); pdfCounterRequestContextReport.setTimeOfSnapshot(timeOfSnapshot); pdfCounterRequestContextReport.writeContextDetails(); } } } catch (final DocumentException e) { throw createIOException(e); } document.close(); } }
PdfOtherReport { public void writeAllCurrentRequestsAsPart( Map<JavaInformations, List<CounterRequestContext>> currentRequests, Collector collector, List<Counter> counters, long timeOfSnapshot) throws IOException { try { document.open(); final List<CounterRequestContext> allCurrentRequests = new ArrayList<CounterRequestContext>(); for (final List<CounterRequestContext> rootCurrentContexts : currentRequests.values()) { allCurrentRequests.addAll(rootCurrentContexts); } CounterRequestContext.replaceParentCounters(allCurrentRequests, counters); final List<PdfCounterReport> pdfCounterReports = new ArrayList<PdfCounterReport>(); final Range range = Period.TOUT.getRange(); for (final Counter counter : counters) { final PdfCounterReport pdfCounterReport = new PdfCounterReport(collector, counter, range, false, document); pdfCounterReports.add(pdfCounterReport); } final Font normalFont = PdfFonts.NORMAL.getFont(); for (final Map.Entry<JavaInformations, List<CounterRequestContext>> entry : currentRequests .entrySet()) { final JavaInformations javaInformations = entry.getKey(); final List<CounterRequestContext> rootCurrentContexts = entry.getValue(); addParagraph(getString("Requetes_en_cours"), "hourglass.png"); if (rootCurrentContexts.isEmpty()) { addToDocument(new Phrase(getString("Aucune_requete_en_cours"), normalFont)); } else { final PdfCounterRequestContextReport pdfCounterRequestContextReport = new PdfCounterRequestContextReport( rootCurrentContexts, pdfCounterReports, javaInformations.getThreadInformationsList(), javaInformations.isStackTraceEnabled(), pdfDocumentFactory, document); pdfCounterRequestContextReport.setTimeOfSnapshot(timeOfSnapshot); pdfCounterRequestContextReport.writeContextDetails(); } } } catch (final DocumentException e) { throw createIOException(e); } document.close(); } PdfOtherReport(String application, OutputStream output); }
PdfOtherReport { public void writeAllCurrentRequestsAsPart( Map<JavaInformations, List<CounterRequestContext>> currentRequests, Collector collector, List<Counter> counters, long timeOfSnapshot) throws IOException { try { document.open(); final List<CounterRequestContext> allCurrentRequests = new ArrayList<CounterRequestContext>(); for (final List<CounterRequestContext> rootCurrentContexts : currentRequests.values()) { allCurrentRequests.addAll(rootCurrentContexts); } CounterRequestContext.replaceParentCounters(allCurrentRequests, counters); final List<PdfCounterReport> pdfCounterReports = new ArrayList<PdfCounterReport>(); final Range range = Period.TOUT.getRange(); for (final Counter counter : counters) { final PdfCounterReport pdfCounterReport = new PdfCounterReport(collector, counter, range, false, document); pdfCounterReports.add(pdfCounterReport); } final Font normalFont = PdfFonts.NORMAL.getFont(); for (final Map.Entry<JavaInformations, List<CounterRequestContext>> entry : currentRequests .entrySet()) { final JavaInformations javaInformations = entry.getKey(); final List<CounterRequestContext> rootCurrentContexts = entry.getValue(); addParagraph(getString("Requetes_en_cours"), "hourglass.png"); if (rootCurrentContexts.isEmpty()) { addToDocument(new Phrase(getString("Aucune_requete_en_cours"), normalFont)); } else { final PdfCounterRequestContextReport pdfCounterRequestContextReport = new PdfCounterRequestContextReport( rootCurrentContexts, pdfCounterReports, javaInformations.getThreadInformationsList(), javaInformations.isStackTraceEnabled(), pdfDocumentFactory, document); pdfCounterRequestContextReport.setTimeOfSnapshot(timeOfSnapshot); pdfCounterRequestContextReport.writeContextDetails(); } } } catch (final DocumentException e) { throw createIOException(e); } document.close(); } PdfOtherReport(String application, OutputStream output); void close(); void writeSessionInformations(List<SessionInformations> sessionsInformations); void writeHeapHistogram(HeapHistogram heapHistogram); void writeHotspots(List<SampledMethod> hotspots); void writeProcessInformations(List<ProcessInformations> processInformations); void writeProcessInformations(
			Map<String, List<ProcessInformations>> processInformationsByTitle); void writeDatabaseInformations(DatabaseInformations databaseInformations); void writeJndi(List<JndiBinding> jndiBindings, String path); void writeMBeans(List<MBeanNode> mbeans); void writeMBeans(Map<String, List<MBeanNode>> mbeansByTitle); void writeAllCurrentRequestsAsPart(
			Map<JavaInformations, List<CounterRequestContext>> currentRequests, Collector collector,
			List<Counter> counters, long timeOfSnapshot); void writeRequestAndGraphDetail(Collector collector, CollectorServer collectorServer,
			Range range, String requestId); void writeRuntimeDependencies(Counter counter, Range range); void writeCounterSummaryPerClass(Collector collector, Counter counter, String requestId,
			Range range); void writeThreads(List<JavaInformations> javaInformationsList); }
PdfOtherReport { public void writeAllCurrentRequestsAsPart( Map<JavaInformations, List<CounterRequestContext>> currentRequests, Collector collector, List<Counter> counters, long timeOfSnapshot) throws IOException { try { document.open(); final List<CounterRequestContext> allCurrentRequests = new ArrayList<CounterRequestContext>(); for (final List<CounterRequestContext> rootCurrentContexts : currentRequests.values()) { allCurrentRequests.addAll(rootCurrentContexts); } CounterRequestContext.replaceParentCounters(allCurrentRequests, counters); final List<PdfCounterReport> pdfCounterReports = new ArrayList<PdfCounterReport>(); final Range range = Period.TOUT.getRange(); for (final Counter counter : counters) { final PdfCounterReport pdfCounterReport = new PdfCounterReport(collector, counter, range, false, document); pdfCounterReports.add(pdfCounterReport); } final Font normalFont = PdfFonts.NORMAL.getFont(); for (final Map.Entry<JavaInformations, List<CounterRequestContext>> entry : currentRequests .entrySet()) { final JavaInformations javaInformations = entry.getKey(); final List<CounterRequestContext> rootCurrentContexts = entry.getValue(); addParagraph(getString("Requetes_en_cours"), "hourglass.png"); if (rootCurrentContexts.isEmpty()) { addToDocument(new Phrase(getString("Aucune_requete_en_cours"), normalFont)); } else { final PdfCounterRequestContextReport pdfCounterRequestContextReport = new PdfCounterRequestContextReport( rootCurrentContexts, pdfCounterReports, javaInformations.getThreadInformationsList(), javaInformations.isStackTraceEnabled(), pdfDocumentFactory, document); pdfCounterRequestContextReport.setTimeOfSnapshot(timeOfSnapshot); pdfCounterRequestContextReport.writeContextDetails(); } } } catch (final DocumentException e) { throw createIOException(e); } document.close(); } PdfOtherReport(String application, OutputStream output); void close(); void writeSessionInformations(List<SessionInformations> sessionsInformations); void writeHeapHistogram(HeapHistogram heapHistogram); void writeHotspots(List<SampledMethod> hotspots); void writeProcessInformations(List<ProcessInformations> processInformations); void writeProcessInformations(
			Map<String, List<ProcessInformations>> processInformationsByTitle); void writeDatabaseInformations(DatabaseInformations databaseInformations); void writeJndi(List<JndiBinding> jndiBindings, String path); void writeMBeans(List<MBeanNode> mbeans); void writeMBeans(Map<String, List<MBeanNode>> mbeansByTitle); void writeAllCurrentRequestsAsPart(
			Map<JavaInformations, List<CounterRequestContext>> currentRequests, Collector collector,
			List<Counter> counters, long timeOfSnapshot); void writeRequestAndGraphDetail(Collector collector, CollectorServer collectorServer,
			Range range, String requestId); void writeRuntimeDependencies(Counter counter, Range range); void writeCounterSummaryPerClass(Collector collector, Counter counter, String requestId,
			Range range); void writeThreads(List<JavaInformations> javaInformationsList);  }