Examples of RpcHandler


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(converter.convertToString(httpApiResponse),
        "{ headers : {}, status : 200, content : 'CONTENT', token : updated }}");
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(converter.convertToString(httpApiResponse),
        "{ headers : {}, status : 500, content : 'I AM AN ERROR MESSAGE' }}");
  }
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(converter.convertToString(httpApiResponse),
        "{ headers : {}, status : 200, content : 'CONTENT', metadata : { foo : 'CONTENT' }}");
  }
View Full Code Here

Examples of org.apache.shindig.protocol.RpcHandler

    builder.addHeader("Set-Cookie", "foo=bar; Secure");
    builder.addHeader("Set-Cookie", "name=value");
    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(converter.convertToString(httpApiResponse),
        "{ headers : { 'set-cookie' : ['foo=bar; Secure','name=value'] },"
            + " status : 200, content : 'CONTENT' }");   
View Full Code Here

Examples of org.apache.shindig.protocol.RpcHandler

    httpRequest.setMethod("GET");
    builder.addHeader("Location", "here");
    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(converter.convertToString(httpApiResponse),
        "{ headers : { 'location' : ['here'] },"
            + " status : 200, content : 'CONTENT' }");
View Full Code Here

Examples of org.apache.shindig.protocol.RpcHandler

        + "href:'http://www.example.org/somecontent',"
        + "body:'POSTBODY'"
        + "}}");
    HttpRequest httpRequest = new HttpRequest(Uri.parse("http://www.example.org/somecontent"));
    httpRequest.setMethod("GET");
    RpcHandler operation = registry.getRpcHandler(request);
    try {
      operation.execute(emptyFormItems, token, converter).get();
      fail("Body should not be allowed in GET request");
    } catch (ExecutionException ee) {
      assertTrue(ee.getCause() instanceof ProtocolException);
    }
  }
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.