@Test public void testResetOfStatistics() throws Exception { addStatistics("junit.test.type.NameOne", 1, 1L, 1, 1, 1, 1, 1, new int[]{}, new int[]{}); addStatistics("junit.test.type.NameTwo", 1, 1L, 1, 1, 1, 1, 1, new int[]{}, new int[]{}); withRequestPath("/system/console/modelstatistics/api/reset"); doGet(); assertResponseIsEqualTo("{\"success\": true}"); assertStatisticsAreReset(); }
@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);  }