Merge pull request #20108 from dreis2211

* pr/20108:
  Fix some deprecation warnings

Closes gh-20108
pull/20113/head
Stephane Nicoll 5 years ago
commit b18db5eea7

@ -267,7 +267,7 @@ class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationTests {
assertThat(cacheManager.getCacheNames()).isEmpty();
RedisCacheConfiguration redisCacheConfiguration = getDefaultRedisCacheConfiguration(cacheManager);
assertThat(redisCacheConfiguration.getTtl()).isEqualTo(java.time.Duration.ofSeconds(30));
assertThat(redisCacheConfiguration.getKeyPrefixFor("")).isEqualTo("bar");
assertThat(redisCacheConfiguration.getKeyPrefixFor("")).isEqualTo("bar::");
});
}
@ -758,7 +758,7 @@ class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationTests {
@Bean
org.springframework.data.redis.cache.RedisCacheConfiguration customRedisCacheConfiguration() {
return org.springframework.data.redis.cache.RedisCacheConfiguration.defaultCacheConfig()
.entryTtl(java.time.Duration.ofSeconds(30)).prefixKeysWith("bar");
.entryTtl(java.time.Duration.ofSeconds(30)).prefixCacheNameWith("bar");
}
}

@ -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.
@ -21,7 +21,7 @@ import java.io.Serializable;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
@Document(indexName = "city", type = "city", shards = 1, replicas = 0, refreshInterval = "-1")
@Document(indexName = "city", shards = 1, replicas = 0, refreshInterval = "-1")
public class City implements Serializable {
private static final long serialVersionUID = 1L;

@ -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.
@ -145,9 +145,9 @@ class RestClientAutoConfigurationTests {
Map<String, String> source = new HashMap<>();
source.put("a", "alpha");
source.put("b", "bravo");
IndexRequest index = new IndexRequest("foo", "bar", "1").source(source);
IndexRequest index = new IndexRequest("test").id("1").source(source);
client.index(index, RequestOptions.DEFAULT);
GetRequest getRequest = new GetRequest("foo", "bar", "1");
GetRequest getRequest = new GetRequest("test").id("1");
assertThat(client.get(getRequest, RequestOptions.DEFAULT).isExists()).isTrue();
});
}

@ -230,11 +230,12 @@ class JacksonAutoConfigurationTests {
@Test
void enableGeneratorFeature() {
this.contextRunner.withPropertyValues("spring.jackson.generator.write_numbers_as_strings:true")
this.contextRunner.withPropertyValues("spring.jackson.generator.strict_duplicate_detection:true")
.run((context) -> {
ObjectMapper mapper = context.getBean(ObjectMapper.class);
assertThat(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS.enabledByDefault()).isFalse();
assertThat(mapper.getFactory().isEnabled(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS)).isTrue();
JsonGenerator.Feature feature = JsonGenerator.Feature.STRICT_DUPLICATE_DETECTION;
assertThat(feature.enabledByDefault()).isFalse();
assertThat(mapper.getFactory().isEnabled(feature)).isTrue();
});
}

@ -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.
@ -21,6 +21,7 @@ import java.util.Map;
import org.springframework.hateoas.EntityModel;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.LinkRelation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -36,7 +37,7 @@ class HateoasController {
@RequestMapping("/resource")
EntityModel<Map<String, String>> resource() {
return new EntityModel<>(new HashMap<>(), new Link("self", "https://api.example.com"));
return EntityModel.of(new HashMap<>(), Link.of("self", LinkRelation.of("https://api.example.com")));
}
@RequestMapping("/plain")

@ -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.
@ -123,9 +123,8 @@ class NettyReactiveWebServerFactoryTests extends AbstractReactiveWebServerFactor
ReactorClientHttpConnector connector = buildTrustAllSslConnector();
WebClient client = WebClient.builder().baseUrl("https://localhost:" + this.webServer.getPort())
.clientConnector(connector).build();
return client.post().uri("/test").contentType(MediaType.TEXT_PLAIN)
.body(BodyInserters.fromObject("Hello World")).exchange()
.flatMap((response) -> response.bodyToMono(String.class));
return client.post().uri("/test").contentType(MediaType.TEXT_PLAIN).body(BodyInserters.fromValue("Hello World"))
.exchange().flatMap((response) -> response.bodyToMono(String.class));
}
}

@ -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.
@ -19,7 +19,7 @@ package smoketest.data.elasticsearch;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
@Document(indexName = "customer", type = "customer", shards = 1, replicas = 0, refreshInterval = "-1")
@Document(indexName = "customer", shards = 1, replicas = 0, refreshInterval = "-1")
public class Customer {
@Id

@ -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.
@ -24,7 +24,7 @@ import org.springframework.data.annotation.Id;
import org.springframework.data.solr.core.geo.Point;
import org.springframework.data.solr.core.mapping.SolrDocument;
@SolrDocument(solrCoreName = "collection1")
@SolrDocument(collection = "collection1")
public class Product {
@Id

@ -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.
@ -18,6 +18,7 @@ package smoketest.rsocket;
import java.time.Duration;
import io.rsocket.metadata.WellKnownMimeType;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
@ -27,8 +28,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.rsocket.context.LocalRSocketServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.messaging.rsocket.RSocketRequester;
import org.springframework.security.rsocket.metadata.BasicAuthenticationEncoder;
import org.springframework.security.rsocket.metadata.SimpleAuthenticationEncoder;
import org.springframework.security.rsocket.metadata.UsernamePasswordMetadata;
import org.springframework.util.MimeTypeUtils;
@SpringBootTest(properties = "spring.rsocket.server.port=0")
public class SampleRSocketApplicationTests {
@ -49,9 +51,9 @@ public class SampleRSocketApplicationTests {
@Test
void rSocketEndpoint() {
RSocketRequester requester = this.builder
.rsocketStrategies((builder) -> builder.encoder(new BasicAuthenticationEncoder()))
.rsocketStrategies((builder) -> builder.encoder(new SimpleAuthenticationEncoder()))
.setupMetadata(new UsernamePasswordMetadata("user", "password"),
UsernamePasswordMetadata.BASIC_AUTHENTICATION_MIME_TYPE)
MimeTypeUtils.parseMimeType(WellKnownMimeType.MESSAGE_RSOCKET_AUTHENTICATION.getString()))
.connectTcp("localhost", this.port).block(Duration.ofSeconds(5));
Mono<Project> result = requester.route("find.project.spring-boot").retrieveMono(Project.class);
StepVerifier.create(result)

Loading…
Cancel
Save