@Test public void testRetrievalOfAllStatistics() throws Exception { addStatistics("junit.test.type.NameOne", 123456L, 100L, 5, 0, 1000, 10, 20, new int[]{1, 2, 4, 8, 16}, new int[]{10, 20, 4, 1, 0}); addStatistics("junit.test.type.NameTwo", 234567L, 200L, 10, 1, 1000, 20, 40, new int[]{2, 4, 8, 16, 23}, new int[]{20, 40, 8, 2, 0}); withRequestPath("/system/console/modelstatistics/api/statistics"); doGet(); assertResponseIsEqualTo("[" + "{" + "\"type\":\"junit.test.type.NameOne\"," + "\"since\":123456," + "\"mappableFields\":0," + "\"lazyFields\":0," + "\"greedyFields\":0," + "\"instantiations\":0," + "\"mappings\":100," + "\"averageMappingDuration\":10.0," + "\"totalMappingDuration\":1000.0," + "\"maximumMappingDuration\":20.0," + "\"minimumMappingDuration\":0.0," + "\"mappingDurationMedian\":5.0," + "\"cacheHits\":0" + "}," + "{" + "\"type\":\"junit.test.type.NameTwo\"," + "\"since\":234567," + "\"mappableFields\":0," + "\"lazyFields\":0," + "\"greedyFields\":0," + "\"instantiations\":0," + "\"mappings\":200," + "\"averageMappingDuration\":20.0," + "\"totalMappingDuration\":1000.0," + "\"maximumMappingDuration\":40.0," + "\"minimumMappingDuration\":1.0," + "\"mappingDurationMedian\":10.0," + "\"cacheHits\":0" + "}" + "]"); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String suffix = substringAfter(req.getRequestURI(), req.getServletPath() + "/" + getLabel()); if (!isBlank(suffix) && suffix.startsWith(STATISTICS_API_PATH)) { setNoCacheHeaders(res); getModelMetadata(suffix.substring(STATISTICS_API_PATH.length()), res); return; } if (!isBlank(suffix) && suffix.startsWith(RESET_API_PATH)) { setNoCacheHeaders(res); resetStatistics(res); return; } super.doGet(req, res); }
ModelStatisticsConsolePlugin extends AbstractWebConsolePlugin { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String suffix = substringAfter(req.getRequestURI(), req.getServletPath() + "/" + getLabel()); if (!isBlank(suffix) && suffix.startsWith(STATISTICS_API_PATH)) { setNoCacheHeaders(res); getModelMetadata(suffix.substring(STATISTICS_API_PATH.length()), res); return; } if (!isBlank(suffix) && suffix.startsWith(RESET_API_PATH)) { setNoCacheHeaders(res); resetStatistics(res); return; } super.doGet(req, res); } }
ModelStatisticsConsolePlugin extends AbstractWebConsolePlugin { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String suffix = substringAfter(req.getRequestURI(), req.getServletPath() + "/" + getLabel()); if (!isBlank(suffix) && suffix.startsWith(STATISTICS_API_PATH)) { setNoCacheHeaders(res); getModelMetadata(suffix.substring(STATISTICS_API_PATH.length()), res); return; } if (!isBlank(suffix) && suffix.startsWith(RESET_API_PATH)) { setNoCacheHeaders(res); resetStatistics(res); return; } super.doGet(req, res); }  }
ModelStatisticsConsolePlugin extends AbstractWebConsolePlugin { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String suffix = substringAfter(req.getRequestURI(), req.getServletPath() + "/" + getLabel()); if (!isBlank(suffix) && suffix.startsWith(STATISTICS_API_PATH)) { setNoCacheHeaders(res); getModelMetadata(suffix.substring(STATISTICS_API_PATH.length()), res); return; } if (!isBlank(suffix) && suffix.startsWith(RESET_API_PATH)) { setNoCacheHeaders(res); resetStatistics(res); return; } super.doGet(req, res); }  @SuppressWarnings("unused") String getCategory(); @Override String getLabel(); @Override String getTitle(); URL getResource(String path); }
ModelStatisticsConsolePlugin extends AbstractWebConsolePlugin { @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String suffix = substringAfter(req.getRequestURI(), req.getServletPath() + "/" + getLabel()); if (!isBlank(suffix) && suffix.startsWith(STATISTICS_API_PATH)) { setNoCacheHeaders(res); getModelMetadata(suffix.substring(STATISTICS_API_PATH.length()), res); return; } if (!isBlank(suffix) && suffix.startsWith(RESET_API_PATH)) { setNoCacheHeaders(res); resetStatistics(res); return; } super.doGet(req, res); }  @SuppressWarnings("unused") String getCategory(); @Override String getLabel(); @Override String getTitle(); URL getResource(String path);  }