From 2d632bbd38c1c68768c45d87ef46ed8452c1b685 Mon Sep 17 00:00:00 2001 From: Doug Hoard Date: Fri, 1 Nov 2024 01:10:53 -0400 Subject: [PATCH] Cleanup integration tests (#1028) * Integration tests cleanup Signed-off-by: dhoard --- NOTICE | 2 +- .../io/prometheus/jmx/BuildInfoMetrics.java | 2 +- .../java/io/prometheus/jmx/JmxCollector.java | 2 +- .../prometheus/jmx/JmxMBeanPropertyCache.java | 2 +- .../java/io/prometheus/jmx/JmxScraper.java | 2 +- .../java/io/prometheus/jmx/MatchedRule.java | 2 +- ...MatchedRuleToMetricSnapshotsConverter.java | 16 ++++++++ .../io/prometheus/jmx/MatchedRulesCache.java | 2 +- .../jmx/ObjectNameAttributeFilter.java | 2 +- .../java/io/prometheus/jmx/logger/Logger.java | 2 +- .../prometheus/jmx/logger/LoggerFactory.java | 2 +- .../io/prometheus/jmx/BeanWithEnumMBean.java | 16 ++++++++ .../java/io/prometheus/jmx/BoolMBean.java | 16 ++++++++ .../prometheus/jmx/BuildInfoMetricsTest.java | 16 ++++++++ .../java/io/prometheus/jmx/CamelMBean.java | 16 ++++++++ .../io/prometheus/jmx/CassandraMBean.java | 16 ++++++++ .../prometheus/jmx/CassandraMetricsMBean.java | 16 ++++++++ .../io/prometheus/jmx/CollidingNameMBean.java | 16 ++++++++ .../io/prometheus/jmx/DuplicateLabels.java | 2 +- .../java/io/prometheus/jmx/ExistDbMXBean.java | 3 +- .../prometheus/jmx/HadoopDataNodeMXBean.java | 16 ++++++++ .../java/io/prometheus/jmx/HadoopMBean.java | 16 ++++++++ .../io/prometheus/jmx/JmxCollectorTest.java | 16 ++++++++ .../jmx/JmxMBeanPropertyCacheTest.java | 16 ++++++++ ...hedRuleToMetricSnapshotsConverterTest.java | 16 ++++++++ .../jmx/ObjectNameAttributeFilterTest.java | 16 ++++++++ .../jmx/PerformanceMetricsMBean.java | 16 ++++++++ .../jmx/PrometheusRegistryUtils.java | 2 +- .../java/io/prometheus/jmx/SafeNameTest.java | 16 ++++++++ .../io/prometheus/jmx/SnakeCaseAttrTest.java | 16 ++++++++ .../test/java/io/prometheus/jmx/State.java | 16 ++++++++ .../jmx/TomcatPatternCheckTest.java | 16 ++++++++ .../io/prometheus/jmx/TomcatServletMBean.java | 16 ++++++++ .../io/prometheus/jmx/TotalValueMBean.java | 16 ++++++++ .../jmx/test/support/Assertions.java | 16 ++++++++ .../jmx/test/support/JavaDockerImages.java | 2 +- .../jmx/test/support/JmxExporterMode.java | 2 +- .../jmx/test/support/http/HttpClient.java | 16 ++++++++ .../jmx/test/support/http/HttpHeader.java | 29 ++++++++++++++ .../jmx/test/support/http/HttpRequest.java | 16 ++++++++ .../jmx/test/support/http/HttpResponse.java | 16 ++++++++ .../test/support/http/HttpResponseBody.java | 16 ++++++++ .../support/metrics/MapMetricAssertion.java | 2 +- .../jmx/test/support/metrics/Metric.java | 2 +- .../test/support/metrics/MetricAssertion.java | 2 +- .../test/support/metrics/MetricsParser.java | 2 +- .../metrics/MetricsParserException.java | 2 +- .../throttle/ExponentialBackoffThrottle.java | 16 ++++++++ .../jmx/test/support/throttle/Throttle.java | 16 ++++++++ .../jmx/test/AutoIncrementingMBeanTest.java | 37 +++++++++--------- .../jmx/test/BlacklistObjectNamesTest.java | 36 +++++++++--------- .../jmx/test/CompositeKeyDataTest.java | 36 +++++++++--------- ...leAutoExcludeObjectNameAttributesTest.java | 36 +++++++++--------- .../test/ExcludeObjectNameAttributesTest.java | 36 +++++++++--------- .../jmx/test/ExcludeObjectNamesTest.java | 36 +++++++++--------- .../IncludeAndExcludeObjectNamesTest.java | 36 +++++++++--------- .../jmx/test/IncludeObjectNamesTest.java | 36 +++++++++--------- .../LowerCaseOutputAndLabelNamesTest.java | 36 +++++++++--------- .../test/LowerCaseOutputLabelNamesTest.java | 36 +++++++++--------- .../jmx/test/LowerCaseOutputNamesTest.java | 36 +++++++++--------- .../io/prometheus/jmx/test/MinimalTest.java | 36 +++++++++--------- .../jmx/test/OptionalValueMBeanTest.java | 36 +++++++++--------- .../WhitelistAndBlacklistObjectNamesTest.java | 36 +++++++++--------- .../jmx/test/WhitelistObjectNamesTest.java | 36 +++++++++--------- .../jmx/test/common/ExporterPath.java | 32 ++++++++++++++++ .../test/common/ExporterTestEnvironment.java | 35 +++++++++++++++++ .../ExporterTestEnvironmentFactory.java | 16 ++++++++ .../jmx/test/common/ExporterTestSupport.java | 16 ++++++++ .../jmx/test/common/MetricsType.java | 38 +++++++++++++++++++ ...WithHmacExporterTestEnvironmentFilter.java | 16 ++++++++ ...KeyStoreExporterTestEnvironmentFilter.java | 16 ++++++++ .../CompleteHttpServerConfigurationTest.java | 36 ++++++++++-------- .../AuthenticatorPluginTest.java | 36 ++++++++++-------- ...cAuthenticationPBKDF2WithHmacSHA1Test.java | 36 ++++++++++-------- ...uthenticationPBKDF2WithHmacSHA256Test.java | 36 ++++++++++-------- ...uthenticationPBKDF2WithHmacSHA512Test.java | 36 ++++++++++-------- .../BasicAuthenticationPlaintextTest.java | 36 ++++++++++-------- .../BasicAuthenticationSHA1Test.java | 36 ++++++++++-------- .../BasicAuthenticationSHA256Test.java | 36 ++++++++++-------- .../BasicAuthenticationSHA512Test.java | 36 ++++++++++-------- ...uthenticationPBKDF2WithHmacSHA512Test.java | 36 ++++++++++-------- ...thJKSKeyStoreMultipleCertificatesTest.java | 36 +++++++++--------- .../test/http/ssl/SSLWithJKSKeyStoreTest.java | 36 +++++++++--------- .../http/ssl/SSLWithJKSKeyStoreTest2.java | 36 +++++++++--------- ...KCS12KeyStoreMultipleCertificatesTest.java | 36 +++++++++--------- .../http/ssl/SSLWithPKCS12KeyStoreTest.java | 36 +++++++++--------- .../http/ssl/SSLWithPKCS12KeyStoreTest2.java | 36 +++++++++--------- .../threads/ThreadsConfigurationTest.java | 36 +++++++++--------- .../jmx/test/rmi/ssl/MinimalRMISSLTest.java | 36 +++++++++--------- .../rmi/ssl/RMIRegistrySSLDisabledTest.java | 36 +++++++++--------- .../prometheus/jmx/AuthenticatorPlugin.java | 22 ++++++----- .../prometheus/jmx/AutoIncrementingMBean.java | 2 +- .../java/io/prometheus/jmx/ExistDbMXBean.java | 2 +- .../prometheus/jmx/JmxExampleApplication.java | 2 +- .../io/prometheus/jmx/OptionalValueMBean.java | 2 +- .../jmx/PerformanceMetricsMBean.java | 16 ++++++++ .../java/io/prometheus/jmx/TabularMBean.java | 2 +- .../configuration/ConvertToInteger.java | 2 +- .../configuration/ConvertToMapAccessor.java | 2 +- .../common/configuration/ConvertToString.java | 2 +- .../configuration/ValidateIntegerInRange.java | 2 +- .../ValidateStringIsNotBlank.java | 2 +- .../common/http/ConfigurationException.java | 2 +- .../jmx/common/http/HTTPServerFactory.java | 2 +- .../http/authenticator/Credentials.java | 2 +- .../http/authenticator/CredentialsCache.java | 2 +- .../common/http/authenticator/HexString.java | 2 +- .../MessageDigestAuthenticator.java | 2 +- .../authenticator/PBKDF2Authenticator.java | 2 +- .../authenticator/PlaintextAuthenticator.java | 2 +- .../common/http/ssl/SSLContextFactory.java | 2 +- .../jmx/common/util/Precondition.java | 2 +- .../jmx/common/yaml/YamlMapAccessor.java | 2 +- .../common/http/HTTPServerFactoryTest.java | 16 ++++++++ .../authenticator/BaseAuthenticatorTest.java | 2 +- .../authenticator/CredentialsCacheTest.java | 2 +- .../http/authenticator/CredentialsTest.java | 2 +- .../authenticator/CustomAuthenticator451.java | 22 ++++++----- .../CustomAuthenticatorWithSubject.java | 22 ++++++----- .../MessageDigestAuthenticatorTest.java | 2 +- .../PBKDF2AuthenticatorTest.java | 2 +- .../PlaintextAuthenticatorTest.java | 2 +- .../jmx/common/util/PreconditionTest.java | 2 +- .../jmx/common/yaml/YamlMapAccessorTest.java | 2 +- .../java/io/prometheus/jmx/WebServer.java | 2 +- .../java/io/prometheus/jmx/JavaAgent.java | 2 +- .../jmx/JavaAgentConfigurationRegexTest.java | 2 +- stress-test.sh | 2 +- 128 files changed, 1410 insertions(+), 666 deletions(-) create mode 100644 integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpHeader.java create mode 100644 integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterPath.java create mode 100644 integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/MetricsType.java diff --git a/NOTICE b/NOTICE index 64f0bb8d..7663493b 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ Prometheus exporter for JMX beans. -Copyright 2012-2015 The Prometheus Authors +Copyright 2012-present The Prometheus jmx_exporter Authors This product includes software developed at SoundCloud Ltd. (http://soundcloud.com/). diff --git a/collector/src/main/java/io/prometheus/jmx/BuildInfoMetrics.java b/collector/src/main/java/io/prometheus/jmx/BuildInfoMetrics.java index a771202f..af0535ab 100755 --- a/collector/src/main/java/io/prometheus/jmx/BuildInfoMetrics.java +++ b/collector/src/main/java/io/prometheus/jmx/BuildInfoMetrics.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2018-present 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. diff --git a/collector/src/main/java/io/prometheus/jmx/JmxCollector.java b/collector/src/main/java/io/prometheus/jmx/JmxCollector.java index 450083da..a51568d5 100644 --- a/collector/src/main/java/io/prometheus/jmx/JmxCollector.java +++ b/collector/src/main/java/io/prometheus/jmx/JmxCollector.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2015-present 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. diff --git a/collector/src/main/java/io/prometheus/jmx/JmxMBeanPropertyCache.java b/collector/src/main/java/io/prometheus/jmx/JmxMBeanPropertyCache.java index 0b738daf..50241bea 100644 --- a/collector/src/main/java/io/prometheus/jmx/JmxMBeanPropertyCache.java +++ b/collector/src/main/java/io/prometheus/jmx/JmxMBeanPropertyCache.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2018-present 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. diff --git a/collector/src/main/java/io/prometheus/jmx/JmxScraper.java b/collector/src/main/java/io/prometheus/jmx/JmxScraper.java index 926c764f..a1edecf1 100644 --- a/collector/src/main/java/io/prometheus/jmx/JmxScraper.java +++ b/collector/src/main/java/io/prometheus/jmx/JmxScraper.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2015-present 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. diff --git a/collector/src/main/java/io/prometheus/jmx/MatchedRule.java b/collector/src/main/java/io/prometheus/jmx/MatchedRule.java index 4ba409c5..fbef982b 100644 --- a/collector/src/main/java/io/prometheus/jmx/MatchedRule.java +++ b/collector/src/main/java/io/prometheus/jmx/MatchedRule.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2020-present 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. diff --git a/collector/src/main/java/io/prometheus/jmx/MatchedRuleToMetricSnapshotsConverter.java b/collector/src/main/java/io/prometheus/jmx/MatchedRuleToMetricSnapshotsConverter.java index 9ef834a1..6e67794c 100644 --- a/collector/src/main/java/io/prometheus/jmx/MatchedRuleToMetricSnapshotsConverter.java +++ b/collector/src/main/java/io/prometheus/jmx/MatchedRuleToMetricSnapshotsConverter.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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; import io.prometheus.jmx.logger.Logger; diff --git a/collector/src/main/java/io/prometheus/jmx/MatchedRulesCache.java b/collector/src/main/java/io/prometheus/jmx/MatchedRulesCache.java index aa45d049..213799c0 100644 --- a/collector/src/main/java/io/prometheus/jmx/MatchedRulesCache.java +++ b/collector/src/main/java/io/prometheus/jmx/MatchedRulesCache.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2020-present 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. diff --git a/collector/src/main/java/io/prometheus/jmx/ObjectNameAttributeFilter.java b/collector/src/main/java/io/prometheus/jmx/ObjectNameAttributeFilter.java index aeaee085..e93eda95 100644 --- a/collector/src/main/java/io/prometheus/jmx/ObjectNameAttributeFilter.java +++ b/collector/src/main/java/io/prometheus/jmx/ObjectNameAttributeFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2015-present 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. diff --git a/collector/src/main/java/io/prometheus/jmx/logger/Logger.java b/collector/src/main/java/io/prometheus/jmx/logger/Logger.java index 105cb28f..919ffc87 100644 --- a/collector/src/main/java/io/prometheus/jmx/logger/Logger.java +++ b/collector/src/main/java/io/prometheus/jmx/logger/Logger.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/collector/src/main/java/io/prometheus/jmx/logger/LoggerFactory.java b/collector/src/main/java/io/prometheus/jmx/logger/LoggerFactory.java index cfe55aff..4f42f58b 100644 --- a/collector/src/main/java/io/prometheus/jmx/logger/LoggerFactory.java +++ b/collector/src/main/java/io/prometheus/jmx/logger/LoggerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/collector/src/test/java/io/prometheus/jmx/BeanWithEnumMBean.java b/collector/src/test/java/io/prometheus/jmx/BeanWithEnumMBean.java index 4d77d0c9..c13ea68b 100644 --- a/collector/src/test/java/io/prometheus/jmx/BeanWithEnumMBean.java +++ b/collector/src/test/java/io/prometheus/jmx/BeanWithEnumMBean.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2023-present 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; import javax.management.MBeanServer; diff --git a/collector/src/test/java/io/prometheus/jmx/BoolMBean.java b/collector/src/test/java/io/prometheus/jmx/BoolMBean.java index b4506700..f277181f 100644 --- a/collector/src/test/java/io/prometheus/jmx/BoolMBean.java +++ b/collector/src/test/java/io/prometheus/jmx/BoolMBean.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2016-present 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; import javax.management.MBeanServer; diff --git a/collector/src/test/java/io/prometheus/jmx/BuildInfoMetricsTest.java b/collector/src/test/java/io/prometheus/jmx/BuildInfoMetricsTest.java index 7f8b214f..da4fdb7c 100644 --- a/collector/src/test/java/io/prometheus/jmx/BuildInfoMetricsTest.java +++ b/collector/src/test/java/io/prometheus/jmx/BuildInfoMetricsTest.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; diff --git a/collector/src/test/java/io/prometheus/jmx/CamelMBean.java b/collector/src/test/java/io/prometheus/jmx/CamelMBean.java index 24d159f6..f7e318c0 100644 --- a/collector/src/test/java/io/prometheus/jmx/CamelMBean.java +++ b/collector/src/test/java/io/prometheus/jmx/CamelMBean.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2019-present 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; import java.util.Date; diff --git a/collector/src/test/java/io/prometheus/jmx/CassandraMBean.java b/collector/src/test/java/io/prometheus/jmx/CassandraMBean.java index 1e6dea74..561abd11 100644 --- a/collector/src/test/java/io/prometheus/jmx/CassandraMBean.java +++ b/collector/src/test/java/io/prometheus/jmx/CassandraMBean.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2014-present 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; import javax.management.MBeanServer; diff --git a/collector/src/test/java/io/prometheus/jmx/CassandraMetricsMBean.java b/collector/src/test/java/io/prometheus/jmx/CassandraMetricsMBean.java index acebafbf..5a017ec4 100644 --- a/collector/src/test/java/io/prometheus/jmx/CassandraMetricsMBean.java +++ b/collector/src/test/java/io/prometheus/jmx/CassandraMetricsMBean.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2014-present 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; import javax.management.MBeanServer; diff --git a/collector/src/test/java/io/prometheus/jmx/CollidingNameMBean.java b/collector/src/test/java/io/prometheus/jmx/CollidingNameMBean.java index 05a86bf4..4bcfe69b 100644 --- a/collector/src/test/java/io/prometheus/jmx/CollidingNameMBean.java +++ b/collector/src/test/java/io/prometheus/jmx/CollidingNameMBean.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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; import javax.management.MBeanServer; diff --git a/collector/src/test/java/io/prometheus/jmx/DuplicateLabels.java b/collector/src/test/java/io/prometheus/jmx/DuplicateLabels.java index 70235ff2..f9c84b0a 100644 --- a/collector/src/test/java/io/prometheus/jmx/DuplicateLabels.java +++ b/collector/src/test/java/io/prometheus/jmx/DuplicateLabels.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2015-present 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. diff --git a/collector/src/test/java/io/prometheus/jmx/ExistDbMXBean.java b/collector/src/test/java/io/prometheus/jmx/ExistDbMXBean.java index 4cdf3bf8..6f35ac98 100644 --- a/collector/src/test/java/io/prometheus/jmx/ExistDbMXBean.java +++ b/collector/src/test/java/io/prometheus/jmx/ExistDbMXBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2022-present 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. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package io.prometheus.jmx; import java.util.Map; diff --git a/collector/src/test/java/io/prometheus/jmx/HadoopDataNodeMXBean.java b/collector/src/test/java/io/prometheus/jmx/HadoopDataNodeMXBean.java index 3e6b715e..c61f3c5a 100644 --- a/collector/src/test/java/io/prometheus/jmx/HadoopDataNodeMXBean.java +++ b/collector/src/test/java/io/prometheus/jmx/HadoopDataNodeMXBean.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2018-present 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; import java.util.HashMap; diff --git a/collector/src/test/java/io/prometheus/jmx/HadoopMBean.java b/collector/src/test/java/io/prometheus/jmx/HadoopMBean.java index aff5ae4d..3db89e45 100644 --- a/collector/src/test/java/io/prometheus/jmx/HadoopMBean.java +++ b/collector/src/test/java/io/prometheus/jmx/HadoopMBean.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2018-present 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; import javax.management.MBeanServer; diff --git a/collector/src/test/java/io/prometheus/jmx/JmxCollectorTest.java b/collector/src/test/java/io/prometheus/jmx/JmxCollectorTest.java index e875b68e..e23350a8 100644 --- a/collector/src/test/java/io/prometheus/jmx/JmxCollectorTest.java +++ b/collector/src/test/java/io/prometheus/jmx/JmxCollectorTest.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2014-present 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; import static org.junit.Assert.assertEquals; diff --git a/collector/src/test/java/io/prometheus/jmx/JmxMBeanPropertyCacheTest.java b/collector/src/test/java/io/prometheus/jmx/JmxMBeanPropertyCacheTest.java index 04358c96..e8f95c00 100644 --- a/collector/src/test/java/io/prometheus/jmx/JmxMBeanPropertyCacheTest.java +++ b/collector/src/test/java/io/prometheus/jmx/JmxMBeanPropertyCacheTest.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2018-present 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; import static org.junit.Assert.assertEquals; diff --git a/collector/src/test/java/io/prometheus/jmx/MatchedRuleToMetricSnapshotsConverterTest.java b/collector/src/test/java/io/prometheus/jmx/MatchedRuleToMetricSnapshotsConverterTest.java index 8bfd7f9c..d45a1017 100644 --- a/collector/src/test/java/io/prometheus/jmx/MatchedRuleToMetricSnapshotsConverterTest.java +++ b/collector/src/test/java/io/prometheus/jmx/MatchedRuleToMetricSnapshotsConverterTest.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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; import static org.assertj.core.api.Assertions.assertThat; diff --git a/collector/src/test/java/io/prometheus/jmx/ObjectNameAttributeFilterTest.java b/collector/src/test/java/io/prometheus/jmx/ObjectNameAttributeFilterTest.java index 1650b01c..7fc84213 100644 --- a/collector/src/test/java/io/prometheus/jmx/ObjectNameAttributeFilterTest.java +++ b/collector/src/test/java/io/prometheus/jmx/ObjectNameAttributeFilterTest.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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; import static org.junit.Assert.*; diff --git a/collector/src/test/java/io/prometheus/jmx/PerformanceMetricsMBean.java b/collector/src/test/java/io/prometheus/jmx/PerformanceMetricsMBean.java index 8b535ead..f495e91b 100644 --- a/collector/src/test/java/io/prometheus/jmx/PerformanceMetricsMBean.java +++ b/collector/src/test/java/io/prometheus/jmx/PerformanceMetricsMBean.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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; import java.util.LinkedHashMap; diff --git a/collector/src/test/java/io/prometheus/jmx/PrometheusRegistryUtils.java b/collector/src/test/java/io/prometheus/jmx/PrometheusRegistryUtils.java index 48298e82..6f26aa70 100644 --- a/collector/src/test/java/io/prometheus/jmx/PrometheusRegistryUtils.java +++ b/collector/src/test/java/io/prometheus/jmx/PrometheusRegistryUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/collector/src/test/java/io/prometheus/jmx/SafeNameTest.java b/collector/src/test/java/io/prometheus/jmx/SafeNameTest.java index c4b6300e..2842647b 100644 --- a/collector/src/test/java/io/prometheus/jmx/SafeNameTest.java +++ b/collector/src/test/java/io/prometheus/jmx/SafeNameTest.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2018-present 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; import static org.junit.Assert.assertEquals; diff --git a/collector/src/test/java/io/prometheus/jmx/SnakeCaseAttrTest.java b/collector/src/test/java/io/prometheus/jmx/SnakeCaseAttrTest.java index 6ea5cf09..c5d70df0 100644 --- a/collector/src/test/java/io/prometheus/jmx/SnakeCaseAttrTest.java +++ b/collector/src/test/java/io/prometheus/jmx/SnakeCaseAttrTest.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2018-present 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; import static org.junit.Assert.assertEquals; diff --git a/collector/src/test/java/io/prometheus/jmx/State.java b/collector/src/test/java/io/prometheus/jmx/State.java index c3dd917c..375d8d25 100644 --- a/collector/src/test/java/io/prometheus/jmx/State.java +++ b/collector/src/test/java/io/prometheus/jmx/State.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2023-present 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; public enum State { diff --git a/collector/src/test/java/io/prometheus/jmx/TomcatPatternCheckTest.java b/collector/src/test/java/io/prometheus/jmx/TomcatPatternCheckTest.java index 59061b5b..ddf332d5 100644 --- a/collector/src/test/java/io/prometheus/jmx/TomcatPatternCheckTest.java +++ b/collector/src/test/java/io/prometheus/jmx/TomcatPatternCheckTest.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2015-present 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; import static org.junit.Assert.assertFalse; diff --git a/collector/src/test/java/io/prometheus/jmx/TomcatServletMBean.java b/collector/src/test/java/io/prometheus/jmx/TomcatServletMBean.java index 5f9fb952..00fe46ec 100644 --- a/collector/src/test/java/io/prometheus/jmx/TomcatServletMBean.java +++ b/collector/src/test/java/io/prometheus/jmx/TomcatServletMBean.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2015-present 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; import javax.management.MBeanServer; diff --git a/collector/src/test/java/io/prometheus/jmx/TotalValueMBean.java b/collector/src/test/java/io/prometheus/jmx/TotalValueMBean.java index 0df85d20..99eb94e8 100644 --- a/collector/src/test/java/io/prometheus/jmx/TotalValueMBean.java +++ b/collector/src/test/java/io/prometheus/jmx/TotalValueMBean.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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; import javax.management.MBeanServer; diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Assertions.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Assertions.java index 4c067917..a7027a30 100644 --- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Assertions.java +++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/Assertions.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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 java.lang.String.format; diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/JavaDockerImages.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/JavaDockerImages.java index d27ca04e..6a53cfeb 100644 --- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/JavaDockerImages.java +++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/JavaDockerImages.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/JmxExporterMode.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/JmxExporterMode.java index 0dc43004..5dd271d4 100644 --- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/JmxExporterMode.java +++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/JmxExporterMode.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpClient.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpClient.java index 1be6ba54..2343a4f8 100644 --- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpClient.java +++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpClient.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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.io.*; 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..3515ed9a --- /dev/null +++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/http/HttpHeader.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2024-present 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; + +/** Class to implement HttpHeader */ +public class HttpHeader { + + /** Content-Type header */ + public static final String CONTENT_TYPE = "CONTENT-TYPE"; + + /** Constructor */ + private HttpHeader() { + // INTENTIONALLY BLANK + } +} 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 index cd0c027d..bbd291d1 100644 --- 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 @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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.StandardCharsets; 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 index abf9e7d8..43a188fc 100644 --- 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 @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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.util.List; 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 index 94444c9d..b87c7e2f 100644 --- 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 @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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; diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MapMetricAssertion.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MapMetricAssertion.java index fc6fec8c..b0f1801f 100644 --- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MapMetricAssertion.java +++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MapMetricAssertion.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/Metric.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/Metric.java index aaf2b967..d675e418 100644 --- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/Metric.java +++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/Metric.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricAssertion.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricAssertion.java index 42835cb7..09a8be3a 100644 --- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricAssertion.java +++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricAssertion.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. 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 index 0f705d76..0bc42d96 100644 --- 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricsParserException.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricsParserException.java index b9d853ac..8c5be9b4 100644 --- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricsParserException.java +++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricsParserException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/throttle/ExponentialBackoffThrottle.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/throttle/ExponentialBackoffThrottle.java index 152e8d70..2bfec6f2 100644 --- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/throttle/ExponentialBackoffThrottle.java +++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/throttle/ExponentialBackoffThrottle.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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.throttle; /** Class to implement ExponentialBackupThrottle */ diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/throttle/Throttle.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/throttle/Throttle.java index a0fce163..40d62093 100644 --- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/throttle/Throttle.java +++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/throttle/Throttle.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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.throttle; /** Interface to implement Throttle */ 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 fb072cbb..02573818 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -21,11 +21,14 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -67,54 +70,50 @@ public void beforeAll(ArgumentContext argumentContext) { @Verifyica.Test @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @@ -139,7 +138,7 @@ public static void conclude(ClassContext classContext) throws Throwable { @Verifyica.Test public void testAutoIncrementingMBean(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); // Collect the auto incrementing MBean values double value1 = collect(url); 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 82b41bf8..78debb1b 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,10 +20,13 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -59,55 +62,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 6edede11..3e61f18e 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,10 +20,13 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -58,55 +61,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 789c7978..6f089062 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,10 +20,13 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static org.assertj.core.api.Assertions.fail; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -60,55 +63,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 604dcd78..7149e9af 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,10 +20,13 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static org.assertj.core.api.Assertions.fail; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -60,55 +63,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 73de8991..11553393 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,10 +20,13 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -59,55 +62,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 e9e2fc95..4c299f85 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,10 +20,13 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -59,55 +62,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 9c61a104..3437b840 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,10 +20,13 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -59,55 +62,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 63aaf4f9..b41653cb 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,10 +20,13 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -59,55 +62,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 5f5307b0..d1863371 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,10 +20,13 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -59,55 +62,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 01aa25f3..d4d83d06 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,10 +20,13 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -59,55 +62,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 52affe5f..d16d9346 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,11 +20,14 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -63,55 +66,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 3c1303bd..f7c88885 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,11 +20,14 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -60,55 +63,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 5f6c1539..e4fcfd65 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,10 +20,13 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -59,55 +62,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 6398138b..2f3a640b 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,10 +20,13 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -59,55 +62,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterPath.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterPath.java new file mode 100644 index 00000000..b48926de --- /dev/null +++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterPath.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2024-present 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.common; + +/** Class to implement ExporterPath */ +public class ExporterPath { + + /** Healthy exporter path */ + public static final String HEALTHY = "/-/healthy"; + + /** Metrics exporter path */ + public static final String METRICS = "/metrics"; + + /** Constructor */ + private ExporterPath() { + // INTENTIONALLY BLANK + } +} diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterTestEnvironment.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterTestEnvironment.java index dd353c84..3703dd6b 100644 --- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterTestEnvironment.java +++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterTestEnvironment.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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.common; import com.github.dockerjava.api.model.Ulimit; @@ -108,6 +124,25 @@ public void initialize(Class testClass, Network network) { } } + /** + * Method to get a URL (base URL + path) + * + * @param path path + * @return the URL (base URL + path) + */ + public String getUrl(String path) { + if (!path.startsWith("/")) { + return getBaseUrl() + "/" + path; + } else { + return getBaseUrl() + path; + } + } + + /** + * Method to get the base URL + * + * @return the base URL + */ public String getBaseUrl() { int port = 0; diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterTestEnvironmentFactory.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterTestEnvironmentFactory.java index c05232cc..605da1ef 100644 --- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterTestEnvironmentFactory.java +++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterTestEnvironmentFactory.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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.common; import io.prometheus.jmx.test.support.JavaDockerImages; diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterTestSupport.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterTestSupport.java index 03fba093..daef3041 100644 --- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterTestSupport.java +++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/ExporterTestSupport.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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.common; import java.util.Optional; diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/MetricsType.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/MetricsType.java new file mode 100644 index 00000000..f7dfc3c1 --- /dev/null +++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/MetricsType.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2024-present 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.common; + +/** Class to implement ContentType */ +public class MetricsType { + + /** Prometheus text format */ + public static final String PROMETHEUS_TEXT_METRICS = "text/plain; version=0.0.4; charset=utf-8"; + + /** Prometheus Protobuf format */ + public static final String PROMETHEUS_PROTOBUF_METRICS = + "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" + + " encoding=delimited"; + + /** OpenMetrics text format */ + public static final String OPEN_METRICS_TEXT_METRICS = + "application/openmetrics-text; version=1.0.0; charset=utf-8"; + + /** Constructor */ + private MetricsType() { + // INTENTIONALLY BLANK + } +} diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/PBKDF2WithHmacExporterTestEnvironmentFilter.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/PBKDF2WithHmacExporterTestEnvironmentFilter.java index 9d21a172..4a8432fd 100644 --- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/PBKDF2WithHmacExporterTestEnvironmentFilter.java +++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/PBKDF2WithHmacExporterTestEnvironmentFilter.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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.common; import java.util.HashSet; diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/PKCS12KeyStoreExporterTestEnvironmentFilter.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/PKCS12KeyStoreExporterTestEnvironmentFilter.java index a3d3ec74..2bf3d5a0 100644 --- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/PKCS12KeyStoreExporterTestEnvironmentFilter.java +++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/common/PKCS12KeyStoreExporterTestEnvironmentFilter.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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.common; import java.util.HashSet; 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 7c1bd56c..a04064d8 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,11 +20,14 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpRequest; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; @@ -82,8 +85,9 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -104,8 +108,9 @@ public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -130,9 +135,9 @@ public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -147,9 +152,8 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0;" - + " charset=utf-8") + HttpHeader.CONTENT_TYPE, + MetricsType.OPEN_METRICS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -164,9 +168,9 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -180,7 +184,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi HttpRequest.builder() .url(url) .authorization(username, password) - .header("CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8") + .header( + HttpHeader.CONTENT_TYPE, + MetricsType.PROMETHEUS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -195,9 +201,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -212,7 +218,7 @@ public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporter .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", + HttpHeader.CONTENT_TYPE, "application/vnd.google.protobuf;" + " proto=io.prometheus.client.MetricFamily;" + " encoding=delimited") diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/AuthenticatorPluginTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/AuthenticatorPluginTest.java index e4f4283d..6f67dd20 100644 --- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/AuthenticatorPluginTest.java +++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/http/authentication/AuthenticatorPluginTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,11 +20,14 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpRequest; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; @@ -75,8 +78,9 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -97,8 +101,9 @@ public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -123,9 +128,9 @@ public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -140,9 +145,8 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0;" - + " charset=utf-8") + HttpHeader.CONTENT_TYPE, + MetricsType.OPEN_METRICS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -157,9 +161,9 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -173,7 +177,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi HttpRequest.builder() .url(url) .authorization(username, password) - .header("CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8") + .header( + HttpHeader.CONTENT_TYPE, + MetricsType.PROMETHEUS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -188,9 +194,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -205,7 +211,7 @@ public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporter .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", + HttpHeader.CONTENT_TYPE, "application/vnd.google.protobuf;" + " proto=io.prometheus.client.MetricFamily;" + " encoding=delimited") 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 2ae67efa..15970e75 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,12 +20,15 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.common.PBKDF2WithHmacExporterTestEnvironmentFilter; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpRequest; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; @@ -73,8 +76,9 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -95,8 +99,9 @@ public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -121,9 +126,9 @@ public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -138,9 +143,8 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0;" - + " charset=utf-8") + HttpHeader.CONTENT_TYPE, + MetricsType.OPEN_METRICS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -155,9 +159,9 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -171,7 +175,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi HttpRequest.builder() .url(url) .authorization(username, password) - .header("CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8") + .header( + HttpHeader.CONTENT_TYPE, + MetricsType.PROMETHEUS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -186,9 +192,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -203,7 +209,7 @@ public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporter .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", + HttpHeader.CONTENT_TYPE, "application/vnd.google.protobuf;" + " proto=io.prometheus.client.MetricFamily;" + " encoding=delimited") 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 e466128e..2b0ebf99 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,12 +20,15 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.common.PBKDF2WithHmacExporterTestEnvironmentFilter; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpRequest; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; @@ -73,8 +76,9 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -95,8 +99,9 @@ public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -121,9 +126,9 @@ public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -138,9 +143,8 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0;" - + " charset=utf-8") + HttpHeader.CONTENT_TYPE, + MetricsType.OPEN_METRICS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -155,9 +159,9 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -171,7 +175,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi HttpRequest.builder() .url(url) .authorization(username, password) - .header("CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8") + .header( + HttpHeader.CONTENT_TYPE, + MetricsType.PROMETHEUS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -186,9 +192,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -203,7 +209,7 @@ public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporter .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", + HttpHeader.CONTENT_TYPE, "application/vnd.google.protobuf;" + " proto=io.prometheus.client.MetricFamily;" + " encoding=delimited") 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 cd7f7abf..330c92f8 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,12 +20,15 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.common.PBKDF2WithHmacExporterTestEnvironmentFilter; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpRequest; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; @@ -73,8 +76,9 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -95,8 +99,9 @@ public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -121,9 +126,9 @@ public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -138,9 +143,8 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0;" - + " charset=utf-8") + HttpHeader.CONTENT_TYPE, + MetricsType.OPEN_METRICS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -155,9 +159,9 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -171,7 +175,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi HttpRequest.builder() .url(url) .authorization(username, password) - .header("CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8") + .header( + HttpHeader.CONTENT_TYPE, + MetricsType.PROMETHEUS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -186,9 +192,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -203,7 +209,7 @@ public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporter .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", + HttpHeader.CONTENT_TYPE, "application/vnd.google.protobuf;" + " proto=io.prometheus.client.MetricFamily;" + " encoding=delimited") 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 bcf655c1..f111e9fb 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,11 +20,14 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpRequest; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; @@ -71,8 +74,9 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -93,8 +97,9 @@ public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -119,9 +124,9 @@ public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -136,9 +141,8 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0;" - + " charset=utf-8") + HttpHeader.CONTENT_TYPE, + MetricsType.OPEN_METRICS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -153,9 +157,9 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -169,7 +173,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi HttpRequest.builder() .url(url) .authorization(username, password) - .header("CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8") + .header( + HttpHeader.CONTENT_TYPE, + MetricsType.PROMETHEUS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -184,9 +190,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -201,7 +207,7 @@ public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporter .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", + HttpHeader.CONTENT_TYPE, "application/vnd.google.protobuf;" + " proto=io.prometheus.client.MetricFamily;" + " encoding=delimited") 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 f7637a65..595e3601 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,11 +20,14 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpRequest; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; @@ -71,8 +74,9 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -93,8 +97,9 @@ public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -119,9 +124,9 @@ public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -136,9 +141,8 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0;" - + " charset=utf-8") + HttpHeader.CONTENT_TYPE, + MetricsType.OPEN_METRICS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -153,9 +157,9 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -169,7 +173,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi HttpRequest.builder() .url(url) .authorization(username, password) - .header("CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8") + .header( + HttpHeader.CONTENT_TYPE, + MetricsType.PROMETHEUS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -184,9 +190,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -201,7 +207,7 @@ public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporter .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", + HttpHeader.CONTENT_TYPE, "application/vnd.google.protobuf;" + " proto=io.prometheus.client.MetricFamily;" + " encoding=delimited") 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 26052039..e7eb9191 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,11 +20,14 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpRequest; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; @@ -71,8 +74,9 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -93,8 +97,9 @@ public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -119,9 +124,9 @@ public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -136,9 +141,8 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0;" - + " charset=utf-8") + HttpHeader.CONTENT_TYPE, + MetricsType.OPEN_METRICS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -153,9 +157,9 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -169,7 +173,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi HttpRequest.builder() .url(url) .authorization(username, password) - .header("CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8") + .header( + HttpHeader.CONTENT_TYPE, + MetricsType.PROMETHEUS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -184,9 +190,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -201,7 +207,7 @@ public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporter .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", + HttpHeader.CONTENT_TYPE, "application/vnd.google.protobuf;" + " proto=io.prometheus.client.MetricFamily;" + " encoding=delimited") 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 cd6c8c1a..9b42ae46 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,11 +20,14 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpRequest; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; @@ -71,8 +74,9 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -93,8 +97,9 @@ public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -119,9 +124,9 @@ public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -136,9 +141,8 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0;" - + " charset=utf-8") + HttpHeader.CONTENT_TYPE, + MetricsType.OPEN_METRICS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -153,9 +157,9 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -169,7 +173,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi HttpRequest.builder() .url(url) .authorization(username, password) - .header("CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8") + .header( + HttpHeader.CONTENT_TYPE, + MetricsType.PROMETHEUS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -184,9 +190,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -201,7 +207,7 @@ public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporter .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", + HttpHeader.CONTENT_TYPE, "application/vnd.google.protobuf;" + " proto=io.prometheus.client.MetricFamily;" + " encoding=delimited") 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 d5f72b48..4bb9c5f6 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,11 +20,14 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpRequest; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; @@ -82,8 +85,9 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -104,8 +108,9 @@ public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -130,9 +135,9 @@ public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -147,9 +152,8 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0;" - + " charset=utf-8") + HttpHeader.CONTENT_TYPE, + MetricsType.OPEN_METRICS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -164,9 +168,9 @@ public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnv } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -180,7 +184,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi HttpRequest.builder() .url(url) .authorization(username, password) - .header("CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8") + .header( + HttpHeader.CONTENT_TYPE, + MetricsType.PROMETHEUS_TEXT_METRICS) .build(); HttpResponse httpResponse = HttpClient.sendRequest(httpRequest); @@ -195,9 +201,9 @@ public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvi } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); for (String username : TEST_USERNAMES) { for (String password : TEST_PASSWORDS) { @@ -212,7 +218,7 @@ public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporter .url(url) .authorization(username, password) .header( - "CONTENT-TYPE", + HttpHeader.CONTENT_TYPE, "application/vnd.google.protobuf;" + " proto=io.prometheus.client.MetricFamily;" + " encoding=delimited") 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 b5520318..889cc0c8 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,11 +20,14 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -74,55 +77,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 548221ab..f6c1d4da 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,11 +20,14 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -74,55 +77,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 4a6bdd8e..a88fd95f 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,11 +20,14 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -74,55 +77,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 5de0a9fa..9c52b948 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,12 +20,15 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.common.PKCS12KeyStoreExporterTestEnvironmentFilter; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -70,55 +73,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 eb1c5298..9068ef9b 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,12 +20,15 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.common.PKCS12KeyStoreExporterTestEnvironmentFilter; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -70,55 +73,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 26608b74..0803880c 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,12 +20,15 @@ import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; import static org.assertj.core.api.Assertions.assertThat; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.common.PKCS12KeyStoreExporterTestEnvironmentFilter; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -70,55 +73,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } 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 1d8ddf7b..4877b6ae 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 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,11 +20,14 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -60,55 +63,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/rmi/ssl/MinimalRMISSLTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/rmi/ssl/MinimalRMISSLTest.java index 3e45ea9a..2cf652f6 100644 --- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/rmi/ssl/MinimalRMISSLTest.java +++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/rmi/ssl/MinimalRMISSLTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,11 +20,14 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -76,55 +79,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/rmi/ssl/RMIRegistrySSLDisabledTest.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/rmi/ssl/RMIRegistrySSLDisabledTest.java index 0a0b4929..42c015aa 100644 --- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/rmi/ssl/RMIRegistrySSLDisabledTest.java +++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/rmi/ssl/RMIRegistrySSLDisabledTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. @@ -20,11 +20,14 @@ import static io.prometheus.jmx.test.support.Assertions.assertHealthyResponse; import static io.prometheus.jmx.test.support.metrics.MetricAssertion.assertMetric; +import io.prometheus.jmx.test.common.ExporterPath; import io.prometheus.jmx.test.common.ExporterTestEnvironment; import io.prometheus.jmx.test.common.ExporterTestEnvironmentFactory; import io.prometheus.jmx.test.common.ExporterTestSupport; +import io.prometheus.jmx.test.common.MetricsType; import io.prometheus.jmx.test.support.JmxExporterMode; import io.prometheus.jmx.test.support.http.HttpClient; +import io.prometheus.jmx.test.support.http.HttpHeader; import io.prometheus.jmx.test.support.http.HttpResponse; import io.prometheus.jmx.test.support.metrics.Metric; import io.prometheus.jmx.test.support.metrics.MetricsParser; @@ -76,55 +79,52 @@ public void beforeAll(ArgumentContext argumentContext) { } @Verifyica.Test + @Verifyica.Order(1) public void testHealthy(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/-/healthy"; + String url = exporterTestEnvironment.getBaseUrl() + ExporterPath.HEALTHY; HttpResponse httpResponse = HttpClient.sendRequest(url); assertHealthyResponse(httpResponse); } @Verifyica.Test - public void testMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + public void testDefaultTextMetrics(ExporterTestEnvironment exporterTestEnvironment) + throws IOException { + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest(url); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsOpenMetricsFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testOpenMetricsTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/openmetrics-text; version=1.0.0; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.OPEN_METRICS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusTextMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, "CONTENT-TYPE", "text/plain; version=0.0.4; charset=utf-8"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_TEXT_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } @Verifyica.Test - public void testMetricsPrometheusProtobufFormat(ExporterTestEnvironment exporterTestEnvironment) + public void testPrometheusProtobufMetrics(ExporterTestEnvironment exporterTestEnvironment) throws IOException { - String url = exporterTestEnvironment.getBaseUrl() + "/metrics"; + String url = exporterTestEnvironment.getUrl(ExporterPath.METRICS); HttpResponse httpResponse = HttpClient.sendRequest( - url, - "CONTENT-TYPE", - "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily;" - + " encoding=delimited"); + url, HttpHeader.CONTENT_TYPE, MetricsType.PROMETHEUS_PROTOBUF_METRICS); assertMetricsResponse(exporterTestEnvironment, httpResponse); } diff --git a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/AuthenticatorPlugin.java b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/AuthenticatorPlugin.java index 9615c5f7..467367f5 100644 --- a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/AuthenticatorPlugin.java +++ b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/AuthenticatorPlugin.java @@ -1,17 +1,19 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You 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 +/* + * Copyright (C) 2024-present The Prometheus jmx_exporter Authors * - *

http://www.apache.org/licenses/LICENSE-2.0 + * 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 * - *

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 + * 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; import com.sun.net.httpserver.Authenticator; diff --git a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/AutoIncrementingMBean.java b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/AutoIncrementingMBean.java index f254b9e1..781260c7 100644 --- a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/AutoIncrementingMBean.java +++ b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/AutoIncrementingMBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2022-present 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. diff --git a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/ExistDbMXBean.java b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/ExistDbMXBean.java index 893e4a77..98c84de8 100644 --- a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/ExistDbMXBean.java +++ b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/ExistDbMXBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2022-present 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. diff --git a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/JmxExampleApplication.java b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/JmxExampleApplication.java index da2c28b7..825b5140 100644 --- a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/JmxExampleApplication.java +++ b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/JmxExampleApplication.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2022-present 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. diff --git a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/OptionalValueMBean.java b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/OptionalValueMBean.java index f8cb43fc..c587b738 100644 --- a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/OptionalValueMBean.java +++ b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/OptionalValueMBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/PerformanceMetricsMBean.java b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/PerformanceMetricsMBean.java index 90017e17..ab8467fe 100644 --- a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/PerformanceMetricsMBean.java +++ b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/PerformanceMetricsMBean.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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; import java.util.LinkedHashMap; diff --git a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/TabularMBean.java b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/TabularMBean.java index 4d105920..4f804a55 100644 --- a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/TabularMBean.java +++ b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/TabularMBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2022-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToInteger.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToInteger.java index 47fc7511..bf65d3fd 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToInteger.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToInteger.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToMapAccessor.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToMapAccessor.java index 5957a07f..7774fe39 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToMapAccessor.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToMapAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToString.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToString.java index b2926d6f..a73db58d 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToString.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToString.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ValidateIntegerInRange.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ValidateIntegerInRange.java index faf689ad..6da4a02e 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ValidateIntegerInRange.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ValidateIntegerInRange.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ValidateStringIsNotBlank.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ValidateStringIsNotBlank.java index dbb04665..7ab3fb7d 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ValidateStringIsNotBlank.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ValidateStringIsNotBlank.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ConfigurationException.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ConfigurationException.java index c5e1717d..cf14efef 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ConfigurationException.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ConfigurationException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2022-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/HTTPServerFactory.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/HTTPServerFactory.java index a667affa..d59d7bf8 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/HTTPServerFactory.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/HTTPServerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2022-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/Credentials.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/Credentials.java index 3c61d34e..a890ace0 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/Credentials.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/Credentials.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2022-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/CredentialsCache.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/CredentialsCache.java index 653929f6..0ec798f4 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/CredentialsCache.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/CredentialsCache.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2022-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/HexString.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/HexString.java index 889e1f90..c6020199 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/HexString.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/HexString.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2022-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/MessageDigestAuthenticator.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/MessageDigestAuthenticator.java index 01854568..9067d2d4 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/MessageDigestAuthenticator.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/MessageDigestAuthenticator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2022-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/PBKDF2Authenticator.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/PBKDF2Authenticator.java index a86a6739..e04cb22f 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/PBKDF2Authenticator.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/PBKDF2Authenticator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2022-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/PlaintextAuthenticator.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/PlaintextAuthenticator.java index ee694c05..09a0172a 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/PlaintextAuthenticator.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/PlaintextAuthenticator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2022-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ssl/SSLContextFactory.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ssl/SSLContextFactory.java index 171adb6f..635baea1 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ssl/SSLContextFactory.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ssl/SSLContextFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/util/Precondition.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/util/Precondition.java index 38562d1a..3a9f0cdc 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/util/Precondition.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/util/Precondition.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2022-present 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. diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/yaml/YamlMapAccessor.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/yaml/YamlMapAccessor.java index db1ef151..c5ceadf0 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/yaml/YamlMapAccessor.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/yaml/YamlMapAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2022-present 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. diff --git a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/HTTPServerFactoryTest.java b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/HTTPServerFactoryTest.java index d1748582..69e63554 100644 --- a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/HTTPServerFactoryTest.java +++ b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/HTTPServerFactoryTest.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2024-present 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.common.http; import static org.junit.Assert.assertTrue; diff --git a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/BaseAuthenticatorTest.java b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/BaseAuthenticatorTest.java index 9ea055d6..cc347fa2 100644 --- a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/BaseAuthenticatorTest.java +++ b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/BaseAuthenticatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CredentialsCacheTest.java b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CredentialsCacheTest.java index ba39430c..821cc379 100644 --- a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CredentialsCacheTest.java +++ b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CredentialsCacheTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CredentialsTest.java b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CredentialsTest.java index ad75f15b..574464b1 100644 --- a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CredentialsTest.java +++ b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CredentialsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CustomAuthenticator451.java b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CustomAuthenticator451.java index 10f97d6e..9b1c0c8f 100644 --- a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CustomAuthenticator451.java +++ b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CustomAuthenticator451.java @@ -1,17 +1,19 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You 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 +/* + * Copyright (C) 2024-present The Prometheus jmx_exporter Authors * - *

http://www.apache.org/licenses/LICENSE-2.0 + * 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 * - *

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 + * 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.common.http.authenticator; import com.sun.net.httpserver.Authenticator; diff --git a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CustomAuthenticatorWithSubject.java b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CustomAuthenticatorWithSubject.java index 8d0e6d04..8df12bf2 100644 --- a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CustomAuthenticatorWithSubject.java +++ b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/CustomAuthenticatorWithSubject.java @@ -1,17 +1,19 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You 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 +/* + * Copyright (C) 2024-present The Prometheus jmx_exporter Authors * - *

http://www.apache.org/licenses/LICENSE-2.0 + * 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 * - *

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 + * 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.common.http.authenticator; import com.sun.net.httpserver.Authenticator; diff --git a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/MessageDigestAuthenticatorTest.java b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/MessageDigestAuthenticatorTest.java index 5a835f7f..41ca5ed7 100644 --- a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/MessageDigestAuthenticatorTest.java +++ b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/MessageDigestAuthenticatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/PBKDF2AuthenticatorTest.java b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/PBKDF2AuthenticatorTest.java index a6360d1c..30f29dd4 100644 --- a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/PBKDF2AuthenticatorTest.java +++ b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/PBKDF2AuthenticatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/PlaintextAuthenticatorTest.java b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/PlaintextAuthenticatorTest.java index 22a8cde7..74eb0f92 100644 --- a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/PlaintextAuthenticatorTest.java +++ b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/http/authenticator/PlaintextAuthenticatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/util/PreconditionTest.java b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/util/PreconditionTest.java index 45b6c980..0d25f63b 100644 --- a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/util/PreconditionTest.java +++ b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/util/PreconditionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/yaml/YamlMapAccessorTest.java b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/yaml/YamlMapAccessorTest.java index 3b87d6b4..b79d92d7 100644 --- a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/yaml/YamlMapAccessorTest.java +++ b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/yaml/YamlMapAccessorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2018-present 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. diff --git a/jmx_prometheus_httpserver/src/main/java/io/prometheus/jmx/WebServer.java b/jmx_prometheus_httpserver/src/main/java/io/prometheus/jmx/WebServer.java index 0b5864ec..96c763b4 100644 --- a/jmx_prometheus_httpserver/src/main/java/io/prometheus/jmx/WebServer.java +++ b/jmx_prometheus_httpserver/src/main/java/io/prometheus/jmx/WebServer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2015-present 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. diff --git a/jmx_prometheus_javaagent/src/main/java/io/prometheus/jmx/JavaAgent.java b/jmx_prometheus_javaagent/src/main/java/io/prometheus/jmx/JavaAgent.java index 408b7715..eee47587 100644 --- a/jmx_prometheus_javaagent/src/main/java/io/prometheus/jmx/JavaAgent.java +++ b/jmx_prometheus_javaagent/src/main/java/io/prometheus/jmx/JavaAgent.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2015-present 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. diff --git a/jmx_prometheus_javaagent/src/test/java/io/prometheus/jmx/JavaAgentConfigurationRegexTest.java b/jmx_prometheus_javaagent/src/test/java/io/prometheus/jmx/JavaAgentConfigurationRegexTest.java index 0c1b07dd..7345fd15 100644 --- a/jmx_prometheus_javaagent/src/test/java/io/prometheus/jmx/JavaAgentConfigurationRegexTest.java +++ b/jmx_prometheus_javaagent/src/test/java/io/prometheus/jmx/JavaAgentConfigurationRegexTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 The Prometheus jmx_exporter Authors + * Copyright (C) 2023-present 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. diff --git a/stress-test.sh b/stress-test.sh index 38ecca85..b38f1ab5 100755 --- a/stress-test.sh +++ b/stress-test.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# Copyright (C) 2022-2023 The Prometheus jmx_exporter Authors +# Copyright (C) 2022-present 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.