Examples of RpcHandler


Examples of org.apache.shindig.protocol.RpcHandler

    httpRequest.setMethod("GET");
    builder.setResponseString("{key:1}");
    expect(pipeline.execute(eqRequest(httpRequest))).andReturn(builder.create()).anyTimes();

    replay();
    RpcHandler operation = registry.getRpcHandler(request);

    HttpRequestHandler.HttpApiResponse httpApiResponse =
        (HttpRequestHandler.HttpApiResponse)operation.execute(emptyFormItems, token, converter).get();
    verify();

    JsonAssert.assertJsonEquals("{ headers : {}, status : 200, content : {key: 1}}}",
        converter.convertToString(httpApiResponse));
  }
View Full Code Here

Examples of org.apache.shindig.protocol.RpcHandler

    httpRequest.setMethod("GET");
    builder.setResponseString("[{key:1},{key:2}]");
    expect(pipeline.execute(eqRequest(httpRequest))).andReturn(builder.create()).anyTimes();

    replay();
    RpcHandler operation = registry.getRpcHandler(request);

    HttpRequestHandler.HttpApiResponse httpApiResponse =
        (HttpRequestHandler.HttpApiResponse)operation.execute(emptyFormItems, token, converter).get();
    verify();

    JsonAssert.assertJsonEquals("{ headers : {}, status : 200, content : [{key:1},{key:2}]}}",
        converter.convertToString(httpApiResponse));
  }
View Full Code Here

Examples of org.apache.shindig.protocol.RpcHandler

    httpRequest.setAuthType(AuthType.SIGNED);
    httpRequest.setOAuthArguments(
        new OAuthArguments(AuthType.SIGNED, ImmutableMap.<String, String>of()));
    expect(pipeline.execute(eqRequest(httpRequest))).andReturn(builder.create()).anyTimes();
    replay();
    RpcHandler operation = registry.getRpcHandler(request);

    HttpRequestHandler.HttpApiResponse httpApiResponse =
        (HttpRequestHandler.HttpApiResponse)operation.execute(emptyFormItems, token, converter).get();
    verify();

    JsonAssert.assertJsonEquals("{ headers : {}, status : 200, content : 'CONTENT' }}",
        converter.convertToString(httpApiResponse));
View Full Code Here

Examples of org.apache.shindig.protocol.RpcHandler

    httpRequest.setOAuthArguments(
        new OAuthArguments(AuthType.SIGNED, ImmutableMap.<String, String>of()));
    httpRequest.setPostBody("POSTBODY".getBytes());
    expect(pipeline.execute(eqRequest(httpRequest))).andReturn(builder.create()).anyTimes();
    replay();
    RpcHandler operation = registry.getRpcHandler(request);

    HttpRequestHandler.HttpApiResponse httpApiResponse =
        (HttpRequestHandler.HttpApiResponse)operation.execute(emptyFormItems, token, converter).get();
    verify();

    JsonAssert.assertJsonEquals("{ headers : {}, status : 200, content : 'CONTENT', token : updated }}",
        converter.convertToString(httpApiResponse));
View Full Code Here

Examples of org.apache.shindig.protocol.RpcHandler

    httpRequest.setOAuthArguments(
        new OAuthArguments(AuthType.OAUTH, ImmutableMap.<String, String>of()));
    httpRequest.setPostBody("POSTBODY".getBytes());
    expect(pipeline.execute(eqRequest(httpRequest))).andReturn(builder.create()).anyTimes();
    replay();
    RpcHandler operation = registry.getRpcHandler(request);

    operation.execute(emptyFormItems, token, converter).get();
    verify();
  }
View Full Code Here

Examples of org.apache.shindig.protocol.RpcHandler

    httpRequest.setPostBody("POSTBODY".getBytes());

    Capture<HttpRequest> requestCapture = new Capture<HttpRequest>();
    expect(pipeline.execute(capture(requestCapture))).andReturn(builder.create());
    replay();
    RpcHandler operation = registry.getRpcHandler(request);

    operation.execute(emptyFormItems, token, converter).get();
    verify();

    assertEquals(httpRequest.getOAuthArguments(),
        requestCapture.getValue().getOAuthArguments());
  }
View Full Code Here

Examples of org.apache.shindig.protocol.RpcHandler

    httpRequest.setMethod("POST");
    httpRequest.setAuthType(AuthType.NONE);
    httpRequest.setPostBody("POSTBODY".getBytes());
    expect(pipeline.execute(eqRequest(httpRequest))).andReturn(builder.create()).anyTimes();
    replay();
    RpcHandler operation = registry.getRpcHandler(request);

    operation.execute(emptyFormItems, token, converter).get();
    verify();
  }
View Full Code Here

Examples of org.apache.shindig.protocol.RpcHandler

    HttpRequest httpRequest = new HttpRequest(Uri.parse("http://www.example.org/somecontent"));
    httpRequest.setMethod("GET");
    httpRequest.setAuthType(AuthType.SIGNED);
    expect(pipeline.execute(eqRequest(httpRequest))).andReturn(builder.create()).anyTimes();
    replay();
    RpcHandler operation = registry.getRpcHandler(request);

    try {
      operation.execute(emptyFormItems, null, converter).get();
      fail("Cannot execute a request without a security token");
    } catch (ExecutionException ee) {
      assertTrue(ee.getCause() instanceof ProtocolException);
    }
    verify();
View Full Code Here

Examples of org.apache.shindig.protocol.RpcHandler

    httpRequest.setAuthType(AuthType.NONE);
    builder.setHttpStatusCode(HttpResponse.SC_INTERNAL_SERVER_ERROR);
    builder.setResponseString("I AM AN ERROR MESSAGE");
    expect(pipeline.execute(eqRequest(httpRequest))).andReturn(builder.create()).anyTimes();
    replay();
    RpcHandler operation = registry.getRpcHandler(request);

    HttpRequestHandler.HttpApiResponse httpApiResponse =
        (HttpRequestHandler.HttpApiResponse)operation.execute(emptyFormItems, token, converter).get();
    verify();

    JsonAssert.assertJsonEquals("{ headers : {}, status : 500, content : 'I AM AN ERROR MESSAGE' }}",
        converter.convertToString(httpApiResponse));
  }
View Full Code Here

Examples of org.apache.shindig.protocol.RpcHandler

    httpRequest.setMethod("GET");
    builder.setMetadata("foo", "CONTENT");
    expect(pipeline.execute(eqRequest(httpRequest))).andReturn(builder.create()).anyTimes();

    replay();
    RpcHandler operation = registry.getRpcHandler(request);

    HttpRequestHandler.HttpApiResponse httpApiResponse =
        (HttpRequestHandler.HttpApiResponse)operation.execute(emptyFormItems, token, converter).get();
    verify();

    JsonAssert.assertJsonEquals("{ headers : {}, status : 200, content : 'CONTENT', metadata : { foo : 'CONTENT' }}",
        converter.convertToString(httpApiResponse));
  }
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.