use of com.hotels.styx.api.HttpResponse in project styx by ExpediaGroup.
the class OriginsCommandHandlerTest method returnsProperErrorMessageForBadCommand.
@Test
public void returnsProperErrorMessageForBadCommand() {
HttpResponse response = post("/admin/tasks/origins?cmd=foo&appId=foo&originId=bar");
assertThat(response.status(), is(BAD_REQUEST));
assertThat(response.bodyAs(UTF_8), is("cmd, appId and originId are all required parameters. cmd can be enable_origin|disable_origin"));
}
use of com.hotels.styx.api.HttpResponse in project styx by ExpediaGroup.
the class OriginsCommandHandlerTest method returnsProperErrorMessageForMissingAppId.
@Test
public void returnsProperErrorMessageForMissingAppId() {
HttpResponse response = post("/admin/tasks/origins?cmd=enable_origin&originId=bar");
assertThat(response.status(), is(BAD_REQUEST));
assertThat(response.bodyAs(UTF_8), is("cmd, appId and originId are all required parameters. cmd can be enable_origin|disable_origin"));
}
use of com.hotels.styx.api.HttpResponse in project styx by ExpediaGroup.
the class OriginsInventoryHandlerTest method returnsEmptyObjectWhenNoOrigins.
@Test
public void returnsEmptyObjectWhenNoOrigins() {
OriginsInventoryHandler handler = new OriginsInventoryHandler(new EventBus());
HttpResponse response = Mono.from(handler.handle(get("/").build(), requestContext())).block();
assertThat(response.bodyAs(UTF_8), is("{}"));
}
use of com.hotels.styx.api.HttpResponse in project styx by ExpediaGroup.
the class PluginListHandlerTest method showsLoadedPlugins.
@Test
public void showsLoadedPlugins() {
NamedPlugin one = namedPlugin("one", PASS_THROUGH);
NamedPlugin two = namedPlugin("two", PASS_THROUGH);
List<NamedPlugin> plugins = asList(one, two);
PluginListHandler handler = new PluginListHandler(plugins);
HttpResponse response = Mono.from(handler.handle(get("/").build(), requestContext())).block();
assertThat(response.status(), is(OK));
assertThat(response.bodyAs(UTF_8), is("" + "<h3>Loaded</h3>" + "<a href='/admin/plugins/one'>one</a><br />" + "<a href='/admin/plugins/two'>two</a><br />"));
}
use of com.hotels.styx.api.HttpResponse in project styx by ExpediaGroup.
the class PluginListHandlerTest method showsEnabledAndDisabledPlugins.
@Test
public void showsEnabledAndDisabledPlugins() {
NamedPlugin one = namedPlugin("one", PASS_THROUGH);
NamedPlugin two = namedPlugin("two", PASS_THROUGH);
NamedPlugin three = namedPlugin("three", PASS_THROUGH);
NamedPlugin four = namedPlugin("four", PASS_THROUGH);
two.setEnabled(false);
three.setEnabled(false);
List<NamedPlugin> plugins = asList(one, two, three, four);
PluginListHandler handler = new PluginListHandler(plugins);
HttpResponse response = Mono.from(handler.handle(get("/").build(), requestContext())).block();
assertThat(response.status(), is(OK));
assertThat(response.bodyAs(UTF_8), is("" + "<h3>Enabled</h3>" + "<a href='/admin/plugins/one'>one</a><br />" + "<a href='/admin/plugins/four'>four</a><br />" + "<h3>Disabled</h3>" + "<a href='/admin/plugins/two'>two</a><br />" + "<a href='/admin/plugins/three'>three</a><br />"));
}
Aggregations