target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void whenServerSends403StatusOnGet_returnToClient() throws Exception { factory.reportNotAuthorized(); servlet.doPost(request, response); assertThat(response.getStatus(), equalTo(SC_FORBIDDEN)); }
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
@Test public void domainNameSelector_selectsConfigurationUrl() { assertThat(MBeanSelector.DOMAIN_NAME_SELECTOR.getUrl(Protocol.HTTP, "myhost", 1234), equalTo(String.format(QueryType.CONFIGURATION_URL_PATTERN, "http", "myhost", 1234))); }
public String getUrl(Protocol protocol, String host, int port) { return protocol.format(queryType.getUrlPattern(), host, port); }
MBeanSelector { public String getUrl(Protocol protocol, String host, int port) { return protocol.format(queryType.getUrlPattern(), host, port); } }
MBeanSelector { public String getUrl(Protocol protocol, String host, int port) { return protocol.format(queryType.getUrlPattern(), host, port); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); }
MBeanSelector { public String getUrl(Protocol protocol, String host, int port) { return protocol.format(queryType.getUrlPattern(), host, port); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); static MBeanSelector create(Map<String, Object> map); Stri...
MBeanSelector { public String getUrl(Protocol protocol, String host, int port) { return protocol.format(queryType.getUrlPattern(), host, port); } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); static MBeanSelector create(Map<String, Object> map); Stri...
@Test public void domainNameSelector_requestsName() { assertThat(MBeanSelector.DOMAIN_NAME_SELECTOR.getValues(), arrayContaining("name")); }
String[] getValues() { return values == null ? NO_VALUES : values; }
MBeanSelector { String[] getValues() { return values == null ? NO_VALUES : values; } }
MBeanSelector { String[] getValues() { return values == null ? NO_VALUES : values; } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); }
MBeanSelector { String[] getValues() { return values == null ? NO_VALUES : values; } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); static MBeanSelector create(Map<String, Object> map); String getPrintableRequest(); String getRequest(); String getUrl(...
MBeanSelector { String[] getValues() { return values == null ? NO_VALUES : values; } private MBeanSelector(Map<String, Object> map); private MBeanSelector(MBeanSelector first, MBeanSelector second); static MBeanSelector create(Map<String, Object> map); String getPrintableRequest(); String getRequest(); String getUrl(...
@Test public void whenServletPathIsSlash_showSimpleLinkToMetrics() throws Exception { request.setServletPath("/"); servlet.doGet(request, response); assertThat(response.getHtml(), containsString("href=\"metrics\"")); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream()); displayForm(req, resp.getOutputS...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
@Test public void whenServletPathIsEmpty_showFullLinkToMetrics() throws Exception { request.setServletPath(""); servlet.doGet(request, response); assertThat(response.getHtml(), containsString("href=\"/exporter/metrics\"")); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream()); displayForm(req, resp.getOutputS...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
@Test public void getRequest_containsConfigurationForm() throws Exception { request.setServletPath("/"); servlet.doGet(request, response); assertThat(response.getHtml(), containsString("form action=\"" + CONFIGURATION_PAGE + "\" method=\"post\" enctype=\"multipart/form-data\"")); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream()); displayForm(req, resp.getOutputS...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
@Test public void whenServletPathIsEmpty_showFullPathToConfigurationServlet() throws Exception { request.setServletPath(""); servlet.doGet(request, response); assertThat(response.getHtml(), containsString("action=\"/exporter/" + CONFIGURATION_PAGE + "\"")); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream()); displayForm(req, resp.getOutputS...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
MainServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LiveConfiguration.updateConfiguration(); LiveConfiguration.setServer(req); resp.getOutputStream().println(ServletConstants.PAGE_HEADER); displayMetricsLink(req, resp.getOutputStream())...
@Test public void whenApacheClientDependentClassesFound_selectApacheClient() { assertThat(WebClientFactoryImpl.getClientConstructor().getDeclaringClass(), sameInstance(WebClientImpl.class)); }
static Constructor<? extends WebClient> getClientConstructor() { for (String className : CLIENT_CLASS_NAMES) { try { return getClientConstructor(className); } catch (NoClassDefFoundError | NoSuchMethodException ignored) { } } throw new IllegalStateException("Unable to select client constructor"); }
WebClientFactoryImpl implements WebClientFactory { static Constructor<? extends WebClient> getClientConstructor() { for (String className : CLIENT_CLASS_NAMES) { try { return getClientConstructor(className); } catch (NoClassDefFoundError | NoSuchMethodException ignored) { } } throw new IllegalStateException("Unable to ...
WebClientFactoryImpl implements WebClientFactory { static Constructor<? extends WebClient> getClientConstructor() { for (String className : CLIENT_CLASS_NAMES) { try { return getClientConstructor(className); } catch (NoClassDefFoundError | NoSuchMethodException ignored) { } } throw new IllegalStateException("Unable to ...
WebClientFactoryImpl implements WebClientFactory { static Constructor<? extends WebClient> getClientConstructor() { for (String className : CLIENT_CLASS_NAMES) { try { return getClientConstructor(className); } catch (NoClassDefFoundError | NoSuchMethodException ignored) { } } throw new IllegalStateException("Unable to ...
WebClientFactoryImpl implements WebClientFactory { static Constructor<? extends WebClient> getClientConstructor() { for (String className : CLIENT_CLASS_NAMES) { try { return getClientConstructor(className); } catch (NoClassDefFoundError | NoSuchMethodException ignored) { } } throw new IllegalStateException("Unable to ...
@Test public void whenApacheClientDependentClassesMissing_selectJKD8Client() throws NoSuchFieldException { mementos.add(StaticStubSupport.install(WebClientFactoryImpl.class, "loadClientClass", apacheClassesMissing)); assertThat(WebClientFactoryImpl.getClientConstructor().getDeclaringClass(), sameInstance(WebClient8Impl...
static Constructor<? extends WebClient> getClientConstructor() { for (String className : CLIENT_CLASS_NAMES) { try { return getClientConstructor(className); } catch (NoClassDefFoundError | NoSuchMethodException ignored) { } } throw new IllegalStateException("Unable to select client constructor"); }
WebClientFactoryImpl implements WebClientFactory { static Constructor<? extends WebClient> getClientConstructor() { for (String className : CLIENT_CLASS_NAMES) { try { return getClientConstructor(className); } catch (NoClassDefFoundError | NoSuchMethodException ignored) { } } throw new IllegalStateException("Unable to ...
WebClientFactoryImpl implements WebClientFactory { static Constructor<? extends WebClient> getClientConstructor() { for (String className : CLIENT_CLASS_NAMES) { try { return getClientConstructor(className); } catch (NoClassDefFoundError | NoSuchMethodException ignored) { } } throw new IllegalStateException("Unable to ...
WebClientFactoryImpl implements WebClientFactory { static Constructor<? extends WebClient> getClientConstructor() { for (String className : CLIENT_CLASS_NAMES) { try { return getClientConstructor(className); } catch (NoClassDefFoundError | NoSuchMethodException ignored) { } } throw new IllegalStateException("Unable to ...
WebClientFactoryImpl implements WebClientFactory { static Constructor<? extends WebClient> getClientConstructor() { for (String className : CLIENT_CLASS_NAMES) { try { return getClientConstructor(className); } catch (NoClassDefFoundError | NoSuchMethodException ignored) { } } throw new IllegalStateException("Unable to ...
@Test public void whenSourceAndTargetAbsolute_useAbsolutePaths() throws Exception { setMojoParameter("sourceFile", "/root/source"); setMojoParameter("targetFile", new File("/root/target")); mojo.execute(); assertThat(copyExecutorStub.sourcePath, equalTo("/root/source")); assertThat(copyExecutorStub.targetPath, equalTo(...
public void execute() throws MojoExecutionException { Path source = toPath(sourceFile); Path target = toPath(targetFile); try { getLog().info("Copying " + source + " to " + target); executor.copyFile(source, target); } catch (IOException e) { throw new MojoExecutionException("Unable to copy " + source + " to " + target...
BuildHelperMojo extends AbstractMojo { public void execute() throws MojoExecutionException { Path source = toPath(sourceFile); Path target = toPath(targetFile); try { getLog().info("Copying " + source + " to " + target); executor.copyFile(source, target); } catch (IOException e) { throw new MojoExecutionException("Unab...
BuildHelperMojo extends AbstractMojo { public void execute() throws MojoExecutionException { Path source = toPath(sourceFile); Path target = toPath(targetFile); try { getLog().info("Copying " + source + " to " + target); executor.copyFile(source, target); } catch (IOException e) { throw new MojoExecutionException("Unab...
BuildHelperMojo extends AbstractMojo { public void execute() throws MojoExecutionException { Path source = toPath(sourceFile); Path target = toPath(targetFile); try { getLog().info("Copying " + source + " to " + target); executor.copyFile(source, target); } catch (IOException e) { throw new MojoExecutionException("Unab...
BuildHelperMojo extends AbstractMojo { public void execute() throws MojoExecutionException { Path source = toPath(sourceFile); Path target = toPath(targetFile); try { getLog().info("Copying " + source + " to " + target); executor.copyFile(source, target); } catch (IOException e) { throw new MojoExecutionException("Unab...
@Test public void whenSourcePathIsRelative_computeAbsoluteRelativeToUserDir() throws Exception { setMojoParameter("sourceFile", "source"); setMojoParameter("targetFile", new File("/root/target")); setMojoParameter("userDir", new File("/root/nested")); mojo.execute(); assertThat(copyExecutorStub.sourcePath, equalTo("/ro...
public void execute() throws MojoExecutionException { Path source = toPath(sourceFile); Path target = toPath(targetFile); try { getLog().info("Copying " + source + " to " + target); executor.copyFile(source, target); } catch (IOException e) { throw new MojoExecutionException("Unable to copy " + source + " to " + target...
BuildHelperMojo extends AbstractMojo { public void execute() throws MojoExecutionException { Path source = toPath(sourceFile); Path target = toPath(targetFile); try { getLog().info("Copying " + source + " to " + target); executor.copyFile(source, target); } catch (IOException e) { throw new MojoExecutionException("Unab...
BuildHelperMojo extends AbstractMojo { public void execute() throws MojoExecutionException { Path source = toPath(sourceFile); Path target = toPath(targetFile); try { getLog().info("Copying " + source + " to " + target); executor.copyFile(source, target); } catch (IOException e) { throw new MojoExecutionException("Unab...
BuildHelperMojo extends AbstractMojo { public void execute() throws MojoExecutionException { Path source = toPath(sourceFile); Path target = toPath(targetFile); try { getLog().info("Copying " + source + " to " + target); executor.copyFile(source, target); } catch (IOException e) { throw new MojoExecutionException("Unab...
BuildHelperMojo extends AbstractMojo { public void execute() throws MojoExecutionException { Path source = toPath(sourceFile); Path target = toPath(targetFile); try { getLog().info("Copying " + source + " to " + target); executor.copyFile(source, target); } catch (IOException e) { throw new MojoExecutionException("Unab...
@Test public void whenServerSends401StatusOnGet_returnToClient() throws Exception { factory.reportAuthenticationRequired("Test-Realm"); servlet.doPost(request, response); assertThat(response.getStatus(), equalTo(SC_UNAUTHORIZED)); assertThat(response, containsHeader("WWW-Authenticate", "Basic realm=\"Test-Realm\"")); }
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
@Test public void whenSourcePathIsRelativeAndNoUserDir_useSystemProperty() throws Exception { System.setProperty("user.dir", "/user"); setMojoParameter("sourceFile", "source"); setMojoParameter("targetFile", new File("/root/target")); mojo.execute(); assertThat(copyExecutorStub.sourcePath, equalTo("/user/source")); ass...
public void execute() throws MojoExecutionException { Path source = toPath(sourceFile); Path target = toPath(targetFile); try { getLog().info("Copying " + source + " to " + target); executor.copyFile(source, target); } catch (IOException e) { throw new MojoExecutionException("Unable to copy " + source + " to " + target...
BuildHelperMojo extends AbstractMojo { public void execute() throws MojoExecutionException { Path source = toPath(sourceFile); Path target = toPath(targetFile); try { getLog().info("Copying " + source + " to " + target); executor.copyFile(source, target); } catch (IOException e) { throw new MojoExecutionException("Unab...
BuildHelperMojo extends AbstractMojo { public void execute() throws MojoExecutionException { Path source = toPath(sourceFile); Path target = toPath(targetFile); try { getLog().info("Copying " + source + " to " + target); executor.copyFile(source, target); } catch (IOException e) { throw new MojoExecutionException("Unab...
BuildHelperMojo extends AbstractMojo { public void execute() throws MojoExecutionException { Path source = toPath(sourceFile); Path target = toPath(targetFile); try { getLog().info("Copying " + source + " to " + target); executor.copyFile(source, target); } catch (IOException e) { throw new MojoExecutionException("Unab...
BuildHelperMojo extends AbstractMojo { public void execute() throws MojoExecutionException { Path source = toPath(sourceFile); Path target = toPath(targetFile); try { getLog().info("Copying " + source + " to " + target); executor.copyFile(source, target); } catch (IOException e) { throw new MojoExecutionException("Unab...
@Test public void afterExceptionReported_isAddedToLog() { errorLog.log(new IOException("Unable to read value")); assertThat(errorLog, containsErrors("IOException: Unable to read value")); }
void log(Throwable throwable) { errors.append(toLogMessage(throwable)); for (Throwable cause = throwable.getCause(); cause != null; cause = cause.getCause()) errors.append(System.lineSeparator()).append(" ").append(toLogMessage(cause)); }
ErrorLog { void log(Throwable throwable) { errors.append(toLogMessage(throwable)); for (Throwable cause = throwable.getCause(); cause != null; cause = cause.getCause()) errors.append(System.lineSeparator()).append(" ").append(toLogMessage(cause)); } }
ErrorLog { void log(Throwable throwable) { errors.append(toLogMessage(throwable)); for (Throwable cause = throwable.getCause(); cause != null; cause = cause.getCause()) errors.append(System.lineSeparator()).append(" ").append(toLogMessage(cause)); } }
ErrorLog { void log(Throwable throwable) { errors.append(toLogMessage(throwable)); for (Throwable cause = throwable.getCause(); cause != null; cause = cause.getCause()) errors.append(System.lineSeparator()).append(" ").append(toLogMessage(cause)); } }
ErrorLog { void log(Throwable throwable) { errors.append(toLogMessage(throwable)); for (Throwable cause = throwable.getCause(); cause != null; cause = cause.getCause()) errors.append(System.lineSeparator()).append(" ").append(toLogMessage(cause)); } }
@Test public void afterExceptionWithNoMessageReported_logSimpleNameOnly() { errorLog.log(new IOException()); assertThat(errorLog, containsErrors("IOException")); }
void log(Throwable throwable) { errors.append(toLogMessage(throwable)); for (Throwable cause = throwable.getCause(); cause != null; cause = cause.getCause()) errors.append(System.lineSeparator()).append(" ").append(toLogMessage(cause)); }
ErrorLog { void log(Throwable throwable) { errors.append(toLogMessage(throwable)); for (Throwable cause = throwable.getCause(); cause != null; cause = cause.getCause()) errors.append(System.lineSeparator()).append(" ").append(toLogMessage(cause)); } }
ErrorLog { void log(Throwable throwable) { errors.append(toLogMessage(throwable)); for (Throwable cause = throwable.getCause(); cause != null; cause = cause.getCause()) errors.append(System.lineSeparator()).append(" ").append(toLogMessage(cause)); } }
ErrorLog { void log(Throwable throwable) { errors.append(toLogMessage(throwable)); for (Throwable cause = throwable.getCause(); cause != null; cause = cause.getCause()) errors.append(System.lineSeparator()).append(" ").append(toLogMessage(cause)); } }
ErrorLog { void log(Throwable throwable) { errors.append(toLogMessage(throwable)); for (Throwable cause = throwable.getCause(); cause != null; cause = cause.getCause()) errors.append(System.lineSeparator()).append(" ").append(toLogMessage(cause)); } }
@Test public void afterExceptionWithNestedThrowableReported_addToLog() { errorLog.log(new IOException("Unable to read value", new RuntimeException("has impossible format"))); assertThat(errorLog, containsErrors("IOException: Unable to read value", " RuntimeException: has impossible format")); }
void log(Throwable throwable) { errors.append(toLogMessage(throwable)); for (Throwable cause = throwable.getCause(); cause != null; cause = cause.getCause()) errors.append(System.lineSeparator()).append(" ").append(toLogMessage(cause)); }
ErrorLog { void log(Throwable throwable) { errors.append(toLogMessage(throwable)); for (Throwable cause = throwable.getCause(); cause != null; cause = cause.getCause()) errors.append(System.lineSeparator()).append(" ").append(toLogMessage(cause)); } }
ErrorLog { void log(Throwable throwable) { errors.append(toLogMessage(throwable)); for (Throwable cause = throwable.getCause(); cause != null; cause = cause.getCause()) errors.append(System.lineSeparator()).append(" ").append(toLogMessage(cause)); } }
ErrorLog { void log(Throwable throwable) { errors.append(toLogMessage(throwable)); for (Throwable cause = throwable.getCause(); cause != null; cause = cause.getCause()) errors.append(System.lineSeparator()).append(" ").append(toLogMessage(cause)); } }
ErrorLog { void log(Throwable throwable) { errors.append(toLogMessage(throwable)); for (Throwable cause = throwable.getCause(); cause != null; cause = cause.getCause()) errors.append(System.lineSeparator()).append(" ").append(toLogMessage(cause)); } }
@Test public void whenUnableToReachServer_returnedTimestampIsZero() { factory.throwWebClientException(new WebClientException()); assertThat(impl.getLatestConfigurationTimestamp(), equalTo(0L)); }
@Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); }
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } }
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } ConfigurationUpdaterImpl(QuerySyncConfiguration syncConfiguration, ErrorLog errorLog); ConfigurationUpdaterImpl(Clock cloc...
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } ConfigurationUpdaterImpl(QuerySyncConfiguration syncConfiguration, ErrorLog errorLog); ConfigurationUpdaterImpl(Clock cloc...
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } ConfigurationUpdaterImpl(QuerySyncConfiguration syncConfiguration, ErrorLog errorLog); ConfigurationUpdaterImpl(Clock cloc...
@Test public void extractTimestampFromReply() { factory.addJsonResponse(RESPONSE_1); assertThat(impl.getLatestConfigurationTimestamp(), equalTo(TIMESTAMP_1)); }
@Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); }
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } }
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } ConfigurationUpdaterImpl(QuerySyncConfiguration syncConfiguration, ErrorLog errorLog); ConfigurationUpdaterImpl(Clock cloc...
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } ConfigurationUpdaterImpl(QuerySyncConfiguration syncConfiguration, ErrorLog errorLog); ConfigurationUpdaterImpl(Clock cloc...
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } ConfigurationUpdaterImpl(QuerySyncConfiguration syncConfiguration, ErrorLog errorLog); ConfigurationUpdaterImpl(Clock cloc...
@Test public void whenAskedForConfigurationWithinUpdateInterval_returnCachedValue() { clock.setCurrentMsec(0); factory.addJsonResponse(RESPONSE_1); impl.getLatestConfigurationTimestamp(); clock.incrementSeconds(REFRESH_INTERVAL / 2); factory.addJsonResponse(RESPONSE_2); assertThat(impl.getLatestConfigurationTimestamp()...
@Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); }
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } }
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } ConfigurationUpdaterImpl(QuerySyncConfiguration syncConfiguration, ErrorLog errorLog); ConfigurationUpdaterImpl(Clock cloc...
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } ConfigurationUpdaterImpl(QuerySyncConfiguration syncConfiguration, ErrorLog errorLog); ConfigurationUpdaterImpl(Clock cloc...
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } ConfigurationUpdaterImpl(QuerySyncConfiguration syncConfiguration, ErrorLog errorLog); ConfigurationUpdaterImpl(Clock cloc...
@Test public void whenAskedForConfigurationAfterUpdateInterval_returnNewValue() { clock.setCurrentMsec(0); factory.addJsonResponse(RESPONSE_1); impl.getLatestConfigurationTimestamp(); clock.incrementSeconds(REFRESH_INTERVAL); factory.addJsonResponse(RESPONSE_2); assertThat(impl.getLatestConfigurationTimestamp(), equalT...
@Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); }
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } }
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } ConfigurationUpdaterImpl(QuerySyncConfiguration syncConfiguration, ErrorLog errorLog); ConfigurationUpdaterImpl(Clock cloc...
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } ConfigurationUpdaterImpl(QuerySyncConfiguration syncConfiguration, ErrorLog errorLog); ConfigurationUpdaterImpl(Clock cloc...
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public long getLatestConfigurationTimestamp() { getLatestConfiguration(); return latest == null ? 0 : latest.getTimestamp(); } ConfigurationUpdaterImpl(QuerySyncConfiguration syncConfiguration, ErrorLog errorLog); ConfigurationUpdaterImpl(Clock cloc...
@Test public void whenRequestUsesHttp_authenticateWithHttp() throws Exception { servlet.doPost(createUploadRequest(createEncodedForm("replace", CONFIGURATION)), response); assertThat(factory.getClientUrl(), Matchers.startsWith("http:")); }
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
@Test public void afterRetrieveUpdate_returnIt() { factory.addJsonResponse(RESPONSE_1); assertThat(impl.getUpdate().getConfiguration(), equalTo(CONFIGURATION_1)); }
@Override public ConfigurationUpdate getUpdate() { getLatestConfiguration(); return latest; }
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public ConfigurationUpdate getUpdate() { getLatestConfiguration(); return latest; } }
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public ConfigurationUpdate getUpdate() { getLatestConfiguration(); return latest; } ConfigurationUpdaterImpl(QuerySyncConfiguration syncConfiguration, ErrorLog errorLog); ConfigurationUpdaterImpl(Clock clock, WebClientFactory factory); }
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public ConfigurationUpdate getUpdate() { getLatestConfiguration(); return latest; } ConfigurationUpdaterImpl(QuerySyncConfiguration syncConfiguration, ErrorLog errorLog); ConfigurationUpdaterImpl(Clock clock, WebClientFactory factory); @Override lon...
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public ConfigurationUpdate getUpdate() { getLatestConfiguration(); return latest; } ConfigurationUpdaterImpl(QuerySyncConfiguration syncConfiguration, ErrorLog errorLog); ConfigurationUpdaterImpl(Clock clock, WebClientFactory factory); @Override lon...
@Test public void onShareConfiguration_sendsConfigurationInJsonObject() { impl.shareConfiguration(CONFIGURATION_1); assertThat(factory.getPostedString(), hasJsonPath("$.configuration").withValue(CONFIGURATION_1)); }
@Override public void shareConfiguration(String configuration) { try { WebClient client = factory.createClient().withUrl(repeaterUrl); client.doPutRequest(new Gson().toJson(createUpdate(configuration))); } catch (IOException | WebClientException e) { errorLog.log(e); } }
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public void shareConfiguration(String configuration) { try { WebClient client = factory.createClient().withUrl(repeaterUrl); client.doPutRequest(new Gson().toJson(createUpdate(configuration))); } catch (IOException | WebClientException e) { errorLog.l...
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public void shareConfiguration(String configuration) { try { WebClient client = factory.createClient().withUrl(repeaterUrl); client.doPutRequest(new Gson().toJson(createUpdate(configuration))); } catch (IOException | WebClientException e) { errorLog.l...
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public void shareConfiguration(String configuration) { try { WebClient client = factory.createClient().withUrl(repeaterUrl); client.doPutRequest(new Gson().toJson(createUpdate(configuration))); } catch (IOException | WebClientException e) { errorLog.l...
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public void shareConfiguration(String configuration) { try { WebClient client = factory.createClient().withUrl(repeaterUrl); client.doPutRequest(new Gson().toJson(createUpdate(configuration))); } catch (IOException | WebClientException e) { errorLog.l...
@Test public void onShareConfiguration_sendsTimestampInJsonObject() { clock.setCurrentMsec(23); impl.shareConfiguration(CONFIGURATION_1); assertThat(factory.getPostedString(), hasJsonPath("$.timestamp").withValue(23)); }
@Override public void shareConfiguration(String configuration) { try { WebClient client = factory.createClient().withUrl(repeaterUrl); client.doPutRequest(new Gson().toJson(createUpdate(configuration))); } catch (IOException | WebClientException e) { errorLog.log(e); } }
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public void shareConfiguration(String configuration) { try { WebClient client = factory.createClient().withUrl(repeaterUrl); client.doPutRequest(new Gson().toJson(createUpdate(configuration))); } catch (IOException | WebClientException e) { errorLog.l...
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public void shareConfiguration(String configuration) { try { WebClient client = factory.createClient().withUrl(repeaterUrl); client.doPutRequest(new Gson().toJson(createUpdate(configuration))); } catch (IOException | WebClientException e) { errorLog.l...
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public void shareConfiguration(String configuration) { try { WebClient client = factory.createClient().withUrl(repeaterUrl); client.doPutRequest(new Gson().toJson(createUpdate(configuration))); } catch (IOException | WebClientException e) { errorLog.l...
ConfigurationUpdaterImpl implements ConfigurationUpdater { @Override public void shareConfiguration(String configuration) { try { WebClient client = factory.createClient().withUrl(repeaterUrl); client.doPutRequest(new Gson().toJson(createUpdate(configuration))); } catch (IOException | WebClientException e) { errorLog.l...
@Test public void whenCreated_boundaryIsDefined() { assertThat(parser.getBoundary(), equalTo(BOUNDARY)); }
String getBoundary() { return boundary; }
MultipartContentParser implements ParserActions { String getBoundary() { return boundary; } }
MultipartContentParser implements ParserActions { String getBoundary() { return boundary; } MultipartContentParser(String contentType); }
MultipartContentParser implements ParserActions { String getBoundary() { return boundary; } MultipartContentParser(String contentType); ParserState getState(); @Override boolean isStart(String line); @Override boolean isEnd(String line); @Override ParserState closeItem(ParserState state); @Override ParserState addHeade...
MultipartContentParser implements ParserActions { String getBoundary() { return boundary; } MultipartContentParser(String contentType); ParserState getState(); @Override boolean isStart(String line); @Override boolean isEnd(String line); @Override ParserState closeItem(ParserState state); @Override ParserState addHeade...
@Test public void parseInitialState() { assertThat(parser.getState(), sameInstance(ParserState.INITIAL)); }
public ParserState getState() { return state; }
MultipartContentParser implements ParserActions { public ParserState getState() { return state; } }
MultipartContentParser implements ParserActions { public ParserState getState() { return state; } MultipartContentParser(String contentType); }
MultipartContentParser implements ParserActions { public ParserState getState() { return state; } MultipartContentParser(String contentType); ParserState getState(); @Override boolean isStart(String line); @Override boolean isEnd(String line); @Override ParserState closeItem(ParserState state); @Override ParserState ad...
MultipartContentParser implements ParserActions { public ParserState getState() { return state; } MultipartContentParser(String contentType); ParserState getState(); @Override boolean isStart(String line); @Override boolean isEnd(String line); @Override ParserState closeItem(ParserState state); @Override ParserState ad...
@Test public void WhenNoContentReceived_itemHasEmptyData() { assertThat(parser.getCurrentItem().getString(), equalTo("")); }
MultipartItem getCurrentItem() { if (currentItem == null) currentItem = new MultipartItemImpl(); return currentItem; }
MultipartContentParser implements ParserActions { MultipartItem getCurrentItem() { if (currentItem == null) currentItem = new MultipartItemImpl(); return currentItem; } }
MultipartContentParser implements ParserActions { MultipartItem getCurrentItem() { if (currentItem == null) currentItem = new MultipartItemImpl(); return currentItem; } MultipartContentParser(String contentType); }
MultipartContentParser implements ParserActions { MultipartItem getCurrentItem() { if (currentItem == null) currentItem = new MultipartItemImpl(); return currentItem; } MultipartContentParser(String contentType); ParserState getState(); @Override boolean isStart(String line); @Override boolean isEnd(String line); @Over...
MultipartContentParser implements ParserActions { MultipartItem getCurrentItem() { if (currentItem == null) currentItem = new MultipartItemImpl(); return currentItem; } MultipartContentParser(String contentType); ParserState getState(); @Override boolean isStart(String line); @Override boolean isEnd(String line); @Over...
@Test(expected = ServletException.class) public void whenMultipartRequestNotParseable_throwException() throws ServletException { HttpServletRequest request = HttpServletRequestStub.createPostRequest(); MultipartContentParser.parse(request); }
static List<MultipartItem> parse(HttpServletRequest request) throws ServletException { try { final MultipartContentParser parser = new MultipartContentParser(request.getContentType()); new BufferedReader(new InputStreamReader(request.getInputStream())).lines().forEach(parser::process); return parser.getItems(); } catch...
MultipartContentParser implements ParserActions { static List<MultipartItem> parse(HttpServletRequest request) throws ServletException { try { final MultipartContentParser parser = new MultipartContentParser(request.getContentType()); new BufferedReader(new InputStreamReader(request.getInputStream())).lines().forEach(p...
MultipartContentParser implements ParserActions { static List<MultipartItem> parse(HttpServletRequest request) throws ServletException { try { final MultipartContentParser parser = new MultipartContentParser(request.getContentType()); new BufferedReader(new InputStreamReader(request.getInputStream())).lines().forEach(p...
MultipartContentParser implements ParserActions { static List<MultipartItem> parse(HttpServletRequest request) throws ServletException { try { final MultipartContentParser parser = new MultipartContentParser(request.getContentType()); new BufferedReader(new InputStreamReader(request.getInputStream())).lines().forEach(p...
MultipartContentParser implements ParserActions { static List<MultipartItem> parse(HttpServletRequest request) throws ServletException { try { final MultipartContentParser parser = new MultipartContentParser(request.getContentType()); new BufferedReader(new InputStreamReader(request.getInputStream())).lines().forEach(p...
@Test public void whenNoRestPortDefined_generateUrl() { UrlBuilder builder = new UrlBuilder(request, null); assertThat(builder.createUrl(URL_PATTERN), equalTo(String.format(URL_PATTERN, "http", "localhost", LOCAL_PORT))); }
public String createUrl(String urlPattern) { return protocol.format(urlPattern, host, selectPort()); }
UrlBuilder { public String createUrl(String urlPattern) { return protocol.format(urlPattern, host, selectPort()); } }
UrlBuilder { public String createUrl(String urlPattern) { return protocol.format(urlPattern, host, selectPort()); } UrlBuilder(HttpServletRequest request, Integer restPort); }
UrlBuilder { public String createUrl(String urlPattern) { return protocol.format(urlPattern, host, selectPort()); } UrlBuilder(HttpServletRequest request, Integer restPort); static void clearHistory(); String createUrl(String urlPattern); void reportSuccess(); void reportFailure(WebClientException connectionException);...
UrlBuilder { public String createUrl(String urlPattern) { return protocol.format(urlPattern, host, selectPort()); } UrlBuilder(HttpServletRequest request, Integer restPort); static void clearHistory(); String createUrl(String urlPattern); void reportSuccess(); void reportFailure(WebClientException connectionException);...
@Test public void whenRestPortDefined_generateUrlWithRestPort() { UrlBuilder builder = new UrlBuilder(request, REST_PORT); assertThat(builder.createUrl(URL_PATTERN), equalTo(String.format(URL_PATTERN, "http", "localhost", REST_PORT))); }
public String createUrl(String urlPattern) { return protocol.format(urlPattern, host, selectPort()); }
UrlBuilder { public String createUrl(String urlPattern) { return protocol.format(urlPattern, host, selectPort()); } }
UrlBuilder { public String createUrl(String urlPattern) { return protocol.format(urlPattern, host, selectPort()); } UrlBuilder(HttpServletRequest request, Integer restPort); }
UrlBuilder { public String createUrl(String urlPattern) { return protocol.format(urlPattern, host, selectPort()); } UrlBuilder(HttpServletRequest request, Integer restPort); static void clearHistory(); String createUrl(String urlPattern); void reportSuccess(); void reportFailure(WebClientException connectionException);...
UrlBuilder { public String createUrl(String urlPattern) { return protocol.format(urlPattern, host, selectPort()); } UrlBuilder(HttpServletRequest request, Integer restPort); static void clearHistory(); String createUrl(String urlPattern); void reportSuccess(); void reportFailure(WebClientException connectionException);...
@Test public void afterMaximumExchangesAdded_retrieveAllExchanges() { IntStream.rangeClosed(1, MAX_EXCHANGES).forEach(this::addTestExchange); assertThat(MessagesServlet.getMessages(), contains(getExchangeMatchers(1, MAX_EXCHANGES))); }
static List<String> getMessages() { return new ArrayList<>(messages); }
MessagesServlet extends HttpServlet { static List<String> getMessages() { return new ArrayList<>(messages); } }
MessagesServlet extends HttpServlet { static List<String> getMessages() { return new ArrayList<>(messages); } }
MessagesServlet extends HttpServlet { static List<String> getMessages() { return new ArrayList<>(messages); } }
MessagesServlet extends HttpServlet { static List<String> getMessages() { return new ArrayList<>(messages); } }
@Test public void whenRequestUsesHttps_authenticateWithHttps() throws Exception { HttpServletRequestStub request = createUploadRequest(createEncodedForm("replace", CONFIGURATION)); request.setSecure(true); servlet.doPost(request, response); assertThat(factory.getClientUrl(), Matchers.startsWith("https:")); }
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
@Test public void afterMoreThanMaximumExchangesAdded_retrieveLastMExchanges() { IntStream.rangeClosed(1, MAX_EXCHANGES+EXCESS_EXCHANGES).forEach(this::addTestExchange); assertThat(MessagesServlet.getMessages(), contains(getExchangeMatchers(EXCESS_EXCHANGES+1, MAX_EXCHANGES+EXCESS_EXCHANGES))); }
static List<String> getMessages() { return new ArrayList<>(messages); }
MessagesServlet extends HttpServlet { static List<String> getMessages() { return new ArrayList<>(messages); } }
MessagesServlet extends HttpServlet { static List<String> getMessages() { return new ArrayList<>(messages); } }
MessagesServlet extends HttpServlet { static List<String> getMessages() { return new ArrayList<>(messages); } }
MessagesServlet extends HttpServlet { static List<String> getMessages() { return new ArrayList<>(messages); } }
@Test public void whenServletInvoked_responseDisplaysRecentExchanges() throws IOException { IntStream.rangeClosed(1, MAX_EXCHANGES).forEach(this::addTestExchange); servlet.doGet(request, response); assertThat(response.getHtml(), containsString("request 4")); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { try(ServletOutputStream out = resp.getOutputStream()) { for (String message : messages) out.println(message); } }
MessagesServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { try(ServletOutputStream out = resp.getOutputStream()) { for (String message : messages) out.println(message); } } }
MessagesServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { try(ServletOutputStream out = resp.getOutputStream()) { for (String message : messages) out.println(message); } } }
MessagesServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { try(ServletOutputStream out = resp.getOutputStream()) { for (String message : messages) out.println(message); } } }
MessagesServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { try(ServletOutputStream out = resp.getOutputStream()) { for (String message : messages) out.println(message); } } }
@Test public void whenInitNotCalled_haveNoQueries() { assertThat(LiveConfiguration.hasQueries(), is(false)); }
static boolean hasQueries() { return getConfig() != null && getConfig().getQueries().length > 0; }
LiveConfiguration { static boolean hasQueries() { return getConfig() != null && getConfig().getQueries().length > 0; } }
LiveConfiguration { static boolean hasQueries() { return getConfig() != null && getConfig().getQueries().length > 0; } }
LiveConfiguration { static boolean hasQueries() { return getConfig() != null && getConfig().getQueries().length > 0; } }
LiveConfiguration { static boolean hasQueries() { return getConfig() != null && getConfig().getQueries().length > 0; } }
@Test public void whenConfigurationSpecifiesSynchronization_installHttpBasedUpdater() throws Exception { init(CONFIGURATION_WITH_SYNC); assertThat(getConfigurationUpdater(), instanceOf(ConfigurationUpdaterImpl.class)); }
static void init(ServletConfig servletConfig) { if (timestamp != null) return; InputStream configurationFile = getConfigurationFile(servletConfig); initialize(Optional.ofNullable(configurationFile) .map(ExporterConfig::loadConfig) .orElse(ExporterConfig.createEmptyConfig())); }
LiveConfiguration { static void init(ServletConfig servletConfig) { if (timestamp != null) return; InputStream configurationFile = getConfigurationFile(servletConfig); initialize(Optional.ofNullable(configurationFile) .map(ExporterConfig::loadConfig) .orElse(ExporterConfig.createEmptyConfig())); } }
LiveConfiguration { static void init(ServletConfig servletConfig) { if (timestamp != null) return; InputStream configurationFile = getConfigurationFile(servletConfig); initialize(Optional.ofNullable(configurationFile) .map(ExporterConfig::loadConfig) .orElse(ExporterConfig.createEmptyConfig())); } }
LiveConfiguration { static void init(ServletConfig servletConfig) { if (timestamp != null) return; InputStream configurationFile = getConfigurationFile(servletConfig); initialize(Optional.ofNullable(configurationFile) .map(ExporterConfig::loadConfig) .orElse(ExporterConfig.createEmptyConfig())); } }
LiveConfiguration { static void init(ServletConfig servletConfig) { if (timestamp != null) return; InputStream configurationFile = getConfigurationFile(servletConfig); initialize(Optional.ofNullable(configurationFile) .map(ExporterConfig::loadConfig) .orElse(ExporterConfig.createEmptyConfig())); } }
@Test public void whenConfigurationSpecifiesSynchronization_configureUpdater() throws Exception { init(CONFIGURATION_WITH_SYNC); ConfigurationUpdaterImpl configurationUpdater = (ConfigurationUpdaterImpl) getConfigurationUpdater(); assertThat(configurationUpdater.getRepeaterUrl(), equalTo(SYNC_URL)); assertThat(configur...
static void init(ServletConfig servletConfig) { if (timestamp != null) return; InputStream configurationFile = getConfigurationFile(servletConfig); initialize(Optional.ofNullable(configurationFile) .map(ExporterConfig::loadConfig) .orElse(ExporterConfig.createEmptyConfig())); }
LiveConfiguration { static void init(ServletConfig servletConfig) { if (timestamp != null) return; InputStream configurationFile = getConfigurationFile(servletConfig); initialize(Optional.ofNullable(configurationFile) .map(ExporterConfig::loadConfig) .orElse(ExporterConfig.createEmptyConfig())); } }
LiveConfiguration { static void init(ServletConfig servletConfig) { if (timestamp != null) return; InputStream configurationFile = getConfigurationFile(servletConfig); initialize(Optional.ofNullable(configurationFile) .map(ExporterConfig::loadConfig) .orElse(ExporterConfig.createEmptyConfig())); } }
LiveConfiguration { static void init(ServletConfig servletConfig) { if (timestamp != null) return; InputStream configurationFile = getConfigurationFile(servletConfig); initialize(Optional.ofNullable(configurationFile) .map(ExporterConfig::loadConfig) .orElse(ExporterConfig.createEmptyConfig())); } }
LiveConfiguration { static void init(ServletConfig servletConfig) { if (timestamp != null) return; InputStream configurationFile = getConfigurationFile(servletConfig); initialize(Optional.ofNullable(configurationFile) .map(ExporterConfig::loadConfig) .orElse(ExporterConfig.createEmptyConfig())); } }
@Test public void whenNoErrorsReported_saySo() throws ServletException, IOException { servlet.doGet(request, response); assertThat(response.getHtml(), containsString("No errors reported.")); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { String errors = LiveConfiguration.getErrors(); if (errors == null || errors.trim().length() == 0) resp.getOutputStream().println("No errors reported."); else resp.getOutputStream().println("<blockquote>" + errors + "</...
LogServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { String errors = LiveConfiguration.getErrors(); if (errors == null || errors.trim().length() == 0) resp.getOutputStream().println("No errors reported."); else resp.getOutputStream().prin...
LogServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { String errors = LiveConfiguration.getErrors(); if (errors == null || errors.trim().length() == 0) resp.getOutputStream().println("No errors reported."); else resp.getOutputStream().prin...
LogServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { String errors = LiveConfiguration.getErrors(); if (errors == null || errors.trim().length() == 0) resp.getOutputStream().println("No errors reported."); else resp.getOutputStream().prin...
LogServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { String errors = LiveConfiguration.getErrors(); if (errors == null || errors.trim().length() == 0) resp.getOutputStream().println("No errors reported."); else resp.getOutputStream().prin...
@Test public void whenErrorsReported_listThem() throws NoSuchFieldException, ServletException, IOException { ErrorLog errorLog = new ErrorLog(); mementos.add(StaticStubSupport.install(LiveConfiguration.class, "errorLog", errorLog)); errorLog.log(new WebClientException("Unable to reach server")); servlet.doGet(request, ...
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { String errors = LiveConfiguration.getErrors(); if (errors == null || errors.trim().length() == 0) resp.getOutputStream().println("No errors reported."); else resp.getOutputStream().println("<blockquote>" + errors + "</...
LogServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { String errors = LiveConfiguration.getErrors(); if (errors == null || errors.trim().length() == 0) resp.getOutputStream().println("No errors reported."); else resp.getOutputStream().prin...
LogServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { String errors = LiveConfiguration.getErrors(); if (errors == null || errors.trim().length() == 0) resp.getOutputStream().println("No errors reported."); else resp.getOutputStream().prin...
LogServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { String errors = LiveConfiguration.getErrors(); if (errors == null || errors.trim().length() == 0) resp.getOutputStream().println("No errors reported."); else resp.getOutputStream().prin...
LogServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { String errors = LiveConfiguration.getErrors(); if (errors == null || errors.trim().length() == 0) resp.getOutputStream().println("No errors reported."); else resp.getOutputStream().prin...
@Test public void whenMetricsPrinted_eachHasItsOwnLineSeparatedByCarriageReturns() { metrics.printMetric("a", 12); metrics.printMetric("b", 120); metrics.printMetric("c", 0); assertThat(getPrintedMetricValues(), hasItems("12", "120", "0", "3")); }
void printMetric(String name, Object value) { print(name + " " + value + '\n'); scrapeCount++; }
MetricsStream extends PrintStream { void printMetric(String name, Object value) { print(name + " " + value + '\n'); scrapeCount++; } }
MetricsStream extends PrintStream { void printMetric(String name, Object value) { print(name + " " + value + '\n'); scrapeCount++; } MetricsStream(HttpServletRequest request, OutputStream outputStream); MetricsStream(HttpServletRequest request, OutputStream outputStream, PerformanceProbe performanceProbe); }
MetricsStream extends PrintStream { void printMetric(String name, Object value) { print(name + " " + value + '\n'); scrapeCount++; } MetricsStream(HttpServletRequest request, OutputStream outputStream); MetricsStream(HttpServletRequest request, OutputStream outputStream, PerformanceProbe performanceProbe); }
MetricsStream extends PrintStream { void printMetric(String name, Object value) { print(name + " " + value + '\n'); scrapeCount++; } MetricsStream(HttpServletRequest request, OutputStream outputStream); MetricsStream(HttpServletRequest request, OutputStream outputStream, PerformanceProbe performanceProbe); }
@Test public void whenMetricsPrintedOnWindows_eachHasItsOwnLineSeparatedByCarriageReturns() throws NoSuchFieldException { simulateWindows(); metrics.printMetric("a", 12); metrics.printMetric("b", 120); metrics.printMetric("c", 0); assertThat(getPrintedMetricValues(), hasItems("12", "120", "0", "3")); }
void printMetric(String name, Object value) { print(name + " " + value + '\n'); scrapeCount++; }
MetricsStream extends PrintStream { void printMetric(String name, Object value) { print(name + " " + value + '\n'); scrapeCount++; } }
MetricsStream extends PrintStream { void printMetric(String name, Object value) { print(name + " " + value + '\n'); scrapeCount++; } MetricsStream(HttpServletRequest request, OutputStream outputStream); MetricsStream(HttpServletRequest request, OutputStream outputStream, PerformanceProbe performanceProbe); }
MetricsStream extends PrintStream { void printMetric(String name, Object value) { print(name + " " + value + '\n'); scrapeCount++; } MetricsStream(HttpServletRequest request, OutputStream outputStream); MetricsStream(HttpServletRequest request, OutputStream outputStream, PerformanceProbe performanceProbe); }
MetricsStream extends PrintStream { void printMetric(String name, Object value) { print(name + " " + value + '\n'); scrapeCount++; } MetricsStream(HttpServletRequest request, OutputStream outputStream); MetricsStream(HttpServletRequest request, OutputStream outputStream, PerformanceProbe performanceProbe); }
@Test public void afterMetricsScraped_reportScrapedCount() { metrics.printMetric("a", 12); metrics.printMetric("b", 120); metrics.printMetric("c", 0); assertThat(getPrintedMetrics(), containsString("wls_scrape_mbeans_count_total{instance=\"wlshost:7201\"} 3")); }
void printMetric(String name, Object value) { print(name + " " + value + '\n'); scrapeCount++; }
MetricsStream extends PrintStream { void printMetric(String name, Object value) { print(name + " " + value + '\n'); scrapeCount++; } }
MetricsStream extends PrintStream { void printMetric(String name, Object value) { print(name + " " + value + '\n'); scrapeCount++; } MetricsStream(HttpServletRequest request, OutputStream outputStream); MetricsStream(HttpServletRequest request, OutputStream outputStream, PerformanceProbe performanceProbe); }
MetricsStream extends PrintStream { void printMetric(String name, Object value) { print(name + " " + value + '\n'); scrapeCount++; } MetricsStream(HttpServletRequest request, OutputStream outputStream); MetricsStream(HttpServletRequest request, OutputStream outputStream, PerformanceProbe performanceProbe); }
MetricsStream extends PrintStream { void printMetric(String name, Object value) { print(name + " " + value + '\n'); scrapeCount++; } MetricsStream(HttpServletRequest request, OutputStream outputStream); MetricsStream(HttpServletRequest request, OutputStream outputStream, PerformanceProbe performanceProbe); }
@Test public void afterUploadWithReplace_useNewConfiguration() throws Exception { servlet.doPost(createUploadRequest(createEncodedForm("replace", CONFIGURATION)), response); assertThat(LiveConfiguration.asString(), equalTo(CONFIGURATION)); }
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
@Test public void onPlaintextGet_defineConnectionUrlFromContext() throws Exception { initServlet(ONE_VALUE_CONFIG); servlet.doGet(request, response); assertThat(factory.getClientUrl(), equalTo(String.format(URL_PATTERN, request.getLocalName(), HttpServletRequestStub.LOCAL_PORT))); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void onSecurePlaintextGet_defineConnectionUrlFromContext() throws Exception { initServlet(ONE_VALUE_CONFIG); request.setSecure(true); servlet.doGet(request, response); assertThat(factory.getClientUrl(), equalTo(String.format(SECURE_URL_PATTERN, request.getLocalName(), HttpServletRequestStub.LOCAL_PORT))); ...
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenRestPortDefined_connectionUrlUsesRestPort() throws ServletException, IOException { initServlet(REST_PORT_CONFIG); servlet.doGet(request, response); assertThat(factory.getClientUrl(), equalTo(String.format(URL_PATTERN, request.getLocalName(), REST_PORT))); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenRestPortAccessFails_switchToLocalPort() throws ServletException, IOException { initServlet(REST_PORT_CONFIG); factory.throwConnectionFailure("localhost", REST_PORT); factory.addJsonResponse(new HashMap<>()); servlet.doGet(request, response); assertThat(factory.getClientUrl(), equalTo(String.format...
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenServerSends403StatusOnGet_returnToClient() throws Exception { initServlet(ONE_VALUE_CONFIG); factory.reportNotAuthorized(); servlet.doGet(request, response); assertThat(response.getStatus(), equalTo(SC_FORBIDDEN)); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenServerSends400StatusOnGet_reportErrorInComments() throws Exception { initServlet(ONE_VALUE_CONFIG); factory.reportBadQuery(); servlet.doGet(request, response); assertThat(toHtml(response), followsPrometheusRules()); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenServerSends401StatusOnGet_returnToClient() throws Exception { initServlet(ONE_VALUE_CONFIG); factory.reportAuthenticationRequired("Test-Realm"); servlet.doGet(request, response); assertThat(response.getStatus(), equalTo(SC_UNAUTHORIZED)); assertThat(response, containsHeader("WWW-Authenticate", "Ba...
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenServerSendsSetCookieHeader_returnToClient() throws Exception { final String SET_COOKIE_HEADER = "ACookie=AValue; Secure"; factory.setSetCookieResponseHeader(SET_COOKIE_HEADER); factory.addJsonResponse(getGroupResponseMap()); initServlet(TWO_VALUE_CONFIG); servlet.doGet(request, response); assertTh...
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenClientSendsAuthenticationHeader_passToServer() throws Exception { initServlet(ONE_VALUE_CONFIG); request.setHeader(AUTHENTICATION_HEADER, "auth-credentials"); request.setHeader(COOKIE_HEADER, "a=2; JSESSIONID=abc#$"); servlet.doGet(request, response); assertThat(factory.getSentAuthentication(), eq...
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenClientSendsAuthenticationMatchingSession_passSessionToServer() throws Exception { final String SESSION_COOKIE = ExporterSession.SESSION_COOKIE_PREFIX + "abcdef"; ExporterSession.cacheSession("auth-credentials", SESSION_COOKIE); initServlet(ONE_VALUE_CONFIG); request.setHeader(AUTHENTICATION_HEADER...
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void afterUpload_redirectToMainPage() throws Exception { servlet.doPost(createUploadRequest(createEncodedForm("replace", CONFIGURATION)), response); assertThat(response.getRedirectLocation(), equalTo("")); }
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
@Test public void whenServerSendsSetCookieHeader_establishExporterSession() throws Exception { final String SESSION_COOKIE = ExporterSession.SESSION_COOKIE_PREFIX + "abc@345"; final String CREDENTIALS = "auth-credentials"; request.setHeader(AUTHENTICATION_HEADER, CREDENTIALS); factory.setSetCookieResponseHeader(SESSION...
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenClientSendsCookieHeaderOnGet_passToServer() throws Exception { final String SESSION_COOKIE = ExporterSession.SESSION_COOKIE_PREFIX + "with-chocolate-chips"; initServlet(ONE_VALUE_CONFIG); request.setHeader("Cookie", SESSION_COOKIE); servlet.doGet(request, response); assertThat(factory.getSentSessi...
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void onGet_sendJsonQuery() throws Exception { initServlet(ONE_VALUE_CONFIG); servlet.doGet(request, response); assertThat(factory.getSentQuery(), hasJsonPath("$.children.groups.fields").withValues("name", "testSample1")); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void onGet_recordJsonQuery() throws Exception { initServlet(ONE_VALUE_CONFIG); servlet.doGet(request, response); assertThat(MessagesServlet.getMessages(), not(empty())); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void onGet_sendXRequestedHeader() throws Exception { initServlet(ONE_VALUE_CONFIG); servlet.doGet(request, response); assertThat(factory.getSentHeaders(), hasKey("X-Requested-By")); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void onGet_displayMetrics() throws Exception { factory.addJsonResponse(getGroupResponseMap()); initServlet(TWO_VALUE_CONFIG); servlet.doGet(request, response); assertThat(toHtml(response), containsString("groupValue_testSample1{name=\"first\"} 12")); assertThat(toHtml(response), containsString("groupValue_...
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenNewConfigAvailable_loadBeforeGeneratingMetrics() throws Exception { factory.addJsonResponse(getGroupResponseMap()); initServlet(ONE_VALUE_CONFIG); ConfigurationUpdaterStub.newConfiguration(1, TWO_VALUE_CONFIG); servlet.doGet(request, response); assertThat(toHtml(response), containsString("groupVal...
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void onGet_displayMetricsInSnakeCase() throws Exception { factory.addJsonResponse(getGroupResponseMap()); initServlet("metricsNameSnakeCase: true\nqueries:\n- groups:\n" + " prefix: groupValue_\n key: name\n values: [testSample1,testSample2]"); servlet.doGet(request, this.response); assertThat(toHtml(this....
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void onGet_metricsArePrometheusCompliant() throws Exception { factory.addJsonResponse(getGroupResponseMap()); initServlet(CONFIG_WITH_CATEGORY_VALUE); servlet.doGet(request, response); assertThat(toHtml(response), followsPrometheusRules()); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void onGet_producePerformanceMetrics() throws Exception { factory.addJsonResponse(getGroupResponseMap()); initServlet(CONFIG_WITH_CATEGORY_VALUE); servlet.doGet(request, response); assertThat(toHtml(response), containsString("wls_scrape_mbeans_count_total{instance=\"myhost:7654\"} 6")); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenRestPortInaccessible_switchToLocalPort() throws Exception { LiveConfiguration.loadFromString(CONFIGURATION_WITH_REST_PORT); factory.throwConnectionFailure("localhost", REST_PORT); servlet.doPost(createUploadRequest(createEncodedForm("replace", CONFIGURATION_WITH_REST_PORT)), response); assertThat(...
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
@Test public void onGetInForeignLocale_performanceMetricsUsePeriodForFloatingPoint() throws Exception { factory.addJsonResponse(getGroupResponseMap()); initServlet(CONFIG_WITH_CATEGORY_VALUE); Locale.setDefault(Locale.FRANCE); servlet.doGet(request, response); assertThat(getMetricValue("wls_scrape_duration_seconds"), c...
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void onGetWithMultipleQueries_displayMetrics() throws Exception { factory.addJsonResponse(getGroupResponseMap()); factory.addJsonResponse(getColorResponseMap()); initServlet(MULTI_QUERY_CONFIG); servlet.doGet(request, this.response); assertThat(toHtml(this.response), containsString("groupValue_testSample1{...
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenNoQueries_produceNoOutput() throws Exception { initServlet(""); servlet.doGet(request, response); assertThat(toHtml(response), containsOnlyComments()); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenNoConfiguration_produceNoOutput() throws Exception { servlet.doGet(request, response); assertThat(toHtml(response), containsOnlyComments()); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenHttpConnectionFails_produceConnectionWarning() throws Exception { initServlet(CONFIG_WITH_CATEGORY_VALUE); factory.throwConnectionFailure("myhost", 1234); servlet.doGet(request, response); assertThat(toHtml(response), allOf(containsOnlyComments(),containsString("restPort"), containsString("http: }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenKeyAlsoListedAsValue_dontDisplayIt() throws Exception { factory.addJsonResponse(getGroupResponseMap()); initServlet("queries:" + "\n- groups:\n prefix: groupValue_\n key: testSample1\n values: [testSample1]"); servlet.doGet(request, response); assertThat(toHtml(this.response), not(containsString("...
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void whenSessionActiveDuringGet_invalidateOnExit() throws Exception { request.getSession(true); servlet.doGet(request, response); assertThat(request.hasInvalidatedSession(), is(true)); }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } }
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
ExporterServlet extends PassThroughAuthenticationServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doWithAuthentication(req, resp, this::displayMetrics); } @SuppressWarnings("unused") // production constructor ExporterServlet(); Exporter...
@Test public void fetchHeaderName() { Header header = new Header("Content-type: text/plain"); assertThat(header.getName(), equalTo("Content-type")); }
public String getName() { return name; }
Header { public String getName() { return name; } }
Header { public String getName() { return name; } Header(String headerLine); }
Header { public String getName() { return name; } Header(String headerLine); String getValue(); String getValue(String key); String getName(); }
Header { public String getName() { return name; } Header(String headerLine); String getValue(); String getValue(String key); String getName(); static final String QUOTE; }
@Test public void fetchMainValue() { Header header = new Header("Content-type: text/plain"); assertThat(header.getValue(), equalTo("text/plain")); }
public String getValue() { return value; }
Header { public String getValue() { return value; } }
Header { public String getValue() { return value; } Header(String headerLine); }
Header { public String getValue() { return value; } Header(String headerLine); String getValue(); String getValue(String key); String getName(); }
Header { public String getValue() { return value; } Header(String headerLine); String getValue(); String getValue(String key); String getName(); static final String QUOTE; }
@Test public void whenSeparatorPresent_truncateValue() { Header header = new Header("Content-type: text/plain; more stuff"); assertThat(header.getValue(), equalTo("text/plain")); }
public String getValue() { return value; }
Header { public String getValue() { return value; } }
Header { public String getValue() { return value; } Header(String headerLine); }
Header { public String getValue() { return value; } Header(String headerLine); String getValue(); String getValue(String key); String getName(); }
Header { public String getValue() { return value; } Header(String headerLine); String getValue(); String getValue(String key); String getName(); static final String QUOTE; }
@Test public void afterUploadWithAppend_useBothConfiguration() throws Exception { LiveConfiguration.loadFromString(CONFIGURATION); servlet.doPost(createUploadRequest(createEncodedForm("append", ADDED_CONFIGURATION)), createServletResponse()); assertThat(LiveConfiguration.asString(), equalTo(COMBINED_CONFIGURATION)); }
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
@Test public void whenParametersPresent_fetchValues() { Header header = new Header("Content-disposition: form-data; name=\"file1\"; filename=\"a.txt\""); assertThat(header.getValue(), equalTo("form-data")); assertThat(header.getValue("name"), equalTo("file1")); assertThat(header.getValue("filename"), equalTo("a.txt"));...
public String getValue() { return value; }
Header { public String getValue() { return value; } }
Header { public String getValue() { return value; } Header(String headerLine); }
Header { public String getValue() { return value; } Header(String headerLine); String getValue(); String getValue(String key); String getName(); }
Header { public String getValue() { return value; } Header(String headerLine); String getValue(); String getValue(String key); String getName(); static final String QUOTE; }
@Test public void generateLeafMetrics() { generateNestedMetrics(getServletsMap(), SERVLET_RESPONSE); assertThat(scraper.getMetrics(), allOf(hasMetric("servlet_invocationTotalCount{servletName=\"JspServlet\"}", 0), hasMetric("servlet_invocationTotalCount{servletName=\"FileServlet\"}", 1), hasMetric("servlet_invocationTo...
Map<String, Object> getMetrics() { return metrics; }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void whenNoValuesSpecified_generateAllMetrics() { generateNestedMetrics(getAllValuesServletsMap(), SERVLET_RESPONSE); assertThat(scraper.getMetrics(), allOf(hasMetric("servlet_invocationHighCount{servletName=\"JspServlet\"}", 10), hasMetric("servlet_invocationHighCount{servletName=\"FileServlet\"}", 15), h...
Map<String, Object> getMetrics() { return metrics; }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void generateLeafMetricsWhileAccumulatingQualifiers() { generateNestedMetrics(getServletsMap(), SERVLET_RESPONSE, "webapp=\"wls\""); assertThat(scraper.getMetrics(), hasMetric("servlet_invocationTotalCount{webapp=\"wls\",servletName=\"JspServlet\"}", 0)); }
Map<String, Object> getMetrics() { return metrics; }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void generateLeafMetricsWithNoQualifiers() { generateNestedMetrics(getServletsMapWithoutQualifierKey(), SINGLE_SERVLET_RESPONSE); assertThat(scraper.getMetrics(), hasMetric("servlet_invocationTotalCount", 0)); }
Map<String, Object> getMetrics() { return metrics; }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void generateLeafMetricsWithParentQualifiersOnly() { generateNestedMetrics(getServletsMapWithoutQualifierKey(), SINGLE_SERVLET_RESPONSE, "webapp=\"wls\""); assertThat(scraper.getMetrics(), hasMetric("servlet_invocationTotalCount{webapp=\"wls\"}", 0)); }
Map<String, Object> getMetrics() { return metrics; }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void whenKeyNameSpecified_useItRatherThanKey() { generateNestedMetrics(getServletsMapWithKeyName("servlet"), SERVLET_RESPONSE); assertThat(scraper.getMetrics(), hasMetric("servlet_invocationTotalCount{servlet=\"JspServlet\"}", 0)); }
Map<String, Object> getMetrics() { return metrics; }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void whenValuesIncludesKey_ignoreIt() { generateNestedMetrics(getServletsMapWithKey("invocationId"), SINGLE_SERVLET_RESPONSE); assertThat(scraper.getMetrics(), not(hasMetric("servlet_invocationId{invocationId=\"23\"}", 23))); }
Map<String, Object> getMetrics() { return metrics; }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void whenNullObjectInResponse_dontFail() { generateNestedMetrics(getServletsMapWithKey("invocationId"), RESPONSE_WITH_NULL); assertThat(scraper.getMetrics(), not(hasMetric("servlet_invocationId{invocationId=\"23\"}", 23))); }
Map<String, Object> getMetrics() { return metrics; }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void whenGenerateHierarchicalMetrics_containsTopLevel() { generateNestedMetrics(twoLevelMap, TWO_LEVEL_RESPONSE); assertThat(scraper.getMetrics(), hasMetric("component_deploymentState{component=\"ejb30_weblogic\"}", 2)); }
Map<String, Object> getMetrics() { return metrics; }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void whenSelectedFileIsNotYaml_reportError() throws Exception { LiveConfiguration.loadFromString(CONFIGURATION); servlet.doPost(createUploadRequest(createEncodedForm("append", NON_YAML)), response); assertThat(response.getHtml(), containsString(ConfigurationException.NOT_YAML_FORMAT)); }
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
@Test public void whenNoPrefix_generateBareMetrics() { generateNestedMetrics(noPrefixTwoLevelMap, TWO_LEVEL_RESPONSE); assertThat(scraper.getMetrics(), hasMetric("deploymentState{component=\"ejb30_weblogic\"}", 2)); }
Map<String, Object> getMetrics() { return metrics; }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void whenGenerateHierarchicalMetrics_ignoresNonNumericValues() { generateNestedMetrics(twoLevelMap, TWO_LEVEL_RESPONSE); assertThat(scraper.getMetrics(), not(hasMetric("component_sourceInfo{component=\"ejb30_weblogic\"}", "weblogic.war"))); assertThat(scraper.getMetrics(), not(hasMetric("component_internal...
Map<String, Object> getMetrics() { return metrics; }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void whenGenerateHierarchicalMetrics_containsBottomLevel() { generateNestedMetrics(twoLevelMap, TWO_LEVEL_RESPONSE); assertThat(scraper.getMetrics(), hasMetric("servlet_invocationTotalCount{component=\"ejb30_weblogic\",servletName=\"JspServlet\"}", 0)); }
Map<String, Object> getMetrics() { return metrics; }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> getMetrics() { return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void whenResponseLacksServerRuntimes_generateEmptyMetrics() { assertThat(scraper.scrape(MBeanSelector.create(getFullMap()), getJsonResponse("{}")), anEmptyMap()); }
Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void generateFromFullResponse() { Map<String, Object> metrics = scraper.scrape(MBeanSelector.create(getFullMap()), getJsonResponse(RESPONSE)); assertThat(metrics, hasMetric("component_deploymentState{application=\"weblogic\",component=\"ejb30_weblogic\"}", 2)); assertThat(metrics, hasMetric("servlet_invoca...
Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void whenTypeNotSpecified_includeAllComponents() { Map<String, Object> metrics = scraper.scrape(MBeanSelector.create(getFullMap()), getJsonResponse(RESPONSE)); assertThat(metrics, hasMetric("component_deploymentState{application=\"weblogic\",component=\"ejb30_weblogic\"}", 2)); assertThat(metrics, hasMetri...
Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void selectOnlyWebApps() { componentMap.put(MBeanSelector.TYPE, "WebAppComponentRuntime"); Map<String, Object> metrics = scraper.scrape(MBeanSelector.create(getFullMap()), getJsonResponse(RESPONSE)); assertThat(metrics, hasMetric("component_deploymentState{application=\"weblogic\",component=\"ejb30_weblogi...
Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void whenValuesAtTopLevel_scrapeThem() { final MBeanSelector selector = MBeanSelector.create(getMetricsMap()); final JsonObject jsonResponse = getJsonResponse(METRICS_RESPONSE); Map<String, Object> metrics = scraper.scrape(selector, jsonResponse); assertThat(metrics, hasMetric("heapSizeCurrent", 123456)); ...
Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } MetricsScraper(String globalQualifiers); }
MetricsScraper { Map<String, Object> scrape(MBeanSelector selector, JsonObject response) { metrics = new HashMap<>(); scrapeItem(response, selector, globalQualifiers); return metrics; } MetricsScraper(String globalQualifiers); }
@Test public void whenYamlConfigEmpty_returnNonNullConfiguration() { assertThat(ExporterConfig.loadConfig(NULL_MAP), notNullValue()); }
public static ExporterConfig loadConfig(InputStream inputStream) { try { return loadConfig(asMap(new Yaml().load(inputStream))); } catch (ScannerException e) { throw new YamlParserException(e); } }
ExporterConfig { public static ExporterConfig loadConfig(InputStream inputStream) { try { return loadConfig(asMap(new Yaml().load(inputStream))); } catch (ScannerException e) { throw new YamlParserException(e); } } }
ExporterConfig { public static ExporterConfig loadConfig(InputStream inputStream) { try { return loadConfig(asMap(new Yaml().load(inputStream))); } catch (ScannerException e) { throw new YamlParserException(e); } } private ExporterConfig(Map<String, Object> yaml); }
ExporterConfig { public static ExporterConfig loadConfig(InputStream inputStream) { try { return loadConfig(asMap(new Yaml().load(inputStream))); } catch (ScannerException e) { throw new YamlParserException(e); } } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static Expo...
ExporterConfig { public static ExporterConfig loadConfig(InputStream inputStream) { try { return loadConfig(asMap(new Yaml().load(inputStream))); } catch (ScannerException e) { throw new YamlParserException(e); } } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static Expo...
@Test public void whenDomainQualifierNotSpecified_dontModifyQueries() { ExporterConfig config = loadFromString(SERVLET_CONFIG); MBeanSelector[] queries = config.getEffectiveQueries(); assertThat(queries, arrayWithSize(1)); assertThat(queries[0].getUrl(Protocol.HTTP, "myhost", 1234), equalTo(String.format(QueryType.RUNT...
public MBeanSelector[] getEffectiveQueries() { if (queries == null) return NO_QUERIES; return withPossibleDomainNameQuery(Arrays.stream(queries)).toArray(MBeanSelector[]::new); }
ExporterConfig { public MBeanSelector[] getEffectiveQueries() { if (queries == null) return NO_QUERIES; return withPossibleDomainNameQuery(Arrays.stream(queries)).toArray(MBeanSelector[]::new); } }
ExporterConfig { public MBeanSelector[] getEffectiveQueries() { if (queries == null) return NO_QUERIES; return withPossibleDomainNameQuery(Arrays.stream(queries)).toArray(MBeanSelector[]::new); } private ExporterConfig(Map<String, Object> yaml); }
ExporterConfig { public MBeanSelector[] getEffectiveQueries() { if (queries == null) return NO_QUERIES; return withPossibleDomainNameQuery(Arrays.stream(queries)).toArray(MBeanSelector[]::new); } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConf...
ExporterConfig { public MBeanSelector[] getEffectiveQueries() { if (queries == null) return NO_QUERIES; return withPossibleDomainNameQuery(Arrays.stream(queries)).toArray(MBeanSelector[]::new); } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConf...
@Test public void whenSelectedFileHasPartialYaml_reportError() throws Exception { LiveConfiguration.loadFromString(CONFIGURATION); servlet.doPost(createUploadRequest(createEncodedForm("append", PARTIAL_YAML)), response); assertThat(response.getHtml(), containsString(ConfigurationException.BAD_YAML_FORMAT)); }
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } }
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
ConfigurationServlet extends PassThroughAuthenticationServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doWithAuthentication(request, response, this::updateConfiguration); } @SuppressWarnings("unused") // production constructor Co...
@Test public void whenSpecified_prependConfigurationQuery() { ExporterConfig config = loadFromString(DOMAIN_QUALIFIER_CONFIG); MBeanSelector[] queries = config.getEffectiveQueries(); assertThat(queries, arrayWithSize(2)); assertThat(queries[0], sameInstance(MBeanSelector.DOMAIN_NAME_SELECTOR)); assertThat(queries[1].ge...
public MBeanSelector[] getEffectiveQueries() { if (queries == null) return NO_QUERIES; return withPossibleDomainNameQuery(Arrays.stream(queries)).toArray(MBeanSelector[]::new); }
ExporterConfig { public MBeanSelector[] getEffectiveQueries() { if (queries == null) return NO_QUERIES; return withPossibleDomainNameQuery(Arrays.stream(queries)).toArray(MBeanSelector[]::new); } }
ExporterConfig { public MBeanSelector[] getEffectiveQueries() { if (queries == null) return NO_QUERIES; return withPossibleDomainNameQuery(Arrays.stream(queries)).toArray(MBeanSelector[]::new); } private ExporterConfig(Map<String, Object> yaml); }
ExporterConfig { public MBeanSelector[] getEffectiveQueries() { if (queries == null) return NO_QUERIES; return withPossibleDomainNameQuery(Arrays.stream(queries)).toArray(MBeanSelector[]::new); } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConf...
ExporterConfig { public MBeanSelector[] getEffectiveQueries() { if (queries == null) return NO_QUERIES; return withPossibleDomainNameQuery(Arrays.stream(queries)).toArray(MBeanSelector[]::new); } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConf...
@Test public void whenQuerySyncDefined_returnIt() { ExporterConfig config = loadFromString(CONFIG_WITH_SYNC_SPEC); final QuerySyncConfiguration syncConfiguration = config.getQuerySyncConfiguration(); assertThat(syncConfiguration.getUrl(), equalTo("http: assertThat(syncConfiguration.getRefreshInterval(), equalTo(3L)); }
public QuerySyncConfiguration getQuerySyncConfiguration() { return querySyncConfiguration; }
ExporterConfig { public QuerySyncConfiguration getQuerySyncConfiguration() { return querySyncConfiguration; } }
ExporterConfig { public QuerySyncConfiguration getQuerySyncConfiguration() { return querySyncConfiguration; } private ExporterConfig(Map<String, Object> yaml); }
ExporterConfig { public QuerySyncConfiguration getQuerySyncConfiguration() { return querySyncConfiguration; } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConfig(InputStream inputStream); Map<String, Object> scrapeMetrics(MBeanSelector selector,...
ExporterConfig { public QuerySyncConfiguration getQuerySyncConfiguration() { return querySyncConfiguration; } private ExporterConfig(Map<String, Object> yaml); static ExporterConfig createEmptyConfig(); static ExporterConfig loadConfig(InputStream inputStream); Map<String, Object> scrapeMetrics(MBeanSelector selector,...