Пример #1
0
  @Test
  public void define_close_action() throws Exception {
    WebService.Controller controller = tester.controller("api/action_plans");

    WebService.Action action = controller.action("close");
    assertThat(action).isNotNull();
    assertThat(action.handler()).isInstanceOf(RailsHandler.class);
    assertThat(action.params()).hasSize(2);
  }
  @Test
  public void define_remove_action() throws Exception {
    WebService.Controller controller = tester.controller("api/permissions");

    WebService.Action action = controller.action("remove");
    assertThat(action).isNotNull();
    assertThat(action.handler()).isInstanceOf(RailsHandler.INSTANCE.getClass());
    assertThat(action.params()).hasSize(5);
  }
Пример #3
0
  @Test
  public void define_search_action() throws Exception {
    WebService.Controller controller = tester.controller("api/action_plans");

    WebService.Action action = controller.action("search");
    assertThat(action).isNotNull();
    assertThat(action.handler()).isInstanceOf(RailsHandler.class);
    assertThat(action.responseExampleAsString()).isNotEmpty();
    assertThat(action.params()).hasSize(2);
  }
Пример #4
0
 @Test
 public void define_suggestions_action() throws Exception {
   WebService.Action action = controller.action("suggestions");
   assertThat(action).isNotNull();
   assertThat(action.isInternal()).isTrue();
   assertThat(action.isPost()).isFalse();
   assertThat(action.handler()).isInstanceOf(RailsHandler.class);
   assertThat(action.responseExampleAsString()).isNotEmpty();
   assertThat(action.params()).hasSize(2);
 }
  @Test
  public void define() {
    WebService.Context context = new WebService.Context();
    ws.define(context);

    WebService.Controller controller = context.controller(ActivitiesWs.ENDPOINT);

    assertThat(controller).isNotNull();
    assertThat(controller.actions()).hasSize(1);
    assertThat(controller.action(SearchAction.SEARCH_ACTION)).isNotNull();
  }
Пример #6
0
 private WebService.Action getAction(String controllerPath, String actionKey) {
   WebService.Controller controller = context.controller(controllerPath);
   if (controller == null) {
     throw new BadRequestException(String.format("Unknown web service: %s", controllerPath));
   }
   WebService.Action action = controller.action(actionKey);
   if (action == null) {
     throw new BadRequestException(
         String.format("Unknown action: %s/%s", controllerPath, actionKey));
   }
   return action;
 }