Require RSocket 1.0+
This commit removes usage of methods and classes that were previously deprecated in RSocket and Spring Framework and have been removed. Closes gh-22764
This commit is contained in:
@@ -59,9 +59,6 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur
|
||||
|
||||
private Duration lifecycleTimeout;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private List<org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> socketFactoryProcessors = new ArrayList<>();
|
||||
|
||||
private List<RSocketServerCustomizer> rSocketServerCustomizers = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
@@ -87,37 +84,6 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur
|
||||
this.resourceFactory = resourceFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set {@link org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor}s
|
||||
* that should be called to process the
|
||||
* {@link io.rsocket.RSocketFactory.ServerRSocketFactory} while building the server.
|
||||
* Calling this method will replace any existing processors.
|
||||
* @param socketFactoryProcessors processors to apply before the server starts
|
||||
* @deprecated in favor of {@link #setRSocketServerCustomizers(Collection)} as of
|
||||
* 2.2.7
|
||||
*/
|
||||
@Deprecated
|
||||
public void setSocketFactoryProcessors(
|
||||
Collection<? extends org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor> socketFactoryProcessors) {
|
||||
Assert.notNull(socketFactoryProcessors, "SocketFactoryProcessors must not be null");
|
||||
this.socketFactoryProcessors = new ArrayList<>(socketFactoryProcessors);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add {@link org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor}s
|
||||
* that should be called to process the
|
||||
* {@link io.rsocket.RSocketFactory.ServerRSocketFactory} while building the server.
|
||||
* @param socketFactoryProcessors processors to apply before the server starts
|
||||
* @deprecated in favor of
|
||||
* {@link #addRSocketServerCustomizers(RSocketServerCustomizer...)} as of 2.2.7
|
||||
*/
|
||||
@Deprecated
|
||||
public void addSocketFactoryProcessors(
|
||||
org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor... socketFactoryProcessors) {
|
||||
Assert.notNull(socketFactoryProcessors, "SocketFactoryProcessors must not be null");
|
||||
this.socketFactoryProcessors.addAll(Arrays.asList(socketFactoryProcessors));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set {@link RSocketServerCustomizer}s that should be called to configure the
|
||||
* {@link io.rsocket.core.RSocketServer} while building the server. Calling this
|
||||
@@ -151,14 +117,10 @@ public class NettyRSocketServerFactory implements RSocketServerFactory, Configur
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public NettyRSocketServer create(SocketAcceptor socketAcceptor) {
|
||||
ServerTransport<CloseableChannel> transport = createTransport();
|
||||
io.rsocket.core.RSocketServer server = io.rsocket.core.RSocketServer.create(socketAcceptor);
|
||||
io.rsocket.RSocketFactory.ServerRSocketFactory factory = new io.rsocket.RSocketFactory.ServerRSocketFactory(
|
||||
server);
|
||||
this.rSocketServerCustomizers.forEach((customizer) -> customizer.customize(server));
|
||||
this.socketFactoryProcessors.forEach((processor) -> processor.process(factory));
|
||||
Mono<CloseableChannel> starter = server.bind(transport);
|
||||
return new NettyRSocketServer(starter, this.lifecycleTimeout);
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.rsocket.server;
|
||||
|
||||
/**
|
||||
* Processor that allows for custom modification of a
|
||||
* {@link io.rsocket.RSocketFactory.ServerRSocketFactory
|
||||
* RSocketFactory.ServerRSocketFactory} before it is used.
|
||||
*
|
||||
* @author Brian Clozel
|
||||
* @see RSocketServerFactory
|
||||
* @since 2.2.0
|
||||
* @deprecated in favor of {@link RSocketServerCustomizer} as of 2.2.7
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@Deprecated
|
||||
public interface ServerRSocketFactoryProcessor {
|
||||
|
||||
/**
|
||||
* Apply this {@code ServerRSocketFactoryProcessor} to the given factory instance
|
||||
* before it's used.
|
||||
* @param factory the factory to process
|
||||
* @return the processed factory instance
|
||||
*/
|
||||
io.rsocket.RSocketFactory.ServerRSocketFactory process(io.rsocket.RSocketFactory.ServerRSocketFactory factory);
|
||||
|
||||
}
|
||||
@@ -46,7 +46,6 @@ import org.springframework.util.SocketUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.will;
|
||||
import static org.mockito.Mockito.inOrder;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -128,24 +127,6 @@ class NettyRSocketServerFactoryTests {
|
||||
assertThat(response).isEqualTo(payload);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Deprecated
|
||||
void serverProcessors() {
|
||||
NettyRSocketServerFactory factory = getFactory();
|
||||
org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor[] processors = new org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor[2];
|
||||
for (int i = 0; i < processors.length; i++) {
|
||||
processors[i] = mock(org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor.class);
|
||||
given(processors[i].process(any(io.rsocket.RSocketFactory.ServerRSocketFactory.class)))
|
||||
.will((invocation) -> invocation.getArgument(0));
|
||||
}
|
||||
factory.setSocketFactoryProcessors(Arrays.asList(processors));
|
||||
this.server = factory.create(new EchoRequestResponseAcceptor());
|
||||
InOrder ordered = inOrder((Object[]) processors);
|
||||
for (org.springframework.boot.rsocket.server.ServerRSocketFactoryProcessor processor : processors) {
|
||||
ordered.verify(processor).process(any(io.rsocket.RSocketFactory.ServerRSocketFactory.class));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void serverCustomizers() {
|
||||
NettyRSocketServerFactory factory = getFactory();
|
||||
|
||||
Reference in New Issue
Block a user