Finish to cleanup Reactor Buffer usages
We use it only for Reactor Net support now.
This commit is contained in:
@@ -23,7 +23,6 @@ import java.util.stream.StreamSupport;
|
||||
import org.junit.Test;
|
||||
import org.reactivestreams.Publisher;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.io.buffer.Buffer;
|
||||
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.stream.StreamSupport;
|
||||
|
||||
import org.junit.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.io.buffer.Buffer;
|
||||
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.stream.StreamSupport;
|
||||
|
||||
import org.junit.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.io.buffer.Buffer;
|
||||
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.junit.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.core.converter.RxJava1SingleConverter;
|
||||
import reactor.io.buffer.Buffer;
|
||||
import rx.Single;
|
||||
|
||||
import org.springframework.core.ResolvableType;
|
||||
|
||||
@@ -28,7 +28,6 @@ import reactor.core.publisher.Mono;
|
||||
import reactor.core.publisher.ProcessorGroup;
|
||||
import reactor.core.publisher.Processors;
|
||||
import reactor.core.timer.Timers;
|
||||
import reactor.io.buffer.Buffer;
|
||||
import reactor.rx.Stream;
|
||||
|
||||
import org.springframework.core.io.buffer.DataBufferAllocator;
|
||||
@@ -98,7 +97,7 @@ public class AsyncIntegrationTests {
|
||||
public void basicTest() throws Exception {
|
||||
URI url = new URI("http://localhost:" + port);
|
||||
ResponseEntity<String> response = new RestTemplate().exchange(RequestEntity.get(url)
|
||||
.build(), String.class);
|
||||
.build(), String.class);
|
||||
|
||||
assertThat(response.getBody(), Matchers.equalTo("hello"));
|
||||
}
|
||||
@@ -107,14 +106,13 @@ public class AsyncIntegrationTests {
|
||||
|
||||
@Override
|
||||
public Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response) {
|
||||
DataBufferAllocator allocator = new DefaultDataBufferAllocator();
|
||||
return response.setBody(Stream.just("h", "e", "l", "l", "o")
|
||||
.timer(Timers.global())
|
||||
.throttleRequest(100)
|
||||
.dispatchOn(asyncGroup)
|
||||
.collect(Buffer::new, Buffer::append)
|
||||
.doOnSuccess(Buffer::flip)
|
||||
.map((bytes) -> allocator.wrap(bytes.byteBuffer()))
|
||||
);
|
||||
.collect(allocator::allocateBuffer,
|
||||
(buffer, str) -> buffer.write(str.getBytes())));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.io.buffer.Buffer;
|
||||
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.DefaultDataBufferAllocator;
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.Map;
|
||||
import org.junit.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.io.buffer.Buffer;
|
||||
|
||||
import org.springframework.context.support.StaticApplicationContext;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.junit.Test;
|
||||
import org.reactivestreams.Publisher;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.io.buffer.Buffer;
|
||||
import reactor.rx.Promise;
|
||||
import reactor.rx.Stream;
|
||||
import rx.Observable;
|
||||
@@ -443,12 +442,12 @@ public class RequestMappingIntegrationTests extends AbstractHttpHandlerIntegrati
|
||||
|
||||
@RequestMapping("/raw-flux")
|
||||
public Flux<ByteBuffer> rawFluxResponseBody() {
|
||||
return Flux.just(Buffer.wrap("Hello!").byteBuffer());
|
||||
return Flux.just(ByteBuffer.wrap("Hello!".getBytes()));
|
||||
}
|
||||
|
||||
@RequestMapping("/raw-observable")
|
||||
public Observable<ByteBuffer> rawObservableResponseBody() {
|
||||
return Observable.just(Buffer.wrap("Hello!").byteBuffer());
|
||||
return Observable.just(ByteBuffer.wrap("Hello!".getBytes()));
|
||||
}
|
||||
|
||||
@RequestMapping("/mono")
|
||||
|
||||
Reference in New Issue
Block a user