Search in sources :

Example 36 with NewAction

use of org.sonar.api.server.ws.WebService.NewAction in project sonarqube by SonarSource.

the class UsersAction method define.

@Override
public void define(NewController context) {
    NewAction action = context.createAction("users").setDescription("Search for users with membership information with respect to a group.<br>" + "Requires the following permission: 'Administer System'.").setHandler(this).setSince("5.2").setResponseExample(getClass().getResource("users-example.json")).addSelectionModeParam().addSearchQuery("freddy", "names", "logins").addPagingParams(25);
    defineGroupWsParameters(action);
}
Also used : NewAction(org.sonar.api.server.ws.WebService.NewAction)

Example 37 with NewAction

use of org.sonar.api.server.ws.WebService.NewAction in project sonarqube by SonarSource.

the class WebServiceTest method fail_if_duplicated_action_parameters.

@Test
public void fail_if_duplicated_action_parameters() {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage("The parameter 'key' is defined multiple times in the action 'create'");
    ((WebService) context -> {
        NewController controller = context.createController("api/rule");
        NewAction action = newDefaultAction(controller, "create");
        action.createParam("key");
        action.createParam("key");
        controller.done();
    }).define(context);
}
Also used : NewAction(org.sonar.api.server.ws.WebService.NewAction) NewController(org.sonar.api.server.ws.WebService.NewController) Test(org.junit.Test)

Aggregations

NewAction (org.sonar.api.server.ws.WebService.NewAction)37 Test (org.junit.Test)6 NewController (org.sonar.api.server.ws.WebService.NewController)6 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Writer (java.io.Writer)1 StandardCharsets (java.nio.charset.StandardCharsets)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Set (java.util.Set)1 Nullable (javax.annotation.Nullable)1 ProfileExporter (org.sonar.api.profiles.ProfileExporter)1 ProfileImporter (org.sonar.api.profiles.ProfileImporter)1 Languages (org.sonar.api.resources.Languages)1 Request (org.sonar.api.server.ws.Request)1 Response (org.sonar.api.server.ws.Response)1 Stream (org.sonar.api.server.ws.Response.Stream)1 WebService (org.sonar.api.server.ws.WebService)1 Collectors (org.sonar.core.util.stream.Collectors)1