From c1c90b11b8a12e0d72375f362760ff59555b9416 Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Tue, 28 Apr 2020 16:31:31 +0200 Subject: [PATCH] Fix some deprecations See gh-21212 --- .../metrics/PropertiesMeterFilterTests.java | 14 +++++++------- .../kafka/KafkaAutoConfigurationTests.java | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilterTests.java index bd4d442ccf..7ee94fc293 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilterTests.java @@ -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"); * you may not use this file except in compliance with the License. @@ -240,7 +240,7 @@ class PropertiesMeterFilterTests { PropertiesMeterFilter filter = new PropertiesMeterFilter( createProperties("distribution.minimum-expected-value.spring.boot=10")); assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT) - .getMinimumExpectedValue()).isEqualTo(Duration.ofMillis(10).toNanos()); + .getMinimumExpectedValueAsDouble()).isEqualTo(Duration.ofMillis(10).toNanos()); } @Test @@ -248,7 +248,7 @@ class PropertiesMeterFilterTests { PropertiesMeterFilter filter = new PropertiesMeterFilter( createProperties("distribution.minimum-expected-value.spring=10")); assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT) - .getMinimumExpectedValue()).isEqualTo(Duration.ofMillis(10).toNanos()); + .getMinimumExpectedValueAsDouble()).isEqualTo(Duration.ofMillis(10).toNanos()); } @Test @@ -256,7 +256,7 @@ class PropertiesMeterFilterTests { PropertiesMeterFilter filter = new PropertiesMeterFilter(createProperties( "distribution.minimum-expected-value.spring=10", "distribution.minimum-expected-value.spring.boot=50")); assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT) - .getMinimumExpectedValue()).isEqualTo(Duration.ofMillis(50).toNanos()); + .getMinimumExpectedValueAsDouble()).isEqualTo(Duration.ofMillis(50).toNanos()); } @Test @@ -264,7 +264,7 @@ class PropertiesMeterFilterTests { PropertiesMeterFilter filter = new PropertiesMeterFilter( createProperties("distribution.maximum-expected-value.spring.boot=5000")); assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT) - .getMaximumExpectedValue()).isEqualTo(Duration.ofMillis(5000).toNanos()); + .getMaximumExpectedValueAsDouble()).isEqualTo(Duration.ofMillis(5000).toNanos()); } @Test @@ -272,7 +272,7 @@ class PropertiesMeterFilterTests { PropertiesMeterFilter filter = new PropertiesMeterFilter( createProperties("distribution.maximum-expected-value.spring=5000")); assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT) - .getMaximumExpectedValue()).isEqualTo(Duration.ofMillis(5000).toNanos()); + .getMaximumExpectedValueAsDouble()).isEqualTo(Duration.ofMillis(5000).toNanos()); } @Test @@ -281,7 +281,7 @@ class PropertiesMeterFilterTests { createProperties("distribution.maximum-expected-value.spring=5000", "distribution.maximum-expected-value.spring.boot=10000")); 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) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java index 08c5b12108..24132b1c4d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java @@ -214,7 +214,7 @@ class KafkaAutoConfigurationTests { "spring.kafka.admin.ssl.trust-store-type=PKCS12", "spring.kafka.admin.ssl.protocol=TLSv1.2") .run((context) -> { KafkaAdmin admin = context.getBean(KafkaAdmin.class); - Map configs = admin.getConfig(); + Map configs = admin.getConfigurationProperties(); // common assertThat(configs.get(AdminClientConfig.CLIENT_ID_CONFIG)).isEqualTo("cid"); // admin @@ -583,7 +583,7 @@ class KafkaAutoConfigurationTests { Map producerConfigs = producerFactory.getConfigurationProperties(); assertThat(producerConfigs.get(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG)).isEqualTo("SSL"); KafkaAdmin admin = context.getBean(KafkaAdmin.class); - Map configs = admin.getConfig(); + Map configs = admin.getConfigurationProperties(); assertThat(configs.get(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG)).isEqualTo("PLAINTEXT"); }); }