Polishing
This commit is contained in:
@@ -125,7 +125,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "deprecation", "removal" })
|
||||
@SuppressWarnings("removal")
|
||||
void submitListenableRunnable() {
|
||||
TestTask task = new TestTask(this.testName, 1);
|
||||
// Act
|
||||
@@ -156,7 +156,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "deprecation", "removal" })
|
||||
@SuppressWarnings("removal")
|
||||
void submitFailingListenableRunnable() {
|
||||
TestTask task = new TestTask(this.testName, 0);
|
||||
org.springframework.util.concurrent.ListenableFuture<?> future = executor.submitListenable(task);
|
||||
@@ -185,7 +185,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "deprecation", "removal" })
|
||||
@SuppressWarnings("removal")
|
||||
void submitListenableRunnableWithGetAfterShutdown() throws Exception {
|
||||
org.springframework.util.concurrent.ListenableFuture<?> future1 = executor.submitListenable(new TestTask(this.testName, -1));
|
||||
org.springframework.util.concurrent.ListenableFuture<?> future2 = executor.submitListenable(new TestTask(this.testName, -1));
|
||||
@@ -209,18 +209,10 @@ abstract class AbstractSchedulingTaskExecutorTests {
|
||||
CompletableFuture<?> future1 = executor.submitCompletable(new TestTask(this.testName, -1));
|
||||
CompletableFuture<?> future2 = executor.submitCompletable(new TestTask(this.testName, -1));
|
||||
shutdownExecutor();
|
||||
|
||||
try {
|
||||
assertThatExceptionOfType(TimeoutException.class).isThrownBy(() -> {
|
||||
future1.get(1000, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
// ignore
|
||||
}
|
||||
Awaitility.await()
|
||||
.atMost(5, TimeUnit.SECONDS)
|
||||
.pollInterval(10, TimeUnit.MILLISECONDS)
|
||||
.untilAsserted(() -> assertThatExceptionOfType(TimeoutException.class)
|
||||
.isThrownBy(() -> future2.get(1000, TimeUnit.MILLISECONDS)));
|
||||
future2.get(1000, TimeUnit.MILLISECONDS);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -260,7 +252,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "deprecation", "removal" })
|
||||
@SuppressWarnings("removal")
|
||||
void submitListenableCallable() {
|
||||
TestCallable task = new TestCallable(this.testName, 1);
|
||||
// Act
|
||||
@@ -275,7 +267,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "deprecation", "removal" })
|
||||
@SuppressWarnings("removal")
|
||||
void submitFailingListenableCallable() {
|
||||
TestCallable task = new TestCallable(this.testName, 0);
|
||||
// Act
|
||||
@@ -291,7 +283,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "deprecation", "removal" })
|
||||
@SuppressWarnings("removal")
|
||||
void submitListenableCallableWithGetAfterShutdown() throws Exception {
|
||||
org.springframework.util.concurrent.ListenableFuture<?> future1 = executor.submitListenable(new TestCallable(this.testName, -1));
|
||||
org.springframework.util.concurrent.ListenableFuture<?> future2 = executor.submitListenable(new TestCallable(this.testName, -1));
|
||||
|
||||
@@ -182,10 +182,10 @@ public class SqlScriptsTestExecutionListener extends AbstractTestExecutionListen
|
||||
@Override
|
||||
public void processAheadOfTime(RuntimeHints runtimeHints, Class<?> testClass, ClassLoader classLoader) {
|
||||
getSqlAnnotationsFor(testClass).forEach(sql ->
|
||||
registerClasspathResources(getScripts(sql, testClass, null, true), runtimeHints, classLoader));
|
||||
registerClasspathResources(getScripts(sql, testClass, null, true), runtimeHints, classLoader));
|
||||
getSqlMethods(testClass).forEach(testMethod ->
|
||||
getSqlAnnotationsFor(testMethod).forEach(sql ->
|
||||
registerClasspathResources(getScripts(sql, testClass, testMethod, false), runtimeHints, classLoader)));
|
||||
getSqlAnnotationsFor(testMethod).forEach(sql ->
|
||||
registerClasspathResources(getScripts(sql, testClass, testMethod, false), runtimeHints, classLoader)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -871,7 +871,7 @@ public class MediaType extends MimeType implements Serializable {
|
||||
* <blockquote>audio/basic == text/html</blockquote>
|
||||
* <blockquote>audio/basic == audio/wave</blockquote>
|
||||
* @param mediaTypes the list of media types to be sorted
|
||||
* @deprecated As of 6.0, in favor of {@link MimeTypeUtils#sortBySpecificity(List)}
|
||||
* @deprecated as of 6.0, in favor of {@link MimeTypeUtils#sortBySpecificity(List)}
|
||||
*/
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
public static void sortBySpecificity(List<MediaType> mediaTypes) {
|
||||
@@ -900,7 +900,7 @@ public class MediaType extends MimeType implements Serializable {
|
||||
* </ol>
|
||||
* @param mediaTypes the list of media types to be sorted
|
||||
* @see #getQualityValue()
|
||||
* @deprecated As of 6.0, with no direct replacement
|
||||
* @deprecated as of 6.0, with no direct replacement
|
||||
*/
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
public static void sortByQualityValue(List<MediaType> mediaTypes) {
|
||||
@@ -913,9 +913,9 @@ public class MediaType extends MimeType implements Serializable {
|
||||
/**
|
||||
* Sorts the given list of {@code MediaType} objects by specificity as the
|
||||
* primary criteria and quality value the secondary.
|
||||
* @deprecated As of 6.0, in favor of {@link MimeTypeUtils#sortBySpecificity(List)}
|
||||
* @deprecated as of 6.0, in favor of {@link MimeTypeUtils#sortBySpecificity(List)}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
public static void sortBySpecificityAndQuality(List<MediaType> mediaTypes) {
|
||||
Assert.notNull(mediaTypes, "'mediaTypes' must not be null");
|
||||
if (mediaTypes.size() > 1) {
|
||||
@@ -926,7 +926,7 @@ public class MediaType extends MimeType implements Serializable {
|
||||
|
||||
/**
|
||||
* Comparator used by {@link #sortByQualityValue(List)}.
|
||||
* @deprecated As of 6.0, with no direct replacement
|
||||
* @deprecated as of 6.0, with no direct replacement
|
||||
*/
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
public static final Comparator<MediaType> QUALITY_VALUE_COMPARATOR = (mediaType1, mediaType2) -> {
|
||||
@@ -966,7 +966,7 @@ public class MediaType extends MimeType implements Serializable {
|
||||
|
||||
/**
|
||||
* Comparator used by {@link #sortBySpecificity(List)}.
|
||||
* @deprecated As of 6.0, with no direct replacement
|
||||
* @deprecated as of 6.0, with no direct replacement
|
||||
*/
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
|
||||
@@ -27,8 +27,8 @@ dependencies {
|
||||
optional("org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jetty-server") {
|
||||
exclude group: "jakarta.servlet", module: "jakarta.servlet-api"
|
||||
}
|
||||
optional("org.eclipse.jetty.websocket:jetty-websocket-jetty-server")
|
||||
optional("org.eclipse.jetty.websocket:jetty-websocket-jetty-client")
|
||||
optional("org.eclipse.jetty.websocket:jetty-websocket-jetty-server")
|
||||
optional("org.freemarker:freemarker")
|
||||
optional("org.jetbrains.kotlin:kotlin-reflect")
|
||||
optional("org.jetbrains.kotlin:kotlin-stdlib")
|
||||
|
||||
@@ -49,6 +49,7 @@ public class LiteWebJarsResourceResolver extends AbstractResourceResolver {
|
||||
|
||||
private final WebJarVersionLocator webJarVersionLocator;
|
||||
|
||||
|
||||
/**
|
||||
* Create a {@code LiteWebJarsResourceResolver} with a default {@code WebJarVersionLocator} instance.
|
||||
*/
|
||||
@@ -64,6 +65,7 @@ public class LiteWebJarsResourceResolver extends AbstractResourceResolver {
|
||||
this.webJarVersionLocator = webJarVersionLocator;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Mono<Resource> resolveResourceInternal(@Nullable ServerWebExchange exchange,
|
||||
String requestPath, List<? extends Resource> locations, ResourceResolverChain chain) {
|
||||
|
||||
@@ -46,6 +46,7 @@ final class CompletedAsyncServerResponse implements AsyncServerResponse {
|
||||
this.serverResponse = serverResponse;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ServerResponse block() {
|
||||
return this.serverResponse;
|
||||
@@ -73,11 +74,12 @@ final class CompletedAsyncServerResponse implements AsyncServerResponse {
|
||||
return this.serverResponse.cookies();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@Nullable
|
||||
public ModelAndView writeTo(HttpServletRequest request, HttpServletResponse response, Context context)
|
||||
throws ServletException, IOException {
|
||||
|
||||
return this.serverResponse.writeTo(request, response, context);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ final class DefaultAsyncServerResponse extends ErrorHandlingServerResponse imple
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ServerResponse block() {
|
||||
try {
|
||||
@@ -110,8 +111,8 @@ final class DefaultAsyncServerResponse extends ErrorHandlingServerResponse imple
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@Nullable
|
||||
public ModelAndView writeTo(HttpServletRequest request, HttpServletResponse response, Context context)
|
||||
throws ServletException, IOException {
|
||||
|
||||
@@ -164,4 +165,5 @@ final class DefaultAsyncServerResponse extends ErrorHandlingServerResponse imple
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ public class LiteWebJarsResourceResolver extends AbstractResourceResolver {
|
||||
|
||||
private final WebJarVersionLocator webJarVersionLocator;
|
||||
|
||||
|
||||
/**
|
||||
* Create a {@code LiteWebJarsResourceResolver} with a default {@code WebJarVersionLocator} instance.
|
||||
*/
|
||||
@@ -64,6 +65,7 @@ public class LiteWebJarsResourceResolver extends AbstractResourceResolver {
|
||||
this.webJarVersionLocator = webJarVersionLocator;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Resource resolveResourceInternal(@Nullable HttpServletRequest request, String requestPath,
|
||||
|
||||
@@ -54,6 +54,7 @@ class DefaultServerResponseBuilderTests {
|
||||
|
||||
static final ServerResponse.Context EMPTY_CONTEXT = Collections::emptyList;
|
||||
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
void status() {
|
||||
@@ -75,7 +76,6 @@ class DefaultServerResponseBuilderTests {
|
||||
assertThat(result.cookies().getFirst("foo")).isEqualTo(cookie);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void ok() {
|
||||
ServerResponse response = ServerResponse.ok().build();
|
||||
|
||||
@@ -16,14 +16,14 @@ dependencies {
|
||||
exclude group: "org.apache.tomcat", module: "tomcat-servlet-api"
|
||||
exclude group: "org.apache.tomcat", module: "tomcat-websocket-api"
|
||||
}
|
||||
optional("org.eclipse.jetty.ee10:jetty-ee10-webapp") {
|
||||
exclude group: "jakarta.servlet", module: "jakarta.servlet-api"
|
||||
}
|
||||
optional("org.eclipse.jetty.websocket:jetty-websocket-jetty-api")
|
||||
optional("org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jakarta-server")
|
||||
optional("org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jetty-server") {
|
||||
exclude group: "jakarta.servlet", module: "jakarta.servlet-api"
|
||||
}
|
||||
optional("org.eclipse.jetty.ee10:jetty-ee10-webapp") {
|
||||
exclude group: "jakarta.servlet", module: "jakarta.servlet-api"
|
||||
}
|
||||
optional("org.eclipse.jetty.websocket:jetty-websocket-jetty-api")
|
||||
optional("org.glassfish.tyrus:tyrus-container-servlet")
|
||||
testImplementation(testFixtures(project(":spring-core")))
|
||||
testImplementation(testFixtures(project(":spring-web")))
|
||||
|
||||
@@ -34,12 +34,10 @@ import org.springframework.web.socket.WebSocketExtension;
|
||||
*/
|
||||
public class StandardToWebSocketExtensionAdapter extends WebSocketExtension {
|
||||
|
||||
|
||||
public StandardToWebSocketExtensionAdapter(Extension extension) {
|
||||
super(extension.getName(), initParameters(extension));
|
||||
}
|
||||
|
||||
|
||||
private static Map<String, String> initParameters(Extension extension) {
|
||||
List<Extension.Parameter> parameters = extension.getParameters();
|
||||
Map<String, String> result = new LinkedCaseInsensitiveMap<>(parameters.size(), Locale.ROOT);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
@@ -55,6 +55,7 @@ public class WebSocketToStandardExtensionAdapter implements Extension {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
|
||||
@@ -262,7 +262,7 @@ public class WebSocketStompClient extends StompClientSupport implements SmartLif
|
||||
|
||||
/**
|
||||
* An overloaded version of
|
||||
* {@link #connect(String, StompSessionHandler, Object...)} that also
|
||||
* {@link #connectAsync(String, StompSessionHandler, Object...)} that also
|
||||
* accepts {@link WebSocketHttpHeaders} to use for the WebSocket handshake.
|
||||
* @param url the url to connect to
|
||||
* @param handshakeHeaders the headers for the WebSocket handshake
|
||||
@@ -283,7 +283,7 @@ public class WebSocketStompClient extends StompClientSupport implements SmartLif
|
||||
|
||||
/**
|
||||
* An overloaded version of
|
||||
* {@link #connect(String, StompSessionHandler, Object...)} that also
|
||||
* {@link #connectAsync(String, StompSessionHandler, Object...)} that also
|
||||
* accepts {@link WebSocketHttpHeaders} to use for the WebSocket handshake.
|
||||
* @param url the url to connect to
|
||||
* @param handshakeHeaders the headers for the WebSocket handshake
|
||||
@@ -300,7 +300,7 @@ public class WebSocketStompClient extends StompClientSupport implements SmartLif
|
||||
|
||||
/**
|
||||
* An overloaded version of
|
||||
* {@link #connect(String, StompSessionHandler, Object...)} that also accepts
|
||||
* {@link #connectAsync(String, StompSessionHandler, Object...)} that also accepts
|
||||
* {@link WebSocketHttpHeaders} to use for the WebSocket handshake and
|
||||
* {@link StompHeaders} for the STOMP CONNECT frame.
|
||||
* @param url the url to connect to
|
||||
@@ -323,7 +323,7 @@ public class WebSocketStompClient extends StompClientSupport implements SmartLif
|
||||
|
||||
/**
|
||||
* An overloaded version of
|
||||
* {@link #connect(String, StompSessionHandler, Object...)} that also accepts
|
||||
* {@link #connectAsync(String, StompSessionHandler, Object...)} that also accepts
|
||||
* {@link WebSocketHttpHeaders} to use for the WebSocket handshake and
|
||||
* {@link StompHeaders} for the STOMP CONNECT frame.
|
||||
* @param url the url to connect to
|
||||
@@ -344,7 +344,7 @@ public class WebSocketStompClient extends StompClientSupport implements SmartLif
|
||||
|
||||
/**
|
||||
* An overloaded version of
|
||||
* {@link #connect(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
|
||||
* {@link #connectAsync(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
|
||||
* that accepts a fully prepared {@link java.net.URI}.
|
||||
* @param url the url to connect to
|
||||
* @param handshakeHeaders the headers for the WebSocket handshake
|
||||
@@ -365,7 +365,7 @@ public class WebSocketStompClient extends StompClientSupport implements SmartLif
|
||||
|
||||
/**
|
||||
* An overloaded version of
|
||||
* {@link #connect(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
|
||||
* {@link #connectAsync(String, WebSocketHttpHeaders, StompSessionHandler, Object...)}
|
||||
* that accepts a fully prepared {@link java.net.URI}.
|
||||
* @param url the url to connect to
|
||||
* @param handshakeHeaders the headers for the WebSocket handshake
|
||||
|
||||
@@ -279,6 +279,7 @@ class DefaultTransportRequest implements TransportRequest {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the given (global) future based success or failure to connect for
|
||||
* the entire SockJS request regardless of which transport actually managed
|
||||
|
||||
@@ -84,7 +84,6 @@ class XhrTransportTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
void connect() {
|
||||
HttpHeaders handshakeHeaders = new HttpHeaders();
|
||||
handshakeHeaders.setOrigin("foo");
|
||||
@@ -96,7 +95,7 @@ class XhrTransportTests {
|
||||
|
||||
TestXhrTransport transport = new TestXhrTransport();
|
||||
WebSocketHandler handler = mock();
|
||||
transport.connect(request, handler);
|
||||
transport.connectAsync(request, handler);
|
||||
|
||||
ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class);
|
||||
verify(request).getSockJsUrlInfo();
|
||||
@@ -127,7 +126,6 @@ class XhrTransportTests {
|
||||
|
||||
private XhrClientSockJsSession actualSession;
|
||||
|
||||
|
||||
@Override
|
||||
protected ResponseEntity<String> executeInfoRequestInternal(URI infoUrl, HttpHeaders headers) {
|
||||
return this.infoResponseToReturn;
|
||||
|
||||
Reference in New Issue
Block a user