Finish to cleanup Reactor Buffer usages

We use it only for Reactor Net support now.
This commit is contained in:
Sebastien Deleuze
2016-01-27 16:58:59 +01:00
parent 1c7d845245
commit 506c4bc27b
8 changed files with 6 additions and 15 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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())));
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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")