Skip to content

Commit

Permalink
Polish "Test Micrometer config to property exposure"
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkinsona committed Jul 21, 2023
1 parent be1f1c8 commit c2b43e7
Show file tree
Hide file tree
Showing 25 changed files with 233 additions and 270 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@

package org.springframework.boot.actuate.autoconfigure.metrics.export.appoptics;

import io.micrometer.appoptics.AppOpticsConfig;
import org.junit.jupiter.api.Test;

import org.springframework.boot.actuate.autoconfigure.metrics.export.TestConfigsToPropertiesExposure;
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.StepRegistryPropertiesConfigAdapterTests;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -32,6 +30,10 @@
class AppOpticsPropertiesConfigAdapterTests
extends StepRegistryPropertiesConfigAdapterTests<AppOpticsProperties, AppOpticsPropertiesConfigAdapter> {

AppOpticsPropertiesConfigAdapterTests() {
super(AppOpticsPropertiesConfigAdapter.class);
}

@Override
protected AppOpticsProperties createProperties() {
return new AppOpticsProperties();
Expand Down Expand Up @@ -70,10 +72,4 @@ void whenPropertiesFloorTimesIsSetAdapterFloorTimesReturnsIt() {
assertThat(createConfigAdapter(properties).floorTimes()).isTrue();
}

@Test
void allDefaultConfigMethodsAreOverriddenByAtlasPropertiesConfigAdapter() {
TestConfigsToPropertiesExposure.assertThatAllConfigDefaultMethodsAreOverriddenByAdapter(AppOpticsConfig.class,
AppOpticsPropertiesConfigAdapter.class, "connectTimeout");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

import java.time.Duration;

import com.netflix.spectator.atlas.AtlasConfig;
import org.junit.jupiter.api.Test;

import org.springframework.boot.actuate.autoconfigure.metrics.export.TestConfigsToPropertiesExposure;
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;

import static org.assertj.core.api.Assertions.assertThat;

Expand All @@ -30,7 +29,12 @@
*
* @author Mirko Sobeck
*/
class AtlasPropertiesConfigAdapterTests {
class AtlasPropertiesConfigAdapterTests
extends AbstractPropertiesConfigAdapterTests<AtlasProperties, AtlasPropertiesConfigAdapter> {

AtlasPropertiesConfigAdapterTests() {
super(AtlasPropertiesConfigAdapter.class);
}

@Test
void whenPropertiesStepIsSetAdapterStepReturnsIt() {
Expand Down Expand Up @@ -120,10 +124,10 @@ void whenPropertiesEvalUriIsSetAdapterEvalUriReturnsIt() {
}

@Test
void allConfigDefaultMethodsAreOverriddenByAdapter() {
TestConfigsToPropertiesExposure.assertThatAllConfigDefaultMethodsAreOverriddenByAdapter(AtlasConfig.class,
AtlasPropertiesConfigAdapter.class, "lwcIgnorePublishStep", "initialPollingDelay", "autoStart",
"lwcStep", "validTagCharacters");
@Override
protected void adapterOverridesAllConfigMethods() {
adapterOverridesAllConfigMethodsExcept("autoStart", "commonTags", "debugRegistry", "publisher", "rollupPolicy",
"validTagCharacters");
}

}
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -41,6 +41,8 @@ void defaultValuesAreConsistent() {
assertThat(properties.getUri()).isEqualTo(config.uri());
assertThat(properties.getMeterTimeToLive()).isEqualTo(config.meterTTL());
assertThat(properties.isLwcEnabled()).isEqualTo(config.lwcEnabled());
assertThat(properties.isLwcIgnorePublishStep()).isEqualTo(config.lwcIgnorePublishStep());
assertThat(properties.getLwcStep()).isEqualTo(config.lwcStep());
assertThat(properties.getConfigRefreshFrequency()).isEqualTo(config.configRefreshFrequency());
assertThat(properties.getConfigTimeToLive()).isEqualTo(config.configTTL());
assertThat(properties.getConfigUri()).isEqualTo(config.configUri());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@

package org.springframework.boot.actuate.autoconfigure.metrics.export.datadog;

import io.micrometer.datadog.DatadogConfig;
import org.junit.jupiter.api.Test;

import org.springframework.boot.actuate.autoconfigure.metrics.export.TestConfigsToPropertiesExposure;
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.StepRegistryPropertiesConfigAdapterTests;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -33,6 +31,10 @@
class DatadogPropertiesConfigAdapterTests
extends StepRegistryPropertiesConfigAdapterTests<DatadogProperties, DatadogPropertiesConfigAdapter> {

DatadogPropertiesConfigAdapterTests() {
super(DatadogPropertiesConfigAdapter.class);
}

@Override
protected DatadogProperties createProperties() {
return new DatadogProperties();
Expand Down Expand Up @@ -78,10 +80,4 @@ void whenPropertiesUriIsSetAdapterUriReturnsIt() {
assertThat(createConfigAdapter(properties).uri()).isEqualTo("https://app.example.com/api/v1/series");
}

@Test
void allConfigDefaultMethodsAreOverriddenByAdapter() {
TestConfigsToPropertiesExposure.assertThatAllConfigDefaultMethodsAreOverriddenByAdapter(DatadogConfig.class,
DatadogPropertiesConfigAdapter.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
import java.util.HashMap;

import io.micrometer.dynatrace.DynatraceApiVersion;
import io.micrometer.dynatrace.DynatraceConfig;
import org.junit.jupiter.api.Test;

import org.springframework.boot.actuate.autoconfigure.metrics.export.TestConfigsToPropertiesExposure;
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;

import static org.assertj.core.api.Assertions.assertThat;

Expand All @@ -32,7 +31,12 @@
* @author Andy Wilkinson
* @author Georg Pirklbauer
*/
class DynatracePropertiesConfigAdapterTests {
class DynatracePropertiesConfigAdapterTests
extends AbstractPropertiesConfigAdapterTests<DynatraceProperties, DynatracePropertiesConfigAdapter> {

DynatracePropertiesConfigAdapterTests() {
super(DynatracePropertiesConfigAdapter.class);
}

@Test
void whenPropertiesUriIsSetAdapterUriReturnsIt() {
Expand Down Expand Up @@ -164,10 +168,4 @@ void defaultValues() {
assertThat(properties.getGroup()).isNull();
}

@Test
void allConfigDefaultMethodsAreOverriddenByAdapter() {
TestConfigsToPropertiesExposure.assertThatAllConfigDefaultMethodsAreOverriddenByAdapter(DynatraceConfig.class,
DynatracePropertiesConfigAdapter.class, "documentType");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@

package org.springframework.boot.actuate.autoconfigure.metrics.export.elastic;

import io.micrometer.elastic.ElasticConfig;
import org.junit.jupiter.api.Test;

import org.springframework.boot.actuate.autoconfigure.metrics.export.TestConfigsToPropertiesExposure;
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;

import static org.assertj.core.api.Assertions.assertThat;

Expand All @@ -28,7 +27,12 @@
*
* @author Andy Wilkinson
*/
class ElasticPropertiesConfigAdapterTests {
class ElasticPropertiesConfigAdapterTests
extends AbstractPropertiesConfigAdapterTests<ElasticProperties, ElasticPropertiesConfigAdapter> {

ElasticPropertiesConfigAdapterTests() {
super(ElasticPropertiesConfigAdapter.class);
}

@Test
void whenPropertiesHostsIsSetAdapterHostsReturnsIt() {
Expand Down Expand Up @@ -100,10 +104,4 @@ void whenPropertiesApiKeyCredentialsIsSetAdapterPipelineReturnsIt() {
assertThat(new ElasticPropertiesConfigAdapter(properties).apiKeyCredentials()).isEqualTo("secret");
}

@Test
void allConfigDefaultMethodsAreOverriddenByAdapter() {
TestConfigsToPropertiesExposure.assertThatAllConfigDefaultMethodsAreOverriddenByAdapter(ElasticConfig.class,
ElasticPropertiesConfigAdapter.class, "documentType");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
import java.util.concurrent.TimeUnit;

import info.ganglia.gmetric4j.gmetric.GMetric.UDPAddressingMode;
import io.micrometer.ganglia.GangliaConfig;
import org.junit.jupiter.api.Test;

import org.springframework.boot.actuate.autoconfigure.metrics.export.TestConfigsToPropertiesExposure;
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;

import static org.assertj.core.api.Assertions.assertThat;

Expand All @@ -32,7 +31,12 @@
*
* @author Mirko Sobeck
*/
class GangliaPropertiesConfigAdapterTests {
class GangliaPropertiesConfigAdapterTests
extends AbstractPropertiesConfigAdapterTests<GangliaProperties, GangliaPropertiesConfigAdapter> {

GangliaPropertiesConfigAdapterTests() {
super(GangliaPropertiesConfigAdapter.class);
}

@Test
void whenPropertiesEnabledIsSetAdapterEnabledReturnsIt() {
Expand Down Expand Up @@ -84,10 +88,4 @@ void whenPropertiesPortIsSetAdapterPortReturnsIt() {
assertThat(new GangliaPropertiesConfigAdapter(properties).port()).isEqualTo(4242);
}

@Test
void allConfigDefaultMethodsAreOverriddenByAdapter() {
TestConfigsToPropertiesExposure.assertThatAllConfigDefaultMethodsAreOverriddenByAdapter(GangliaConfig.class,
GangliaPropertiesConfigAdapter.class, "protocolVersion");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
import java.time.Duration;
import java.util.concurrent.TimeUnit;

import io.micrometer.graphite.GraphiteConfig;
import io.micrometer.graphite.GraphiteProtocol;
import org.junit.jupiter.api.Test;

import org.springframework.boot.actuate.autoconfigure.metrics.export.TestConfigsToPropertiesExposure;
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.AbstractPropertiesConfigAdapterTests;

import static org.assertj.core.api.Assertions.assertThat;

Expand All @@ -32,7 +31,12 @@
*
* @author Mirko Sobeck
*/
class GraphitePropertiesConfigAdapterTests {
class GraphitePropertiesConfigAdapterTests
extends AbstractPropertiesConfigAdapterTests<GraphiteProperties, GraphitePropertiesConfigAdapter> {

GraphitePropertiesConfigAdapterTests() {
super(GraphitePropertiesConfigAdapter.class);
}

@Test
void whenPropertiesEnabledIsSetAdapterEnabledReturnsIt() {
Expand Down Expand Up @@ -97,10 +101,4 @@ void whenPropertiesTagsAsPrefixIsSetAdapterTagsAsPrefixReturnsIt() {
assertThat(new GraphitePropertiesConfigAdapter(properties).tagsAsPrefix()).isEqualTo(new String[] { "worker" });
}

@Test
void allConfigDefaultMethodsAreOverriddenByAdapter() {
TestConfigsToPropertiesExposure.assertThatAllConfigDefaultMethodsAreOverriddenByAdapter(GraphiteConfig.class,
GraphitePropertiesConfigAdapter.class);
}

}
Loading

0 comments on commit c2b43e7

Please sign in to comment.