@Test public void authIsUsedGettingChartFromGraphite() throws Exception { System.setProperty("GRAPHITE_USERNAME", "seyren"); System.setProperty("GRAPHITE_PASSWORD", "s3yr3N"); graphiteHttpClient = new GraphiteHttpClient(seyrenConfig(clientDriver.getBaseUrl())); byte[] bytes = new byte[] { 12, 12, 24, 34 }; InputStream response = new ByteArrayInputStream(bytes); clientDriver.addExpectation( onRequestTo("/render/") .withParam("target", "hello.world") .withParam("from", "-1hours") .withParam("width", 300) .withParam("height", 200) .withParam("uniq", Pattern.compile("[0-9]+")) .withParam("hideLegend", false) .withParam("hideAxes", false) .withHeader("Authorization", "Basic c2V5cmVuOnMzeXIzTg=="), giveResponseAsBytes(response, "image/png")); byte[] actualBytes = graphiteHttpClient.getChart("hello.world", 300, 200, "-1hours", null, LegendState.SHOW, AxesState.SHOW); assertThat(actualBytes, is(bytes)); System.clearProperty("GRAPHITE_USERNAME"); System.clearProperty("GRAPHITE_PASSWORD"); }
public byte[] getChart(String target, int width, int height, String from, String to, LegendState legendState, AxesState axesState) throws Exception { return getChart(target, width, height, from, to, legendState, axesState, null, null); }
GraphiteHttpClient { public byte[] getChart(String target, int width, int height, String from, String to, LegendState legendState, AxesState axesState) throws Exception { return getChart(target, width, height, from, to, legendState, axesState, null, null); } }
GraphiteHttpClient { public byte[] getChart(String target, int width, int height, String from, String to, LegendState legendState, AxesState axesState) throws Exception { return getChart(target, width, height, from, to, legendState, axesState, null, null); } @Inject  GraphiteHttpClient(SeyrenConfig seyrenConfig); }
GraphiteHttpClient { public byte[] getChart(String target, int width, int height, String from, String to, LegendState legendState, AxesState axesState) throws Exception { return getChart(target, width, height, from, to, legendState, axesState, null, null); } @Inject  GraphiteHttpClient(SeyrenConfig seyrenConfig); @Deprecated JsonNode getTargetJson(String target); JsonNode getTargetJson(String target, String from, String until); byte[] getChart(String target, int width, int height, String from, String to, LegendState legendState, AxesState axesState); byte[] getChart(String target, int width, int height, String from, String to, LegendState legendState, AxesState axesState,
            BigDecimal warnThreshold, BigDecimal errorThreshold); }
GraphiteHttpClient { public byte[] getChart(String target, int width, int height, String from, String to, LegendState legendState, AxesState axesState) throws Exception { return getChart(target, width, height, from, to, legendState, axesState, null, null); } @Inject  GraphiteHttpClient(SeyrenConfig seyrenConfig); @Deprecated JsonNode getTargetJson(String target); JsonNode getTargetJson(String target, String from, String until); byte[] getChart(String target, int width, int height, String from, String to, LegendState legendState, AxesState axesState); byte[] getChart(String target, int width, int height, String from, String to, LegendState legendState, AxesState axesState,
            BigDecimal warnThreshold, BigDecimal errorThreshold);  }