Tabnine Logo
WebService$Action.handler
Code IndexAdd Tabnine to your IDE (free)

How to use
handler
method
in
org.sonar.api.server.ws.WebService$Action

Best Java code snippets using org.sonar.api.server.ws.WebService$Action.handler (Showing top 20 results out of 315)

origin: SonarSource/sonarqube

public WebServiceFilter(WebServiceEngine webServiceEngine, SonarRuntime runtime) {
 this.webServiceEngine = webServiceEngine;
 this.includeUrls = concat(
  Stream.of("/api/*"),
  webServiceEngine.controllers().stream()
   .flatMap(controller -> controller.actions().stream())
   .map(toPath()))
    .collect(MoreCollectors.toSet());
 this.excludeUrls = concat(concat(
  Stream.of("/" + CONTROLLER_PROPERTIES + "*"),
  MOVED_WEB_SERVICES.stream()),
  webServiceEngine.controllers().stream()
   .flatMap(controller -> controller.actions().stream())
   .filter(action -> action.handler() instanceof ServletFilterHandler)
   .map(toPath()))
    .collect(MoreCollectors.toSet());
 this.runtime = runtime;
}
origin: SonarSource/sonarqube

@Test
public void define_app_action() {
 WebService.Action action = ws.getDef();
 assertThat(action).isNotNull();
 assertThat(action.isInternal()).isTrue();
 assertThat(action.isPost()).isFalse();
 assertThat(action.handler()).isNotNull();
 assertThat(action.params()).hasSize(4);
}
origin: SonarSource/sonarqube

@Test
public void handle_request() throws Exception {
 MetricWs metricWs = new MetricWs();
 metricWs.define(context);
 assertThat(metricWs.showCalled).isFalse();
 assertThat(metricWs.createCalled).isFalse();
 context.controller("api/metric").action("show").handler().handle(mock(Request.class), mock(Response.class));
 assertThat(metricWs.showCalled).isTrue();
 assertThat(metricWs.createCalled).isFalse();
 context.controller("api/metric").action("create").handler().handle(mock(Request.class), mock(Response.class));
 assertThat(metricWs.createCalled).isTrue();
}
origin: SonarSource/sonarqube

@Test
public void verify_definition() {
 WebService.Action action = wsTester.getDef();
 assertThat(action.key()).isEqualTo("set_root");
 assertThat(action.isInternal()).isTrue();
 assertThat(action.isPost()).isTrue();
 assertThat(action.since()).isEqualTo("6.2");
 assertThat(action.description()).isEqualTo("Make the specified user root.<br/>" +
  "Requires to be root.");
 assertThat(action.responseExample()).isNull();
 assertThat(action.deprecatedKey()).isNull();
 assertThat(action.deprecatedSince()).isNull();
 assertThat(action.handler()).isSameAs(underTest);
 assertThat(action.params()).hasSize(1);
 WebService.Param param = action.param("login");
 assertThat(param.isRequired()).isTrue();
 assertThat(param.description()).isEqualTo("A user login");
 assertThat(param.defaultValue()).isNull();
 assertThat(param.deprecatedSince()).isNull();
 assertThat(param.deprecatedKey()).isNull();
 assertThat(param.exampleValue()).isEqualTo("admin");
}
origin: SonarSource/sonarqube

private void initWebServiceEngine(WsUrl... wsUrls) {
 List<WebService.Controller> controllers = new ArrayList<>();
 for (WsUrl wsUrl : wsUrls) {
  String controller = wsUrl.getController();
  WebService.Controller wsController = mock(WebService.Controller.class);
  when(wsController.path()).thenReturn(controller);
  List<WebService.Action> actions = new ArrayList<>();
  for (String action : wsUrl.getActions()) {
   WebService.Action wsAction = mock(WebService.Action.class);
   when(wsAction.path()).thenReturn(controller + "/" + action);
   when(wsAction.key()).thenReturn(action);
   when(wsAction.handler()).thenReturn(wsUrl.getRequestHandler());
   actions.add(wsAction);
  }
  when(wsController.actions()).thenReturn(actions);
  controllers.add(wsController);
 }
 when(webServiceEngine.controllers()).thenReturn(controllers);
 underTest = new WebServiceFilter(webServiceEngine, runtime);
}
origin: SonarSource/sonarqube

@Test
public void should_be_well_defined() {
 Controller controller = tester.controller(CONTROLLER_LANGUAGES);
 assertThat(controller).isNotNull();
 assertThat(controller.description()).isNotEmpty();
 assertThat(controller.isInternal()).isFalse();
 assertThat(controller.path()).isEqualTo(CONTROLLER_LANGUAGES);
 assertThat(controller.since()).isEqualTo("5.1");
 assertThat(controller.actions()).hasSize(1);
 Action list = controller.action(ACTION_LIST);
 assertThat(list).isNotNull();
 assertThat(list.description()).isNotEmpty();
 assertThat(list.handler()).isInstanceOf(ListAction.class);
 assertThat(list.isInternal()).isFalse();
 assertThat(list.isPost()).isFalse();
 assertThat(list.responseExampleAsString()).isNotEmpty();
 assertThat(list.params()).hasSize(2);
}
origin: SonarSource/sonarqube

@Test
public void definition() {
 WebService.Action action = wsTester.getDef();
 assertThat(action.key()).isEqualTo("delete");
 assertThat(action.isPost()).isTrue();
 assertThat(action.description()).isEqualTo("Delete an organization.<br/>" +
  "Require 'Administer System' permission on the specified organization. Organization support must be enabled.");
 assertThat(action.isInternal()).isTrue();
 assertThat(action.since()).isEqualTo("6.2");
 assertThat(action.handler()).isNotNull();
 assertThat(action.params()).hasSize(1);
 assertThat(action.responseExample()).isNull();
 assertThat(action.param("organization"))
  .matches(param -> param.isRequired())
  .matches(param -> "foo-company".equals(param.exampleValue()))
  .matches(param -> "Organization key".equals(param.description()));
}
origin: SonarSource/sonarqube

 @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");
 }
}
origin: SonarSource/sonarqube

@Test
public void define_ws() {
 WsTester tester = new WsTester(underTest);
 WebService.Controller controller = tester.controller("api/webservices");
 assertThat(controller).isNotNull();
 assertThat(controller.path()).isEqualTo("api/webservices");
 assertThat(controller.since()).isEqualTo("4.2");
 assertThat(controller.description()).isNotEmpty();
 assertThat(controller.actions()).hasSize(2);
 WebService.Action index = controller.action("list");
 assertThat(index).isNotNull();
 assertThat(index.key()).isEqualTo("list");
 assertThat(index.handler()).isNotNull();
 assertThat(index.since()).isEqualTo("4.2");
 assertThat(index.isPost()).isFalse();
 assertThat(index.isInternal()).isFalse();
 assertThat(controller.action("response_example")).isNotNull();
}
origin: SonarSource/sonarqube

@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();
}
origin: SonarSource/sonarqube

@Test
public void define_list_action() {
 WebService.Controller controller = controller();
 WebService.Action listProfiles = controller.action("list");
 assertThat(listProfiles).isNotNull();
 assertThat(listProfiles.handler()).isInstanceOf(RemovedWebServiceHandler.class);
 assertThat(listProfiles.responseExampleAsString()).isNotEmpty();
 assertThat(listProfiles.params()).isEmpty();
}
origin: SonarSource/sonarqube

@Test
public void define_search_action() {
 WebService.Action action = ws.getDef();
 assertThat(action).isNotNull();
 assertThat(action.isPost()).isFalse();
 assertThat(action.handler()).isNotNull();
 assertThat(action.responseExampleAsString()).isNotEmpty();
 assertThat(action.params()).hasSize(2);
}
origin: SonarSource/sonarqube

@Test
public void define_index_action() {
 WebService.Controller controller = ws.controller("api/profiles");
 WebService.Action restoreProfiles = controller.action("index");
 assertThat(restoreProfiles).isNotNull();
 assertThat(restoreProfiles.handler()).isInstanceOf(RemovedWebServiceHandler.class);
 assertThat(restoreProfiles.responseExampleAsString()).isNotEmpty();
 assertThat(restoreProfiles.params()).isEmpty();
}
origin: SonarSource/sonarqube

@Test
public void define_delete_action() {
 WebService.Action action = ws.getDef();
 assertThat(action).isNotNull();
 assertThat(action.isPost()).isTrue();
 assertThat(action.handler()).isNotNull();
 assertThat(action.responseExample()).isNull();
 assertThat(action.params()).hasSize(1);
}
origin: SonarSource/sonarqube

@Test
public void define_create_action() {
 WebService.Action action = ws.getDef();
 assertThat(action).isNotNull();
 assertThat(action.isPost()).isTrue();
 assertThat(action.handler()).isNotNull();
 assertThat(action.responseExampleAsString()).isNotEmpty();
 assertThat(action.params()).hasSize(4);
}
origin: SonarSource/sonarqube

@Test
public void define_index_action() {
 WebService.Action action = controller.action("index");
 assertThat(action).isNotNull();
 assertThat(action.handler()).isInstanceOf(RemovedWebServiceHandler.class);
 assertThat(action.responseExampleAsString()).isNotEmpty();
 assertThat(action.params()).isEmpty();
}
origin: SonarSource/sonarqube

 @Test
 public void define_upload_action() {
  WebService.Controller controller = tester.controller("api/updatecenter");

  WebService.Action action = controller.action("upload");
  assertThat(action).isNotNull();
  assertThat(action.handler()).isNotNull();
  assertThat(action.isInternal()).isTrue();
  assertThat(action.isPost()).isTrue();
  assertThat(action.params()).hasSize(1);
 }
}
origin: SonarSource/sonarqube

 public Result execute() throws Exception {
  TestResponse response = new TestResponse();
  verifyRequest(action(), this);
  action().handler().handle(this, response);
  return new Result(response);
 }
}
origin: SonarSource/sonarqube

public TestResponse execute() {
 try {
  DumbResponse response = new DumbResponse();
  action().handler().handle(this, response);
  return new TestResponse(response);
 } catch (Exception e) {
  throw Throwables.propagate(e);
 }
}
origin: SonarSource/sonarqube

@Test
public void define_ws() {
 WebService.Action show = ws.getDef();
 assertThat(show).isNotNull();
 assertThat(show.handler()).isNotNull();
 assertThat(show.since()).isEqualTo("4.4");
 assertThat(show.isInternal()).isFalse();
 assertThat(show.responseExampleAsString()).isNotEmpty();
 assertThat(show.params()).hasSize(4);
}
org.sonar.api.server.wsWebService$Actionhandler

Popular methods of WebService$Action

  • isInternal
  • key
  • param
  • changelog
  • deprecatedSince
  • description
  • isPost
  • params
  • path
  • responseExample
  • responseExampleAsString
  • since
    Set if different than controller.
  • responseExampleAsString,
  • since,
  • <init>,
  • responseExampleFormat,
  • logWarningIf,
  • deprecatedKey,
  • toString

Popular in Java

  • Finding current android device location
  • onRequestPermissionsResult (Fragment)
  • getExternalFilesDir (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now