From 4d3dd9b9f6fafca0af4d17051b7c211465fe1f2e Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 11 Aug 2020 17:10:52 +0200 Subject: [PATCH] Clean up warnings in Gradle build --- ...ttpInvokerFactoryBeanIntegrationTests.java | 32 ++++++++++--------- .../annotation/SseIntegrationTests.java | 5 +-- .../socket/WebSocketIntegrationTests.java | 9 +++--- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpInvokerFactoryBeanIntegrationTests.java b/spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpInvokerFactoryBeanIntegrationTests.java index 62844ab6a65..a53d1e2e387 100644 --- a/spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpInvokerFactoryBeanIntegrationTests.java +++ b/spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpInvokerFactoryBeanIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-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. @@ -38,11 +38,11 @@ import static org.assertj.core.api.Assertions.assertThat; /** * @author Stephane Nicoll */ -public class HttpInvokerFactoryBeanIntegrationTests { +class HttpInvokerFactoryBeanIntegrationTests { @Test @SuppressWarnings("resource") - public void testLoadedConfigClass() { + void testLoadedConfigClass() { ApplicationContext context = new AnnotationConfigApplicationContext(InvokerAutowiringConfig.class); MyBean myBean = context.getBean("myBean", MyBean.class); assertThat(myBean.myService).isSameAs(context.getBean("myService")); @@ -52,7 +52,7 @@ public class HttpInvokerFactoryBeanIntegrationTests { @Test @SuppressWarnings("resource") - public void testNonLoadedConfigClass() { + void testNonLoadedConfigClass() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.registerBeanDefinition("config", new RootBeanDefinition(InvokerAutowiringConfig.class.getName())); context.refresh(); @@ -64,7 +64,7 @@ public class HttpInvokerFactoryBeanIntegrationTests { @Test @SuppressWarnings("resource") - public void withConfigurationClassWithPlainFactoryBean() { + void withConfigurationClassWithPlainFactoryBean() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(ConfigWithPlainFactoryBean.class); context.refresh(); @@ -75,9 +75,9 @@ public class HttpInvokerFactoryBeanIntegrationTests { } - public interface MyService { + interface MyService { - public void handle(); + void handle(); @Async public void handleAsync(); @@ -85,25 +85,26 @@ public class HttpInvokerFactoryBeanIntegrationTests { @Component("myBean") - public static class MyBean { + static class MyBean { @Autowired - public MyService myService; + MyService myService; } @Configuration @ComponentScan @Lazy - public static class InvokerAutowiringConfig { + static class InvokerAutowiringConfig { @Bean - public AsyncAnnotationBeanPostProcessor aabpp() { + AsyncAnnotationBeanPostProcessor aabpp() { return new AsyncAnnotationBeanPostProcessor(); } @Bean - public HttpInvokerProxyFactoryBean myService() { + @SuppressWarnings("deprecation") + HttpInvokerProxyFactoryBean myService() { HttpInvokerProxyFactoryBean factory = new HttpInvokerProxyFactoryBean(); factory.setServiceUrl("/svc/dummy"); factory.setServiceInterface(MyService.class); @@ -112,7 +113,7 @@ public class HttpInvokerFactoryBeanIntegrationTests { } @Bean - public FactoryBean myOtherService() { + FactoryBean myOtherService() { throw new IllegalStateException("Don't ever call me"); } } @@ -125,12 +126,13 @@ public class HttpInvokerFactoryBeanIntegrationTests { Environment env; @Bean - public MyBean myBean() { + MyBean myBean() { return new MyBean(); } @Bean - public HttpInvokerProxyFactoryBean myService() { + @SuppressWarnings("deprecation") + HttpInvokerProxyFactoryBean myService() { String name = env.getProperty("testbean.name"); HttpInvokerProxyFactoryBean factory = new HttpInvokerProxyFactoryBean(); factory.setServiceUrl("/svc/" + name); diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java index 6344b86c874..17f0eaec37c 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-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. @@ -27,6 +27,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.core.publisher.Flux; import reactor.core.publisher.MonoProcessor; +import reactor.core.publisher.Sinks; import reactor.test.StepVerifier; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -223,7 +224,7 @@ class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests { private static final Flux INTERVAL = testInterval(Duration.ofMillis(100), 50); - private MonoProcessor cancellation = MonoProcessor.create(); + private MonoProcessor cancellation = MonoProcessor.fromSink(Sinks.one()); @GetMapping("/string") diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/socket/WebSocketIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/socket/WebSocketIntegrationTests.java index 64b3d70e57b..656d9081f78 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/socket/WebSocketIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/socket/WebSocketIntegrationTests.java @@ -28,6 +28,7 @@ import org.apache.commons.logging.LogFactory; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.publisher.MonoProcessor; +import reactor.core.publisher.Sinks; import reactor.util.retry.Retry; import org.springframework.context.annotation.Bean; @@ -98,7 +99,7 @@ class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests { String protocol = "echo-v1"; AtomicReference infoRef = new AtomicReference<>(); - MonoProcessor output = MonoProcessor.create(); + MonoProcessor output = MonoProcessor.fromSink(Sinks.one()); this.client.execute(getUrl("/sub-protocol"), new WebSocketHandler() { @@ -131,7 +132,7 @@ class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests { HttpHeaders headers = new HttpHeaders(); headers.add("my-header", "my-value"); - MonoProcessor output = MonoProcessor.create(); + MonoProcessor output = MonoProcessor.fromSink(Sinks.one()); this.client.execute(getUrl("/custom-header"), headers, session -> session.receive() @@ -147,7 +148,7 @@ class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests { void sessionClosing(WebSocketClient client, HttpServer server, Class serverConfigClass) throws Exception { startServer(client, server, serverConfigClass); - MonoProcessor statusProcessor = MonoProcessor.create(); + MonoProcessor statusProcessor = MonoProcessor.fromSink(Sinks.one()); this.client.execute(getUrl("/close"), session -> { logger.debug("Starting.."); @@ -168,7 +169,7 @@ class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests { void cookie(WebSocketClient client, HttpServer server, Class serverConfigClass) throws Exception { startServer(client, server, serverConfigClass); - MonoProcessor output = MonoProcessor.create(); + MonoProcessor output = MonoProcessor.fromSink(Sinks.one()); AtomicReference cookie = new AtomicReference<>(); this.client.execute(getUrl("/cookie"), session -> {