Package org.apache.shindig.protocol

Examples of org.apache.shindig.protocol.RpcHandler.execute()


  @Test
  public void testCajaES53Request() throws Exception {
    registerGadgetsHandler(null);
    JSONObject request = makeCajaRequest(null);
    RpcHandler operation = registry.getRpcHandler(request);
    Object empty = operation.execute(emptyFormItems, authContext, converter).get();
    JsonAssert.assertJsonEquals("{}", converter.convertToString(empty));
  }

  @Test
  public void testGetRenderingType() throws Exception {
View Full Code Here


  @Test
  public void testTokenEmptyRequest() throws Exception {
    registerGadgetsHandler(null);
    JSONObject request = makeTokenRequest();
    RpcHandler operation = registry.getRpcHandler(request);
    Object empty = operation.execute(emptyFormItems, authContext, converter).get();
    JsonAssert.assertJsonEquals("{}", converter.convertToString(empty));
  }

  @Test
  public void testMetadataInvalidUrl() throws Exception {
View Full Code Here

  public void testMetadataInvalidUrl() throws Exception {
    registerGadgetsHandler(null);
    String badUrl = "[moo]";
    JSONObject request = makeMetadataRequest(null, null, null, badUrl);
    RpcHandler operation = registry.getRpcHandler(request);
    Object responseObj = operation.execute(emptyFormItems, authContext, converter).get();
    JSONObject response = new JSONObject(converter.convertToString(responseObj));
    JSONObject gadget = response.getJSONObject(badUrl);
    assertEquals("Bad url - " + badUrl, gadget.getJSONObject("error").getString("message"));
    assertEquals(400, gadget.getJSONObject("error").getInt("code"));
  }
View Full Code Here

  public void testTokenInvalidUrl() throws Exception {
    registerGadgetsHandler(null);
    String badUrl = "[moo]";
    JSONObject request = makeTokenRequest(badUrl);
    RpcHandler operation = registry.getRpcHandler(request);
    Object responseObj = operation.execute(emptyFormItems, authContext, converter).get();
    JSONObject response = new JSONObject(converter.convertToString(responseObj));
    JSONObject gadget = response.getJSONObject(badUrl);
    assertEquals("Bad url - " + badUrl, gadget.getJSONObject("error").getString("message"));
    assertEquals(400, gadget.getJSONObject("error").getInt("code"));
  }
View Full Code Here

    registerGadgetsHandler(null);
    setupGadgetAdminStore();
    setupMockRegistry(Lists.newArrayList("core"));
    JSONObject request = makeMetadataRequest(null, null, null, GADGET1_URL);
    RpcHandler operation = registry.getRpcHandler(request);
    Object responseObj = operation.execute(emptyFormItems, authContext, converter).get();
    JSONObject response = new JSONObject(converter.convertToString(responseObj));

    JSONObject gadget = response.getJSONObject(GADGET1_URL);
    JSONObject iframeUrls = gadget.getJSONObject("iframeUrls");
    assertEquals(FakeIframeUriManager.DEFAULT_IFRAME_URI.toString(),
View Full Code Here

    registerGadgetsHandler(codec);
    setupGadgetAdminStore();
    setupMockRegistry(Lists.newArrayList("core"));
    JSONObject request = makeMetadataRequest(null, null, new String[]{"tokenTTL", "iframeurl"}, GADGET1_URL);
    RpcHandler operation = registry.getRpcHandler(request);
    Object responseObj = operation.execute(emptyFormItems, authContext, converter).get();
    JSONObject response = new JSONObject(converter.convertToString(responseObj));

    assertEquals(42, response.getJSONObject(FakeProcessor.SPEC_URL.toString()).getInt("tokenTTL"));
  }
View Full Code Here

    registerGadgetsHandler(null);
    setupGadgetAdminStore();
    setupMockRegistry(Lists.newArrayList("core"));
    JSONObject request = makeMetadataRequest(null, null, null, GADGET1_URL);
    RpcHandler operation = registry.getRpcHandler(request);
    Object responseObj = operation.execute(emptyFormItems, authContext, converter).get();
    JSONObject response = new JSONObject(converter.convertToString(responseObj));

    assertFalse(response.getJSONObject(FakeProcessor.SPEC_URL.toString()).has("tokenTTL"));
  }
View Full Code Here

    setupGadgetAdminStore();
    setupMockRegistry(Lists.newArrayList("core"));
    JSONObject request = makeMetadataRequest(null, null, new String[] { "rpcServiceIds" },
            GADGET1_URL);
    RpcHandler operation = registry.getRpcHandler(request);
    Object responseObj = operation.execute(emptyFormItems, authContext, converter).get();
    JSONObject response = new JSONObject(converter.convertToString(responseObj));

    JSONObject gadget = response.getJSONObject(GADGET1_URL);

    JSONArray rpcServiceIds = gadget.getJSONArray("rpcServiceIds");
View Full Code Here

    replay(codec);

    registerGadgetsHandler(codec);
    JSONObject request = makeTokenRequest(GADGET1_URL);
    RpcHandler operation = registry.getRpcHandler(request);
    Object responseObj = operation.execute(emptyFormItems, authContext, converter).get();
    JSONObject response = new JSONObject(converter.convertToString(responseObj));

    JSONObject gadget = response.getJSONObject(GADGET1_URL);
    assertEquals(TOKEN, gadget.getString("token"));
    assertFalse(gadget.has("error"));
View Full Code Here

    replay();

    JSONObject request = makeMetadataRequest(null, null, null, GADGET1_URL);
    urlGenerator.throwRandomFault = true;
    RpcHandler operation = registry.getRpcHandler(request);
    Object responseObj = operation.execute(emptyFormItems, authContext, converter).get();
    JSONObject response = new JSONObject(converter.convertToString(responseObj));

    JSONObject gadget = response.getJSONObject(GADGET1_URL);
    assertEquals(GadgetsHandler.FAILURE_METADATA, gadget.getJSONObject("error")
            .getString("message"));
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.