use of com.hotels.styx.StyxObjectRecord in project styx by ExpediaGroup.
the class ServiceProviderHandlerTest method returnsNoContentStatusWhenNoProvidersAvailable.
@Test
public void returnsNoContentStatusWhenNoProvidersAvailable() {
StyxObjectStore<StyxObjectRecord<StyxService>> empty = new StyxObjectStore<>();
ServiceProviderHandler handler = new ServiceProviderHandler(empty);
HttpRequest request = HttpRequest.get("/admin/service/providers").build();
HttpResponse response = Mono.from(handler.handle(request, requestContext())).block();
assertThat(response.status(), equalTo(NO_CONTENT));
assertFalse(response.contentLength().isPresent());
}
use of com.hotels.styx.StyxObjectRecord 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());
}
Aggregations