use of com.hotels.styx.api.HttpRequest in project styx by ExpediaGroup.
the class ServiceProviderHandlerTest method returnsNamedProvider.
@Test
public void returnsNamedProvider() throws IOException {
StyxObjectStore<StyxObjectRecord<StyxService>> store = createTestStore();
ServiceProviderHandler handler = new ServiceProviderHandler(store);
HttpRequest request = HttpRequest.get("/admin/service/provider/object2").build();
HttpResponse response = Mono.from(handler.handle(request, requestContext())).block();
assertThat(response.status(), equalTo(OK));
StyxObjectDefinition actualProvider = deserialiseProvider(response.bodyAs(UTF_8));
assertThat(actualProvider, notNullValue());
assertThat(actualProvider.name(), equalTo("object2"));
validateProvider(actualProvider, store.get("object2").get());
}
use of com.hotels.styx.api.HttpRequest in project styx by ExpediaGroup.
the class HttpMethodFilteringHandlerTest method delegatesTheRequestIfRequestMethodIsSupported.
@Test
public void delegatesTheRequestIfRequestMethodIsSupported() {
WebServiceHandler handler = mock(WebServiceHandler.class);
HttpMethodFilteringHandler post = new HttpMethodFilteringHandler(POST, handler);
HttpRequest request = post("/some-uri").build();
post.handle(request, mock(HttpInterceptor.Context.class));
verify(handler).handle(eq(request), any(HttpInterceptor.Context.class));
}
Aggregations