use of org.sonar.api.server.ws.internal.ValidatingRequest in project sonarqube by SonarSource.
the class WebServiceEngineTest method execute_request_with_action_suffix.
@Test
public void execute_request_with_action_suffix() {
ValidatingRequest request = new TestRequest().setMethod("GET").setPath("/api/system/health");
DumbResponse response = new DumbResponse();
underTest.execute(request, response);
assertThat(response.stream().outputAsString()).isEqualTo("good");
}
use of org.sonar.api.server.ws.internal.ValidatingRequest in project sonarqube by SonarSource.
the class WebServiceEngineTest method method_get_not_allowed.
@Test
public void method_get_not_allowed() {
ValidatingRequest request = new TestRequest().setMethod("GET").setPath("/api/system/ping");
DumbResponse response = new DumbResponse();
underTest.execute(request, response);
assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"HTTP method POST is required\"}]}");
}
use of org.sonar.api.server.ws.internal.ValidatingRequest in project sonarqube by SonarSource.
the class WebServiceEngineTest method method_put_not_allowed.
@Test
public void method_put_not_allowed() {
ValidatingRequest request = new TestRequest().setMethod("PUT").setPath("/api/system/ping");
DumbResponse response = new DumbResponse();
underTest.execute(request, response);
assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"HTTP method PUT is not allowed\"}]}");
}
use of org.sonar.api.server.ws.internal.ValidatingRequest in project sonarqube by SonarSource.
the class WebServiceEngineTest method method_delete_not_allowed.
@Test
public void method_delete_not_allowed() {
ValidatingRequest request = new TestRequest().setMethod("DELETE").setPath("/api/system/ping");
DumbResponse response = new DumbResponse();
underTest.execute(request, response);
assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"HTTP method DELETE is not allowed\"}]}");
}
use of org.sonar.api.server.ws.internal.ValidatingRequest in project sonarqube by SonarSource.
the class WebServiceEngineTest method optional_parameter_is_not_set.
@Test
public void optional_parameter_is_not_set() {
ValidatingRequest request = new TestRequest().setMethod("GET").setPath("/api/system/print").setParam("message", "Hello World");
DumbResponse response = new DumbResponse();
underTest.execute(request, response);
assertThat(response.stream().outputAsString()).isEqualTo("Hello World by -");
}
Aggregations