@Test public void definition_with_exporters() { WebService.Action definition = newWsActionTester(newExporter("polop"), newExporter("palap")).getDef(); assertThat(definition.isPost()).isFalse(); assertThat(definition.isInternal()).isFalse(); assertThat(definition.params()).extracting("key").containsExactlyInAnyOrder("key", "language", "qualityProfile", "organization", "exporterKey"); WebService.Param exportersParam = definition.param("exporterKey"); assertThat(exportersParam.possibleValues()).containsOnly("polop", "palap"); assertThat(exportersParam.deprecatedKey()).isEqualTo("format"); assertThat(exportersParam.deprecatedKeySince()).isEqualTo("6.3"); assertThat(exportersParam.isInternal()).isFalse(); }
@Test public void definition() { WebService.Action definition = ws.getDef(); assertThat(definition.responseExampleAsString()).isNotEmpty(); assertThat(definition.isPost()).isTrue(); assertThat(definition.params()).extracting(Param::key) .containsExactlyInAnyOrder("language", "organization", "name", "backup_with_messages", "backup_with_errors", "backup_xoo_lint"); Param name = definition.param("name"); assertThat(name.deprecatedKey()).isEqualTo("profileName"); assertThat(name.deprecatedKeySince()).isEqualTo("6.6"); }
@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"); }
private static void writeParam(JsonWriter writer, WebService.Param param) { writer.beginObject(); writer.prop("key", param.key()); writer.prop("description", param.description()); writer.prop("since", param.since()); writer.prop("required", param.isRequired()); writer.prop("internal", param.isInternal()); writer.prop("defaultValue", param.defaultValue()); writer.prop("exampleValue", param.exampleValue()); writer.prop("deprecatedSince", param.deprecatedSince()); writer.prop("deprecatedKey", param.deprecatedKey()); writer.prop("deprecatedKeySince", param.deprecatedKeySince()); writer.prop("maxValuesAllowed", param.maxValuesAllowed()); ofNullable(param.possibleValues()).ifPresent(possibleValues -> writer.name("possibleValues").beginArray().values(possibleValues).endArray()); ofNullable(param.maximumLength()).ifPresent(maximumLength -> writer.prop("maximumLength", maximumLength)); ofNullable(param.minimumLength()).ifPresent(minimumLength -> writer.prop("minimumLength", minimumLength)); ofNullable(param.maximumValue()).ifPresent(maximumValue -> writer.prop("maximumValue", maximumValue)); writer.endObject(); }
assertThat(severityParam.since()).isEqualTo("4.4"); assertThat(severityParam.deprecatedKey()).isEqualTo("old-severity"); assertThat(severityParam.deprecatedKeySince()).isEqualTo("4.5"); assertThat(severityParam.defaultValue()).isEqualTo("MAJOR"); assertThat(severityParam.possibleValues()).containsOnly("INFO", "MAJOR", "BLOCKER");
assertThat(componentId.deprecatedSince()).isEqualTo("6.4"); assertThat(componentId.deprecatedKey()).isEqualTo("id"); assertThat(componentId.deprecatedKeySince()).isEqualTo("6.4"); assertThat(component.exampleValue()).isNotNull(); assertThat(component.deprecatedKey()).isEqualTo("key"); assertThat(component.deprecatedKeySince()).isEqualTo("6.4");
@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"); }
private static void writeParam(JsonWriter writer, WebService.Param param) { writer.beginObject(); writer.prop("key", param.key()); writer.prop("description", param.description()); writer.prop("since", param.since()); writer.prop("required", param.isRequired()); writer.prop("internal", param.isInternal()); writer.prop("defaultValue", param.defaultValue()); writer.prop("exampleValue", param.exampleValue()); writer.prop("deprecatedSince", param.deprecatedSince()); writer.prop("deprecatedKey", param.deprecatedKey()); writer.prop("deprecatedKeySince", param.deprecatedKeySince()); writer.prop("maxValuesAllowed", param.maxValuesAllowed()); ofNullable(param.possibleValues()).ifPresent(possibleValues -> writer.name("possibleValues").beginArray().values(possibleValues).endArray()); ofNullable(param.maximumLength()).ifPresent(maximumLength -> writer.prop("maximumLength", maximumLength)); ofNullable(param.minimumLength()).ifPresent(minimumLength -> writer.prop("minimumLength", minimumLength)); ofNullable(param.maximumValue()).ifPresent(maximumValue -> writer.prop("maximumValue", maximumValue)); writer.endObject(); }