Package org.apache.shindig.protocol

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


  public void testMetadataOneGadgetFailure() throws Exception {
    registerGadgetsHandler(null);
    JSONObject request = makeMetadataRequest(null, null, GADGET1_URL);
    urlGenerator.throwRandomFault = true;
    RpcHandler operation = registry.getRpcHandler(request);
    Object responseObj = operation.execute(emptyFormItems, token, converter).get();
    JSONObject response = new JSONObject(converter.convertToString(responseObj));

    JSONObject gadget = response.getJSONObject(GADGET1_URL);
    assertEquals(GadgetsHandler.FAILURE_METADATA, gadget.getString("error"));
  }
View Full Code Here


    replay(codec);

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

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

  @Test
  public void testMetadataMultipleGadgets() throws Exception {
    registerGadgetsHandler(null);
    JSONObject request = makeMetadataRequest("en", "US", GADGET1_URL, GADGET2_URL);
    RpcHandler operation = registry.getRpcHandler(request);
    Object responseObj = operation.execute(emptyFormItems, token, converter).get();
    JSONObject response = new JSONObject(converter.convertToString(responseObj));

    JSONObject modulePrefs1 = response.getJSONObject(GADGET1_URL).getJSONObject("modulePrefs");
    assertEquals(FakeProcessor.SPEC_TITLE, modulePrefs1.getString("title"));
View Full Code Here

    registerGadgetsHandler(codec);
    JSONObject request = makeTokenRequest(GADGET1_URL, GADGET2_URL);

    RpcHandler operation = registry.getRpcHandler(request);
    Object responseObj = operation.execute(emptyFormItems, token, converter).get();
    JSONObject response = new JSONObject(converter.convertToString(responseObj));

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

    registerGadgetsHandler(null);
    JSONObject request = makeMetadataRequest("en", "US", GADGET1_URL, GADGET2_URL);
    processor.exceptions.put(FakeProcessor.SPEC_URL2, new ProcessingException("broken",
        HttpServletResponse.SC_BAD_REQUEST));
    RpcHandler operation = registry.getRpcHandler(request);
    Object responseObj = operation.execute(emptyFormItems, token, converter).get();
    JSONObject response = new JSONObject(converter.convertToString(responseObj));

    JSONObject modulePrefs1 = response.getJSONObject(GADGET1_URL).getJSONObject("modulePrefs");
    assertEquals(FakeProcessor.SPEC_TITLE, modulePrefs1.getString("title"));
View Full Code Here

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

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

  public void testMetadataNoContainerRequest() throws Exception {
    registerGadgetsHandler(null);
    JSONObject request = makeMetadataNoContainerRequest(GADGET1_URL);
    RpcHandler operation = registry.getRpcHandler(request);
    try {
      operation.execute(emptyFormItems, authContext, converter).get();
      fail("Missing container");
    } catch (Exception e) {
      assertTrue(e.getMessage().contains("Missing container"));
    }
  }
View Full Code Here

  @Test
  public void testCajaEmptyRequest() 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));
  }

  private CajoledResult cajole(Uri uri, String mime, String content) throws ParseException {
    CajaContentRewriter rw = new CajaContentRewriter(null, null, null, proxyUriManager);
View Full Code Here

                    EasyMock.eq(true), EasyMock.anyBoolean())).andReturn(golden).anyTimes();
    replay();

    JSONObject request = makeCajaRequest(goldenMime, JS_URL.toString());
    RpcHandler operation = registry.getRpcHandler(request);
    Object result = operation.execute(emptyFormItems, authContext, converter).get();

    assertEquals(CONTAINER, containerCapture.getValue());
    assertEquals(JS_URL, uriCapture.getValue());
    assertTrue(mimeCapture.getValue().contains("javascript"));
View Full Code Here

                    EasyMock.eq(true), EasyMock.anyBoolean())).andReturn(golden).anyTimes();
    replay();

    JSONObject request = makeCajaRequest(goldenMime, HTML_URL.toString());
    RpcHandler operation = registry.getRpcHandler(request);
    Object result = operation.execute(emptyFormItems, authContext, converter).get();

    assertEquals(CONTAINER, containerCapture.getValue());
    assertEquals(HTML_URL, uriCapture.getValue());
    assertTrue(mimeCapture.getValue().contains("html"));
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.