Skip to content

Commit aa0360e

Browse files
dreis2211snicoll
authored andcommitted
Fix some deprecation warnings
See gh-20108
1 parent ddcf596 commit aa0360e

File tree

9 files changed

+27
-24
lines changed

9 files changed

+27
-24
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ void redisCacheWithRedisCacheConfiguration() {
267267
assertThat(cacheManager.getCacheNames()).isEmpty();
268268
RedisCacheConfiguration redisCacheConfiguration = getDefaultRedisCacheConfiguration(cacheManager);
269269
assertThat(redisCacheConfiguration.getTtl()).isEqualTo(java.time.Duration.ofSeconds(30));
270-
assertThat(redisCacheConfiguration.getKeyPrefixFor("")).isEqualTo("bar");
270+
assertThat(redisCacheConfiguration.getKeyPrefixFor("")).isEqualTo("bar::");
271271
});
272272
}
273273

@@ -758,7 +758,7 @@ static class RedisWithCacheConfigurationConfiguration {
758758
@Bean
759759
org.springframework.data.redis.cache.RedisCacheConfiguration customRedisCacheConfiguration() {
760760
return org.springframework.data.redis.cache.RedisCacheConfiguration.defaultCacheConfig()
761-
.entryTtl(java.time.Duration.ofSeconds(30)).prefixKeysWith("bar");
761+
.entryTtl(java.time.Duration.ofSeconds(30)).prefixCacheNameWith("bar");
762762
}
763763

764764
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/elasticsearch/city/City.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@
2121
import org.springframework.data.annotation.Id;
2222
import org.springframework.data.elasticsearch.annotations.Document;
2323

24-
@Document(indexName = "city", type = "city", shards = 1, replicas = 0, refreshInterval = "-1")
24+
@Document(indexName = "city", shards = 1, replicas = 0, refreshInterval = "-1")
2525
public class City implements Serializable {
2626

2727
private static final long serialVersionUID = 1L;

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/rest/RestClientAutoConfigurationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -145,9 +145,9 @@ void restClientCanQueryElasticsearchNode() {
145145
Map<String, String> source = new HashMap<>();
146146
source.put("a", "alpha");
147147
source.put("b", "bravo");
148-
IndexRequest index = new IndexRequest("foo", "bar", "1").source(source);
148+
IndexRequest index = new IndexRequest("test").id("1").source(source);
149149
client.index(index, RequestOptions.DEFAULT);
150-
GetRequest getRequest = new GetRequest("foo", "bar", "1");
150+
GetRequest getRequest = new GetRequest("test").id("1");
151151
assertThat(client.get(getRequest, RequestOptions.DEFAULT).isExists()).isTrue();
152152
});
153153
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,12 @@ void disableParserFeature() {
230230

231231
@Test
232232
void enableGeneratorFeature() {
233-
this.contextRunner.withPropertyValues("spring.jackson.generator.write_numbers_as_strings:true")
233+
this.contextRunner.withPropertyValues("spring.jackson.generator.strict_duplicate_detection:true")
234234
.run((context) -> {
235235
ObjectMapper mapper = context.getBean(ObjectMapper.class);
236-
assertThat(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS.enabledByDefault()).isFalse();
237-
assertThat(mapper.getFactory().isEnabled(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS)).isTrue();
236+
JsonGenerator.Feature feature = JsonGenerator.Feature.STRICT_DUPLICATE_DETECTION;
237+
assertThat(feature.enabledByDefault()).isFalse();
238+
assertThat(mapper.getFactory().isEnabled(feature)).isTrue();
238239
});
239240
}
240241

spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/HateoasController.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
2121

2222
import org.springframework.hateoas.EntityModel;
2323
import org.springframework.hateoas.Link;
24+
import org.springframework.hateoas.LinkRelation;
2425
import org.springframework.web.bind.annotation.RequestMapping;
2526
import org.springframework.web.bind.annotation.RestController;
2627

@@ -36,7 +37,7 @@ class HateoasController {
3637

3738
@RequestMapping("/resource")
3839
EntityModel<Map<String, String>> resource() {
39-
return new EntityModel<>(new HashMap<>(), new Link("self", "https://api.example.com"));
40+
return EntityModel.of(new HashMap<>(), Link.of("self", LinkRelation.of("https://api.example.com")));
4041
}
4142

4243
@RequestMapping("/plain")

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -123,9 +123,8 @@ protected Mono<String> testSslWithAlias(String alias) {
123123
ReactorClientHttpConnector connector = buildTrustAllSslConnector();
124124
WebClient client = WebClient.builder().baseUrl("https://localhost:" + this.webServer.getPort())
125125
.clientConnector(connector).build();
126-
return client.post().uri("/test").contentType(MediaType.TEXT_PLAIN)
127-
.body(BodyInserters.fromObject("Hello World")).exchange()
128-
.flatMap((response) -> response.bodyToMono(String.class));
126+
return client.post().uri("/test").contentType(MediaType.TEXT_PLAIN).body(BodyInserters.fromValue("Hello World"))
127+
.exchange().flatMap((response) -> response.bodyToMono(String.class));
129128
}
130129

131130
}

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/main/java/smoketest/data/elasticsearch/Customer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@
1919
import org.springframework.data.annotation.Id;
2020
import org.springframework.data.elasticsearch.annotations.Document;
2121

22-
@Document(indexName = "customer", type = "customer", shards = 1, replicas = 0, refreshInterval = "-1")
22+
@Document(indexName = "customer", shards = 1, replicas = 0, refreshInterval = "-1")
2323
public class Customer {
2424

2525
@Id

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-solr/src/main/java/smoketest/data/solr/Product.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
2424
import org.springframework.data.solr.core.geo.Point;
2525
import org.springframework.data.solr.core.mapping.SolrDocument;
2626

27-
@SolrDocument(solrCoreName = "collection1")
27+
@SolrDocument(collection = "collection1")
2828
public class Product {
2929

3030
@Id

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/test/java/smoketest/rsocket/SampleRSocketApplicationTests.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
1818

1919
import java.time.Duration;
2020

21+
import io.rsocket.metadata.WellKnownMimeType;
2122
import org.assertj.core.api.Assertions;
2223
import org.junit.jupiter.api.Test;
2324
import reactor.core.publisher.Mono;
@@ -27,8 +28,9 @@
2728
import org.springframework.boot.rsocket.context.LocalRSocketServerPort;
2829
import org.springframework.boot.test.context.SpringBootTest;
2930
import org.springframework.messaging.rsocket.RSocketRequester;
30-
import org.springframework.security.rsocket.metadata.BasicAuthenticationEncoder;
31+
import org.springframework.security.rsocket.metadata.SimpleAuthenticationEncoder;
3132
import org.springframework.security.rsocket.metadata.UsernamePasswordMetadata;
33+
import org.springframework.util.MimeTypeUtils;
3234

3335
@SpringBootTest(properties = "spring.rsocket.server.port=0")
3436
public class SampleRSocketApplicationTests {
@@ -49,9 +51,9 @@ void unauthenticatedAccessToRSocketEndpoint() {
4951
@Test
5052
void rSocketEndpoint() {
5153
RSocketRequester requester = this.builder
52-
.rsocketStrategies((builder) -> builder.encoder(new BasicAuthenticationEncoder()))
54+
.rsocketStrategies((builder) -> builder.encoder(new SimpleAuthenticationEncoder()))
5355
.setupMetadata(new UsernamePasswordMetadata("user", "password"),
54-
UsernamePasswordMetadata.BASIC_AUTHENTICATION_MIME_TYPE)
56+
MimeTypeUtils.parseMimeType(WellKnownMimeType.MESSAGE_RSOCKET_AUTHENTICATION.getString()))
5557
.connectTcp("localhost", this.port).block(Duration.ofSeconds(5));
5658
Mono<Project> result = requester.route("find.project.spring-boot").retrieveMono(Project.class);
5759
StepVerifier.create(result)

0 commit comments

Comments
 (0)