Fix some deprecations

See gh-21212
pull/21259/head
dreis2211 5 years ago committed by Stephane Nicoll
parent 2eef71cba5
commit c1c90b11b8

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 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.
@ -240,7 +240,7 @@ class PropertiesMeterFilterTests {
PropertiesMeterFilter filter = new PropertiesMeterFilter( PropertiesMeterFilter filter = new PropertiesMeterFilter(
createProperties("distribution.minimum-expected-value.spring.boot=10")); createProperties("distribution.minimum-expected-value.spring.boot=10"));
assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT) assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT)
.getMinimumExpectedValue()).isEqualTo(Duration.ofMillis(10).toNanos()); .getMinimumExpectedValueAsDouble()).isEqualTo(Duration.ofMillis(10).toNanos());
} }
@Test @Test
@ -248,7 +248,7 @@ class PropertiesMeterFilterTests {
PropertiesMeterFilter filter = new PropertiesMeterFilter( PropertiesMeterFilter filter = new PropertiesMeterFilter(
createProperties("distribution.minimum-expected-value.spring=10")); createProperties("distribution.minimum-expected-value.spring=10"));
assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT) assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT)
.getMinimumExpectedValue()).isEqualTo(Duration.ofMillis(10).toNanos()); .getMinimumExpectedValueAsDouble()).isEqualTo(Duration.ofMillis(10).toNanos());
} }
@Test @Test
@ -256,7 +256,7 @@ class PropertiesMeterFilterTests {
PropertiesMeterFilter filter = new PropertiesMeterFilter(createProperties( PropertiesMeterFilter filter = new PropertiesMeterFilter(createProperties(
"distribution.minimum-expected-value.spring=10", "distribution.minimum-expected-value.spring.boot=50")); "distribution.minimum-expected-value.spring=10", "distribution.minimum-expected-value.spring.boot=50"));
assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT) assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT)
.getMinimumExpectedValue()).isEqualTo(Duration.ofMillis(50).toNanos()); .getMinimumExpectedValueAsDouble()).isEqualTo(Duration.ofMillis(50).toNanos());
} }
@Test @Test
@ -264,7 +264,7 @@ class PropertiesMeterFilterTests {
PropertiesMeterFilter filter = new PropertiesMeterFilter( PropertiesMeterFilter filter = new PropertiesMeterFilter(
createProperties("distribution.maximum-expected-value.spring.boot=5000")); createProperties("distribution.maximum-expected-value.spring.boot=5000"));
assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT) assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT)
.getMaximumExpectedValue()).isEqualTo(Duration.ofMillis(5000).toNanos()); .getMaximumExpectedValueAsDouble()).isEqualTo(Duration.ofMillis(5000).toNanos());
} }
@Test @Test
@ -272,7 +272,7 @@ class PropertiesMeterFilterTests {
PropertiesMeterFilter filter = new PropertiesMeterFilter( PropertiesMeterFilter filter = new PropertiesMeterFilter(
createProperties("distribution.maximum-expected-value.spring=5000")); createProperties("distribution.maximum-expected-value.spring=5000"));
assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT) assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT)
.getMaximumExpectedValue()).isEqualTo(Duration.ofMillis(5000).toNanos()); .getMaximumExpectedValueAsDouble()).isEqualTo(Duration.ofMillis(5000).toNanos());
} }
@Test @Test
@ -281,7 +281,7 @@ class PropertiesMeterFilterTests {
createProperties("distribution.maximum-expected-value.spring=5000", createProperties("distribution.maximum-expected-value.spring=5000",
"distribution.maximum-expected-value.spring.boot=10000")); "distribution.maximum-expected-value.spring.boot=10000"));
assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT) assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT)
.getMaximumExpectedValue()).isEqualTo(Duration.ofMillis(10000).toNanos()); .getMaximumExpectedValueAsDouble()).isEqualTo(Duration.ofMillis(10000).toNanos());
} }
private Id createMeterId(String name) { private Id createMeterId(String name) {

@ -214,7 +214,7 @@ class KafkaAutoConfigurationTests {
"spring.kafka.admin.ssl.trust-store-type=PKCS12", "spring.kafka.admin.ssl.protocol=TLSv1.2") "spring.kafka.admin.ssl.trust-store-type=PKCS12", "spring.kafka.admin.ssl.protocol=TLSv1.2")
.run((context) -> { .run((context) -> {
KafkaAdmin admin = context.getBean(KafkaAdmin.class); KafkaAdmin admin = context.getBean(KafkaAdmin.class);
Map<String, Object> configs = admin.getConfig(); Map<String, Object> configs = admin.getConfigurationProperties();
// common // common
assertThat(configs.get(AdminClientConfig.CLIENT_ID_CONFIG)).isEqualTo("cid"); assertThat(configs.get(AdminClientConfig.CLIENT_ID_CONFIG)).isEqualTo("cid");
// admin // admin
@ -583,7 +583,7 @@ class KafkaAutoConfigurationTests {
Map<String, Object> producerConfigs = producerFactory.getConfigurationProperties(); Map<String, Object> producerConfigs = producerFactory.getConfigurationProperties();
assertThat(producerConfigs.get(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG)).isEqualTo("SSL"); assertThat(producerConfigs.get(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG)).isEqualTo("SSL");
KafkaAdmin admin = context.getBean(KafkaAdmin.class); KafkaAdmin admin = context.getBean(KafkaAdmin.class);
Map<String, Object> configs = admin.getConfig(); Map<String, Object> configs = admin.getConfigurationProperties();
assertThat(configs.get(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG)).isEqualTo("PLAINTEXT"); assertThat(configs.get(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG)).isEqualTo("PLAINTEXT");
}); });
} }

Loading…
Cancel
Save