mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Merge branch '3.0.x' into 3.1.x
Closes gh-36567
This commit is contained in:
commit
ee9574d399
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -30,6 +30,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
class AppOpticsPropertiesConfigAdapterTests
|
class AppOpticsPropertiesConfigAdapterTests
|
||||||
extends StepRegistryPropertiesConfigAdapterTests<AppOpticsProperties, AppOpticsPropertiesConfigAdapter> {
|
extends StepRegistryPropertiesConfigAdapterTests<AppOpticsProperties, AppOpticsPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
AppOpticsPropertiesConfigAdapterTests() {
|
||||||
|
super(AppOpticsPropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AppOpticsProperties createProperties() {
|
protected AppOpticsProperties createProperties() {
|
||||||
return new AppOpticsProperties();
|
return new AppOpticsProperties();
|
||||||
|
@ -20,6 +20,8 @@ import java.time.Duration;
|
|||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,7 +29,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
*
|
*
|
||||||
* @author Mirko Sobeck
|
* @author Mirko Sobeck
|
||||||
*/
|
*/
|
||||||
class AtlasPropertiesConfigAdapterTests {
|
class AtlasPropertiesConfigAdapterTests
|
||||||
|
extends AbstractPropertiesConfigAdapterTests<AtlasProperties, AtlasPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
AtlasPropertiesConfigAdapterTests() {
|
||||||
|
super(AtlasPropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenPropertiesStepIsSetAdapterStepReturnsIt() {
|
void whenPropertiesStepIsSetAdapterStepReturnsIt() {
|
||||||
@ -130,4 +137,11 @@ class AtlasPropertiesConfigAdapterTests {
|
|||||||
assertThat(new AtlasPropertiesConfigAdapter(properties).lwcIgnorePublishStep()).isFalse();
|
assertThat(new AtlasPropertiesConfigAdapter(properties).lwcIgnorePublishStep()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
protected void adapterOverridesAllConfigMethods() {
|
||||||
|
adapterOverridesAllConfigMethodsExcept("autoStart", "commonTags", "debugRegistry", "publisher", "rollupPolicy",
|
||||||
|
"validTagCharacters");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
class DatadogPropertiesConfigAdapterTests
|
class DatadogPropertiesConfigAdapterTests
|
||||||
extends StepRegistryPropertiesConfigAdapterTests<DatadogProperties, DatadogPropertiesConfigAdapter> {
|
extends StepRegistryPropertiesConfigAdapterTests<DatadogProperties, DatadogPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
DatadogPropertiesConfigAdapterTests() {
|
||||||
|
super(DatadogPropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DatadogProperties createProperties() {
|
protected DatadogProperties createProperties() {
|
||||||
return new DatadogProperties();
|
return new DatadogProperties();
|
||||||
|
@ -21,6 +21,8 @@ import java.util.HashMap;
|
|||||||
import io.micrometer.dynatrace.DynatraceApiVersion;
|
import io.micrometer.dynatrace.DynatraceApiVersion;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,7 +31,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
* @author Georg Pirklbauer
|
* @author Georg Pirklbauer
|
||||||
*/
|
*/
|
||||||
class DynatracePropertiesConfigAdapterTests {
|
class DynatracePropertiesConfigAdapterTests
|
||||||
|
extends AbstractPropertiesConfigAdapterTests<DynatraceProperties, DynatracePropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
DynatracePropertiesConfigAdapterTests() {
|
||||||
|
super(DynatracePropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenPropertiesUriIsSetAdapterUriReturnsIt() {
|
void whenPropertiesUriIsSetAdapterUriReturnsIt() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -18,6 +18,8 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.elastic;
|
|||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,7 +27,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
class ElasticPropertiesConfigAdapterTests {
|
class ElasticPropertiesConfigAdapterTests
|
||||||
|
extends AbstractPropertiesConfigAdapterTests<ElasticProperties, ElasticPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
ElasticPropertiesConfigAdapterTests() {
|
||||||
|
super(ElasticPropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenPropertiesHostsIsSetAdapterHostsReturnsIt() {
|
void whenPropertiesHostsIsSetAdapterHostsReturnsIt() {
|
||||||
|
@ -22,6 +22,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import info.ganglia.gmetric4j.gmetric.GMetric.UDPAddressingMode;
|
import info.ganglia.gmetric4j.gmetric.GMetric.UDPAddressingMode;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,7 +31,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
*
|
*
|
||||||
* @author Mirko Sobeck
|
* @author Mirko Sobeck
|
||||||
*/
|
*/
|
||||||
class GangliaPropertiesConfigAdapterTests {
|
class GangliaPropertiesConfigAdapterTests
|
||||||
|
extends AbstractPropertiesConfigAdapterTests<GangliaProperties, GangliaPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
GangliaPropertiesConfigAdapterTests() {
|
||||||
|
super(GangliaPropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenPropertiesEnabledIsSetAdapterEnabledReturnsIt() {
|
void whenPropertiesEnabledIsSetAdapterEnabledReturnsIt() {
|
||||||
|
@ -22,6 +22,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import io.micrometer.graphite.GraphiteProtocol;
|
import io.micrometer.graphite.GraphiteProtocol;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,7 +31,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
*
|
*
|
||||||
* @author Mirko Sobeck
|
* @author Mirko Sobeck
|
||||||
*/
|
*/
|
||||||
class GraphitePropertiesConfigAdapterTests {
|
class GraphitePropertiesConfigAdapterTests
|
||||||
|
extends AbstractPropertiesConfigAdapterTests<GraphiteProperties, GraphitePropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
GraphitePropertiesConfigAdapterTests() {
|
||||||
|
super(GraphitePropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenPropertiesEnabledIsSetAdapterEnabledReturnsIt() {
|
void whenPropertiesEnabledIsSetAdapterEnabledReturnsIt() {
|
||||||
|
@ -20,6 +20,8 @@ import java.util.Collections;
|
|||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,7 +29,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
class HumioPropertiesConfigAdapterTests {
|
class HumioPropertiesConfigAdapterTests
|
||||||
|
extends AbstractPropertiesConfigAdapterTests<HumioProperties, HumioPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
HumioPropertiesConfigAdapterTests() {
|
||||||
|
super(HumioPropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenApiTokenIsSetAdapterApiTokenReturnsIt() {
|
void whenApiTokenIsSetAdapterApiTokenReturnsIt() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -19,6 +19,8 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.influx;
|
|||||||
import io.micrometer.influx.InfluxApiVersion;
|
import io.micrometer.influx.InfluxApiVersion;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,7 +28,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
*
|
*
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
*/
|
*/
|
||||||
class InfluxPropertiesConfigAdapterTests {
|
class InfluxPropertiesConfigAdapterTests
|
||||||
|
extends AbstractPropertiesConfigAdapterTests<InfluxProperties, InfluxPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
InfluxPropertiesConfigAdapterTests() {
|
||||||
|
super(InfluxPropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void adaptInfluxV1BasicConfig() {
|
void adaptInfluxV1BasicConfig() {
|
||||||
|
@ -20,6 +20,8 @@ import java.time.Duration;
|
|||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,7 +29,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
*
|
*
|
||||||
* @author Mirko Sobeck
|
* @author Mirko Sobeck
|
||||||
*/
|
*/
|
||||||
class JmxPropertiesConfigAdapterTests {
|
class JmxPropertiesConfigAdapterTests
|
||||||
|
extends AbstractPropertiesConfigAdapterTests<JmxProperties, JmxPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
JmxPropertiesConfigAdapterTests() {
|
||||||
|
super(JmxPropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenPropertiesStepIsSetAdapterStepReturnsIt() {
|
void whenPropertiesStepIsSetAdapterStepReturnsIt() {
|
||||||
|
@ -30,6 +30,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
class KairosPropertiesConfigAdapterTests
|
class KairosPropertiesConfigAdapterTests
|
||||||
extends StepRegistryPropertiesConfigAdapterTests<KairosProperties, KairosPropertiesConfigAdapter> {
|
extends StepRegistryPropertiesConfigAdapterTests<KairosProperties, KairosPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
KairosPropertiesConfigAdapterTests() {
|
||||||
|
super(KairosPropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected KairosProperties createProperties() {
|
protected KairosProperties createProperties() {
|
||||||
return new KairosProperties();
|
return new KairosProperties();
|
||||||
|
@ -31,6 +31,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
class NewRelicPropertiesConfigAdapterTests
|
class NewRelicPropertiesConfigAdapterTests
|
||||||
extends StepRegistryPropertiesConfigAdapterTests<NewRelicProperties, NewRelicPropertiesConfigAdapter> {
|
extends StepRegistryPropertiesConfigAdapterTests<NewRelicProperties, NewRelicPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
NewRelicPropertiesConfigAdapterTests() {
|
||||||
|
super(NewRelicPropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected NewRelicProperties createProperties() {
|
protected NewRelicProperties createProperties() {
|
||||||
return new NewRelicProperties();
|
return new NewRelicProperties();
|
||||||
|
@ -21,6 +21,8 @@ import java.time.Duration;
|
|||||||
import io.micrometer.prometheus.HistogramFlavor;
|
import io.micrometer.prometheus.HistogramFlavor;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +30,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
*
|
*
|
||||||
* @author Mirko Sobeck
|
* @author Mirko Sobeck
|
||||||
*/
|
*/
|
||||||
class PrometheusPropertiesConfigAdapterTests {
|
class PrometheusPropertiesConfigAdapterTests
|
||||||
|
extends AbstractPropertiesConfigAdapterTests<PrometheusProperties, PrometheusPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
PrometheusPropertiesConfigAdapterTests() {
|
||||||
|
super(PrometheusPropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenPropertiesDescriptionsIsSetAdapterDescriptionsReturnsIt() {
|
void whenPropertiesDescriptionsIsSetAdapterDescriptionsReturnsIt() {
|
||||||
|
@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012-2023 the original author or 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
|
||||||
|
*
|
||||||
|
* https://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 org.springframework.boot.actuate.autoconfigure.metrics.export.properties;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import io.micrometer.core.instrument.config.validate.Validated;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for testing properties config adapters.
|
||||||
|
*
|
||||||
|
* @param <P> the properties used by the adapter
|
||||||
|
* @param <A> the adapter under test
|
||||||
|
* @author Andy Wilkinson
|
||||||
|
* @author Mirko Sobeck
|
||||||
|
*/
|
||||||
|
public abstract class AbstractPropertiesConfigAdapterTests<P, A extends PropertiesConfigAdapter<P>> {
|
||||||
|
|
||||||
|
private final Class<? extends A> adapter;
|
||||||
|
|
||||||
|
protected AbstractPropertiesConfigAdapterTests(Class<? extends A> adapter) {
|
||||||
|
this.adapter = adapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
protected void adapterOverridesAllConfigMethods() {
|
||||||
|
adapterOverridesAllConfigMethodsExcept();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final void adapterOverridesAllConfigMethodsExcept(String... nonConfigMethods) {
|
||||||
|
Class<?> config = findImplementedConfig();
|
||||||
|
Set<String> expectedConfigMethodNames = Arrays.stream(config.getDeclaredMethods())
|
||||||
|
.filter(Method::isDefault)
|
||||||
|
.filter(this::hasNoParameters)
|
||||||
|
.filter(this::isNotValidationMethod)
|
||||||
|
.filter(this::isNotDeprecated)
|
||||||
|
.map(Method::getName)
|
||||||
|
.collect(Collectors.toCollection(TreeSet::new));
|
||||||
|
expectedConfigMethodNames.removeAll(Arrays.asList(nonConfigMethods));
|
||||||
|
Set<String> actualConfigMethodNames = new TreeSet<>();
|
||||||
|
Class<?> currentClass = this.adapter;
|
||||||
|
while (!Object.class.equals(currentClass)) {
|
||||||
|
actualConfigMethodNames.addAll(Arrays.stream(currentClass.getDeclaredMethods())
|
||||||
|
.map(Method::getName)
|
||||||
|
.filter(expectedConfigMethodNames::contains)
|
||||||
|
.toList());
|
||||||
|
currentClass = currentClass.getSuperclass();
|
||||||
|
}
|
||||||
|
assertThat(actualConfigMethodNames).containsExactlyInAnyOrderElementsOf(expectedConfigMethodNames);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Class<?> findImplementedConfig() {
|
||||||
|
Class<?>[] interfaces = this.adapter.getInterfaces();
|
||||||
|
if (interfaces.length == 1) {
|
||||||
|
return interfaces[0];
|
||||||
|
}
|
||||||
|
throw new IllegalStateException(this.adapter + " is not a config implementation");
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isNotDeprecated(Method method) {
|
||||||
|
return !AnnotatedElementUtils.hasAnnotation(method, Deprecated.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasNoParameters(Method method) {
|
||||||
|
return method.getParameterCount() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isNotValidationMethod(Method method) {
|
||||||
|
return !Validated.class.equals(method.getReturnType());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -30,7 +30,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @author Artsiom Yudovin
|
* @author Artsiom Yudovin
|
||||||
*/
|
*/
|
||||||
public abstract class PushRegistryPropertiesConfigAdapterTests<P extends PushRegistryProperties, A extends PushRegistryPropertiesConfigAdapter<P>> {
|
public abstract class PushRegistryPropertiesConfigAdapterTests<P extends PushRegistryProperties, A extends PushRegistryPropertiesConfigAdapter<P>>
|
||||||
|
extends AbstractPropertiesConfigAdapterTests<P, PropertiesConfigAdapter<P>> {
|
||||||
|
|
||||||
|
protected PushRegistryPropertiesConfigAdapterTests(Class<A> adapter) {
|
||||||
|
super(adapter);
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract P createProperties();
|
protected abstract P createProperties();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -27,4 +27,8 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.properties
|
|||||||
public abstract class StepRegistryPropertiesConfigAdapterTests<P extends StepRegistryProperties, A extends StepRegistryPropertiesConfigAdapter<P>>
|
public abstract class StepRegistryPropertiesConfigAdapterTests<P extends StepRegistryProperties, A extends StepRegistryPropertiesConfigAdapter<P>>
|
||||||
extends PushRegistryPropertiesConfigAdapterTests<P, A> {
|
extends PushRegistryPropertiesConfigAdapterTests<P, A> {
|
||||||
|
|
||||||
|
protected StepRegistryPropertiesConfigAdapterTests(Class<A> adapter) {
|
||||||
|
super(adapter);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
class SignalFxPropertiesConfigAdapterTests
|
class SignalFxPropertiesConfigAdapterTests
|
||||||
extends StepRegistryPropertiesConfigAdapterTests<SignalFxProperties, SignalFxPropertiesConfigAdapter> {
|
extends StepRegistryPropertiesConfigAdapterTests<SignalFxProperties, SignalFxPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
protected SignalFxPropertiesConfigAdapterTests() {
|
||||||
|
super(SignalFxPropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SignalFxProperties createProperties() {
|
protected SignalFxProperties createProperties() {
|
||||||
SignalFxProperties signalFxProperties = new SignalFxProperties();
|
SignalFxProperties signalFxProperties = new SignalFxProperties();
|
||||||
|
@ -21,6 +21,8 @@ import java.time.Duration;
|
|||||||
import io.micrometer.core.instrument.simple.CountingMode;
|
import io.micrometer.core.instrument.simple.CountingMode;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +30,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
*
|
*
|
||||||
* @author Mirko Sobeck
|
* @author Mirko Sobeck
|
||||||
*/
|
*/
|
||||||
class SimplePropertiesConfigAdapterTests {
|
class SimplePropertiesConfigAdapterTests
|
||||||
|
extends AbstractPropertiesConfigAdapterTests<SimpleProperties, SimplePropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
SimplePropertiesConfigAdapterTests() {
|
||||||
|
super(SimplePropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenPropertiesStepIsSetAdapterStepReturnsIt() {
|
void whenPropertiesStepIsSetAdapterStepReturnsIt() {
|
||||||
|
@ -21,6 +21,8 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +30,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
*
|
*
|
||||||
* @author Johannes Graf
|
* @author Johannes Graf
|
||||||
*/
|
*/
|
||||||
class StackdriverPropertiesConfigAdapterTests {
|
class StackdriverPropertiesConfigAdapterTests
|
||||||
|
extends AbstractPropertiesConfigAdapterTests<StackdriverProperties, StackdriverPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
StackdriverPropertiesConfigAdapterTests() {
|
||||||
|
super(StackdriverPropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenPropertiesProjectIdIsSetAdapterProjectIdReturnsIt() {
|
void whenPropertiesProjectIdIsSetAdapterProjectIdReturnsIt() {
|
||||||
@ -70,4 +77,10 @@ class StackdriverPropertiesConfigAdapterTests {
|
|||||||
.isEqualTo("external.googleapis.com/prometheus");
|
.isEqualTo("external.googleapis.com/prometheus");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
protected void adapterOverridesAllConfigMethods() {
|
||||||
|
adapterOverridesAllConfigMethodsExcept("credentials");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,8 @@ import io.micrometer.statsd.StatsdFlavor;
|
|||||||
import io.micrometer.statsd.StatsdProtocol;
|
import io.micrometer.statsd.StatsdProtocol;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,7 +31,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
*
|
*
|
||||||
* @author Johnny Lim
|
* @author Johnny Lim
|
||||||
*/
|
*/
|
||||||
class StatsdPropertiesConfigAdapterTests {
|
class StatsdPropertiesConfigAdapterTests
|
||||||
|
extends AbstractPropertiesConfigAdapterTests<StatsdProperties, StatsdPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
protected StatsdPropertiesConfigAdapterTests() {
|
||||||
|
super(StatsdPropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenPropertiesEnabledIsSetAdapterEnabledReturnsIt() {
|
void whenPropertiesEnabledIsSetAdapterEnabledReturnsIt() {
|
||||||
|
@ -35,6 +35,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
class WavefrontPropertiesConfigAdapterTests extends
|
class WavefrontPropertiesConfigAdapterTests extends
|
||||||
PushRegistryPropertiesConfigAdapterTests<WavefrontProperties.Metrics.Export, WavefrontPropertiesConfigAdapter> {
|
PushRegistryPropertiesConfigAdapterTests<WavefrontProperties.Metrics.Export, WavefrontPropertiesConfigAdapter> {
|
||||||
|
|
||||||
|
protected WavefrontPropertiesConfigAdapterTests() {
|
||||||
|
super(WavefrontPropertiesConfigAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected WavefrontProperties.Metrics.Export createProperties() {
|
protected WavefrontProperties.Metrics.Export createProperties() {
|
||||||
return new WavefrontProperties.Metrics.Export();
|
return new WavefrontProperties.Metrics.Export();
|
||||||
|
Loading…
Reference in New Issue
Block a user