result = new ArrayList<>();
- int start = 0;
- boolean inQuotes = false;
- for (int current = 0; current < input.length(); current++) {
- if (input.charAt(current) == '\"') inQuotes = !inQuotes; // toggle state
- else if (input.charAt(current) == ',' && !inQuotes) {
- result.add(input.substring(start, current));
- start = current + 1;
- }
- }
- result.add(input.substring(start));
- return result;
- }
-}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/MetricsParser.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/MetricsParser.java
deleted file mode 100644
index 84461367..00000000
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/MetricsParser.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2023 The Prometheus jmx_exporter Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.prometheus.jmx.test;
-
-import java.io.BufferedReader;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/** Class to implements a Metrics response parser */
-public final class MetricsParser {
-
- /** Constructor */
- private MetricsParser() {
- // DO NOTHING
- }
-
- /**
- * Method to parse a response as a list of Metric objects
- *
- * A List is used because Metrics could have the same name, but with different labels
- *
- * @param content content
- * @return the Collection of Metrics
- */
- public static Collection parse(String content) {
- List metricList = new ArrayList<>();
-
- try (BufferedReader bufferedReader = new BufferedReader(new StringReader(content))) {
- while (true) {
- String line = bufferedReader.readLine();
- if (line == null) {
- break;
- }
- line = line.trim();
- if (!line.isEmpty() && !line.startsWith("#")) {
- metricList.add(new Metric(line));
- }
- }
- } catch (Throwable t) {
- throw new MetricsParserException("Exception parsing metrics", t);
- }
-
- return metricList;
- }
-}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/BaseRequest.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/BaseRequest.java
deleted file mode 100644
index 7654a8e8..00000000
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/BaseRequest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2023 The Prometheus jmx_exporter Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.prometheus.jmx.test.support;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import io.prometheus.jmx.test.HttpClient;
-import io.prometheus.jmx.test.credentials.Credentials;
-import io.prometheus.jmx.test.util.ThrowableUtils;
-import okhttp3.Headers;
-import okhttp3.ResponseBody;
-
-/** Base class for all tests */
-public abstract class BaseRequest implements Request {
-
- public static final BaseResponse RESULT_401 = new BaseResponse().withCode(401);
-
- protected final HttpClient httpClient;
- protected final Headers.Builder headersBuilder;
- protected String path;
- protected Credentials credentials;
-
- /**
- * Constructor
- *
- * @param httpClient httpClient
- */
- public BaseRequest(HttpClient httpClient) {
- this.httpClient = httpClient;
- this.headersBuilder = new Headers.Builder();
- }
-
- /**
- * Method to set the path
- *
- * @param path path
- * @return this
- */
- public BaseRequest withPath(String path) {
- this.path = path;
- return this;
- }
-
- /**
- * Method to add Headers
- *
- * @param headers headers
- * @return this
- */
- public BaseRequest withHeaders(Headers headers) {
- if (headers != null) {
- headersBuilder.addAll(headers);
- }
- return this;
- }
-
- /**
- * Method to set the Content-Type
- *
- * @param contentType contentType
- * @return this
- */
- public BaseRequest withContentType(String contentType) {
- if (contentType != null) {
- headersBuilder.add("Content-Type", contentType);
- }
- return this;
- }
-
- /**
- * Method to set the Credentials
- *
- * @param credentials credentials
- * @return this
- */
- public BaseRequest withCredentials(Credentials credentials) {
- this.credentials = credentials;
- return this;
- }
-
- /**
- * Method to execute the test
- *
- * @return the TestResult
- */
- @Override
- public Response execute() {
- Response actualResponse = null;
-
- try {
- okhttp3.Request.Builder requestBuilder = httpClient.createRequest(path);
-
- if (credentials != null) {
- credentials.apply(requestBuilder);
- }
-
- try (okhttp3.Response response = httpClient.execute(requestBuilder)) {
- assertThat(response).isNotNull();
- int code = response.code();
- Headers headers = response.headers();
- ResponseBody body = response.body();
- assertThat(body).isNotNull();
- String content = body.string();
- assertThat(content).isNotNull();
- actualResponse =
- new BaseResponse().withCode(code).withHeaders(headers).withContent(content);
- }
- } catch (Throwable t) {
- ThrowableUtils.throwUnchecked(t);
- }
-
- return actualResponse;
- }
-}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/BaseResponse.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/BaseResponse.java
deleted file mode 100644
index 4bee05cb..00000000
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/BaseResponse.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright (C) 2023 The Prometheus jmx_exporter Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.prometheus.jmx.test.support;
-
-import java.util.List;
-import java.util.Objects;
-import okhttp3.Headers;
-import org.opentest4j.AssertionFailedError;
-
-/** Class to implement a Response */
-public class BaseResponse implements Response {
-
- public static final Response RESULT_401 = new BaseResponse().withCode(401);
-
- private enum Status {
- OBJECT_NULL,
- OBJECT_CLASS_MISMATCH,
- STATUS_CODE_MISMATCH,
- HEADERS_MISMATCH_1,
- HEADERS_MISMATCH_2,
- HEADERS_MISMATCH_3,
- CONTENT_MISMATCH_1,
- MATCH
- }
-
- private Integer code;
- private Headers headers;
- private boolean hasContent;
- private String content;
- private final Headers.Builder headersBuilder;
-
- /** Constructor */
- public BaseResponse() {
- headersBuilder = new Headers.Builder();
- }
-
- /**
- * Method to set the response code
- *
- * @param code code
- * @return this
- */
- public BaseResponse withCode(int code) {
- this.code = code;
- return this;
- }
-
- /**
- * Method to set the response Headers
- *
- * @param headers headers
- * @return this
- */
- public BaseResponse withHeaders(Headers headers) {
- if (headers != null) {
- headersBuilder.addAll(headers);
- }
- return this;
- }
-
- /**
- * Method to set the response Content-Type
- *
- * @param contentType contentType
- * @return this
- */
- public BaseResponse withContentType(String contentType) {
- if (contentType != null) {
- headersBuilder.add("Content-Type", contentType);
- }
- return this;
- }
-
- /**
- * Method to set the response content
- *
- * @param content content
- * @return this
- */
- public BaseResponse withContent(String content) {
- this.hasContent = true;
- this.content = content;
- return this;
- }
-
- /**
- * Method to get the response code
- *
- * @return the response code
- */
- @Override
- public int code() {
- return code;
- }
-
- /**
- * Method to get the response Headers
- *
- * @return the Headers
- */
- @Override
- public Headers headers() {
- if (headers == null) {
- headers = headersBuilder.build();
- }
- return headers;
- }
-
- /**
- * Method to get the response content
- *
- * @return the response content
- */
- @Override
- public String content() {
- return content;
- }
-
- /**
- * Method to check if this Response is a superset of another Response
- *
- * @param response response
- * @return this
- */
- @Override
- public Response isSuperset(Response response) {
- Status status = checkSuperset(response);
- if (status != Status.MATCH) {
- throw new AssertionFailedError(
- String.format(
- "Actual response is not a superset of the expected response,"
- + " error [%s]",
- status));
- }
- return this;
- }
-
- /**
- * Method to dispatch the response code to a CodeConsumer
- *
- * @param consumer consumer
- * @return this
- */
- @Override
- public Response dispatch(CodeConsumer consumer) {
- consumer.accept(code);
- return this;
- }
-
- /**
- * Method to dispatch the response Headers to a HeadersConsumer
- *
- * @param consumer consumer
- * @return this
- */
- @Override
- public Response dispatch(HeadersConsumer consumer) {
- consumer.accept(headers);
- return this;
- }
-
- /**
- * Method to dispatch the response content to a ContentConsumer
- *
- * @param consumer consumer
- * @return this
- */
- @Override
- public Response dispatch(ContentConsumer consumer) {
- consumer.accept(content);
- return this;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
-
- BaseResponse that = (BaseResponse) o;
-
- return hasContent == that.hasContent
- && Objects.equals(code, that.code)
- && Objects.equals(headers, that.headers)
- && Objects.equals(content, that.content)
- && Objects.equals(headersBuilder, that.headersBuilder);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(code, headers, content);
- }
-
- /**
- * Method to check if this Object is a superset of another object
- *
- * @param o o
- * @return the return value
- */
- private Status checkSuperset(Object o) {
- if (this == o) {
- return Status.MATCH;
- }
-
- if (o == null) {
- return Status.OBJECT_NULL;
- }
-
- if (getClass() != o.getClass()) {
- return Status.OBJECT_CLASS_MISMATCH;
- }
-
- BaseResponse that = (BaseResponse) o;
-
- if (!Objects.equals(this.code, that.code)) {
- return Status.STATUS_CODE_MISMATCH;
- }
-
- if (this.headers != null && that.headers == null) {
- return Status.HEADERS_MISMATCH_1;
- } else if (this.headers == null && that.headers != null) {
- return Status.HEADERS_MISMATCH_2;
- } else if (this.headers != null) {
- Headers thatHeaders = that.headers;
- for (String name : thatHeaders.names()) {
- List values = this.headers.values(name);
- List thatValues = thatHeaders.values(name);
- for (String thatValue : thatValues) {
- if (!values.contains(thatValue)) {
- return Status.HEADERS_MISMATCH_3;
- }
- }
- }
- }
-
- if (that.content != null && !Objects.equals(this.content, that.content)) {
- return Status.CONTENT_MISMATCH_1;
- }
-
- return Status.MATCH;
- }
-}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/CodeConsumer.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/CodeConsumer.java
deleted file mode 100644
index 189349d5..00000000
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/CodeConsumer.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2023 The Prometheus jmx_exporter Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.prometheus.jmx.test.support;
-
-import java.util.function.Consumer;
-
-/** Interface to accept a code */
-public interface CodeConsumer extends Consumer {
-
- /**
- * Accept the status code
- *
- * @param code the status code
- */
- void accept(int code);
-}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/DockerImageNames.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/DockerImageNames.java
similarity index 99%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/DockerImageNames.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/DockerImageNames.java
index 615573fa..5d1fa79c 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/DockerImageNames.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/DockerImageNames.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test;
+package io.prometheus.jmx.test.support;
import java.io.BufferedReader;
import java.io.IOException;
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/HeadersConsumer.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/HeadersConsumer.java
deleted file mode 100644
index 1d8ee618..00000000
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/HeadersConsumer.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2023 The Prometheus jmx_exporter Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.prometheus.jmx.test.support;
-
-import java.util.function.Consumer;
-import okhttp3.Headers;
-
-/** Interface to accept Headers */
-public interface HeadersConsumer extends Consumer {
-
- /**
- * Accept the Headers
- *
- * @param headers the Headers
- */
- void accept(Headers headers);
-}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/HealthyRequest.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/HealthyRequest.java
deleted file mode 100644
index 8f085cba..00000000
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/HealthyRequest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2023 The Prometheus jmx_exporter Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.prometheus.jmx.test.support;
-
-import io.prometheus.jmx.test.HttpClient;
-
-/** Class to implement a healthy test */
-public class HealthyRequest extends BaseRequest {
-
- /**
- * Constructor
- *
- * @param httpClient httpClient
- */
- public HealthyRequest(HttpClient httpClient) {
- super(httpClient);
- withPath("/-/healthy");
- }
-}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Label.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Label.java
deleted file mode 100644
index 6394a15c..00000000
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Label.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2023 The Prometheus jmx_exporter Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.prometheus.jmx.test.support;
-
-import java.util.Objects;
-
-/** Class to implement a Label */
-public class Label {
-
- private final String name;
- private final String value;
-
- /**
- * Constructor
- *
- * @param name name
- * @param value value
- */
- private Label(String name, String value) {
- this.name = name;
- this.value = value;
- }
-
- /**
- * Method to get the name
- *
- * @return the name
- */
- public String name() {
- return name;
- }
-
- /**
- * Method to get the value
- *
- * @return the value
- */
- public String value() {
- return value;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Label label = (Label) o;
- return Objects.equals(name, label.name) && Objects.equals(value, label.value);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(name, value);
- }
-
- /**
- * Method to create a Label
- *
- * @param name name
- * @param value value
- * @return a Label
- */
- public static Label of(String name, String value) {
- return new Label(name, value);
- }
-}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/MetricAssertion.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/MetricAssertion.java
deleted file mode 100644
index 243791d5..00000000
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/MetricAssertion.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Copyright (C) 2023 The Prometheus jmx_exporter Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.prometheus.jmx.test.support;
-
-import io.prometheus.jmx.test.Metric;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import org.opentest4j.AssertionFailedError;
-
-/** Class to implement a MetricAssertion */
-public class MetricAssertion {
-
- private final Collection metrics;
- private String name;
- private final List labelTuples;
- private Double value;
-
- /**
- * Constructor
- *
- * @param metrics metrics
- */
- public MetricAssertion(Collection metrics) {
- this.metrics = metrics;
- this.labelTuples = new ArrayList<>();
- }
-
- /**
- * Method to set the metric name
- *
- * @param name name
- * @return the return value
- */
- public MetricAssertion withName(String name) {
- this.name = name;
- return this;
- }
-
- /**
- * Method to add a metric label and value
- *
- * @param label label
- * @param value value
- * @return this
- */
- public MetricAssertion withLabel(String label, String value) {
- labelTuples.add(new LabelTuple(label, value));
- return this;
- }
-
- /**
- * Method to a add a metric Label
- *
- * @param label label
- * @return this;
- */
- public MetricAssertion withLabel(Label label) {
- labelTuples.add(new LabelTuple(label.name(), label.value()));
- return this;
- }
-
- /**
- * Method to set the metric value
- *
- * @param value value
- * @return this
- */
- public MetricAssertion withValue(double value) {
- this.value = value;
- return this;
- }
-
- /**
- * Method to test if a Metric exists in the Metric Collection
- *
- * @param expected expected
- * @return this
- */
- public MetricAssertion exists(boolean expected) {
- if (expected) {
- exists();
- } else {
- doesNotExist();
- }
-
- return this;
- }
-
- /**
- * Method to test if a Metric exists in the Metric Collection
- *
- * @return this
- */
- public MetricAssertion exists() {
- metrics.stream()
- .filter(metric -> metric.getName().equals(name))
- .filter(
- metric -> {
- if (labelTuples.size() == 0) {
- return true;
- }
- List labelTuples = toLabelTupleList(metric);
- return labelTuples.containsAll(this.labelTuples);
- })
- .filter(
- metric -> {
- if (value != null) {
- return metric.getValue() == value;
- }
- return true;
- })
- .findFirst()
- .ifPresentOrElse(
- metric -> {
- /* DO NOTHING */
- },
- () -> {
- String message;
- if (labelTuples.size() > 0) {
- message =
- String.format(
- "Metric [%s] with labels / values %s does not"
- + " exist",
- name, toLabelTupleString(labelTuples));
- } else {
- message = String.format("Metric [%s] does not exist", name);
- }
- throw new AssertionFailedError(message);
- });
-
- return this;
- }
-
- /**
- * Method to test if a Metric does not exist in the Metric Collection
- *
- * @return this
- */
- public MetricAssertion doesNotExist() {
- metrics.stream()
- .filter(metric -> metric.getName().equals(name))
- .filter(
- metric -> {
- if (labelTuples.size() == 0) {
- return true;
- }
- List labelTuples = toLabelTupleList(metric);
- return labelTuples.containsAll(this.labelTuples);
- })
- .filter(
- metric -> {
- if (value != null) {
- return metric.getValue() == value;
- }
- return true;
- })
- .findFirst()
- .ifPresent(
- metric -> {
- String message;
- if (labelTuples.size() > 0) {
- message =
- String.format(
- "Metric [%s] with labels / values %s should not"
- + " exist",
- name, toLabelTupleString(labelTuples));
- } else {
- message = String.format("Metric [%s] should not exist", name);
- }
- throw new AssertionFailedError(message);
- });
-
- return this;
- }
-
- private static List toLabelTupleList(Metric metric) {
- List labelTuples = new ArrayList<>();
- for (Map.Entry entry : metric.getLabels().entrySet()) {
- labelTuples.add(new LabelTuple(entry.getKey(), entry.getValue()));
- }
- return labelTuples;
- }
-
- private static String toLabelTupleString(List labelTuples) {
- StringBuilder stringBuilder = new StringBuilder();
- labelTuples.forEach(
- labelTuple -> {
- stringBuilder.append(labelTuple);
- stringBuilder.append(", ");
- });
- return stringBuilder.substring(0, stringBuilder.length() - 2);
- }
-
- private static class LabelTuple {
-
- private final String label;
- private final String value;
-
- public LabelTuple(String label, String value) {
- this.label = label;
- this.value = value;
- }
-
- public String getLabel() {
- return label;
- }
-
- public String getValue() {
- return value;
- }
-
- @Override
- public String toString() {
- return "[" + label + "] = [" + value + "]";
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(label, value);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- LabelTuple that = (LabelTuple) o;
- return Objects.equals(label, that.label) && Objects.equals(value, that.value);
- }
- }
-}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/MetricsAssertions.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/MetricsAssertions.java
deleted file mode 100644
index ffac1b41..00000000
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/MetricsAssertions.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2023 The Prometheus jmx_exporter Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.prometheus.jmx.test.support;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import io.prometheus.jmx.test.Metric;
-import java.util.Collection;
-
-/** Class to implement a metrics assertion */
-public class MetricsAssertions {
-
- /** Constructor */
- private MetricsAssertions() {
- // DO NOTHING
- }
-
- /**
- * Method to create a MetricAssertion
- *
- * @param metrics metrics
- * @return the return value
- */
- public static MetricAssertion assertThatMetricIn(Collection metrics) {
- assertThat(metrics).isNotNull();
- assertThat(metrics).isNotEmpty();
-
- return new MetricAssertion(metrics);
- }
-}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/MetricsRequest.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/MetricsRequest.java
deleted file mode 100644
index 8cba8703..00000000
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/MetricsRequest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2023 The Prometheus jmx_exporter Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.prometheus.jmx.test.support;
-
-import io.prometheus.jmx.test.HttpClient;
-
-/** Class to implement a metrics test (no Content-Type) */
-public class MetricsRequest extends BaseRequest {
-
- /**
- * Constructor
- *
- * @param httpClient httpClient
- */
- public MetricsRequest(HttpClient httpClient) {
- super(httpClient);
- withPath("/");
- }
-}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/MetricsResponse.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/MetricsResponse.java
deleted file mode 100644
index 3459c310..00000000
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/MetricsResponse.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2023 The Prometheus jmx_exporter Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.prometheus.jmx.test.support;
-
-public class MetricsResponse extends BaseResponse {
-
- private static final String CONTENT_TYPE = "text/plain; version=0.0.4; charset=utf-8";
-
- public static final BaseResponse RESULT_200 =
- new BaseResponse().withCode(200).withContentType(CONTENT_TYPE);
-}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/Mode.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Mode.java
similarity index 94%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/Mode.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Mode.java
index 874d9c38..cdda52ae 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/Mode.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Mode.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test;
+package io.prometheus.jmx.test.support;
/** Enum of the two operational modes */
public enum Mode {
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/OpenMetricsResponse.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/OpenMetricsResponse.java
deleted file mode 100644
index 82e2c254..00000000
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/OpenMetricsResponse.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2023 The Prometheus jmx_exporter Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.prometheus.jmx.test.support;
-
-public class OpenMetricsResponse extends BaseResponse {
-
- private static final String CONTENT_TYPE =
- "application/openmetrics-text; version=1.0.0; charset=utf-8";
-
- public static final BaseResponse RESULT_200 =
- new BaseResponse().withCode(200).withContentType(CONTENT_TYPE);
-}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Response.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Response.java
deleted file mode 100644
index b6a975a4..00000000
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Response.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2023 The Prometheus jmx_exporter Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.prometheus.jmx.test.support;
-
-import okhttp3.Headers;
-
-/** Interface for a Response */
-public interface Response {
-
- /**
- * Method to get the response code
- *
- * @return the response code
- */
- int code();
-
- /**
- * Method to get the response Headers
- *
- * @return the response Headers
- */
- Headers headers();
-
- /**
- * Method to get the response content
- *
- * @return the response content
- */
- String content();
-
- /**
- * Method to compare whether this Response is equals to another Object
- *
- * @param response response
- * @return this
- */
- Response isSuperset(Response response);
-
- /**
- * Method to dispatch the response code to a CodeConsumer
- *
- * @param consumer consumer
- * @return this
- */
- Response dispatch(CodeConsumer consumer);
-
- /**
- * Method to dispatch the response Headers to a HeadersConsumer
- *
- * @param consumer consumer
- * @return this
- */
- Response dispatch(HeadersConsumer consumer);
-
- /**
- * Method to dispatch the response content to a ContentConsumer
- *
- * @param consumer consumer
- * @return this
- */
- Response dispatch(ContentConsumer consumer);
-}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/TestArgument.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/TestArgument.java
similarity index 97%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/TestArgument.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/TestArgument.java
index 96856427..cb8a1fee 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/TestArgument.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/TestArgument.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test;
+package io.prometheus.jmx.test.support;
import org.antublue.test.engine.api.Argument;
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/TestState.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/TestContext.java
similarity index 88%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/TestState.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/TestContext.java
index 13beff3b..084a233a 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/TestState.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/TestContext.java
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test;
+package io.prometheus.jmx.test.support;
+import io.prometheus.jmx.test.support.http.HttpClient;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
/** Class to a TestState */
-public class TestState {
+public class TestContext {
private Network network;
private GenericContainer> applicationContainer;
@@ -29,7 +30,7 @@ public class TestState {
private HttpClient httpClient;
/** Constructor */
- public TestState() {
+ public TestContext() {
// DO NOTHING
}
@@ -39,7 +40,7 @@ public TestState() {
* @param network network
* @return this
*/
- public TestState network(Network network) {
+ public TestContext network(Network network) {
this.network = network;
return this;
}
@@ -59,7 +60,7 @@ public Network network() {
* @param applicationContainer application container
* @return this
*/
- public TestState applicationContainer(GenericContainer> applicationContainer) {
+ public TestContext applicationContainer(GenericContainer> applicationContainer) {
this.applicationContainer = applicationContainer;
return this;
}
@@ -79,7 +80,7 @@ public GenericContainer> applicationContainer() {
* @param exporterContainer exporter container
* @return this
*/
- public TestState exporterContainer(GenericContainer> exporterContainer) {
+ public TestContext exporterContainer(GenericContainer> exporterContainer) {
this.exporterContainer = exporterContainer;
return this;
}
@@ -99,7 +100,7 @@ public GenericContainer> exporterContainer() {
* @param baseUrl baseURL
* @return this
*/
- public TestState baseUrl(String baseUrl) {
+ public TestContext baseUrl(String baseUrl) {
this.baseUrl = baseUrl;
return this;
}
@@ -119,7 +120,7 @@ public String baseUrl() {
* @param httpClient httpClient
* @return this
*/
- public TestState httpClient(HttpClient httpClient) {
+ public TestContext httpClient(HttpClient httpClient) {
this.httpClient = httpClient;
return this;
}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/credentials/BasicAuthenticationCredentials.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpBasicAuthenticationCredentials.java
similarity index 76%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/credentials/BasicAuthenticationCredentials.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpBasicAuthenticationCredentials.java
index 962fc236..8d292a9c 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/credentials/BasicAuthenticationCredentials.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpBasicAuthenticationCredentials.java
@@ -14,15 +14,12 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test.credentials;
+package io.prometheus.jmx.test.support.http;
-import static io.prometheus.jmx.test.HttpClient.basicAuthentication;
-
-import io.prometheus.jmx.test.HttpHeader;
import okhttp3.Request;
/** Class to implement Basic authentication credentials */
-public class BasicAuthenticationCredentials implements Credentials {
+public class HttpBasicAuthenticationCredentials implements HttpCredentials {
private final String username;
private final String password;
@@ -33,7 +30,7 @@ public class BasicAuthenticationCredentials implements Credentials {
* @param username username
* @param password password
*/
- public BasicAuthenticationCredentials(String username, String password) {
+ public HttpBasicAuthenticationCredentials(String username, String password) {
this.username = username;
this.password = password;
}
@@ -46,7 +43,7 @@ public BasicAuthenticationCredentials(String username, String password) {
public void apply(Request.Builder requestBuilder) {
if ((username != null) && (password != null)) {
requestBuilder.addHeader(
- HttpHeader.AUTHORIZATION, basicAuthentication(username, password));
+ HttpHeader.AUTHORIZATION, HttpClient.basicAuthentication(username, password));
}
}
}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/HttpClient.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpClient.java
similarity index 98%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/HttpClient.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpClient.java
index 47f8a6c2..8b56eadf 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/HttpClient.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpClient.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test;
+package io.prometheus.jmx.test.support.http;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpContentType.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpContentType.java
new file mode 100644
index 00000000..0aa78e88
--- /dev/null
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpContentType.java
@@ -0,0 +1,14 @@
+package io.prometheus.jmx.test.support.http;
+
+public class HttpContentType {
+
+ public static final String TEXT_PLAIN = "text/plain";
+
+ public static final String PROTOBUF =
+ "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;"
+ + " encoding=delimited";
+
+ private HttpContentType() {
+ // DO NOTHING
+ }
+}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/credentials/Credentials.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpCredentials.java
similarity index 91%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/credentials/Credentials.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpCredentials.java
index 21cc8f74..02e835e9 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/credentials/Credentials.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpCredentials.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test.credentials;
+package io.prometheus.jmx.test.support.http;
import okhttp3.Request;
/** Interface to implement Credentials */
-public interface Credentials {
+public interface HttpCredentials {
/**
* Method to apply the Credentials to a Request.Builder
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpHeader.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpHeader.java
new file mode 100644
index 00000000..8f61f698
--- /dev/null
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpHeader.java
@@ -0,0 +1,14 @@
+package io.prometheus.jmx.test.support.http;
+
+public class HttpHeader {
+
+ public static final String ACCEPT = "Accept";
+
+ public static final String CONTENT_TYPE = "Content-Type";
+
+ public static final String AUTHORIZATION = "Authorization";
+
+ private HttpHeader() {
+ // DO NOTHING
+ }
+}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/HttpHeader.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpHealthyRequest.java
similarity index 72%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/HttpHeader.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpHealthyRequest.java
index 52bf66ad..364d350d 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/HttpHeader.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpHealthyRequest.java
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test;
+package io.prometheus.jmx.test.support.http;
-public class HttpHeader {
+/** Class to implement a healthy test */
+public class HttpHealthyRequest extends HttpRequest {
- public static final String AUTHORIZATION = "Authorization";
-
- private HttpHeader() {
- // DO NOTHING
+ /** Constructor */
+ public HttpHealthyRequest() {
+ super();
+ path("/-/healthy");
}
}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/HealthyResponse.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpMetricsRequest.java
similarity index 70%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/HealthyResponse.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpMetricsRequest.java
index 355807ef..588f4ca2 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/HealthyResponse.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpMetricsRequest.java
@@ -14,11 +14,14 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test.support;
+package io.prometheus.jmx.test.support.http;
-public class HealthyResponse extends BaseResponse {
+/** Class to implement a metrics test (no Content-Type) */
+public class HttpMetricsRequest extends HttpRequest {
- private static final String CONTENT = "Exporter is Healthy.";
-
- public static final Response RESULT_200 = new BaseResponse().withCode(200).withContent(CONTENT);
+ /** Constructor */
+ public HttpMetricsRequest() {
+ super();
+ path("/metrics");
+ }
}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/OpenMetricsRequest.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpOpenMetricsRequest.java
similarity index 70%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/OpenMetricsRequest.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpOpenMetricsRequest.java
index 04a97e16..71ae5f42 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/OpenMetricsRequest.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpOpenMetricsRequest.java
@@ -14,23 +14,17 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test.support;
-
-import io.prometheus.jmx.test.HttpClient;
+package io.prometheus.jmx.test.support.http;
/** Class to implement an OpenMetrics metrics test (Content-Type for OpenMetrics) */
-public class OpenMetricsRequest extends BaseRequest {
+public class HttpOpenMetricsRequest extends HttpRequest {
private static final String CONTENT_TYPE =
"application/openmetrics-text; version=1.0.0; charset=utf-8";
- /**
- * Constructor
- *
- * @param httpClient httpClient
- */
- public OpenMetricsRequest(HttpClient httpClient) {
- super(httpClient);
- withPath("/").withContentType(CONTENT_TYPE);
+ /** Constructor */
+ public HttpOpenMetricsRequest() {
+ super();
+ path("/metrics").header(HttpHeader.CONTENT_TYPE, CONTENT_TYPE);
}
}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/PrometheusMetricsResponse.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpPrometheusMetricsRequest.java
similarity index 66%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/PrometheusMetricsResponse.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpPrometheusMetricsRequest.java
index 6f9ad3f2..5d0d2052 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/PrometheusMetricsResponse.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpPrometheusMetricsRequest.java
@@ -14,12 +14,16 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test.support;
+package io.prometheus.jmx.test.support.http;
-public class PrometheusMetricsResponse extends BaseResponse {
+/** Class to implement a Prometheus metrics test (Content-Type for Prometheus metrics) */
+public class HttpPrometheusMetricsRequest extends HttpRequest {
private static final String CONTENT_TYPE = "text/plain; version=0.0.4; charset=utf-8";
- public static final BaseResponse RESULT_200 =
- new BaseResponse().withCode(200).withContentType(CONTENT_TYPE);
+ /** Constructor */
+ public HttpPrometheusMetricsRequest() {
+ super();
+ path("/metrics").header(HttpHeader.CONTENT_TYPE, CONTENT_TYPE);
+ }
}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/RequestResponseAssertions.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpPrometheusProtobufMetricsRequest.java
similarity index 55%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/RequestResponseAssertions.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpPrometheusProtobufMetricsRequest.java
index 3932db9f..96fe6ba5 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/RequestResponseAssertions.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpPrometheusProtobufMetricsRequest.java
@@ -14,23 +14,18 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test.support;
+package io.prometheus.jmx.test.support.http;
-/** Class to implement Request Response assertions */
-public class RequestResponseAssertions {
+/** Class to implement an OpenMetrics metrics test (Content-Type for OpenMetrics) */
+public class HttpPrometheusProtobufMetricsRequest extends HttpRequest {
- /** Constructor */
- private RequestResponseAssertions() {
- // DO NOTHING
- }
+ private static final String ACCEPT_VALUE =
+ "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;"
+ + " encoding=delimited";
- /**
- * Method to execute a Request and return the Response
- *
- * @param request request
- * @return the TestResult
- */
- public static Response assertThatResponseForRequest(Request request) {
- return request.execute();
+ /** Constructor */
+ public HttpPrometheusProtobufMetricsRequest() {
+ super();
+ path("/metrics").header(HttpHeader.ACCEPT, ACCEPT_VALUE);
}
}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpRequest.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpRequest.java
new file mode 100644
index 00000000..786001af
--- /dev/null
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpRequest.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2023 The Prometheus jmx_exporter Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.prometheus.jmx.test.support.http;
+
+import okhttp3.Headers;
+
+/** Base class for all tests */
+public abstract class HttpRequest {
+
+ protected HttpClient httpClient;
+ protected Headers.Builder headersBuilder;
+ protected String path;
+ protected HttpCredentials httpCredentials;
+
+ public HttpRequest() {
+ headersBuilder = new Headers.Builder();
+ }
+
+ /**
+ * Constructor
+ *
+ * @param httpClient httpClient
+ */
+ public HttpRequest(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ this.headersBuilder = new Headers.Builder();
+ }
+
+ /**
+ * Method to set the path
+ *
+ * @param path path
+ * @return this
+ */
+ public HttpRequest path(String path) {
+ this.path = path;
+ return this;
+ }
+
+ /**
+ * Method to add Headers
+ *
+ * @param headers headers
+ * @return this
+ */
+ public HttpRequest headers(Headers headers) {
+ if (headers != null) {
+ headersBuilder.addAll(headers);
+ }
+ return this;
+ }
+
+ public HttpRequest header(String name, String value) {
+ headersBuilder.add(name, value);
+ return this;
+ }
+
+ /**
+ * Method to set the Credentials
+ *
+ * @param httpCredentials credentials
+ * @return this
+ */
+ public HttpRequest credentials(HttpCredentials httpCredentials) {
+ this.httpCredentials = httpCredentials;
+ return this;
+ }
+
+ /**
+ * Method to execute the request
+ *
+ * @param httpClient httpClient
+ * @return the response
+ */
+ public HttpResponse send(HttpClient httpClient) {
+ HttpResponse httpResponse;
+
+ try {
+ okhttp3.Request.Builder requestBuilder = httpClient.createRequest(path);
+
+ requestBuilder.headers(headersBuilder.build());
+
+ if (httpCredentials != null) {
+ httpCredentials.apply(requestBuilder);
+ }
+
+ try (okhttp3.Response okhttp3Response = httpClient.execute(requestBuilder)) {
+ httpResponse = new HttpResponse(okhttp3Response);
+ }
+
+ return httpResponse;
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }
+}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpResponse.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpResponse.java
new file mode 100644
index 00000000..348d3710
--- /dev/null
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpResponse.java
@@ -0,0 +1,45 @@
+package io.prometheus.jmx.test.support.http;
+
+import java.io.IOException;
+import java.util.function.Consumer;
+import okhttp3.Headers;
+import okhttp3.ResponseBody;
+
+public class HttpResponse {
+
+ public static final int OK = 200;
+ public static final int UNAUTHORIZED = 401;
+
+ private final int code;
+ private final Headers headers;
+ private final HttpResponseBody body;
+
+ public HttpResponse(okhttp3.Response response) throws IOException {
+ this.code = response.code();
+ this.headers = response.headers();
+
+ ResponseBody responseBody = response.body();
+ if (responseBody != null) {
+ body = new HttpResponseBody(responseBody.bytes());
+ } else {
+ body = null;
+ }
+ }
+
+ public int code() {
+ return code;
+ }
+
+ public Headers headers() {
+ return headers;
+ }
+
+ public HttpResponseBody body() {
+ return body;
+ }
+
+ public HttpResponse accept(Consumer consumer) {
+ consumer.accept(this);
+ return this;
+ }
+}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpResponseAssertions.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpResponseAssertions.java
new file mode 100644
index 00000000..6af309f4
--- /dev/null
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpResponseAssertions.java
@@ -0,0 +1,44 @@
+package io.prometheus.jmx.test.support.http;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class HttpResponseAssertions {
+
+ private HttpResponseAssertions() {
+ // DO NOTHING
+ }
+
+ public static void assertHttpResponseCode(HttpResponse httpResponse, int code) {
+ assertThat(httpResponse.code()).isEqualTo(code);
+ }
+
+ public static void assertHttpResponseHasHeaders(HttpResponse httpResponse) {
+ assertThat(httpResponse.headers()).isNotNull();
+ }
+
+ public static void assertHttpResponseHasHeader(HttpResponse httpResponse, String name) {
+ assertThat(httpResponse.headers()).isNotNull();
+ assertThat(httpResponse.headers().get(name)).isNotNull();
+ }
+
+ public static void assertHttpResponseHasBody(HttpResponse httpResponse) {
+ assertThat(httpResponse.body()).isNotNull();
+ assertThat(httpResponse.body().bytes().length).isGreaterThan(0);
+ }
+
+ public static void assertHttpHealthyResponse(HttpResponse httpResponse) {
+ assertThat(httpResponse).isNotNull();
+ assertThat(httpResponse.code()).isEqualTo(200);
+ assertThat(httpResponse.body()).isNotNull();
+ assertThat(httpResponse.body().string().length()).isGreaterThan(0);
+ assertThat(httpResponse.body().string()).isEqualTo("Exporter is healthy.\n");
+ }
+
+ public static void assertHttpMetricsResponse(HttpResponse httpResponse) {
+ assertThat(httpResponse).isNotNull();
+ assertThat(httpResponse.code()).isEqualTo(200);
+ assertHttpResponseHasHeaders(httpResponse);
+ assertHttpResponseHasHeader(httpResponse, HttpHeader.CONTENT_TYPE);
+ assertHttpResponseHasBody(httpResponse);
+ }
+}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpResponseBody.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpResponseBody.java
new file mode 100644
index 00000000..4145096f
--- /dev/null
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpResponseBody.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2023 The Prometheus jmx_exporter Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.prometheus.jmx.test.support.http;
+
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+
+public class HttpResponseBody {
+
+ private final byte[] bytes;
+
+ /**
+ * Constructor
+ *
+ * @param bytes bytes
+ */
+ public HttpResponseBody(byte[] bytes) {
+ this.bytes = bytes;
+ }
+
+ /**
+ * Method to get the body as bytes
+ *
+ * @return the body as bytes
+ */
+ public byte[] bytes() {
+ return bytes;
+ }
+
+ /**
+ * Method to get the body as a String using UTF-8
+ *
+ * @return the body as a String using UTF-8
+ */
+ public String string() {
+ return string(StandardCharsets.UTF_8);
+ }
+
+ /**
+ * Method to get the body as a String using a specific character set
+ *
+ * @param charset charset
+ * @return the body as a String using the specified character set
+ */
+ public String string(Charset charset) {
+ String string = null;
+ if (bytes != null) {
+ string = new String(bytes, charset);
+ }
+ return string;
+ }
+}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Request.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/DoubleValueMetric.java
similarity index 71%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Request.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/DoubleValueMetric.java
index 365cb461..68aaf47f 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Request.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/DoubleValueMetric.java
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test.support;
+package io.prometheus.jmx.test.support.metrics;
-/** Interface for all tests */
-public interface Request {
+/** Interface implemented by all metrics that have a double value */
+public interface DoubleValueMetric extends Metric {
/**
- * Method to execute a Request
+ * Method to get the Metric value
*
- * @return the Response
+ * @return the Metric value
*/
- Response execute();
+ double value();
}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/DoubleValueMetricAssertion.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/DoubleValueMetricAssertion.java
new file mode 100644
index 00000000..f22621ba
--- /dev/null
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/DoubleValueMetricAssertion.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2023 The Prometheus jmx_exporter Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.prometheus.jmx.test.support.metrics;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.stream.Collectors;
+import org.opentest4j.AssertionFailedError;
+
+/** Class to assert a DoubleValueMetric */
+public class DoubleValueMetricAssertion {
+
+ private static final Set VALID_TYPES = new HashSet<>();
+
+ static {
+ VALID_TYPES.add("COUNTER");
+ VALID_TYPES.add("GAUGE");
+ VALID_TYPES.add("UNTYPED");
+ }
+
+ private final Collection metrics;
+ private String type;
+ private String name;
+ private String help;
+ private TreeMap labels;
+ private Double value;
+
+ /**
+ * Constructor
+ *
+ * @param metrics metrics
+ */
+ public DoubleValueMetricAssertion(Collection metrics) {
+ if (metrics == null) {
+ throw new IllegalArgumentException("Collection is null");
+ }
+ this.metrics = metrics;
+ }
+
+ /**
+ * Method to set the type to match against
+ *
+ * @param type type
+ * @return this DoubleValueMetricAssertion
+ */
+ public DoubleValueMetricAssertion type(String type) {
+ if (type == null || !VALID_TYPES.contains(type)) {
+ throw new IllegalArgumentException(String.format("Type [%s] is null or invalid", type));
+ }
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * Method to set the name to match against
+ *
+ * @param name name
+ * @return this DoubleValueMetricAssertion
+ */
+ public DoubleValueMetricAssertion name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * Method to set the help to match against
+ *
+ * @param help help
+ * @return this DoubleValueMetricAssertion
+ */
+ public DoubleValueMetricAssertion help(String help) {
+ this.help = help;
+ return this;
+ }
+
+ /**
+ * Method to add a label to match against
+ *
+ * @param name name
+ * @param value value
+ * @return this DoubleValueMetricAssertion
+ */
+ public DoubleValueMetricAssertion label(String name, String value) {
+ if (name == null || value == null) {
+ throw new IllegalArgumentException(
+ String.format("Label name [%s] or value [%s] is null", name, value));
+ }
+ if (labels == null) {
+ labels = new TreeMap<>();
+ }
+ labels.put(name, value);
+ return this;
+ }
+
+ /**
+ * Method to set the value to match against
+ *
+ * @param value value
+ * @return this DoubleValueMetricAssertion
+ */
+ public DoubleValueMetricAssertion value(Double value) {
+ this.value = value;
+ return this;
+ }
+
+ /** Method to assert the Metric is present */
+ public void isPresent() {
+ isPresent(true);
+ }
+
+ /**
+ * Method to assert the Metric is present
+ *
+ * @param isPresent isPresent
+ */
+ public void isPresent(boolean isPresent) {
+ List metrics =
+ this.metrics.stream()
+ .filter(metric -> metric instanceof DoubleValueMetric)
+ .filter(metric -> type == null || metric.type().equals(type))
+ .filter(metric -> name == null || metric.name().equals(name))
+ .filter(metric -> help == null || metric.help().equals(help))
+ .filter(
+ metric ->
+ labels == null
+ || new LabelsSubsetFilter(labels).test(metric))
+ .map(metric -> (DoubleValueMetric) metric)
+ .filter(metric -> value == null || metric.value() == value)
+ .collect(Collectors.toList());
+
+ if (isPresent && metrics.size() != 1) {
+ throw new AssertionFailedError(
+ String.format(
+ "Metric type [%s] help [%s] name [%s] labels [%s] value [%f] is not"
+ + " present or matches multiple metrics",
+ type, help, name, labels, value));
+ } else if (!isPresent && !metrics.isEmpty()) {
+ throw new AssertionFailedError(
+ String.format(
+ "Metric type [%s] help [%s] name [%s] labels [%s] value [%f] is"
+ + " present or matches multiple metrics",
+ type, help, name, labels, value));
+ }
+ }
+
+ /** Method to assert the Metric is not present */
+ public void isNotPresent() {
+ isPresent(false);
+ }
+
+ /**
+ * Method to assert the Metric is not present
+ *
+ * @param isNotPresent isNotPresent
+ */
+ public void isNotPresent(boolean isNotPresent) {
+ isPresent(!isNotPresent);
+ }
+}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/PrometheusMetricsRequest.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/LabelsSubsetFilter.java
similarity index 51%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/PrometheusMetricsRequest.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/LabelsSubsetFilter.java
index 6fb2eafa..85e17234 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/PrometheusMetricsRequest.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/LabelsSubsetFilter.java
@@ -14,25 +14,29 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test.support;
+package io.prometheus.jmx.test.support.metrics;
-import io.prometheus.jmx.test.HttpClient;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.function.Predicate;
-/** Class to implement a Prometheus metrics test (Content-Type for Prometheus metrics) */
-public class PrometheusMetricsRequest extends BaseRequest {
+/** Class to filter to test if a Metric contains a subset of labels */
+public class LabelsSubsetFilter implements Predicate {
- private static final String CONTENT_TYPE = "text/plain; version=0.0.4; charset=utf-8";
-
- public static final BaseResponse RESULT_200 =
- new BaseResponse().withCode(200).withContentType(CONTENT_TYPE);
+ private final TreeMap labels;
/**
* Constructor
*
- * @param httpClient httpClient
+ * @param labels labels
*/
- public PrometheusMetricsRequest(HttpClient httpClient) {
- super(httpClient);
- withPath("/").withContentType(CONTENT_TYPE);
+ public LabelsSubsetFilter(TreeMap labels) {
+ this.labels = labels;
+ }
+
+ @Override
+ public boolean test(Metric metric) {
+ Map labels = metric.labels();
+ return labels.entrySet().containsAll(this.labels.entrySet());
}
}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/ContentConsumer.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/Metric.java
similarity index 52%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/ContentConsumer.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/Metric.java
index 94d38fc7..b75d44f8 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/ContentConsumer.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/Metric.java
@@ -14,17 +14,38 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test.support;
+package io.prometheus.jmx.test.support.metrics;
-import java.util.function.Consumer;
+import java.util.Map;
-/** Interface to accept content */
-public interface ContentConsumer extends Consumer {
+/** Interface implemented by all metrics */
+public interface Metric {
/**
- * Accept the response content
+ * Method to get the Metric type
*
- * @param content the response content
+ * @return the Metric type
*/
- void accept(String content);
+ String type();
+
+ /**
+ * Method to get the Metric help
+ *
+ * @return the Metric help
+ */
+ String help();
+
+ /**
+ * Method to get the Metric name
+ *
+ * @return the Metric name
+ */
+ String name();
+
+ /**
+ * Metric to get the Metric labels
+ *
+ * @return the Metric labels
+ */
+ Map labels();
}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricsParser.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricsParser.java
new file mode 100644
index 00000000..2b2ca4f6
--- /dev/null
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricsParser.java
@@ -0,0 +1,327 @@
+/*
+ * Copyright (C) 2023 The Prometheus jmx_exporter Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.prometheus.jmx.test.support.metrics;
+
+import io.prometheus.jmx.test.support.http.HttpContentType;
+import io.prometheus.jmx.test.support.http.HttpHeader;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.metrics.impl.DoubleValueMetricImpl;
+import io.prometheus.metrics.expositionformats.generated.com_google_protobuf_3_21_7.Metrics;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
+import java.util.TreeMap;
+
+/** Class to parse Metrics from an HttpResponse */
+public class MetricsParser {
+
+ /** Constructor */
+ private MetricsParser() {
+ // DO NOTHING
+ }
+
+ /**
+ * Method to parse Metrics from an HttpResponse
+ *
+ * @param httpResponse httpResponse
+ * @return a Collection of Metrics
+ */
+ public static Collection parse(HttpResponse httpResponse) {
+ if (Objects.requireNonNull(httpResponse.headers().get(HttpHeader.CONTENT_TYPE))
+ .contains(HttpContentType.PROTOBUF)) {
+ return parseProtobufMetrics(httpResponse);
+ } else {
+ return parseTextMetrics(httpResponse);
+ }
+ }
+
+ private static Collection parseProtobufMetrics(HttpResponse httpResponse) {
+ Collection collection = new ArrayList<>();
+
+ try (InputStream inputStream = new ByteArrayInputStream(httpResponse.body().bytes())) {
+ while (true) {
+ Metrics.MetricFamily metricFamily =
+ Metrics.MetricFamily.parseDelimitedFrom(inputStream);
+ if (metricFamily == null) {
+ break;
+ }
+
+ String name = metricFamily.getName();
+ String help = metricFamily.getHelp();
+ Metrics.MetricType metricType = metricFamily.getType();
+
+ for (Metrics.Metric metric : metricFamily.getMetricList()) {
+ switch (metricType) {
+ case COUNTER:
+ {
+ Metrics.Counter counter = metric.getCounter();
+
+ DoubleValueMetricImpl doubleValueMetricImpl =
+ new DoubleValueMetricImpl(
+ "COUNTER",
+ help,
+ name,
+ toLabels(metric.getLabelList()),
+ counter.getValue());
+
+ collection.add(doubleValueMetricImpl);
+
+ break;
+ }
+ case GAUGE:
+ {
+ Metrics.Gauge gauge = metric.getGauge();
+
+ DoubleValueMetricImpl doubleValueMetricImpl =
+ new DoubleValueMetricImpl(
+ "GAUGE",
+ help,
+ name,
+ toLabels(metric.getLabelList()),
+ gauge.getValue());
+
+ collection.add(doubleValueMetricImpl);
+
+ break;
+ }
+ case UNTYPED:
+ {
+ Metrics.Untyped untyped = metric.getUntyped();
+
+ DoubleValueMetricImpl doubleValueMetricImpl =
+ new DoubleValueMetricImpl(
+ "UNTYPED",
+ help,
+ name,
+ toLabels(metric.getLabelList()),
+ untyped.getValue());
+
+ collection.add(doubleValueMetricImpl);
+
+ break;
+ }
+ default:
+ {
+ // TODO ignore?
+ }
+ }
+ }
+ }
+
+ return collection;
+ } catch (Throwable t) {
+ throw new MetricsParserException("Exception parsing Protobuf metrics", t);
+ }
+ }
+
+ private static Collection parseTextMetrics(HttpResponse httpResponse) {
+ Collection metrics = new ArrayList<>();
+
+ try (LineReader lineReader =
+ new LineReader(new StringReader(httpResponse.body().string()))) {
+ String typeLine;
+ String helpLine;
+
+ while (true) {
+ helpLine = readHelpLine(lineReader);
+ if (helpLine == null) {
+ break;
+ }
+
+ typeLine = readTypeLine(lineReader);
+
+ while (true) {
+ String metricLine = readMetricLine(lineReader);
+ if (metricLine == null) {
+ break;
+ }
+ metrics.add(createMetric(typeLine, helpLine, metricLine));
+ }
+ }
+
+ return metrics;
+ } catch (Throwable t) {
+ throw new MetricsParserException("Exception parsing text metrics", t);
+ }
+ }
+
+ private static String readHelpLine(LineReader lineReader) throws IOException {
+ String line = lineReader.readLine();
+ if (line != null) {
+ line = line.substring("# HELP".length()).trim();
+ }
+ return line;
+ }
+
+ private static String readTypeLine(LineReader lineReader) throws IOException {
+ String line = lineReader.readLine();
+ return line.substring(line.lastIndexOf(" ")).trim();
+ }
+
+ private static String readMetricLine(LineReader lineReader) throws IOException {
+ String line = lineReader.readLine();
+ if (line != null && line.startsWith("#")) {
+ lineReader.unreadLine(line);
+ return null;
+ }
+ return line;
+ }
+
+ private static Metric createMetric(String typeLine, String helpLine, String metricLine) {
+ String help = helpLine.substring("# HELP".length());
+ String name;
+ TreeMap labels = new TreeMap<>();
+
+ int curlyBraceIndex = metricLine.indexOf("{");
+ if (curlyBraceIndex > 1) {
+ name = metricLine.substring(0, curlyBraceIndex);
+ labels =
+ parseLabels(
+ metricLine.substring(curlyBraceIndex, metricLine.lastIndexOf("}") + 1));
+ } else {
+ name = metricLine.substring(0, metricLine.indexOf(" "));
+ }
+
+ double value = Double.parseDouble(metricLine.substring(metricLine.lastIndexOf(" ")));
+
+ if (typeLine.equalsIgnoreCase("COUNTER")) {
+ return new DoubleValueMetricImpl("COUNTER", help, name, labels, value);
+ } else if (typeLine.equalsIgnoreCase("GAUGE")) {
+ return new DoubleValueMetricImpl("GAUGE", help, name, labels, value);
+ } else {
+ return new DoubleValueMetricImpl("UNTYPED", help, name, labels, value);
+ }
+ }
+
+ private static TreeMap parseLabels(String labelsLine) {
+ if (labelsLine.endsWith(",")) {
+ labelsLine = labelsLine.substring(0, labelsLine.length() - 1);
+ }
+
+ labelsLine = labelsLine.substring(1, labelsLine.length() - 1);
+
+ TreeMap map = new TreeMap<>();
+
+ List tokens = splitOnCommas(labelsLine);
+ for (String token : tokens) {
+ int equalIndex = token.indexOf("=");
+ String label = token.substring(0, equalIndex);
+ String value = token.substring(equalIndex + 1);
+ if (value.startsWith("\"")) {
+ value = value.substring(1);
+ }
+ if (value.endsWith("\"")) {
+ value = value.substring(0, value.length() - 1);
+ }
+ map.put(label, value);
+ }
+
+ return map;
+ }
+
+ private static List splitOnCommas(String input) {
+ List result = new ArrayList<>();
+ int start = 0;
+ boolean inQuotes = false;
+ for (int current = 0; current < input.length(); current++) {
+ if (input.charAt(current) == '\"') inQuotes = !inQuotes; // toggle state
+ else if (input.charAt(current) == ',' && !inQuotes) {
+ result.add(input.substring(start, current));
+ start = current + 1;
+ }
+ }
+ result.add(input.substring(start));
+ return result;
+ }
+
+ private static TreeMap toLabels(List labelPairs) {
+ TreeMap labels = new TreeMap<>();
+
+ for (Metrics.LabelPair labelPair : labelPairs) {
+ labels.put(labelPair.getName(), labelPair.getValue());
+ }
+
+ return labels;
+ }
+
+ /** Class to read a Reader line by line */
+ private static class LineReader implements AutoCloseable {
+
+ private final LinkedList lineBuffer;
+ private BufferedReader bufferedReader;
+
+ /**
+ * Constructor
+ *
+ * @param reader reader
+ */
+ public LineReader(Reader reader) {
+ if (reader instanceof BufferedReader) {
+ this.bufferedReader = (BufferedReader) reader;
+ } else {
+ this.bufferedReader = new BufferedReader(reader);
+ }
+ this.lineBuffer = new LinkedList<>();
+ }
+
+ /**
+ * Method to read a line from the reader
+ *
+ * @return a line or null of no more lines are available
+ * @throws IOException IOException
+ */
+ public String readLine() throws IOException {
+ if (!lineBuffer.isEmpty()) {
+ return lineBuffer.removeLast();
+ } else {
+ return bufferedReader.readLine();
+ }
+ }
+
+ /**
+ * Method to unread (push) a line back to the reader
+ *
+ * @param line line
+ */
+ public void unreadLine(String line) {
+ lineBuffer.add(line);
+ }
+
+ @Override
+ public void close() {
+ lineBuffer.clear();
+
+ if (bufferedReader != null) {
+ try {
+ bufferedReader.close();
+ } catch (Throwable t) {
+ // DO NOTHING
+ }
+
+ bufferedReader = null;
+ }
+ }
+ }
+}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/MetricsParserException.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricsParserException.java
similarity index 88%
rename from integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/MetricsParserException.java
rename to integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricsParserException.java
index d3ebf8ec..b9d853ac 100644
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/MetricsParserException.java
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricsParserException.java
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-package io.prometheus.jmx.test;
+package io.prometheus.jmx.test.support.metrics;
public class MetricsParserException extends RuntimeException {
/**
* Constructor
*
- * @param message
- * @param throwable
+ * @param message message
+ * @param throwable throwable
*/
public MetricsParserException(String message, Throwable throwable) {
super(message, throwable);
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/impl/DoubleValueMetricImpl.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/impl/DoubleValueMetricImpl.java
new file mode 100644
index 00000000..9940e9ba
--- /dev/null
+++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/impl/DoubleValueMetricImpl.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2023 The Prometheus jmx_exporter Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.prometheus.jmx.test.support.metrics.impl;
+
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetric;
+import java.util.Map;
+import java.util.Objects;
+import java.util.TreeMap;
+
+/** Class to implement a concrete DoubleValueMetric */
+public class DoubleValueMetricImpl implements DoubleValueMetric {
+
+ private final String type;
+ private final String name;
+ private final String help;
+ private final TreeMap labels;
+ private final double value;
+
+ /**
+ * Constructor
+ *
+ * @param type type
+ * @param help help
+ * @param name name
+ * @param labels labels
+ * @param value value
+ */
+ public DoubleValueMetricImpl(
+ String type, String help, String name, TreeMap labels, double value) {
+ this.type = type;
+ this.help = help;
+ this.name = name;
+ this.labels = labels != null ? labels : new TreeMap<>();
+ this.value = value;
+ }
+
+ @Override
+ public String type() {
+ return type;
+ }
+
+ @Override
+ public String name() {
+ return name;
+ }
+
+ @Override
+ public String help() {
+ return help;
+ }
+
+ @Override
+ public Map labels() {
+ return labels;
+ }
+
+ @Override
+ public double value() {
+ return value;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ DoubleValueMetricImpl that = (DoubleValueMetricImpl) o;
+ return Double.compare(value, that.value) == 0
+ && Objects.equals(type, that.type)
+ && Objects.equals(help, that.help)
+ && Objects.equals(name, that.name)
+ && Objects.equals(labels, that.labels);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type, help, name, labels, value);
+ }
+
+ @Override
+ public String toString() {
+ return "type ["
+ + type
+ + "] name ["
+ + name
+ + "] help ["
+ + help
+ + "] labels ["
+ + labels
+ + "] value ["
+ + value
+ + "]";
+ }
+}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/util/Precondition.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/util/Precondition.java
deleted file mode 100644
index 9ecaa617..00000000
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/util/Precondition.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2023 The Prometheus jmx_exporter Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.prometheus.jmx.test.util;
-
-import java.io.File;
-
-public class Precondition {
-
- private Precondition() {
- // DO NOTHING
- }
-
- public static void notNull(Object object, String message) {
- if (object == null) {
- throw new IllegalArgumentException(message);
- }
- }
-
- public static String notEmpty(String string, String message) {
- string = string.trim();
-
- if (string.isEmpty()) {
- throw new IllegalArgumentException(message);
- }
-
- return string;
- }
-
- public static void inRange(short value, short min, short max, String message) {
- if ((value < min) || (value > max)) {
- throw new IllegalArgumentException(message);
- }
- }
-
- public static void inRange(int value, int min, int max, String message) {
- if ((value < min) || (value > max)) {
- throw new IllegalArgumentException(message);
- }
- }
-
- public static void inRange(long value, long min, long max, String message) {
- if ((value < min) || (value > max)) {
- throw new IllegalArgumentException(message);
- }
- }
-
- public static void isTrue(boolean bool, String message) {
- if (!bool) {
- throw new IllegalStateException(message);
- }
- }
-
- public static void exists(File file, String message) {
- if (!file.exists()) {
- throw new IllegalStateException(message);
- }
- }
-
- public static void isFile(File file, String message) {
- if (!file.isFile()) {
- throw new IllegalStateException(message);
- }
- }
-
- public static void canRead(File file, String message) {
- if (!file.canRead()) {
- throw new IllegalStateException(message);
- }
- }
-}
diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/util/ThrowableUtils.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/util/ThrowableUtils.java
deleted file mode 100644
index c37104f6..00000000
--- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/util/ThrowableUtils.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2023 The Prometheus jmx_exporter Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.prometheus.jmx.test.util;
-
-public class ThrowableUtils {
-
- public static void throwUnchecked(Throwable t) {
- if (t instanceof RuntimeException) {
- throw ((RuntimeException) t);
- } else {
- throw new RuntimeException(t);
- }
- }
-}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/BaseTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/AbstractTest.java
similarity index 88%
rename from integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/BaseTest.java
rename to integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/AbstractTest.java
index 7f02bf71..136923e0 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/BaseTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/AbstractTest.java
@@ -17,9 +17,18 @@
package io.prometheus.jmx.test;
import com.github.dockerjava.api.model.Ulimit;
+import io.prometheus.jmx.test.support.DockerImageNames;
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.TestContext;
+import io.prometheus.jmx.test.support.http.HttpClient;
+import io.prometheus.jmx.test.support.http.HttpContentType;
+import io.prometheus.jmx.test.support.http.HttpHeader;
+import io.prometheus.jmx.test.support.http.HttpResponse;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
import org.testcontainers.containers.BindMode;
@@ -28,14 +37,13 @@
import org.testcontainers.containers.startupcheck.IsRunningStartupCheckStrategy;
import org.testcontainers.containers.wait.strategy.Wait;
-@TestEngine.BaseClass
-public class BaseTest {
+public abstract class AbstractTest {
private static final String BASE_URL = "http://localhost";
private static final long MEMORY_BYTES = 1073741824; // 1GB
private static final long MEMORY_SWAP_BYTES = 2 * MEMORY_BYTES;
- protected TestState testState;
+ protected TestContext testContext;
@TestEngine.Argument protected TestArgument testArgument;
@@ -65,24 +73,24 @@ protected static Stream arguments() {
@TestEngine.Prepare
protected final void prepare() {
- testState = new TestState();
+ testContext = new TestContext();
// Get the Network and get the id to force the network creation
Network network = Network.newNetwork();
network.getId();
- testState.network(network);
- testState.baseUrl(BASE_URL);
+ testContext.network(network);
+ testContext.baseUrl(BASE_URL);
}
@TestEngine.BeforeAll
protected final void beforeAll() {
- testState.reset();
+ testContext.reset();
- Network network = testState.network();
+ Network network = testContext.network();
String dockerImageName = testArgument.dockerImageName();
String testName = this.getClass().getName();
- String baseUrl = testState.baseUrl();
+ String baseUrl = testContext.baseUrl();
switch (testArgument.mode()) {
case JavaAgent:
@@ -90,10 +98,10 @@ protected final void beforeAll() {
GenericContainer> applicationContainer =
createJavaAgentApplicationContainer(network, dockerImageName, testName);
applicationContainer.start();
- testState.applicationContainer(applicationContainer);
+ testContext.applicationContainer(applicationContainer);
HttpClient httpClient = createHttpClient(applicationContainer, baseUrl);
- testState.httpClient(httpClient);
+ testContext.httpClient(httpClient);
break;
}
@@ -103,15 +111,15 @@ protected final void beforeAll() {
createStandaloneApplicationContainer(
network, dockerImageName, testName);
applicationContainer.start();
- testState.applicationContainer(applicationContainer);
+ testContext.applicationContainer(applicationContainer);
GenericContainer> exporterContainer =
createStandaloneExporterContainer(network, dockerImageName, testName);
exporterContainer.start();
- testState.exporterContainer(exporterContainer);
+ testContext.exporterContainer(exporterContainer);
HttpClient httpClient = createHttpClient(exporterContainer, baseUrl);
- testState.httpClient(httpClient);
+ testContext.httpClient(httpClient);
break;
}
@@ -120,13 +128,13 @@ protected final void beforeAll() {
@TestEngine.AfterAll
protected final void afterAll() {
- testState.reset();
+ testContext.reset();
}
@TestEngine.Conclude
protected final void conclude() {
- testState.dispose();
- testState = null;
+ testContext.dispose();
+ testContext = null;
}
/**
@@ -269,4 +277,9 @@ private static HttpClient createHttpClient(
GenericContainer> genericContainer, String baseUrl) {
return new HttpClient(baseUrl + ":" + genericContainer.getMappedPort(8888));
}
+
+ protected static boolean isProtoBufFormat(HttpResponse httpResponse) {
+ return Objects.requireNonNull(httpResponse.headers().get(HttpHeader.CONTENT_TYPE))
+ .contains(HttpContentType.PROTOBUF);
+ }
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/AutoIncrementingMBeanTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/AutoIncrementingMBeanTest.java
index 8e7726c1..ac80513c 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/AutoIncrementingMBeanTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/AutoIncrementingMBeanTest.java
@@ -16,84 +16,59 @@
package io.prometheus.jmx.test;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
import static org.assertj.core.api.Assertions.assertThat;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetric;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
import org.antublue.test.engine.api.TestEngine;
import org.testcontainers.shaded.com.google.common.util.concurrent.AtomicDouble;
-public class AutoIncrementingMBeanTest extends BaseTest {
+public class AutoIncrementingMBeanTest extends AbstractTest {
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- AtomicDouble value1 = new AtomicDouble();
- AtomicDouble value2 = new AtomicDouble();
- AtomicDouble value3 = new AtomicDouble();
+ double value1 = collect();
+ double value2 = collect();
+ double value3 = collect();
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(
- (ContentConsumer)
- content -> {
- Collection metrics = MetricsParser.parse(content);
- metrics.forEach(
- metric -> {
- if (metric.getName()
- .startsWith(
- "io_prometheus_jmx_autoIncrementing")) {
- assertThat(metric.getValue())
- .isGreaterThanOrEqualTo(1);
- value1.set(metric.getValue());
- }
- });
- });
+ assertThat(value2).isGreaterThan(value1);
+ assertThat(value2).isEqualTo(value1 + 1);
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(
- (ContentConsumer)
- content -> {
- Collection metrics = MetricsParser.parse(content);
- metrics.forEach(
- metric -> {
- if (metric.getName()
- .startsWith(
- "io_prometheus_jmx_autoIncrementing")) {
- value2.set(metric.getValue());
- }
- });
- });
+ assertThat(value3).isGreaterThan(value2);
+ assertThat(value3).isEqualTo(value2 + 1);
+ }
+
+ private double collect() {
+ final AtomicDouble value = new AtomicDouble();
+
+ HttpResponse httpResponse =
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient());
+
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(
- (ContentConsumer)
- content -> {
- Collection metrics = MetricsParser.parse(content);
- metrics.forEach(
- metric -> {
- if (metric.getName()
- .startsWith(
- "io_prometheus_jmx_autoIncrementing")) {
- value3.set(metric.getValue());
- }
- });
- });
+ metrics.forEach(
+ metric -> {
+ if (metric.name().startsWith("io_prometheus_jmx_autoIncrementing")) {
+ value.set(((DoubleValueMetric) metric).value());
+ }
+ });
- // Use value1 as a baseline value
- assertThat(value2.get()).isEqualTo(value1.get() + 1);
- assertThat(value3.get()).isEqualTo(value2.get() + 1);
+ return value.doubleValue();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/BlacklistObjectNamesTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/BlacklistObjectNamesTest.java
index d29a2046..c9f8079d 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/BlacklistObjectNamesTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/BlacklistObjectNamesTest.java
@@ -16,64 +16,63 @@
package io.prometheus.jmx.test;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
import static org.assertj.core.api.Assertions.assertThat;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
-import io.prometheus.jmx.test.support.RequestResponseAssertions;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import org.antublue.test.engine.api.TestEngine;
-public class BlacklistObjectNamesTest extends BaseTest implements ContentConsumer {
+public class BlacklistObjectNamesTest extends AbstractTest implements Consumer {
@TestEngine.Test
public void testHealthy() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metricCollection = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
/*
* Assert that we don't have any metrics that start with ...
*
* name = java_lang*
*/
- metricCollection.forEach(
- metric -> assertThat(metric.getName().toLowerCase()).doesNotStartWith("java_lang"));
+ metrics.forEach(
+ metric -> assertThat(metric.name().toLowerCase()).doesNotStartWith("java_lang"));
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/CompositeKeyDataTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/CompositeKeyDataTest.java
index 41cab3d9..40454de1 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/CompositeKeyDataTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/CompositeKeyDataTest.java
@@ -16,64 +16,69 @@
package io.prometheus.jmx.test;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import org.antublue.test.engine.api.TestEngine;
-public class CompositeKeyDataTest extends BaseTest implements ContentConsumer {
+public class CompositeKeyDataTest extends AbstractTest implements Consumer {
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
- assertThatMetricIn(metrics)
- .withName("org_exist_management_exist_ProcessReport_RunningQueries_id")
- .withLabel("key_id", "1")
- .withLabel("key_path", "/db/query1.xq")
- .exists();
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("org_exist_management_exist_ProcessReport_RunningQueries_id")
+ .label("key_id", "1")
+ .label("key_path", "/db/query1.xq")
+ .isPresent();
- assertThatMetricIn(metrics)
- .withName("org_exist_management_exist_ProcessReport_RunningQueries_id")
- .withLabel("key_id", "2")
- .withLabel("key_path", "/db/query2.xq")
- .exists();
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("org_exist_management_exist_ProcessReport_RunningQueries_id")
+ .label("key_id", "2")
+ .label("key_path", "/db/query2.xq")
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest.java
index c7d4054b..c4793c08 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest.java
@@ -16,60 +16,59 @@
package io.prometheus.jmx.test;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
import static org.assertj.core.api.Assertions.fail;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
-import io.prometheus.jmx.test.support.RequestResponseAssertions;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
+import java.util.function.Consumer;
import org.antublue.test.engine.api.TestEngine;
-public class DisableAutoExcludeObjectNameAttributesTest extends BaseTest
- implements ContentConsumer {
+public class DisableAutoExcludeObjectNameAttributesTest extends AbstractTest
+ implements Consumer {
@TestEngine.Test
public void testHealthy() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metricCollection = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
Set excludeAttributeNameSet = new HashSet<>();
excludeAttributeNameSet.add("_ClassPath");
@@ -80,10 +79,10 @@ public void accept(String content) {
*
* name = java_lang*
*/
- metricCollection.forEach(
+ metrics.forEach(
metric -> {
- String name = metric.getName();
- if (name.contains("java_lang")) {
+ String name = metric.name();
+ if (metric.name().contains("java_lang")) {
for (String attributeName : excludeAttributeNameSet) {
if (name.contains(attributeName)) {
fail("metric found");
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest.java
index ebee405b..0d657e4e 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest.java
@@ -16,59 +16,59 @@
package io.prometheus.jmx.test;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
import static org.assertj.core.api.Assertions.fail;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
-import io.prometheus.jmx.test.support.RequestResponseAssertions;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
+import java.util.function.Consumer;
import org.antublue.test.engine.api.TestEngine;
-public class ExcludeObjectNameAttributesTest extends BaseTest implements ContentConsumer {
+public class ExcludeObjectNameAttributesTest extends AbstractTest
+ implements Consumer {
@TestEngine.Test
public void testHealthy() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metricCollection = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
Set excludeAttributeNameSet = new HashSet<>();
excludeAttributeNameSet.add("_ClassPath");
@@ -79,9 +79,9 @@ public void accept(String content) {
*
* name = java_lang*
*/
- metricCollection.forEach(
+ metrics.forEach(
metric -> {
- String name = metric.getName();
+ String name = metric.name();
if (name.contains("java_lang")) {
for (String attributeName : excludeAttributeNameSet) {
if (name.contains(attributeName)) {
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/ExcludeObjectNamesTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/ExcludeObjectNamesTest.java
index 340b22a7..a99ed68d 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/ExcludeObjectNamesTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/ExcludeObjectNamesTest.java
@@ -16,64 +16,63 @@
package io.prometheus.jmx.test;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
import static org.assertj.core.api.Assertions.assertThat;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
-import io.prometheus.jmx.test.support.RequestResponseAssertions;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import org.antublue.test.engine.api.TestEngine;
-public class ExcludeObjectNamesTest extends BaseTest implements ContentConsumer {
+public class ExcludeObjectNamesTest extends AbstractTest implements Consumer {
@TestEngine.Test
public void testHealthy() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- RequestResponseAssertions.assertThatResponseForRequest(
- new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metricCollection = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
/*
* Assert that we don't have any metrics that start with ...
*
* name = java_lang*
*/
- metricCollection.forEach(
- metric -> assertThat(metric.getName().toLowerCase()).doesNotStartWith("java_lang"));
+ metrics.forEach(
+ metric -> assertThat(metric.name().toLowerCase()).doesNotStartWith("java_lang"));
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest.java
index f168d895..5191a3ea 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest.java
@@ -16,60 +16,64 @@
package io.prometheus.jmx.test;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
import static org.assertj.core.api.Assertions.assertThat;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import org.antublue.test.engine.api.TestEngine;
-public class IncludeAndExcludeObjectNamesTest extends BaseTest implements ContentConsumer {
+public class IncludeAndExcludeObjectNamesTest extends AbstractTest
+ implements Consumer {
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metricCollection = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
/*
* Assert that we don't have any metrics that start with ...
*
* name = java_lang*
*/
- metricCollection.forEach(
- metric -> assertThat(metric.getName().toLowerCase()).doesNotStartWith("java_lang"));
+ metrics.forEach(
+ metric -> assertThat(metric.name().toLowerCase()).doesNotStartWith("java_lang"));
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/IncludeObjectNamesTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/IncludeObjectNamesTest.java
index 10d7ca0c..a0b34de9 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/IncludeObjectNamesTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/IncludeObjectNamesTest.java
@@ -16,53 +16,56 @@
package io.prometheus.jmx.test;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
import static org.assertj.core.api.Assertions.assertThat;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import org.antublue.test.engine.api.TestEngine;
-public class IncludeObjectNamesTest extends BaseTest implements ContentConsumer {
+public class IncludeObjectNamesTest extends AbstractTest implements Consumer {
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
/*
* We have to filter metrics that start with ...
@@ -76,14 +79,14 @@ public void accept(String content) {
* ... because they are registered directly and are not MBeans
*/
metrics.stream()
- .filter(metric -> !metric.getName().toLowerCase().startsWith("jmx_exporter"))
- .filter(metric -> !metric.getName().toLowerCase().startsWith("jmx_config"))
- .filter(metric -> !metric.getName().toLowerCase().startsWith("jmx_scrape"))
- .filter(metric -> !metric.getName().toLowerCase().startsWith("jvm_"))
- .filter(metric -> !metric.getName().toLowerCase().startsWith("process_"))
+ .filter(metric -> !metric.name().toLowerCase().startsWith("jmx_exporter"))
+ .filter(metric -> !metric.name().toLowerCase().startsWith("jmx_config"))
+ .filter(metric -> !metric.name().toLowerCase().startsWith("jmx_scrape"))
+ .filter(metric -> !metric.name().toLowerCase().startsWith("jvm_"))
+ .filter(metric -> !metric.name().toLowerCase().startsWith("process_"))
.forEach(
metric -> {
- String name = metric.getName();
+ String name = metric.name();
boolean match =
name.startsWith("java_lang")
|| name.startsWith("io_prometheus_jmx");
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest.java
index d27abdce..06257d79 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest.java
@@ -16,61 +16,65 @@
package io.prometheus.jmx.test;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
import static org.assertj.core.api.Assertions.assertThat;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import org.antublue.test.engine.api.TestEngine;
-public class LowerCaseOutputAndLabelNamesTest extends BaseTest implements ContentConsumer {
+public class LowerCaseOutputAndLabelNamesTest extends AbstractTest
+ implements Consumer {
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metricCollection = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
/*
* Assert that all metrics have lower case names and lower case label names
*/
- metricCollection.forEach(
+ metrics.forEach(
metric -> {
- assertThat(metric.getName()).isEqualTo(metric.getName().toLowerCase());
- metric.getLabels()
+ assertThat(metric.name()).isEqualTo(metric.name().toLowerCase());
+ metric.labels()
.forEach((key, value) -> assertThat(key).isEqualTo(key.toLowerCase()));
});
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest.java
index 4df91168..a76db4d7 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest.java
@@ -16,60 +16,63 @@
package io.prometheus.jmx.test;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
import static org.assertj.core.api.Assertions.assertThat;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import org.antublue.test.engine.api.TestEngine;
-public class LowerCaseOutputLabelNamesTest extends BaseTest implements ContentConsumer {
+public class LowerCaseOutputLabelNamesTest extends AbstractTest implements Consumer {
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metricCollection = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
/*
* Assert that all metrics have lower case label names
*/
- metricCollection.forEach(
+ metrics.forEach(
metric -> {
- metric.getLabels()
+ metric.labels()
.forEach((key, value) -> assertThat(key).isEqualTo(key.toLowerCase()));
});
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/LowerCaseOutputNamesTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/LowerCaseOutputNamesTest.java
index f264187f..2cb2d52d 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/LowerCaseOutputNamesTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/LowerCaseOutputNamesTest.java
@@ -16,58 +16,60 @@
package io.prometheus.jmx.test;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
import static org.assertj.core.api.Assertions.assertThat;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import org.antublue.test.engine.api.TestEngine;
-public class LowerCaseOutputNamesTest extends BaseTest implements ContentConsumer {
+public class LowerCaseOutputNamesTest extends AbstractTest implements Consumer {
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metricCollection = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
/*
* Assert that all metrics have lower case names
*/
- metricCollection.forEach(
- metric -> assertThat(metric.getName()).isEqualTo(metric.getName().toLowerCase()));
+ metrics.forEach(metric -> assertThat(metric.name()).isEqualTo(metric.name().toLowerCase()));
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/MinimalTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/MinimalTest.java
index a84ba2dd..45ac639c 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/MinimalTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/MinimalTest.java
@@ -16,82 +16,118 @@
package io.prometheus.jmx.test;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import org.antublue.test.engine.api.TestEngine;
-public class MinimalTest extends BaseTest implements ContentConsumer {
+public class MinimalTest extends AbstractTest implements Consumer {
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/OptionalValueMBeanTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/OptionalValueMBeanTest.java
index 632f4151..db3483f6 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/OptionalValueMBeanTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/OptionalValueMBeanTest.java
@@ -16,33 +16,123 @@
package io.prometheus.jmx.test;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-import static org.assertj.core.api.Assertions.assertThat;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import org.antublue.test.engine.api.TestEngine;
-public class OptionalValueMBeanTest extends BaseTest {
+public class OptionalValueMBeanTest extends AbstractTest implements Consumer {
+
+ @TestEngine.Test
+ public void testHealthy() {
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
+ }
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(
- (ContentConsumer)
- content -> {
- Collection metrics = MetricsParser.parse(content);
- metrics.forEach(
- metric -> {
- if (metric.getName()
- .equals(
- "io_prometheus_jmx_optionalValue_Value")) {
- assertThat(metric.getValue()).isEqualTo(345.0);
- }
- });
- });
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsOpenMetricsFormat() {
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusFormat() {
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @Override
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
+
+ String buildInfoName =
+ testArgument.mode() == Mode.JavaAgent
+ ? "jmx_prometheus_javaagent"
+ : "jmx_prometheus_httpserver";
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("io_prometheus_jmx_optionalValue_Value")
+ .value(345d);
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest.java
index c34d23b0..4cbfc78e 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest.java
@@ -16,60 +16,64 @@
package io.prometheus.jmx.test;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
import static org.assertj.core.api.Assertions.assertThat;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import org.antublue.test.engine.api.TestEngine;
-public class WhitelistAndBlacklistObjectNamesTest extends BaseTest implements ContentConsumer {
+public class WhitelistAndBlacklistObjectNamesTest extends AbstractTest
+ implements Consumer {
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metricCollection = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
/*
* Assert that we don't have any metrics that start with ...
*
* name = java_lang*
*/
- metricCollection.forEach(
- metric -> assertThat(metric.getName().toLowerCase()).doesNotStartWith("java_lang"));
+ metrics.forEach(
+ metric -> assertThat(metric.name().toLowerCase()).doesNotStartWith("java_lang"));
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/WhitelistObjectNamesTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/WhitelistObjectNamesTest.java
index d04cbcef..b26b4c5a 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/WhitelistObjectNamesTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/WhitelistObjectNamesTest.java
@@ -16,53 +16,56 @@
package io.prometheus.jmx.test;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
import static org.assertj.core.api.Assertions.assertThat;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import org.antublue.test.engine.api.TestEngine;
-public class WhitelistObjectNamesTest extends BaseTest implements ContentConsumer {
+public class WhitelistObjectNamesTest extends AbstractTest implements Consumer {
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
/*
* We have to filter metrics that start with ...
@@ -76,14 +79,14 @@ public void accept(String content) {
* ... because they are registered directly and are not MBeans
*/
metrics.stream()
- .filter(metric -> !metric.getName().toLowerCase().startsWith("jmx_exporter"))
- .filter(metric -> !metric.getName().toLowerCase().startsWith("jmx_config"))
- .filter(metric -> !metric.getName().toLowerCase().startsWith("jmx_scrape"))
- .filter(metric -> !metric.getName().toLowerCase().startsWith("jvm_"))
- .filter(metric -> !metric.getName().toLowerCase().startsWith("process_"))
+ .filter(metric -> !metric.name().toLowerCase().startsWith("jmx_exporter"))
+ .filter(metric -> !metric.name().toLowerCase().startsWith("jmx_config"))
+ .filter(metric -> !metric.name().toLowerCase().startsWith("jmx_scrape"))
+ .filter(metric -> !metric.name().toLowerCase().startsWith("jvm_"))
+ .filter(metric -> !metric.name().toLowerCase().startsWith("process_"))
.forEach(
metric -> {
- String name = metric.getName();
+ String name = metric.name();
boolean match =
name.startsWith("java_lang")
|| name.startsWith("io_prometheus_jmx");
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest.java
index 50c31ffb..37d3230e 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest.java
@@ -16,35 +16,39 @@
package io.prometheus.jmx.test.http;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import io.prometheus.jmx.test.BaseTest;
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.TestArgument;
-import io.prometheus.jmx.test.credentials.BasicAuthenticationCredentials;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
-import io.prometheus.jmx.test.support.Response;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpResponseCode;
+
+import io.prometheus.jmx.test.AbstractTest;
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.http.HttpBasicAuthenticationCredentials;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
-public class CompleteHttpServerConfigurationTest extends BaseTest implements ContentConsumer {
+public class CompleteHttpServerConfigurationTest extends AbstractTest
+ implements Consumer {
private final String BASE_URL = "https://localhost";
+
private final String VALID_USERNAME = "Prometheus";
+
private final String VALID_PASSWORD = "secret";
+
private final String[] TEST_USERNAMES =
new String[] {VALID_USERNAME, "prometheus", "bad", "", null};
+
private final String[] TEST_PASSWORDS =
new String[] {VALID_PASSWORD, "Secret", "bad", "", null};
@@ -57,7 +61,8 @@ public class CompleteHttpServerConfigurationTest extends BaseTest implements Con
protected static Stream arguments() {
// Filter eclipse-temurin:8 based Alpine images due to missing TLS cipher suites
// https://github.com/adoptium/temurin-build/issues/3002
- return BaseTest.arguments()
+ // https://bugs.openjdk.org/browse/JDK-8306037
+ return AbstractTest.arguments()
.filter(
testArgument ->
!testArgument
@@ -67,25 +72,23 @@ protected static Stream arguments() {
@TestEngine.Prepare
protected void setBaseUrl() {
- testState.baseUrl(BASE_URL);
+ testContext.baseUrl(BASE_URL);
}
@TestEngine.Test
public void testHealthy() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedHealthyResponse = HealthyResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedHealthyResponse = HealthyResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- assertThatResponseForRequest(
- new HealthyRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(
- username, password)))
- .isSuperset(expectedHealthyResponse);
+ new HttpHealthyRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(response -> assertHttpResponseCode(response, code.get()));
}
}
}
@@ -94,23 +97,22 @@ public void testHealthy() {
public void testMetrics() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = MetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = MetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse)).isNotNull();
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpPrometheusMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (response.code() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -119,23 +121,22 @@ public void testMetrics() {
public void testMetricsOpenMetricsFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = OpenMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = OpenMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse)).isNotNull();
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpOpenMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (response.code() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -144,59 +145,116 @@ public void testMetricsOpenMetricsFormat() {
public void testMetricsPrometheusFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = PrometheusMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = PrometheusMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
+ new HttpPrometheusMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (response.code() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
+ }
+ }
+ }
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse)).isNotNull();
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ for (String username : TEST_USERNAMES) {
+ for (String password : TEST_PASSWORDS) {
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
+ if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
+ code.set(HttpResponse.OK);
}
+
+ new HttpPrometheusProtobufMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (response.code() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationBaseTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/AbstractBasicAuthenticationTest.java
similarity index 90%
rename from integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationBaseTest.java
rename to integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/AbstractBasicAuthenticationTest.java
index ad14dd54..d3f16c19 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationBaseTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/AbstractBasicAuthenticationTest.java
@@ -16,15 +16,13 @@
package io.prometheus.jmx.test.http.authentication;
-import io.prometheus.jmx.test.BaseTest;
-import io.prometheus.jmx.test.TestArgument;
+import io.prometheus.jmx.test.AbstractTest;
+import io.prometheus.jmx.test.support.TestArgument;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Predicate;
-import org.antublue.test.engine.api.TestEngine;
-@TestEngine.BaseClass
-public class BasicAuthenticationBaseTest extends BaseTest {
+public abstract class AbstractBasicAuthenticationTest extends AbstractTest {
protected final String VALID_USERNAME = "Prometheus";
protected final String VALID_PASSWORD = "secret";
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test.java
index d9aece11..c8101cdd 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test.java
@@ -16,29 +16,29 @@
package io.prometheus.jmx.test.http.authentication;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.TestArgument;
-import io.prometheus.jmx.test.credentials.BasicAuthenticationCredentials;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
-import io.prometheus.jmx.test.support.Response;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpResponseCode;
+
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.http.HttpBasicAuthenticationCredentials;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
-public class BasicAuthenticationPBKDF2WithHmacSHA1Test extends BasicAuthenticationBaseTest
- implements ContentConsumer {
+public class BasicAuthenticationPBKDF2WithHmacSHA1Test extends AbstractBasicAuthenticationTest
+ implements Consumer {
/**
* Method to get the list of TestArguments
@@ -47,25 +47,24 @@ public class BasicAuthenticationPBKDF2WithHmacSHA1Test extends BasicAuthenticati
*/
@TestEngine.ArgumentSupplier
protected static Stream arguments() {
- return BasicAuthenticationBaseTest.arguments().filter(PBKDF2WITHHMAC_TEST_ARGUMENT_FILTER);
+ return AbstractBasicAuthenticationTest.arguments()
+ .filter(PBKDF2WITHHMAC_TEST_ARGUMENT_FILTER);
}
@TestEngine.Test
public void testHealthy() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedHealthyResponse = HealthyResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedHealthyResponse = HealthyResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- assertThatResponseForRequest(
- new HealthyRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(
- username, password)))
- .isSuperset(expectedHealthyResponse);
+ new HttpHealthyRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(response -> assertHttpResponseCode(response, code.get()));
}
}
}
@@ -74,23 +73,22 @@ public void testHealthy() {
public void testMetrics() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = MetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = MetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -99,23 +97,22 @@ public void testMetrics() {
public void testMetricsOpenMetricsFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = OpenMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = OpenMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpOpenMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -124,59 +121,116 @@ public void testMetricsOpenMetricsFormat() {
public void testMetricsPrometheusFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = PrometheusMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = PrometheusMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
+ new HttpPrometheusMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
+ }
+ }
+ }
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ for (String username : TEST_USERNAMES) {
+ for (String password : TEST_PASSWORDS) {
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
+ if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
+ code.set(HttpResponse.OK);
}
+
+ new HttpPrometheusProtobufMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test.java
index aa0dbbfb..40db1ef9 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test.java
@@ -16,29 +16,29 @@
package io.prometheus.jmx.test.http.authentication;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.TestArgument;
-import io.prometheus.jmx.test.credentials.BasicAuthenticationCredentials;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
-import io.prometheus.jmx.test.support.Response;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpResponseCode;
+
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.http.HttpBasicAuthenticationCredentials;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
-public class BasicAuthenticationPBKDF2WithHmacSHA256Test extends BasicAuthenticationBaseTest
- implements ContentConsumer {
+public class BasicAuthenticationPBKDF2WithHmacSHA256Test extends AbstractBasicAuthenticationTest
+ implements Consumer {
/**
* Method to get the list of TestArguments
@@ -47,25 +47,24 @@ public class BasicAuthenticationPBKDF2WithHmacSHA256Test extends BasicAuthentica
*/
@TestEngine.ArgumentSupplier
protected static Stream arguments() {
- return BasicAuthenticationBaseTest.arguments().filter(PBKDF2WITHHMAC_TEST_ARGUMENT_FILTER);
+ return AbstractBasicAuthenticationTest.arguments()
+ .filter(PBKDF2WITHHMAC_TEST_ARGUMENT_FILTER);
}
@TestEngine.Test
public void testHealthy() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedHealthyResponse = HealthyResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedHealthyResponse = HealthyResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- assertThatResponseForRequest(
- new HealthyRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(
- username, password)))
- .isSuperset(expectedHealthyResponse);
+ new HttpHealthyRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(response -> assertHttpResponseCode(response, code.get()));
}
}
}
@@ -74,23 +73,22 @@ public void testHealthy() {
public void testMetrics() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = MetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = MetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -99,23 +97,22 @@ public void testMetrics() {
public void testMetricsOpenMetricsFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = OpenMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = OpenMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpOpenMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -124,59 +121,116 @@ public void testMetricsOpenMetricsFormat() {
public void testMetricsPrometheusFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = PrometheusMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = PrometheusMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
+ new HttpPrometheusMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
+ }
+ }
+ }
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ for (String username : TEST_USERNAMES) {
+ for (String password : TEST_PASSWORDS) {
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
+ if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
+ code.set(HttpResponse.OK);
}
+
+ new HttpPrometheusProtobufMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test.java
index 3727e1db..a3849d8a 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test.java
@@ -16,29 +16,29 @@
package io.prometheus.jmx.test.http.authentication;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.TestArgument;
-import io.prometheus.jmx.test.credentials.BasicAuthenticationCredentials;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
-import io.prometheus.jmx.test.support.Response;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpResponseCode;
+
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.http.HttpBasicAuthenticationCredentials;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
-public class BasicAuthenticationPBKDF2WithHmacSHA512Test extends BasicAuthenticationBaseTest
- implements ContentConsumer {
+public class BasicAuthenticationPBKDF2WithHmacSHA512Test extends AbstractBasicAuthenticationTest
+ implements Consumer {
/**
* Method to get the list of TestArguments
@@ -47,25 +47,24 @@ public class BasicAuthenticationPBKDF2WithHmacSHA512Test extends BasicAuthentica
*/
@TestEngine.ArgumentSupplier
protected static Stream arguments() {
- return BasicAuthenticationBaseTest.arguments().filter(PBKDF2WITHHMAC_TEST_ARGUMENT_FILTER);
+ return AbstractBasicAuthenticationTest.arguments()
+ .filter(PBKDF2WITHHMAC_TEST_ARGUMENT_FILTER);
}
@TestEngine.Test
public void testHealthy() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedHealthyResponse = HealthyResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedHealthyResponse = HealthyResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- assertThatResponseForRequest(
- new HealthyRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(
- username, password)))
- .isSuperset(expectedHealthyResponse);
+ new HttpHealthyRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(response -> assertHttpResponseCode(response, code.get()));
}
}
}
@@ -74,23 +73,22 @@ public void testHealthy() {
public void testMetrics() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = MetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = MetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -99,23 +97,22 @@ public void testMetrics() {
public void testMetricsOpenMetricsFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = OpenMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = OpenMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpOpenMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -124,59 +121,116 @@ public void testMetricsOpenMetricsFormat() {
public void testMetricsPrometheusFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = PrometheusMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = PrometheusMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
+ new HttpPrometheusMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
+ }
+ }
+ }
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ for (String username : TEST_USERNAMES) {
+ for (String password : TEST_PASSWORDS) {
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
+ if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
+ code.set(HttpResponse.OK);
}
+
+ new HttpPrometheusProtobufMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest.java
index 0dae297c..dd2c4971 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest.java
@@ -16,44 +16,55 @@
package io.prometheus.jmx.test.http.authentication;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.credentials.BasicAuthenticationCredentials;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
-import io.prometheus.jmx.test.support.Response;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpResponseCode;
+
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.http.HttpBasicAuthenticationCredentials;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
+import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
-public class BasicAuthenticationPlaintextTest extends BasicAuthenticationBaseTest
- implements ContentConsumer {
+public class BasicAuthenticationPlaintextTest extends AbstractBasicAuthenticationTest
+ implements Consumer {
+
+ /**
+ * Method to get the list of TestArguments
+ *
+ * @return the return value
+ */
+ @TestEngine.ArgumentSupplier
+ protected static Stream arguments() {
+ return AbstractBasicAuthenticationTest.arguments()
+ .filter(PBKDF2WITHHMAC_TEST_ARGUMENT_FILTER);
+ }
@TestEngine.Test
public void testHealthy() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedHealthyResponse = HealthyResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedHealthyResponse = HealthyResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- assertThatResponseForRequest(
- new HealthyRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(
- username, password)))
- .isSuperset(expectedHealthyResponse);
+ new HttpHealthyRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(response -> assertHttpResponseCode(response, code.get()));
}
}
}
@@ -62,23 +73,22 @@ public void testHealthy() {
public void testMetrics() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = MetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = MetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -87,23 +97,22 @@ public void testMetrics() {
public void testMetricsOpenMetricsFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = OpenMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = OpenMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpOpenMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -112,59 +121,116 @@ public void testMetricsOpenMetricsFormat() {
public void testMetricsPrometheusFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = PrometheusMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = PrometheusMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
+ new HttpPrometheusMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
+ }
+ }
+ }
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ for (String username : TEST_USERNAMES) {
+ for (String password : TEST_PASSWORDS) {
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
+ if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
+ code.set(HttpResponse.OK);
}
+
+ new HttpPrometheusProtobufMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test.java
index d1f84fc1..4a200471 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test.java
@@ -16,44 +16,55 @@
package io.prometheus.jmx.test.http.authentication;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.credentials.BasicAuthenticationCredentials;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
-import io.prometheus.jmx.test.support.Response;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpResponseCode;
+
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.http.HttpBasicAuthenticationCredentials;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
+import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
-public class BasicAuthenticationSHA1Test extends BasicAuthenticationBaseTest
- implements ContentConsumer {
+public class BasicAuthenticationSHA1Test extends AbstractBasicAuthenticationTest
+ implements Consumer {
+
+ /**
+ * Method to get the list of TestArguments
+ *
+ * @return the return value
+ */
+ @TestEngine.ArgumentSupplier
+ protected static Stream arguments() {
+ return AbstractBasicAuthenticationTest.arguments()
+ .filter(PBKDF2WITHHMAC_TEST_ARGUMENT_FILTER);
+ }
@TestEngine.Test
public void testHealthy() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedHealthyResponse = HealthyResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedHealthyResponse = HealthyResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- assertThatResponseForRequest(
- new HealthyRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(
- username, password)))
- .isSuperset(expectedHealthyResponse);
+ new HttpHealthyRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(response -> assertHttpResponseCode(response, code.get()));
}
}
}
@@ -62,23 +73,22 @@ public void testHealthy() {
public void testMetrics() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = MetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = MetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -87,23 +97,22 @@ public void testMetrics() {
public void testMetricsOpenMetricsFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = OpenMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = OpenMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpOpenMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -112,59 +121,116 @@ public void testMetricsOpenMetricsFormat() {
public void testMetricsPrometheusFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = PrometheusMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = PrometheusMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
+ new HttpPrometheusMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
+ }
+ }
+ }
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ for (String username : TEST_USERNAMES) {
+ for (String password : TEST_PASSWORDS) {
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
+ if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
+ code.set(HttpResponse.OK);
}
+
+ new HttpPrometheusProtobufMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test.java
index d5ee97e6..ee4b71c5 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test.java
@@ -16,44 +16,55 @@
package io.prometheus.jmx.test.http.authentication;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.credentials.BasicAuthenticationCredentials;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
-import io.prometheus.jmx.test.support.Response;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpResponseCode;
+
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.http.HttpBasicAuthenticationCredentials;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
+import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
-public class BasicAuthenticationSHA256Test extends BasicAuthenticationBaseTest
- implements ContentConsumer {
+public class BasicAuthenticationSHA256Test extends AbstractBasicAuthenticationTest
+ implements Consumer {
+
+ /**
+ * Method to get the list of TestArguments
+ *
+ * @return the return value
+ */
+ @TestEngine.ArgumentSupplier
+ protected static Stream arguments() {
+ return AbstractBasicAuthenticationTest.arguments()
+ .filter(PBKDF2WITHHMAC_TEST_ARGUMENT_FILTER);
+ }
@TestEngine.Test
public void testHealthy() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedHealthyResponse = HealthyResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedHealthyResponse = HealthyResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- assertThatResponseForRequest(
- new HealthyRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(
- username, password)))
- .isSuperset(expectedHealthyResponse);
+ new HttpHealthyRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(response -> assertHttpResponseCode(response, code.get()));
}
}
}
@@ -62,23 +73,22 @@ public void testHealthy() {
public void testMetrics() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = MetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = MetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -87,23 +97,22 @@ public void testMetrics() {
public void testMetricsOpenMetricsFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = OpenMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = OpenMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpOpenMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -112,59 +121,116 @@ public void testMetricsOpenMetricsFormat() {
public void testMetricsPrometheusFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = PrometheusMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = PrometheusMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
+ new HttpPrometheusMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
+ }
+ }
+ }
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ for (String username : TEST_USERNAMES) {
+ for (String password : TEST_PASSWORDS) {
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
+ if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
+ code.set(HttpResponse.OK);
}
+
+ new HttpPrometheusProtobufMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test.java
index 245198bf..fc361752 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test.java
@@ -16,44 +16,55 @@
package io.prometheus.jmx.test.http.authentication;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.credentials.BasicAuthenticationCredentials;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
-import io.prometheus.jmx.test.support.Response;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpResponseCode;
+
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.http.HttpBasicAuthenticationCredentials;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
+import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
-public class BasicAuthenticationSHA512Test extends BasicAuthenticationBaseTest
- implements ContentConsumer {
+public class BasicAuthenticationSHA512Test extends AbstractBasicAuthenticationTest
+ implements Consumer {
+
+ /**
+ * Method to get the list of TestArguments
+ *
+ * @return the return value
+ */
+ @TestEngine.ArgumentSupplier
+ protected static Stream arguments() {
+ return AbstractBasicAuthenticationTest.arguments()
+ .filter(PBKDF2WITHHMAC_TEST_ARGUMENT_FILTER);
+ }
@TestEngine.Test
public void testHealthy() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedHealthyResponse = HealthyResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedHealthyResponse = HealthyResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- assertThatResponseForRequest(
- new HealthyRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(
- username, password)))
- .isSuperset(expectedHealthyResponse);
+ new HttpHealthyRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(response -> assertHttpResponseCode(response, code.get()));
}
}
}
@@ -62,23 +73,22 @@ public void testHealthy() {
public void testMetrics() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = MetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = MetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -87,23 +97,22 @@ public void testMetrics() {
public void testMetricsOpenMetricsFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = OpenMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = OpenMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpOpenMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -112,59 +121,116 @@ public void testMetricsOpenMetricsFormat() {
public void testMetricsPrometheusFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = PrometheusMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = PrometheusMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
+ new HttpPrometheusMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
+ }
+ }
+ }
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse));
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ for (String username : TEST_USERNAMES) {
+ for (String password : TEST_PASSWORDS) {
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
+ if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
+ code.set(HttpResponse.OK);
}
+
+ new HttpPrometheusProtobufMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test.java
index 0a65920e..a0dd588c 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test.java
@@ -16,30 +16,30 @@
package io.prometheus.jmx.test.http.ssl;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.TestArgument;
-import io.prometheus.jmx.test.credentials.BasicAuthenticationCredentials;
-import io.prometheus.jmx.test.http.authentication.BasicAuthenticationBaseTest;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
-import io.prometheus.jmx.test.support.Response;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpResponseCode;
+
+import io.prometheus.jmx.test.http.authentication.AbstractBasicAuthenticationTest;
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.http.HttpBasicAuthenticationCredentials;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
-public class SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test extends BasicAuthenticationBaseTest
- implements ContentConsumer {
+public class SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test
+ extends AbstractBasicAuthenticationTest implements Consumer {
private static final String BASE_URL = "https://localhost";
@@ -50,7 +50,7 @@ public class SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test extends BasicAuth
*/
@TestEngine.ArgumentSupplier
protected static Stream arguments() {
- return BasicAuthenticationBaseTest.arguments()
+ return AbstractBasicAuthenticationTest.arguments()
.filter(PBKDF2WITHHMAC_TEST_ARGUMENT_FILTER)
.filter(
testArgument ->
@@ -61,25 +61,23 @@ protected static Stream arguments() {
@TestEngine.Prepare
protected void setBaseUrl() {
- testState.baseUrl(BASE_URL);
+ testContext.baseUrl(BASE_URL);
}
@TestEngine.Test
public void testHealthy() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedHealthyResponse = HealthyResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedHealthyResponse = HealthyResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- assertThatResponseForRequest(
- new HealthyRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(
- username, password)))
- .isSuperset(expectedHealthyResponse);
+ new HttpHealthyRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(response -> assertHttpResponseCode(response, code.get()));
}
}
}
@@ -88,23 +86,22 @@ public void testHealthy() {
public void testMetrics() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = MetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = MetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse)).isNotNull();
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -113,23 +110,22 @@ public void testMetrics() {
public void testMetricsOpenMetricsFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = OpenMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = OpenMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
-
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse)).isNotNull();
-
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
- }
+ new HttpOpenMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@@ -138,59 +134,116 @@ public void testMetricsOpenMetricsFormat() {
public void testMetricsPrometheusFormat() {
for (String username : TEST_USERNAMES) {
for (String password : TEST_PASSWORDS) {
- Response expectedMetricsResponse = PrometheusMetricsResponse.RESULT_401;
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
- expectedMetricsResponse = PrometheusMetricsResponse.RESULT_200;
+ code.set(HttpResponse.OK);
}
- Response actualMetricsResponse =
- new MetricsRequest(testState.httpClient())
- .withCredentials(
- new BasicAuthenticationCredentials(username, password))
- .execute();
+ new HttpPrometheusMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
+ }
+ }
+ }
- assertThat(actualMetricsResponse.isSuperset(expectedMetricsResponse)).isNotNull();
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ for (String username : TEST_USERNAMES) {
+ for (String password : TEST_PASSWORDS) {
+ final AtomicInteger code = new AtomicInteger(HttpResponse.UNAUTHORIZED);
- if (actualMetricsResponse.code() == 200) {
- actualMetricsResponse.dispatch(this);
+ if (VALID_USERNAME.equals(username) && VALID_PASSWORD.equals(password)) {
+ code.set(HttpResponse.OK);
}
+
+ new HttpPrometheusProtobufMetricsRequest()
+ .credentials(new HttpBasicAuthenticationCredentials(username, password))
+ .send(testContext.httpClient())
+ .accept(
+ response -> {
+ assertHttpResponseCode(response, code.get());
+ if (code.get() == HttpResponse.OK) {
+ accept(response);
+ }
+ });
}
}
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest.java
index 7a87b6b6..c0e9845a 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest.java
@@ -16,29 +16,28 @@
package io.prometheus.jmx.test.http.ssl;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-
-import io.prometheus.jmx.test.BaseTest;
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.TestArgument;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+
+import io.prometheus.jmx.test.AbstractTest;
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
-public class SSLWithJKSKeyStoreMultipleCertificatesTest extends BaseTest
- implements ContentConsumer {
+public class SSLWithJKSKeyStoreMultipleCertificatesTest extends AbstractTest
+ implements Consumer {
private static final String BASE_URL = "https://localhost";
@@ -51,7 +50,7 @@ public class SSLWithJKSKeyStoreMultipleCertificatesTest extends BaseTest
protected static Stream arguments() {
// Filter eclipse-temurin:8 based Alpine images due to missing TLS cipher suites
// https://github.com/adoptium/temurin-build/issues/3002
- return BaseTest.arguments()
+ return AbstractTest.arguments()
.filter(
testArgument ->
!testArgument
@@ -61,68 +60,102 @@ protected static Stream arguments() {
@TestEngine.Prepare
protected void setBaseUrl() {
- testState.baseUrl(BASE_URL);
+ testContext.baseUrl(BASE_URL);
}
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest.java
index ca7f5ec5..b1d9958f 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest.java
@@ -16,28 +16,27 @@
package io.prometheus.jmx.test.http.ssl;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-
-import io.prometheus.jmx.test.BaseTest;
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.TestArgument;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+
+import io.prometheus.jmx.test.AbstractTest;
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
-public class SSLWithJKSKeyStoreTest extends BaseTest implements ContentConsumer {
+public class SSLWithJKSKeyStoreTest extends AbstractTest implements Consumer {
private static final String BASE_URL = "https://localhost";
@@ -50,7 +49,7 @@ public class SSLWithJKSKeyStoreTest extends BaseTest implements ContentConsumer
protected static Stream arguments() {
// Filter eclipse-temurin:8 based Alpine images due to missing TLS cipher suites
// https://github.com/adoptium/temurin-build/issues/3002
- return BaseTest.arguments()
+ return AbstractTest.arguments()
.filter(
testArgument ->
!testArgument
@@ -60,68 +59,102 @@ protected static Stream arguments() {
@TestEngine.Prepare
protected void setBaseUrl() {
- testState.baseUrl(BASE_URL);
+ testContext.baseUrl(BASE_URL);
}
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2.java
index a1156880..e73c765a 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2.java
@@ -16,28 +16,27 @@
package io.prometheus.jmx.test.http.ssl;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-
-import io.prometheus.jmx.test.BaseTest;
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.TestArgument;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+
+import io.prometheus.jmx.test.AbstractTest;
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
-public class SSLWithJKSKeyStoreTest2 extends BaseTest implements ContentConsumer {
+public class SSLWithJKSKeyStoreTest2 extends AbstractTest implements Consumer {
private static final String BASE_URL = "https://localhost";
@@ -50,7 +49,7 @@ public class SSLWithJKSKeyStoreTest2 extends BaseTest implements ContentConsumer
protected static Stream arguments() {
// Filter eclipse-temurin:8 based Alpine images due to missing TLS cipher suites
// https://github.com/adoptium/temurin-build/issues/3002
- return BaseTest.arguments()
+ return AbstractTest.arguments()
.filter(
testArgument ->
!testArgument
@@ -60,68 +59,102 @@ protected static Stream arguments() {
@TestEngine.Prepare
protected void setBaseUrl() {
- testState.baseUrl(BASE_URL);
+ testContext.baseUrl(BASE_URL);
}
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest.java
index 3dff6aa5..14b60a7f 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest.java
@@ -16,32 +16,31 @@
package io.prometheus.jmx.test.http.ssl;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-
-import io.prometheus.jmx.test.BaseTest;
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.TestArgument;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+
+import io.prometheus.jmx.test.AbstractTest;
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
+import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
-public class SSLWithPKCS12KeyStoreMultipleCertificatesTest extends BaseTest
- implements ContentConsumer {
+public class SSLWithPKCS12KeyStoreMultipleCertificatesTest extends AbstractTest
+ implements Consumer {
private static final String BASE_URL = "https://localhost";
@@ -84,73 +83,107 @@ public boolean test(TestArgument testArgument) {
protected static Stream arguments() {
// Filter Java versions that don't support the PKCS12 keystore
// format or don't support the required TLS cipher suites
- return BaseTest.arguments().filter(PKCS12_KEYSTORE_TEST_ARGUMENT_FILTER);
+ return AbstractTest.arguments().filter(PKCS12_KEYSTORE_TEST_ARGUMENT_FILTER);
}
@TestEngine.Prepare
protected void setBaseUrl() {
- testState.baseUrl(BASE_URL);
+ testContext.baseUrl(BASE_URL);
}
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest.java
index 1dc5e935..502d5673 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest.java
@@ -16,31 +16,30 @@
package io.prometheus.jmx.test.http.ssl;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-
-import io.prometheus.jmx.test.BaseTest;
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.TestArgument;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+
+import io.prometheus.jmx.test.AbstractTest;
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
+import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
-public class SSLWithPKCS12KeyStoreTest extends BaseTest implements ContentConsumer {
+public class SSLWithPKCS12KeyStoreTest extends AbstractTest implements Consumer {
private static final String BASE_URL = "https://localhost";
@@ -83,73 +82,107 @@ public boolean test(TestArgument testArgument) {
protected static Stream arguments() {
// Filter Java versions that don't support the PKCS12 keystore
// format or don't support the required TLS cipher suites
- return BaseTest.arguments().filter(PKCS12_KEYSTORE_TEST_ARGUMENT_FILTER);
+ return AbstractTest.arguments().filter(PKCS12_KEYSTORE_TEST_ARGUMENT_FILTER);
}
@TestEngine.Prepare
protected void setBaseUrl() {
- testState.baseUrl(BASE_URL);
+ testContext.baseUrl(BASE_URL);
}
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2.java
index 846e5f98..413cc7ef 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2.java
@@ -16,31 +16,30 @@
package io.prometheus.jmx.test.http.ssl;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-
-import io.prometheus.jmx.test.BaseTest;
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.TestArgument;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+
+import io.prometheus.jmx.test.AbstractTest;
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.TestArgument;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
+import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;
import org.antublue.test.engine.api.TestEngine;
-public class SSLWithPKCS12KeyStoreTest2 extends BaseTest implements ContentConsumer {
+public class SSLWithPKCS12KeyStoreTest2 extends AbstractTest implements Consumer {
private static final String BASE_URL = "https://localhost";
@@ -83,73 +82,107 @@ public boolean test(TestArgument testArgument) {
protected static Stream arguments() {
// Filter Java versions that don't support the PKCS12 keystore
// format or don't support the required TLS cipher suites
- return BaseTest.arguments().filter(PKCS12_KEYSTORE_TEST_ARGUMENT_FILTER);
+ return AbstractTest.arguments().filter(PKCS12_KEYSTORE_TEST_ARGUMENT_FILTER);
}
@TestEngine.Prepare
protected void setBaseUrl() {
- testState.baseUrl(BASE_URL);
+ testContext.baseUrl(BASE_URL);
}
@TestEngine.Test
public void testHealthy() {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest.java
index dffa755a..838f54d3 100644
--- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest.java
+++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest.java
@@ -16,86 +16,119 @@
package io.prometheus.jmx.test.http.threads;
-import static io.prometheus.jmx.test.support.MetricsAssertions.assertThatMetricIn;
-import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest;
-
-import io.prometheus.jmx.test.BaseTest;
-import io.prometheus.jmx.test.Metric;
-import io.prometheus.jmx.test.MetricsParser;
-import io.prometheus.jmx.test.Mode;
-import io.prometheus.jmx.test.support.ContentConsumer;
-import io.prometheus.jmx.test.support.HealthyRequest;
-import io.prometheus.jmx.test.support.HealthyResponse;
-import io.prometheus.jmx.test.support.MetricsRequest;
-import io.prometheus.jmx.test.support.MetricsResponse;
-import io.prometheus.jmx.test.support.OpenMetricsRequest;
-import io.prometheus.jmx.test.support.OpenMetricsResponse;
-import io.prometheus.jmx.test.support.PrometheusMetricsRequest;
-import io.prometheus.jmx.test.support.PrometheusMetricsResponse;
+import static io.prometheus.jmx.test.support.http.HttpResponseAssertions.assertHttpMetricsResponse;
+
+import io.prometheus.jmx.test.AbstractTest;
+import io.prometheus.jmx.test.support.Mode;
+import io.prometheus.jmx.test.support.http.HttpHealthyRequest;
+import io.prometheus.jmx.test.support.http.HttpMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpOpenMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpPrometheusProtobufMetricsRequest;
+import io.prometheus.jmx.test.support.http.HttpResponse;
+import io.prometheus.jmx.test.support.http.HttpResponseAssertions;
+import io.prometheus.jmx.test.support.metrics.DoubleValueMetricAssertion;
+import io.prometheus.jmx.test.support.metrics.Metric;
+import io.prometheus.jmx.test.support.metrics.MetricsParser;
import java.util.Collection;
+import java.util.function.Consumer;
import org.antublue.test.engine.api.TestEngine;
-public class ThreadsConfigurationTest extends BaseTest implements ContentConsumer {
+public class ThreadsConfigurationTest extends AbstractTest implements Consumer {
@TestEngine.Test
- public void testHealthy() throws InterruptedException {
- assertThatResponseForRequest(new HealthyRequest(testState.httpClient()))
- .isSuperset(HealthyResponse.RESULT_200);
+ public void testHealthy() {
+ new HttpHealthyRequest()
+ .send(testContext.httpClient())
+ .accept(HttpResponseAssertions::assertHttpHealthyResponse);
}
@TestEngine.Test
public void testMetrics() {
- assertThatResponseForRequest(new MetricsRequest(testState.httpClient()))
- .isSuperset(MetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsOpenMetricsFormat() {
- assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient()))
- .isSuperset(OpenMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpOpenMetricsRequest().send(testContext.httpClient()).accept(this);
}
@TestEngine.Test
public void testMetricsPrometheusFormat() {
- assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient()))
- .isSuperset(PrometheusMetricsResponse.RESULT_200)
- .dispatch(this);
+ new HttpPrometheusMetricsRequest().send(testContext.httpClient()).accept(this);
+ }
+
+ @TestEngine.Test
+ public void testMetricsPrometheusProtobufFormat() {
+ new HttpPrometheusProtobufMetricsRequest().send(testContext.httpClient()).accept(this);
}
@Override
- public void accept(String content) {
- Collection metrics = MetricsParser.parse(content);
+ public void accept(HttpResponse httpResponse) {
+ assertHttpMetricsResponse(httpResponse);
+
+ Collection metrics = MetricsParser.parse(httpResponse);
String buildInfoName =
testArgument.mode() == Mode.JavaAgent
? "jmx_prometheus_javaagent"
: "jmx_prometheus_httpserver";
- assertThatMetricIn(metrics)
- .withName("jmx_exporter_build_info")
- .withLabel("name", buildInfoName)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("java_lang_Memory_NonHeapMemoryUsage_committed")
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
- .withLabel("source", "/dev/sda1")
- .withValue(7.516192768E9)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
- .withLabel("source", "/dev/sda2")
- .withValue(0.8)
- .exists();
-
- assertThatMetricIn(metrics)
- .withName("jvm_threads_state")
- .exists(testArgument.mode() == Mode.JavaAgent);
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_exporter_build_info")
+ .label("name", buildInfoName)
+ .value(1d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jmx_scrape_error")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("COUNTER")
+ .name("jmx_config_reload_success_total")
+ .value(0d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isPresent(testArgument.mode() == Mode.JavaAgent);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "nonheap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("GAUGE")
+ .name("jvm_memory_used_bytes")
+ .label("area", "heap")
+ .isNotPresent(testArgument.mode() == Mode.Standalone);
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_1_Disk_Usage_Table_size")
+ .label("source", "/dev/sda1")
+ .value(7.516192768E9d)
+ .isPresent();
+
+ new DoubleValueMetricAssertion(metrics)
+ .type("UNTYPED")
+ .name("io_prometheus_jmx_tabularData_Server_2_Disk_Usage_Table_pcent")
+ .label("source", "/dev/sda2")
+ .value(0.8d)
+ .isPresent();
}
}
diff --git a/integration_test_suite/integration_tests/src/test/resources/docker-image-names.all.txt b/integration_test_suite/integration_tests/src/test/resources/docker-image-names.all.txt
index db7de5fe..1bdc2f89 100644
--- a/integration_test_suite/integration_tests/src/test/resources/docker-image-names.all.txt
+++ b/integration_test_suite/integration_tests/src/test/resources/docker-image-names.all.txt
@@ -6,60 +6,65 @@ alibabadragonwell/dragonwell:17
amazoncorretto:8
amazoncorretto:11
amazoncorretto:17
-amazoncorretto:20
+amazoncorretto:21
antublue/openlogic-openjdk:8
antublue/openlogic-openjdk:11
antublue/openlogic-openjdk:17
azul/zulu-openjdk:8
azul/zulu-openjdk:11
azul/zulu-openjdk:17
-azul/zulu-openjdk:20
+azul/zulu-openjdk:21
azul/prime:8
azul/prime:11
azul/prime:17
-azul/prime:19
+azul/prime:21
bellsoft/liberica-openjdk-debian:8
bellsoft/liberica-openjdk-debian:11
bellsoft/liberica-openjdk-debian:17
-bellsoft/liberica-openjdk-debian:20
+bellsoft/liberica-openjdk-debian:21
bitnami/java:1.8
bitnami/java:11
bitnami/java:17
-bitnami/java:20
+bitnami/java:21
eclipse-temurin:8
eclipse-temurin:11
eclipse-temurin:17
-eclipse-temurin:20
+eclipse-temurin:21
eclipse-temurin:8-alpine
eclipse-temurin:11-alpine
eclipse-temurin:17-alpine
-eclipse-temurin:20-alpine
+eclipse-temurin:21-alpine
ghcr.io/graalvm/jdk:java8
ghcr.io/graalvm/jdk:java11
ghcr.io/graalvm/jdk:java17
+ghcr.io/graalvm/jdk:21
ibmjava:8
ibmjava:11
ibm-semeru-runtimes:open-8-jdk-focal
ibm-semeru-runtimes:open-11-jdk-focal
ibm-semeru-runtimes:open-17-jdk-focal
-ibm-semeru-runtimes:open-19-jdk-focal
+ibm-semeru-runtimes:open-20-jdk-focal
konajdk/konajdk:8
konajdk/konajdk:11
-antublue/konajdk:17
+konajdk/konajdk:17-tlinux
mcr.microsoft.com/openjdk/jdk:8-mariner
mcr.microsoft.com/openjdk/jdk:11-mariner
mcr.microsoft.com/openjdk/jdk:17-mariner
+mcr.microsoft.com/openjdk/jdk:21-mariner
mcr.microsoft.com/openjdk/jdk:11-mariner-cm1
mcr.microsoft.com/openjdk/jdk:17-mariner-cm1
+mcr.microsoft.com/openjdk/jdk:21-mariner-cm1
mcr.microsoft.com/openjdk/jdk:11-ubuntu
mcr.microsoft.com/openjdk/jdk:17-ubuntu
+mcr.microsoft.com/openjdk/jdk:21-ubuntu
openjdk:8
openjdk:11
openjdk:17
-openjdk:20
+openjdk:21
registry.access.redhat.com/ubi8/openjdk-8-runtime:latest
registry.access.redhat.com/ubi8/openjdk-11-runtime:latest
registry.access.redhat.com/ubi8/openjdk-17-runtime:latest
+registry.access.redhat.com/ubi8/openjdk-21-runtime:latest
sapmachine:11
sapmachine:17
-sapmachine:20
\ No newline at end of file
+sapmachine:21
diff --git a/integration_test_suite/integration_tests/src/test/resources/docker-image-names.smoke-test.txt b/integration_test_suite/integration_tests/src/test/resources/docker-image-names.smoke-test.txt
index c7e2e30f..e311f47b 100644
--- a/integration_test_suite/integration_tests/src/test/resources/docker-image-names.smoke-test.txt
+++ b/integration_test_suite/integration_tests/src/test/resources/docker-image-names.smoke-test.txt
@@ -1,4 +1,4 @@
eclipse-temurin:8-alpine
eclipse-temurin:11-alpine
eclipse-temurin:17-alpine
-eclipse-temurin:20-alpine
\ No newline at end of file
+eclipse-temurin:21-alpine
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/AutoIncrementingMBeanTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/AutoIncrementingMBeanTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/AutoIncrementingMBeanTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/AutoIncrementingMBeanTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/AutoIncrementingMBeanTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/AutoIncrementingMBeanTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/AutoIncrementingMBeanTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/AutoIncrementingMBeanTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/AutoIncrementingMBeanTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/AutoIncrementingMBeanTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/AutoIncrementingMBeanTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/AutoIncrementingMBeanTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/BlacklistObjectNamesTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/BlacklistObjectNamesTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/BlacklistObjectNamesTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/BlacklistObjectNamesTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/BlacklistObjectNamesTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/BlacklistObjectNamesTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/BlacklistObjectNamesTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/BlacklistObjectNamesTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/BlacklistObjectNamesTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/BlacklistObjectNamesTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/BlacklistObjectNamesTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/BlacklistObjectNamesTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/CompositeKeyDataTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/CompositeKeyDataTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/CompositeKeyDataTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/CompositeKeyDataTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/CompositeKeyDataTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/CompositeKeyDataTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/CompositeKeyDataTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/CompositeKeyDataTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/CompositeKeyDataTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/CompositeKeyDataTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/CompositeKeyDataTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/CompositeKeyDataTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/DisableAutoExcludeObjectNameAttributesTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNameAttributesTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNamesTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNamesTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNamesTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNamesTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNamesTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNamesTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNamesTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNamesTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNamesTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNamesTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNamesTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/ExcludeObjectNamesTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeObjectNamesTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeObjectNamesTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeObjectNamesTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeObjectNamesTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeObjectNamesTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeObjectNamesTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeObjectNamesTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeObjectNamesTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeObjectNamesTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeObjectNamesTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeObjectNamesTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/IncludeObjectNamesTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputAndLabelNamesTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputLabelNamesTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputNamesTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputNamesTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputNamesTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputNamesTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputNamesTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputNamesTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputNamesTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputNamesTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputNamesTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputNamesTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputNamesTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/LowerCaseOutputNamesTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/MinimalTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/MinimalTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/MinimalTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/MinimalTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/MinimalTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/MinimalTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/MinimalTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/MinimalTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/MinimalTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/MinimalTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/MinimalTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/MinimalTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/OptionalValueMBeanTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/OptionalValueMBeanTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/OptionalValueMBeanTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/OptionalValueMBeanTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/OptionalValueMBeanTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/OptionalValueMBeanTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/OptionalValueMBeanTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/OptionalValueMBeanTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/OptionalValueMBeanTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/OptionalValueMBeanTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/OptionalValueMBeanTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/OptionalValueMBeanTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistAndBlacklistObjectNamesTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistObjectNamesTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistObjectNamesTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistObjectNamesTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistObjectNamesTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistObjectNamesTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistObjectNamesTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistObjectNamesTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistObjectNamesTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistObjectNamesTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistObjectNamesTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistObjectNamesTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/WhitelistObjectNamesTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/CompleteHttpServerConfigurationTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA1Test/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA256Test/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationPlaintextTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA1Test/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA256Test/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/authentication/BasicAuthenticationSHA512Test/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test/JavaAgent/application.sh
index 9c9258b9..12640783 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test/JavaAgent/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Djavax.net.ssl.keyStore=localhost.jks \
-Djavax.net.ssl.keyStorePassword=changeit \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/exporter.sh
index 79862690..30d75027 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLAndBasicAuthenticationPBKDF2WithHmacSHA512Test/Standalone/exporter.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Djavax.net.ssl.keyStore=localhost.jks \
-Djavax.net.ssl.keyStorePassword=changeit \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest/JavaAgent/application.sh
index 9c9258b9..12640783 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest/JavaAgent/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Djavax.net.ssl.keyStore=localhost.jks \
-Djavax.net.ssl.keyStorePassword=changeit \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest/Standalone/exporter.sh
index 79862690..30d75027 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreMultipleCertificatesTest/Standalone/exporter.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Djavax.net.ssl.keyStore=localhost.jks \
-Djavax.net.ssl.keyStorePassword=changeit \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest/JavaAgent/application.sh
index 9c9258b9..12640783 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest/JavaAgent/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Djavax.net.ssl.keyStore=localhost.jks \
-Djavax.net.ssl.keyStorePassword=changeit \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest/Standalone/exporter.sh
index 79862690..30d75027 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest/Standalone/exporter.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Djavax.net.ssl.keyStore=localhost.jks \
-Djavax.net.ssl.keyStorePassword=changeit \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithJKSKeyStoreTest2/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest/JavaAgent/application.sh
index 79f49569..a1693559 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest/JavaAgent/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Djavax.net.ssl.keyStore=localhost.pkcs12 \
-Djavax.net.ssl.keyStorePassword=changeit \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest/Standalone/exporter.sh
index 2eda2d21..678c7c2f 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreMultipleCertificatesTest/Standalone/exporter.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Djavax.net.ssl.keyStore=localhost.pkcs12 \
-Djavax.net.ssl.keyStorePassword=changeit \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest/JavaAgent/application.sh
index 79f49569..a1693559 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest/JavaAgent/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Djavax.net.ssl.keyStore=localhost.pkcs12 \
-Djavax.net.ssl.keyStorePassword=changeit \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest/Standalone/exporter.sh
index 2eda2d21..678c7c2f 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest/Standalone/exporter.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Djavax.net.ssl.keyStore=localhost.pkcs12 \
-Djavax.net.ssl.keyStorePassword=changeit \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/ssl/SSLWithPKCS12KeyStoreTest2/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest/JavaAgent/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest/JavaAgent/application.sh
index 268f821e..9e5717d6 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest/JavaAgent/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest/JavaAgent/application.sh
@@ -1,6 +1,6 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-javaagent:jmx_prometheus_javaagent.jar=8888:exporter.yaml \
-jar jmx_example_application.jar
\ No newline at end of file
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest/Standalone/application.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest/Standalone/application.sh
index c0fa948c..80c2b344 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest/Standalone/application.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest/Standalone/application.sh
@@ -1,7 +1,7 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.local.only=false \
diff --git a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest/Standalone/exporter.sh b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest/Standalone/exporter.sh
index c35f1652..a04f3b63 100644
--- a/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest/Standalone/exporter.sh
+++ b/integration_test_suite/integration_tests/src/test/resources/io/prometheus/jmx/test/http/threads/ThreadsConfigurationTest/Standalone/exporter.sh
@@ -1,5 +1,5 @@
#!/bin/bash
java \
- -Xmx128M \
+ -Xmx512M \
-jar jmx_prometheus_httpserver.jar 8888 exporter.yaml
\ No newline at end of file
diff --git a/integration_test_suite/jmx_example_application/pom.xml b/integration_test_suite/jmx_example_application/pom.xml
index 60c0b726..2faf5832 100644
--- a/integration_test_suite/jmx_example_application/pom.xml
+++ b/integration_test_suite/jmx_example_application/pom.xml
@@ -5,7 +5,7 @@