private static void writeChangelog(JsonWriter writer, WebService.Action action) { writer.name("changelog").beginArray(); action.changelog().stream() .sorted(Comparator.comparing(Change::getVersion).reversed()) .forEach(changelog -> { writer.beginObject(); writer.prop("description", changelog.getDescription()); writer.prop("version", changelog.getVersion()); writer.endObject(); }); writer.endArray(); }
@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 test_definition() { WebService.Action def = ws.getDef(); assertThat(def.isPost()).isTrue(); assertThat(def.isInternal()).isTrue(); assertThat(def.since()).isEqualTo("6.5"); assertThat(def.params()).isEmpty(); assertThat(def.changelog()).isEmpty(); }
private static void writeChangelog(JsonWriter writer, WebService.Action action) { writer.name("changelog").beginArray(); action.changelog().stream() .sorted(Comparator.comparing(Change::getVersion).reversed()) .forEach(changelog -> { writer.beginObject(); writer.prop("description", changelog.getDescription()); writer.prop("version", changelog.getVersion()); writer.endObject(); }); writer.endArray(); }
assertThat(def.responseExampleAsString()).isNotEmpty(); assertThat(def.params().stream().map(Param::key).collect(toList())).containsOnly("organization", "filter", "facets", "s", "asc", "ps", "p", "f"); assertThat(def.changelog()).extracting(Change::getVersion, Change::getDescription).containsExactlyInAnyOrder( tuple("6.4", "The 'languages' parameter accepts 'filter' to filter by language"), tuple("6.4", "The 'visibility' field is added"),
assertThat(showAction.responseExampleAsString()).isNotEmpty(); assertThat(showAction.deprecatedSince()).isNull(); assertThat(showAction.changelog()).isEmpty(); assertThat(createAction.isPost()).isTrue(); assertThat(createAction.isInternal()).isTrue(); assertThat(createAction.changelog()).extracting(Change::getVersion, Change::getDescription).containsOnly( tuple("6.4", "Last event"), tuple("6.0", "Old event"), tuple("4.5.6", "Very old event"));
assertThat(action.description()).isNotNull(); assertThat(action.responseExample()).isNotNull(); assertThat(action.changelog()).extracting(Change::getVersion, Change::getDescription).containsExactlyInAnyOrder( tuple("6.4", "Analysis date has been added to the response"), tuple("6.4", "The field 'id' is deprecated in the response"),
assertThat(definition.isPost()).isFalse(); assertThat(definition.changelog()) .extracting(Change::getVersion, Change::getDescription) .containsExactlyInAnyOrder(
@Test public void verify_definition() { WebService.Action action = ws.getDef(); assertThat(action.since()).isEqualTo("5.4"); assertThat(action.description()).isNotNull(); assertThat(action.responseExample()).isNotNull(); assertThat(action.changelog()).extracting(Change::getVersion, Change::getDescription).containsExactlyInAnyOrder( tuple("7.6", "The use of 'BRC' as value for parameter 'qualifiers' is deprecated"), tuple("7.6", "The use of module keys in parameter 'component' is deprecated"), tuple("6.4", "The field 'id' is deprecated in the response")); assertThat(action.params()).extracting(Param::key).containsExactlyInAnyOrder("component", "componentId", "branch", "pullRequest", "qualifiers", "strategy", "q", "s", "p", "asc", "ps"); Param componentId = action.param(PARAM_COMPONENT_ID); assertThat(componentId.isRequired()).isFalse(); assertThat(componentId.description()).isNotNull(); assertThat(componentId.exampleValue()).isNotNull(); assertThat(componentId.deprecatedSince()).isEqualTo("6.4"); assertThat(componentId.deprecatedKey()).isEqualTo("baseComponentId"); assertThat(componentId.deprecatedKeySince()).isEqualTo("6.4"); Param component = action.param(PARAM_COMPONENT); assertThat(component.isRequired()).isFalse(); assertThat(component.description()).isNotNull(); assertThat(component.exampleValue()).isNotNull(); assertThat(component.deprecatedKey()).isEqualTo("baseComponentKey"); assertThat(component.deprecatedKeySince()).isEqualTo("6.4"); Param branch = action.param(PARAM_BRANCH); assertThat(branch.isInternal()).isTrue(); assertThat(branch.isRequired()).isFalse(); assertThat(branch.since()).isEqualTo("6.6"); }
@Test public void define_suggestions_action() { WebService.Action action = ws.getDef(); assertThat(action).isNotNull(); assertThat(action.isInternal()).isTrue(); assertThat(action.isPost()).isFalse(); assertThat(action.handler()).isNotNull(); assertThat(action.responseExampleAsString()).isNotEmpty(); assertThat(action.params()).extracting(WebService.Param::key).containsExactlyInAnyOrder( PARAM_MORE, PARAM_QUERY, PARAM_RECENTLY_BROWSED); assertThat(action.changelog()).extracting(Change::getVersion, Change::getDescription).containsExactlyInAnyOrder( tuple("7.6", "The use of 'BRC' as value for parameter 'more' is deprecated"), tuple("6.4", "Parameter 's' is optional")); WebService.Param recentlyBrowsed = action.param(PARAM_RECENTLY_BROWSED); assertThat(recentlyBrowsed.since()).isEqualTo("6.4"); assertThat(recentlyBrowsed.exampleValue()).isNotEmpty(); assertThat(recentlyBrowsed.description()).isNotEmpty(); assertThat(recentlyBrowsed.isRequired()).isFalse(); WebService.Param query = action.param(PARAM_QUERY); assertThat(query.exampleValue()).isNotEmpty(); assertThat(query.description()).isNotEmpty(); assertThat(query.isRequired()).isFalse(); }
@Test public void verify_definition() { WebService.Action action = ws.getDef(); assertThat(action.since()).isEqualTo("6.3"); assertThat(action.isPost()).isFalse(); assertThat(action.isInternal()).isFalse(); assertThat(action.changelog()).extracting(Change::getVersion, Change::getDescription).containsExactlyInAnyOrder( tuple("7.6", "The use of 'BRC' as value for parameter 'qualifiers' is deprecated")); assertThat(action.responseExampleAsString()).isNotEmpty(); assertThat(action.params()).hasSize(6); WebService.Param pageSize = action.param("ps"); assertThat(pageSize.isRequired()).isFalse(); assertThat(pageSize.defaultValue()).isEqualTo("100"); assertThat(pageSize.maximumValue()).isEqualTo(500); assertThat(pageSize.description()).isEqualTo("Page size. Must be greater than 0 and less or equal than 500"); WebService.Param qualifiers = action.param("qualifiers"); assertThat(qualifiers.isRequired()).isTrue(); WebService.Param organization = action.param("organization"); assertThat(organization.isRequired()).isFalse(); assertThat(organization.description()).isEqualTo("Organization key"); assertThat(organization.isInternal()).isTrue(); assertThat(organization.exampleValue()).isEqualTo("my-org"); assertThat(organization.since()).isEqualTo("6.3"); }
@Test public void definition() { init(); WebService.Action action = ws.getDef(); assertThat(action.since()).isEqualTo("5.2"); assertThat(action.isPost()).isFalse(); assertThat(action.isInternal()).isTrue(); assertThat(action.description()).isNotNull(); assertThat(action.responseExample()).isNotNull(); assertThat(action.changelog()).extracting(Change::getVersion, Change::getDescription).containsExactlyInAnyOrder( tuple("6.4", "The 'visibility' field is added"), tuple("7.3", "The 'almRepoUrl' and 'almId' fields are added"), tuple("7.6", "The use of module keys in parameter 'component' is deprecated")); WebService.Param componentId = action.param(PARAM_COMPONENT); assertThat(componentId.isRequired()).isFalse(); assertThat(componentId.description()).isNotNull(); assertThat(componentId.exampleValue()).isNotNull(); assertThat(componentId.deprecatedKey()).isEqualTo("componentKey"); assertThat(componentId.deprecatedKeySince()).isEqualTo("6.4"); }
@Test public void definition() { WebService.Action action = ws.getDef(); assertThat(action.description()).isEqualTo("Get the list of provisioned projects.<br> " + "Web service is deprecated. Use api/projects/search instead, with onProvisionedOnly=true.<br> " + "Require 'Create Projects' permission."); assertThat(action.since()).isEqualTo("5.2"); assertThat(action.changelog()).extracting(Change::getVersion, Change::getDescription).containsExactlyInAnyOrder( tuple("6.4", "The 'uuid' field is deprecated in the response"), tuple("6.4", "Paging response fields is now in a Paging object")); assertThat(action.deprecatedSince()).isEqualTo("6.6"); assertThat(action.params()).hasSize(5); Param organization = action.param(PARAM_ORGANIZATION); assertThat(organization.description()).isEqualTo("The key of the organization"); assertThat(organization.isInternal()).isTrue(); assertThat(organization.isRequired()).isFalse(); assertThat(organization.since()).isEqualTo("6.3"); }
@Test public void verify_define() { WebService.Action action = wsTester.getDef(); assertThat(action.key()).isEqualTo(ACTION); assertThat(action.isPost()).isTrue(); assertThat(action.description()).isNotEmpty(); assertThat(action.isInternal()).isTrue(); assertThat(action.since()).isEqualTo("6.4"); assertThat(action.handler()).isEqualTo(underTest); assertThat(action.changelog()) .extracting(Change::getVersion, Change::getDescription) .contains(tuple("7.3", "This WS used to be located at /api/organizations/update_project_visibility")); WebService.Param projectVisibility = action.param(PARAM_PROJECT_VISIBILITY); assertThat(projectVisibility.isRequired()).isTrue(); assertThat(projectVisibility.possibleValues()).containsExactlyInAnyOrder("private", "public"); assertThat(projectVisibility.description()).isEqualTo("Default visibility for projects"); } }
@Test public void verify_definition() { WebService.Action action = ws.getDef(); assertThat(action.since()).isEqualTo("4.3"); assertThat(action.key()).isEqualTo("list"); assertThat(action.isPost()).isFalse(); assertThat(action.isInternal()).isFalse(); assertThat(action.changelog()).extracting(Change::getVersion, Change::getDescription) .containsExactlyInAnyOrder( tuple("7.0", "'isDefault' field is added on quality gate"), tuple("7.0", "'default' field on root level is deprecated"), tuple("7.0", "'isBuiltIn' field is added in the response"), tuple("7.0", "'actions' fields are added in the response")); assertThat(action.params()).extracting(WebService.Param::key, WebService.Param::isRequired) .containsExactlyInAnyOrder(tuple("organization", false)); }
@Test public void definition() { WebService.Action action = ws.getDef(); assertThat(action.description()).isNotEmpty(); assertThat(action.isInternal()).isFalse(); assertThat(action.since()).isEqualTo("6.1"); assertThat(action.changelog()).extracting(Change::getVersion, Change::getDescription).containsExactlyInAnyOrder( tuple("6.6", "The parameter 'projectId' has been removed"), tuple("6.6", "The parameter 'projectKey' has been renamed to 'project'"), tuple("6.6", "This webservice is now part of the public API")); assertThat(action.params()) .extracting(WebService.Param::key, WebService.Param::isRequired) .containsExactlyInAnyOrder( tuple("project", true), tuple("organization", false)); }
@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 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 verify_definition() { WebService.Action action = ws.getDef(); assertThat(action.key()).isEqualTo("rename"); assertThat(action.since()).isEqualTo("4.3"); assertThat(action.changelog()).isEmpty(); assertThat(action.params()) .extracting(WebService.Param::key, WebService.Param::isRequired) .containsExactlyInAnyOrder( tuple("id", true), tuple("name", true), tuple("organization", false)); }
@Test public void api_definition() { WebService.Action definition = ws.getDef(); assertThat(definition.since()).isEqualTo("6.1"); assertThat(definition.isPost()).isTrue(); assertThat(definition.key()).isEqualTo("update_key"); assertThat(definition.changelog()).hasSize(2); assertThat(definition.params()) .hasSize(3) .extracting(Param::key) .containsOnlyOnce("projectId", "from", "to"); }