Skip to content

Commit d803eb5

Browse files
committed
cleanup
1 parent b7cbaa6 commit d803eb5

File tree

1 file changed

+8
-30
lines changed
  • instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure

1 file changed

+8
-30
lines changed

instrumentation/spring/spring-boot-autoconfigure/src/test/java/io/opentelemetry/instrumentation/spring/autoconfigure/EmbeddedConfigFileTest.java

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77

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

10-
import io.opentelemetry.api.incubator.config.DeclarativeConfigProperties;
11-
import io.opentelemetry.sdk.extension.incubator.fileconfig.SdkConfigProvider;
12-
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel;
1310
import java.util.HashMap;
1411
import java.util.List;
1512
import java.util.Map;
@@ -19,7 +16,7 @@ class EmbeddedConfigFileTest {
1916

2017
@Test
2118
void convertFlatPropsToNested_simpleProperties() {
22-
Map<String, Object> flatProps = new HashMap<>();
19+
Map<String, String> flatProps = new HashMap<>();
2320
flatProps.put("resource.service.name", "my-service");
2421
flatProps.put("traces.exporter", "otlp");
2522

@@ -58,7 +55,7 @@ void convertFlatPropsToNested_simpleProperties() {
5855

5956
@Test
6057
void convertFlatPropsToNested_arrayProperties() {
61-
Map<String, Object> flatProps = new HashMap<>();
58+
Map<String, String> flatProps = new HashMap<>();
6259
flatProps.put("instrumentation.java.list[0]", "one");
6360
flatProps.put("instrumentation.java.list[1]", "two");
6461
flatProps.put("instrumentation.java.list[2]", "three");
@@ -92,7 +89,7 @@ void convertFlatPropsToNested_arrayProperties() {
9289

9390
@Test
9491
void convertFlatPropsToNested_mixedPropertiesAndArrays() {
95-
Map<String, Object> flatProps = new HashMap<>();
92+
Map<String, String> flatProps = new HashMap<>();
9693
flatProps.put("resource.service.name", "test-service");
9794
flatProps.put("resource.attributes[0]", "key1=value1");
9895
flatProps.put("resource.attributes[1]", "key2=value2");
@@ -127,7 +124,7 @@ void convertFlatPropsToNested_mixedPropertiesAndArrays() {
127124

128125
@Test
129126
void convertFlatPropsToNested_emptyMap() {
130-
Map<String, Object> flatProps = new HashMap<>();
127+
Map<String, String> flatProps = new HashMap<>();
131128

132129
Map<String, Object> result = EmbeddedConfigFile.convertFlatPropsToNested(flatProps);
133130

@@ -136,7 +133,7 @@ void convertFlatPropsToNested_emptyMap() {
136133

137134
@Test
138135
void convertFlatPropsToNested_singleLevelProperty() {
139-
Map<String, Object> flatProps = new HashMap<>();
136+
Map<String, String> flatProps = new HashMap<>();
140137
flatProps.put("enabled", "true");
141138

142139
Map<String, Object> result = EmbeddedConfigFile.convertFlatPropsToNested(flatProps);
@@ -146,7 +143,7 @@ void convertFlatPropsToNested_singleLevelProperty() {
146143

147144
@Test
148145
void convertFlatPropsToNested_arrayWithGaps() {
149-
Map<String, Object> flatProps = new HashMap<>();
146+
Map<String, String> flatProps = new HashMap<>();
150147
flatProps.put("list[0]", "first");
151148
flatProps.put("list[2]", "third");
152149

@@ -164,7 +161,7 @@ void convertFlatPropsToNested_arrayWithGaps() {
164161

165162
@Test
166163
void convertFlatPropsToNested_deeplyNestedProperties() {
167-
Map<String, Object> flatProps = new HashMap<>();
164+
Map<String, String> flatProps = new HashMap<>();
168165
flatProps.put("a.b.c.d.e", "deep-value");
169166

170167
Map<String, Object> result = EmbeddedConfigFile.convertFlatPropsToNested(flatProps);
@@ -186,7 +183,7 @@ void convertFlatPropsToNested_deeplyNestedProperties() {
186183

187184
@Test
188185
void convertFlatPropsToNested_nestedArrays() {
189-
Map<String, Object> flatProps = new HashMap<>();
186+
Map<String, String> flatProps = new HashMap<>();
190187
flatProps.put("outer[0].inner[0]", "value1");
191188
flatProps.put("outer[0].inner[1]", "value2");
192189
flatProps.put("outer[1].inner[0]", "value3");
@@ -214,23 +211,4 @@ void convertFlatPropsToNested_nestedArrays() {
214211
assertThat(secondInner).containsExactly("value3");
215212
});
216213
}
217-
218-
@Test
219-
void convertToOpenTelemetryConfigurationModel_typeIsPreserved() {
220-
Map<String, Object> flatProps = new HashMap<>();
221-
flatProps.put("instrumentation/development.java.bool", true);
222-
flatProps.put("instrumentation/development.java.string", "test");
223-
flatProps.put("instrumentation/development.java.number", 42);
224-
flatProps.put("instrumentation/development.java.double", 3.14);
225-
226-
OpenTelemetryConfigurationModel model =
227-
EmbeddedConfigFile.convertToOpenTelemetryConfigurationModel(flatProps);
228-
229-
DeclarativeConfigProperties java =
230-
SdkConfigProvider.create(model).getInstrumentationConfig().getStructured("java");
231-
assertThat(java.getBoolean("bool")).isTrue();
232-
assertThat(java.getString("string")).isEqualTo("test");
233-
assertThat(java.getLong("number")).isEqualTo(42L);
234-
assertThat(java.getDouble("double")).isEqualTo(3.14);
235-
}
236214
}

0 commit comments

Comments
 (0)