public HelpPath getHelpPath(final String path) { return helpPathResolver.getHelpPath(path); } }
private String getHelpUrl(String helpKey) { return helpPathResolver.getHelpPath(helpKey).getUrl(); } }
public SupportHealthStatusBuilder(final I18nResolver i18nResolver, final HelpPathResolver helpPathResolver, final String defaultHelpLocation) { this.i18nResolver = i18nResolver; this.helpLocation = helpPathResolver.getHelpPath(defaultHelpLocation).getUrl(); }
@Test public void helpPathResolverAcceptsNullKey() { helpPathResolver.getHelpPath(null); }
private void showDetail(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { HelpPath helpPath = helpPathResolver.getHelpPath("atlassian.monitor.system.health.detail"); String url = helpPath == null ? "" : helpPath.getUrl(); // This is guaranteed not to be null as callers String path = request.getPathInfo(); if (path != null) { String[] split = path.split("/"); if (path.length() >= 4) { url += String.format("&issue=%s&%s", split[2], split[3]); Map<String, Object> params = ImmutableMap.of( "overviewUrl", baseUrl + "/plugins/servlet/system-health/overview", "nodes", monitoringService.findAllNodesWithAlerts(), "issueId", split[2], "pluginKey", split[3], "helpPath", url); render(response, "mon.system.health.detail", params); } } else { response.sendError(HttpServletResponse.SC_NOT_FOUND); } }
private void showOverview(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HelpPath helpPath = helpPathResolver.getHelpPath("atlassian.monitor.system.health"); String url = helpPath == null ? "" : helpPath.getUrl(); render(response, "mon.system.health.overview", ImmutableMap.of( "helpUrl", url, "components", monitoringService.findAllComponents(), "nodeNames", monitoringService.findAllNodesWithAlerts(), "plugins", monitoringService.findAllPluginsWithAlerts() )); } }
@Test public void helpPathKeyAndUrlNeverNull() { HelpPath path = helpPathResolver.getHelpPath("blahblahblahblah_a_random_key"); // we can verify this only if the path here isn't null if (path != null) { assertNotNull("HelpPath can never have null key", path.getKey()); assertNotNull("HelpPath can never have null url", path.getUrl()); } } }