diff --git a/spring-web-reactive/src/test/java/org/springframework/reactive/web/dispatch/method/annotation/RequestMappingIntegrationTests.java b/spring-web-reactive/src/test/java/org/springframework/reactive/web/dispatch/method/annotation/RequestMappingIntegrationTests.java index 00f5c8a698a..98c8fcd39a0 100644 --- a/spring-web-reactive/src/test/java/org/springframework/reactive/web/dispatch/method/annotation/RequestMappingIntegrationTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/reactive/web/dispatch/method/annotation/RequestMappingIntegrationTests.java @@ -150,10 +150,25 @@ public class RequestMappingIntegrationTests extends AbstractHttpHandlerIntegrati } @Test - public void capitalize() throws Exception { + public void publisherCapitalize() throws Exception { + capitalize("http://localhost:" + port + "/publisher-capitalize"); + } + + @Test + public void observableCapitalize() throws Exception { + capitalize("http://localhost:" + port + "/observable-capitalize"); + } + + @Test + public void streamCapitalize() throws Exception { + capitalize("http://localhost:" + port + "/stream-capitalize"); + } + + + public void capitalize(String requestUrl) throws Exception { RestTemplate restTemplate = new RestTemplate(); - URI url = new URI("http://localhost:" + port + "/capitalize"); + URI url = new URI(requestUrl); List persons = Arrays.asList(new Person("Robert"), new Person("Marie")); RequestEntity> request = RequestEntity .post(url) @@ -208,9 +223,27 @@ public class RequestMappingIntegrationTests extends AbstractHttpHandlerIntegrati return Streams.just(new Person("Robert"), new Person("Marie")); } - @RequestMapping("/capitalize") + @RequestMapping("/publisher-capitalize") + @ResponseBody + public Publisher publisherCapitalize(@RequestBody Publisher persons) { + return Streams.wrap(persons).map(person -> { + person.setName(person.getName().toUpperCase()); + return person; + }); + } + + @RequestMapping("/observable-capitalize") + @ResponseBody + public Observable observableCapitalize(@RequestBody Observable persons) { + return persons.map(person -> { + person.setName(person.getName().toUpperCase()); + return person; + }); + } + + @RequestMapping("/stream-capitalize") @ResponseBody - public Observable capitalize(@RequestBody Observable persons) { + public Stream streamCapitalize(@RequestBody Stream persons) { return persons.map(person -> { person.setName(person.getName().toUpperCase()); return person; diff --git a/spring-web-reactive/src/test/java/org/springframework/reactive/web/http/AbstractHttpHandlerIntegrationTests.java b/spring-web-reactive/src/test/java/org/springframework/reactive/web/http/AbstractHttpHandlerIntegrationTests.java index 76512ed0c64..240c0ff82b1 100644 --- a/spring-web-reactive/src/test/java/org/springframework/reactive/web/http/AbstractHttpHandlerIntegrationTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/reactive/web/http/AbstractHttpHandlerIntegrationTests.java @@ -27,7 +27,7 @@ import org.springframework.util.SocketUtils; @RunWith(Parameterized.class) public abstract class AbstractHttpHandlerIntegrationTests { - protected static int port = SocketUtils.findAvailableTcpPort(); + protected int port; @Parameterized.Parameter(0) public HttpServer server; @@ -45,7 +45,8 @@ public abstract class AbstractHttpHandlerIntegrationTests { @Before public void setup() throws Exception { - this.server.setPort(port); + this.port = SocketUtils.findAvailableTcpPort(); + this.server.setPort(this.port); this.server.setHandler(createHttpHandler()); this.server.afterPropertiesSet(); this.server.start(); diff --git a/spring-web-reactive/src/test/java/org/springframework/reactive/web/http/EchoHandlerIntegrationTests.java b/spring-web-reactive/src/test/java/org/springframework/reactive/web/http/EchoHandlerIntegrationTests.java index 2011b613f55..e834ae3166e 100644 --- a/spring-web-reactive/src/test/java/org/springframework/reactive/web/http/EchoHandlerIntegrationTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/reactive/web/http/EchoHandlerIntegrationTests.java @@ -44,7 +44,6 @@ public class EchoHandlerIntegrationTests extends AbstractHttpHandlerIntegrationT @Test - @Ignore public void echoBytes() throws Exception { RestTemplate restTemplate = new RestTemplate();