@Test public void test_definition() { WebService.Action definition = ws.getDef(); assertThat(definition.key()).isEqualTo("current"); assertThat(definition.description()).isEqualTo("Get the details of the current authenticated user."); assertThat(definition.since()).isEqualTo("5.2"); assertThat(definition.isPost()).isFalse(); assertThat(definition.isInternal()).isTrue(); assertThat(definition.responseExampleAsString()).isNotEmpty(); assertThat(definition.params()).isEmpty(); assertThat(definition.changelog()).hasSize(2); }
@Test public void definition() { WebService.Action def = ws.getDef(); assertThat(def.key()).isEqualTo("marketplace"); assertThat(def.since()).isEqualTo("7.2"); assertThat(def.isPost()).isFalse(); assertThat(def.isInternal()).isTrue(); assertThat(def.description()).isNotEmpty(); assertThat(def.params()).isEmpty(); }
@Test public void verify_definition() { WebService.Action definition = underTest.getDef(); assertThat(definition.key()).isEqualTo("health"); assertThat(definition.isPost()).isFalse(); assertThat(definition.description()).isNotEmpty(); assertThat(definition.since()).isEqualTo("6.6"); assertThat(definition.isInternal()).isFalse(); assertThat(definition.responseExample()).isNotNull(); assertThat(definition.params()).isEmpty(); }
@Test public void definition() { WebService.Action def = ws.getDef(); assertThat(def.description()).isNotEmpty(); assertThat(def.isPost()).isTrue(); assertThat(def.since()).isEqualTo("4.3"); assertThat(def.changelog()).extracting(Change::getVersion, Change::getDescription).containsExactly( tuple("6.6", "The parameter 'gateId' was removed")); assertThat(def.params()) .extracting(WebService.Param::key, WebService.Param::isRequired) .containsExactlyInAnyOrder( tuple("projectKey", false), tuple("projectId", false), tuple("organization", false)); }
@Test public void definition() { userSession.logIn(); Action action = ws.getDef(); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExampleAsString()).isNotEmpty(); assertThat(action.isPost()).isFalse(); assertThat(action.isInternal()).isFalse(); assertThat(action.params()) .extracting(Param::key, Param::defaultValue, Param::since, Param::isRequired, Param::isInternal) .containsExactlyInAnyOrder( tuple("q", null, null, false, false), tuple("ps", "10", null, false, false), tuple("organization", null, "6.4", false, true), tuple("project", null, "7.4", false, false)); }
@Test public void action_available_is_defined() { logInAsSystemAdministrator(); WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); underTest.define(newController); newController.done(); WebService.Controller controller = wsTester.controller(DUMMY_CONTROLLER_KEY); assertThat(controller.actions()).extracting("key").containsExactly("available"); WebService.Action action = controller.actions().iterator().next(); assertThat(action.isPost()).isFalse(); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExample()).isNotNull(); }
@Test public void action_cancel_all_is_defined() { WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); underTest.define(newController); newController.done(); WebService.Controller controller = wsTester.controller(DUMMY_CONTROLLER_KEY); assertThat(controller.actions()).extracting("key").containsExactly("cancel_all"); WebService.Action action = controller.actions().iterator().next(); assertThat(action.isPost()).isTrue(); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExample()).isNull(); assertThat(action.params()).isEmpty(); }
@Test public void action_updates_is_defined() { WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); underTest.define(newController); newController.done(); WebService.Controller controller = wsTester.controller(DUMMY_CONTROLLER_KEY); assertThat(controller.actions()).extracting("key").containsExactly("upgrades"); WebService.Action action = controller.actions().iterator().next(); assertThat(action.isPost()).isFalse(); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExample()).isNotNull(); assertThat(action.params()).isEmpty(); }
@Test public void action_pending_is_defined() { logInAsSystemAdministrator(); WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); underTest.define(newController); newController.done(); WebService.Controller controller = wsTester.controller(DUMMY_CONTROLLER_KEY); assertThat(controller.actions()).extracting("key").containsExactly("pending"); WebService.Action action = controller.actions().iterator().next(); assertThat(action.isPost()).isFalse(); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExample()).isNotNull(); }
@Test public void verify_definition() { WebService.Action action = wsTester.getDef(); assertThat(action.key()).isEqualTo("search"); assertThat(action.isInternal()).isTrue(); assertThat(action.isPost()).isFalse(); assertThat(action.since()).isEqualTo("6.2"); assertThat(action.description()).isEqualTo("Search for root users.<br/>" + "Requires to be root."); assertThat(action.responseExample()).isNotNull(); assertThat(action.deprecatedKey()).isNull(); assertThat(action.deprecatedSince()).isNull(); assertThat(action.handler()).isSameAs(underTest); assertThat(action.params()).isEmpty(); }
private static void writeAction(JsonWriter writer, WebService.Action action, boolean includeInternals) { if (includeInternals || !action.isInternal()) { writer.beginObject(); writer.prop("key", action.key()); writer.prop("description", action.description()); writer.prop("since", action.since()); writer.prop("deprecatedSince", action.deprecatedSince()); writer.prop("internal", action.isInternal()); writer.prop("post", action.isPost()); writer.prop("hasResponseExample", action.responseExample() != null); writeChangelog(writer, action); writeParameters(writer, action, includeInternals); writer.endObject(); } }
@Test public void verify_definition() { WebService.Action def = ws.getDef(); assertThat(def.isInternal()).isTrue(); assertThat(def.description()).isEqualTo("Get information concerning organization navigation for the current user"); assertThat(def.since()).isEqualTo("6.3"); assertThat(def.changelog()).extracting(Change::getVersion, Change::getDescription).containsExactlyInAnyOrder( tuple("6.4", "The field 'projectVisibility' is added")); assertThat(def.params()).hasSize(1); WebService.Param organization = def.param("organization"); assertThat(organization.description()).isEqualTo("the organization key"); assertThat(organization.isRequired()).isTrue(); assertThat(organization.exampleValue()).isEqualTo("my-org"); }
@Test public void action_updatable_is_defined() { logInAsSystemAdministrator(); WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); underTest.define(newController); newController.done(); WebService.Controller controller = wsTester.controller(DUMMY_CONTROLLER_KEY); assertThat(controller.actions()).extracting("key").containsExactly("updates"); WebService.Action action = controller.actions().iterator().next(); assertThat(action.isPost()).isFalse(); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExample()).isNotNull(); }
@Test public void check_definition() { assertThat(ws.getDef().isPost()).isTrue(); assertThat(ws.getDef().isInternal()).isFalse(); assertThat(ws.getDef().responseExampleAsString()).isNotNull(); assertThat(ws.getDef().description()).isNotNull(); }
@Test public void verify_definition() { WebService.Action definition = underTest.getDef(); assertThat(definition.key()).isEqualTo("health"); assertThat(definition.isPost()).isFalse(); assertThat(definition.description()).isNotEmpty(); assertThat(definition.since()).isEqualTo("6.6"); assertThat(definition.isInternal()).isFalse(); assertThat(definition.responseExample()).isNotNull(); assertThat(definition.params()).isEmpty(); }
@Test public void define_version_action() { WebService.Controller controller = tester.controller("api/server"); assertThat(controller.actions()).hasSize(1); WebService.Action versionAction = controller.action("version"); assertThat(versionAction.since()).isEqualTo("2.10"); assertThat(versionAction.description()).isNotEmpty(); assertThat(versionAction.isPost()).isFalse(); }
@Test public void check_definition() { assertThat(ws.getDef().isPost()).isTrue(); assertThat(ws.getDef().isInternal()).isFalse(); assertThat(ws.getDef().responseExampleAsString()).isNotNull(); assertThat(ws.getDef().description()).isNotNull(); }
@Test public void action_installed_is_defined() { Action action = tester.getDef(); assertThat(action.isPost()).isFalse(); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExample()).isNotNull(); }
@Test public void action_status_is_defined() { WebService.Action action = underTest.getDef(); assertThat(action.isPost()).isFalse(); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExample()).isNotNull(); assertThat(action.params()).isEmpty(); }
@Test public void definition() { WebService.Action definition = ws.getDef(); assertThat(definition.isPost()).isTrue(); assertThat(definition.isInternal()).isFalse(); assertThat(definition.params()).extracting(WebService.Param::key) .containsOnly("project", "tags"); assertThat(definition.description()).isNotEmpty(); assertThat(definition.since()).isEqualTo("6.4"); }