Examples of ApiMethod


Examples of com.google.api.explorer.client.base.ApiMethod

  public void testDataBinding() {
    Map<String, Schema> properties =
        ImmutableMap.of("oneProp", CustomSchema.lockedStringField(null));
    Schema simpleSchema = CustomSchema.objectSchema(properties, null, false);

    ApiMethod apiMethodWithSchema = new MockApiMethod();
    mockService.schemaForMethod.put(apiMethodWithSchema, simpleSchema);

    ApiMethod apiMethodWithoutSchema = new MockApiMethod();
    mockService.schemaForMethod.put(apiMethodWithoutSchema, null);

    // Set the first method and some data in the editors.
    form.setContent(mockService, apiMethodWithSchema, simpleSchema, "");
    String value = "{\n  \"oneProp\": \"oneValue\"\n}";
View Full Code Here

Examples of com.google.api.explorer.client.base.ApiMethod

  /**
   * When a MethodSelectedEvent fires, it results in a call to setMethod() with
   * that method.
   */
  public void testMethodSelected() {
    ApiMethod method = EasyMock.createControl().createMock(ApiMethod.class);
    Schema param = EasyMock.createControl().createMock(Schema.class);
    EasyMock.expect(method.getParameters()).andReturn(ImmutableMap.of("foo", param)).anyTimes();
    EasyMock.expect(method.getParameterOrder()).andReturn(null);
    EasyMock.expect(param.isRequired()).andReturn(false).anyTimes();

    display.setMethod(service, method, ImmutableSortedMap.of("foo", param),
        ImmutableMultimap.<String, String>of(), null);
    EasyMock.expectLastCall();
View Full Code Here

Examples of com.google.api.explorer.client.base.ApiMethod

  /**
   * When a MethodSelectedEvent fires and specifies parameters to fill in, it
   * results in a call to setMethod() as well as setParameterValues().
   */
  public void testMethodSelected_withParams() {
    ApiMethod method = EasyMock.createControl().createMock(ApiMethod.class);
    Schema param = EasyMock.createControl().createMock(Schema.class);
    EasyMock.expect(method.getParameters()).andReturn(ImmutableMap.of("foo", param)).anyTimes();
    EasyMock.expect(method.getParameterOrder()).andReturn(null);
    EasyMock.expect(param.isRequired()).andReturn(false).anyTimes();

    Multimap<String, String> queryParams = ImmutableMultimap.of("foo", "bar");
    display.setMethod(service, method, ImmutableSortedMap.of("foo", param), queryParams, null);
    EasyMock.expectLastCall();
View Full Code Here

Examples of com.google.api.explorer.client.base.ApiMethod

   * The algorithm in ParameterComparator assures that parameters will be
   * ordered as defined in the parameterOrder list, then alphabetically, even
   * when the parameter map returns the keys in an incorrect order.
   */
  public void testParameterComparator() {
    ApiMethod method = EasyMock.createControl().createMock(ApiMethod.class);
    Schema a = EasyMock.createControl().createMock(Schema.class);
    Schema b = EasyMock.createControl().createMock(Schema.class);
    Schema reqA = EasyMock.createControl().createMock(Schema.class);
    Schema reqB = EasyMock.createControl().createMock(Schema.class);
    // Using a SortedMap so that the keys can be guaranteed to be returned in a
    // known unsorted order.
    EasyMock.expect(method.getParameters()).andReturn(
        ImmutableSortedMap.of("b", b, "req-a", reqA, "a", a, "req-b", reqB));
    EasyMock.expect(method.getParameterOrder()).andReturn(ImmutableList.of("req-b", "req-a"));
    EasyMock.replay(method);

    assertEquals(ImmutableSortedSet.of("req-b", "req-a", "a", "b"), ImmutableSortedMap.copyOf(
        method.getParameters(), new ParameterComparator(method.getParameterOrder())).keySet());

    EasyMock.verify(method);
  }
View Full Code Here

Examples of com.google.api.explorer.client.base.ApiMethod

  /**
   * Test that when a request body is specified as a query param that it gets mapped to the request
   * body editor.
   */
  public void testRequestBodyPredefinition() {
    ApiMethod method = EasyMock.createControl().createMock(ApiMethod.class);
    Schema param = EasyMock.createControl().createMock(Schema.class);
    EasyMock.expect(method.getParameters()).andReturn(ImmutableMap.of("foo", param)).anyTimes();
    EasyMock.expect(method.getParameterOrder()).andReturn(null);
    EasyMock.expect(param.isRequired()).andReturn(false).anyTimes();

    String requestBodyValue = "{\"key\": \"value\"}";
    Multimap<String, String> queryParams =
        ImmutableMultimap.of("foo", "bar", UrlBuilder.BODY_QUERY_PARAM_KEY, requestBodyValue);
View Full Code Here

Examples of com.google.api.explorer.client.base.ApiMethod

      HistoryItem item = Iterables.getOnlyElement(context.getHistoryItems());
      EmbeddedHistoryItemView view = generateHistoryItemView(item);

      detailPane.add(view);
    } else if (context.isMethodFormVisible()) {
      ApiMethod method = context.getMethod();

      // Wrap the callback given by the context so that we may also be notified when a request is
      // finished. Pass through events to the original callback.
      CallbackWrapper cbWrapper = new CallbackWrapper();
      cbWrapper.delegate = context.getRequestFinishedCallback();
      cbWrapper.methodName = method.getId();

      // Create the view of the request editor and the single history item.
      EmbeddedView view = new EmbeddedView(authManager,
          context.getService(),
          method,
View Full Code Here

Examples of com.google.api.explorer.client.base.ApiMethod

      List<Widget> response = Lists.newArrayList();
      response.add(new InlineLabel("\""));

      boolean createdExplorerLink = false;
      try {
        ApiMethod method = getMethodForUrl(service, rawText);
        if (method != null) {
          String explorerLink = createExplorerLink(service, rawText, method);
          Widget linkObject = linkFactory.generateAnchor(rawText, explorerLink);
          linkObject.addStyleName(style.jsonStringExplorerLink());
          response.add(linkObject);
View Full Code Here

Examples of org.apache.camel.util.component.ApiMethod

                callback.done(false);
            }
        });

        // decide which method to invoke
        final ApiMethod method = findMethod(exchange, properties);
        if (method == null) {
            // synchronous failure
            callback.done(true);
            return true;
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug("Invoking operation {} with {}", method.getName(), properties.keySet());
        }

        try {
            doInvokeMethod(method, properties);
        } catch (Throwable t) {
View Full Code Here

Examples of org.entando.entando.aps.system.services.api.model.ApiMethod

        Object responseObject = null;
        try {
            IResponseBuilder responseBuilder = (IResponseBuilder) ApsWebApplicationUtils.getBean(SystemConstants.API_RESPONSE_BUILDER, request);
            Properties properties = this.extractRequestParameters(ui);
            properties.put(SystemConstants.API_LANG_CODE_PARAMETER, langCode);
            ApiMethod apiMethod = responseBuilder.extractApiMethod(httpMethod, namespace, resourceName);
      String entandoApiToken = this.extractApiToken(request, ui);
      if (null != entandoApiToken) {
        this.extractTokenParameters(entandoApiToken, apiMethod, request, properties);
      } else {
        this.extractOAuthParameters(apiMethod, request, response, properties);
View Full Code Here

Examples of org.entando.entando.aps.system.services.api.model.ApiMethod

        Object responseObject = null;
        try {
            IResponseBuilder responseBuilder = (IResponseBuilder) ApsWebApplicationUtils.getBean(SystemConstants.API_RESPONSE_BUILDER, request);
            Properties properties = this.extractRequestParameters(ui);
            properties.put(SystemConstants.API_LANG_CODE_PARAMETER, langCode);
            ApiMethod apiMethod = responseBuilder.extractApiMethod(httpMethod, namespace, resourceName);
     
      String entandoApiToken = this.extractApiToken(request, ui);
      if (null != entandoApiToken) {
        this.extractTokenParameters(entandoApiToken, apiMethod, request, properties);
      } else {
        this.extractOAuthParameters(apiMethod, request, response, properties);
      }
            Class expectedType = apiMethod.getExpectedType();
            Object bodyObject = null;
            if (MediaType.APPLICATION_JSON_TYPE.equals(mediaType)) {
                JSONProvider jsonProvider = new JSONProvider();
                bodyObject = jsonProvider.readFrom(expectedType, expectedType.getGenericSuperclass(),
                        expectedType.getAnnotations(), mediaType, null, request.getInputStream());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.