Fix RxNetty tests by finding a new port for each test
This commit is contained in:
parent
6da7453517
commit
77c5b3fd65
|
@ -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<Person> persons = Arrays.asList(new Person("Robert"), new Person("Marie"));
|
||||
RequestEntity<List<Person>> 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 Observable<Person> capitalize(@RequestBody Observable<Person> persons) {
|
||||
public Publisher<Person> publisherCapitalize(@RequestBody Publisher<Person> persons) {
|
||||
return Streams.wrap(persons).map(person -> {
|
||||
person.setName(person.getName().toUpperCase());
|
||||
return person;
|
||||
});
|
||||
}
|
||||
|
||||
@RequestMapping("/observable-capitalize")
|
||||
@ResponseBody
|
||||
public Observable<Person> observableCapitalize(@RequestBody Observable<Person> persons) {
|
||||
return persons.map(person -> {
|
||||
person.setName(person.getName().toUpperCase());
|
||||
return person;
|
||||
});
|
||||
}
|
||||
|
||||
@RequestMapping("/stream-capitalize")
|
||||
@ResponseBody
|
||||
public Stream<Person> streamCapitalize(@RequestBody Stream<Person> persons) {
|
||||
return persons.map(person -> {
|
||||
person.setName(person.getName().toUpperCase());
|
||||
return person;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -44,7 +44,6 @@ public class EchoHandlerIntegrationTests extends AbstractHttpHandlerIntegrationT
|
|||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void echoBytes() throws Exception {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
|
|
Loading…
Reference in New Issue