Use write aggregator from DataBufferUtils
This commit uses the newly introduced write aggregator from DataBufferUtils throughout WebFlux. Issue: SPR-16351
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -26,6 +26,7 @@ import reactor.test.StepVerifier;
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.DataBufferUtils;
|
||||
import org.springframework.core.io.buffer.DefaultDataBufferFactory;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -38,9 +39,7 @@ import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.springframework.core.ResolvableType.forClassWithGenerics;
|
||||
import static org.springframework.http.HttpHeaders.CONTENT_LENGTH;
|
||||
import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
|
||||
@@ -90,7 +89,7 @@ public class SynchronossPartHttpMessageReaderTests {
|
||||
assertTrue(part instanceof FilePart);
|
||||
assertEquals("fooPart", part.name());
|
||||
assertEquals("foo.txt", ((FilePart) part).filename());
|
||||
DataBuffer buffer = part.content().reduce(DataBuffer::write).block();
|
||||
DataBuffer buffer = part.content().reduce(DataBufferUtils.writeAggregator()).block();
|
||||
assertEquals(12, buffer.readableByteCount());
|
||||
byte[] byteContent = new byte[12];
|
||||
buffer.read(byteContent);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -23,6 +23,7 @@ import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.DataBufferUtils;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -104,7 +105,7 @@ public class MultipartIntegrationTests extends AbstractHttpHandlerIntegrationTes
|
||||
assertEquals("foo.txt", ((FilePart) part).filename());
|
||||
DataBuffer buffer = part
|
||||
.content()
|
||||
.reduce(DataBuffer::write)
|
||||
.reduce(DataBufferUtils.writeAggregator())
|
||||
.block();
|
||||
assertEquals(12, buffer.readableByteCount());
|
||||
byte[] byteContent = new byte[12];
|
||||
|
||||
Reference in New Issue
Block a user