@Test public void testTomcatInformations() throws IOException, JMException { final MBeanServer mBeanServer = MBeans.getPlatformMBeanServer(); final List<ObjectName> mBeans = new ArrayList<ObjectName>(); try { mBeans.add(mBeanServer .registerMBean(new ThreadPool(), new ObjectName("Catalina:type=ThreadPool,name=jk-8009")) .getObjectName()); mBeans.add( mBeanServer .registerMBean(new GlobalRequestProcessor(), new ObjectName( "Catalina:type=GlobalRequestProcessor,name=jk-8009")) .getObjectName()); TomcatInformations.initMBeans(); final List<JavaInformations> myJavaInformationsList = Arrays .asList(new JavaInformations(null, true)); final HtmlJavaInformationsReport htmlReport = new HtmlJavaInformationsReport( myJavaInformationsList, writer); htmlReport.toHtml(); assertNotEmptyAndClear(writer); mBeans.add(mBeanServer .registerMBean(new ThreadPool(), new ObjectName("Catalina:type=ThreadPool,name=jk-8010")) .getObjectName()); final GlobalRequestProcessor jk8010 = new GlobalRequestProcessor(); jk8010.setrequestCount(0); mBeans.add( mBeanServer .registerMBean(jk8010, new ObjectName( "Catalina:type=GlobalRequestProcessor,name=jk-8010")) .getObjectName()); TomcatInformations.initMBeans(); final List<JavaInformations> myJavaInformationsList2 = Arrays .asList(new JavaInformations(null, true)); final HtmlJavaInformationsReport htmlReport2 = new HtmlJavaInformationsReport( myJavaInformationsList2, writer); htmlReport2.toHtml(); assertNotEmptyAndClear(writer); jk8010.setrequestCount(1000); final List<JavaInformations> myJavaInformationsList3 = Arrays .asList(new JavaInformations(null, true)); final HtmlJavaInformationsReport htmlReport3 = new HtmlJavaInformationsReport( myJavaInformationsList3, writer); htmlReport3.toHtml(); assertNotEmptyAndClear(writer); } finally { for (final ObjectName registeredMBean : mBeans) { mBeanServer.unregisterMBean(registeredMBean); } TomcatInformations.initMBeans(); } }
@Override void toHtml() throws IOException { for (final JavaInformations javaInformations : javaInformationsList) { writeSummary(javaInformations); } if (!noDatabase) { write("<br/><br/>"); } final String br = "<br/>"; if (javaInformationsList.get(0).getSessionCount() >= 0) { write(br); } if (javaInformationsList.get(0).getSystemLoadAverage() >= 0) { write(br); } writeln("<br/><br/><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"); writeShowHideLink("detailsJava", "#Details#"); writeln("<br/><br/><br/>"); writeln("<div id='detailsJava' style='display: none;'><div>"); final boolean repeatHost = javaInformationsList.size() > 1; for (final JavaInformations javaInformations : javaInformationsList) { writeDetails(javaInformations, repeatHost); } writeln("</div></div>"); }
HtmlJavaInformationsReport extends HtmlAbstractReport { @Override void toHtml() throws IOException { for (final JavaInformations javaInformations : javaInformationsList) { writeSummary(javaInformations); } if (!noDatabase) { write("<br/><br/>"); } final String br = "<br/>"; if (javaInformationsList.get(0).getSessionCount() >= 0) { write(br); } if (javaInformationsList.get(0).getSystemLoadAverage() >= 0) { write(br); } writeln("<br/><br/><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"); writeShowHideLink("detailsJava", "#Details#"); writeln("<br/><br/><br/>"); writeln("<div id='detailsJava' style='display: none;'><div>"); final boolean repeatHost = javaInformationsList.size() > 1; for (final JavaInformations javaInformations : javaInformationsList) { writeDetails(javaInformations, repeatHost); } writeln("</div></div>"); } }
HtmlJavaInformationsReport extends HtmlAbstractReport { @Override void toHtml() throws IOException { for (final JavaInformations javaInformations : javaInformationsList) { writeSummary(javaInformations); } if (!noDatabase) { write("<br/><br/>"); } final String br = "<br/>"; if (javaInformationsList.get(0).getSessionCount() >= 0) { write(br); } if (javaInformationsList.get(0).getSystemLoadAverage() >= 0) { write(br); } writeln("<br/><br/><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"); writeShowHideLink("detailsJava", "#Details#"); writeln("<br/><br/><br/>"); writeln("<div id='detailsJava' style='display: none;'><div>"); final boolean repeatHost = javaInformationsList.size() > 1; for (final JavaInformations javaInformations : javaInformationsList) { writeDetails(javaInformations, repeatHost); } writeln("</div></div>"); } HtmlJavaInformationsReport(List<JavaInformations> javaInformationsList, Writer writer); }
HtmlJavaInformationsReport extends HtmlAbstractReport { @Override void toHtml() throws IOException { for (final JavaInformations javaInformations : javaInformationsList) { writeSummary(javaInformations); } if (!noDatabase) { write("<br/><br/>"); } final String br = "<br/>"; if (javaInformationsList.get(0).getSessionCount() >= 0) { write(br); } if (javaInformationsList.get(0).getSystemLoadAverage() >= 0) { write(br); } writeln("<br/><br/><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"); writeShowHideLink("detailsJava", "#Details#"); writeln("<br/><br/><br/>"); writeln("<div id='detailsJava' style='display: none;'><div>"); final boolean repeatHost = javaInformationsList.size() > 1; for (final JavaInformations javaInformations : javaInformationsList) { writeDetails(javaInformations, repeatHost); } writeln("</div></div>"); } HtmlJavaInformationsReport(List<JavaInformations> javaInformationsList, Writer writer); static String getOSIconName(String os); static String getApplicationServerIconName(String appServer); }
HtmlJavaInformationsReport extends HtmlAbstractReport { @Override void toHtml() throws IOException { for (final JavaInformations javaInformations : javaInformationsList) { writeSummary(javaInformations); } if (!noDatabase) { write("<br/><br/>"); } final String br = "<br/>"; if (javaInformationsList.get(0).getSessionCount() >= 0) { write(br); } if (javaInformationsList.get(0).getSystemLoadAverage() >= 0) { write(br); } writeln("<br/><br/><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"); writeShowHideLink("detailsJava", "#Details#"); writeln("<br/><br/><br/>"); writeln("<div id='detailsJava' style='display: none;'><div>"); final boolean repeatHost = javaInformationsList.size() > 1; for (final JavaInformations javaInformations : javaInformationsList) { writeDetails(javaInformations, repeatHost); } writeln("</div></div>"); } HtmlJavaInformationsReport(List<JavaInformations> javaInformationsList, Writer writer); static String getOSIconName(String os); static String getApplicationServerIconName(String appServer);  }