HandlerAdapter is asynchronous again

This commit is contained in:
Rossen Stoyanchev
2015-10-30 15:02:54 -04:00
parent 01ae961820
commit 6b73993a38
6 changed files with 40 additions and 23 deletions

View File

@@ -26,6 +26,7 @@ import org.reactivestreams.Publisher;
import reactor.io.buffer.Buffer;
import reactor.rx.Streams;
import org.springframework.http.HttpStatus;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.http.server.ReactiveServerHttpRequest;
@@ -38,6 +39,7 @@ import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.support.StaticWebApplicationContext;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
/**
@@ -71,6 +73,7 @@ public class SimpleUrlHandlerMappingIntegrationTests extends AbstractHttpHandler
RequestEntity<Void> request = RequestEntity.get(url).build();
ResponseEntity<byte[]> response = restTemplate.exchange(request, byte[].class);
assertEquals(HttpStatus.OK, response.getStatusCode());
assertArrayEquals("foo".getBytes(UTF_8), response.getBody());
}
@@ -83,6 +86,7 @@ public class SimpleUrlHandlerMappingIntegrationTests extends AbstractHttpHandler
RequestEntity<Void> request = RequestEntity.get(url).build();
ResponseEntity<byte[]> response = restTemplate.exchange(request, byte[].class);
assertEquals(HttpStatus.OK, response.getStatusCode());
assertArrayEquals("bar".getBytes(UTF_8), response.getBody());
}

View File

@@ -52,14 +52,14 @@ public class RequestMappingHandlerMappingTests {
}
@Test
public void path() throws NoSuchMethodException {
public void path() throws Exception {
ReactiveServerHttpRequest request = new MockServerHttpRequest(HttpMethod.GET, "boo");
HandlerMethod handler = (HandlerMethod) this.mapping.getHandler(request);
assertEquals(TestController.class.getMethod("boo"), handler.getMethod());
}
@Test
public void method() throws NoSuchMethodException {
public void method() throws Exception {
ReactiveServerHttpRequest request = new MockServerHttpRequest(HttpMethod.POST, "foo");
HandlerMethod handler = (HandlerMethod) this.mapping.getHandler(request);
assertEquals(TestController.class.getMethod("postFoo"), handler.getMethod());