Examples of GadgetSpec


Examples of org.apache.shindig.gadgets.spec.GadgetSpec

  public void signedPreloads() throws Exception {
    String xml =
        "<Module><ModulePrefs title=''>" +
        " <Preload href='" + PRELOAD_HREF + "' authz='signed' sign_viewer='false'/>" +
        "</ModulePrefs><Content/></Module>";
    GadgetSpec spec = new GadgetSpec(GADGET_URL, xml);
    Preloader preloader = new HttpPreloader(requestPipeline);

    Gadget gadget = new Gadget()
        .setContext(context)
        .setSpec(spec)
        .setCurrentView(spec.getView(GadgetSpec.DEFAULT_VIEW));
    Collection<Callable<PreloadedData>> preloaded =
        preloader.createPreloadTasks(gadget);

    assertEquals(1, preloaded.size());
    PreloadedData data = preloaded.iterator().next().call();
View Full Code Here

Examples of org.apache.shindig.gadgets.spec.GadgetSpec

    String xml =
        "<Module><ModulePrefs title=''>" +
        // This is kind of a bogus test since oauth params aren't set.
        " <Preload href='" + PRELOAD_HREF + "' authz='oauth'/>" +
        "</ModulePrefs><Content/></Module>";
    GadgetSpec spec = new GadgetSpec(GADGET_URL, xml);
    Preloader preloader = new HttpPreloader(requestPipeline);

    Gadget gadget = new Gadget()
        .setContext(context)
        .setSpec(spec)
        .setCurrentView(spec.getView(GadgetSpec.DEFAULT_VIEW));
    Collection<Callable<PreloadedData>> preloaded = preloader.createPreloadTasks(
        gadget);

    assertEquals(1, preloaded.size());
    PreloadedData data = preloaded.iterator().next().call();
View Full Code Here

Examples of org.apache.shindig.gadgets.spec.GadgetSpec

    String xml =
        "<Module><ModulePrefs title=''>" +
        " <Preload href='" + PRELOAD_HREF + "'/>" +
        " <Preload href='" + PRELOAD_HREF2 + "'/>" +
        "</ModulePrefs><Content/></Module>";
    GadgetSpec spec = new GadgetSpec(GADGET_URL, xml);
    Preloader preloader = new HttpPreloader(requestPipeline);

    Gadget gadget = new Gadget()
        .setContext(context)
        .setSpec(spec)
        .setCurrentView(spec.getView(GadgetSpec.DEFAULT_VIEW));
    Collection<Callable<PreloadedData>> preloaded = preloader.createPreloadTasks(
        gadget);

    assertEquals(2, preloaded.size());
    List<Object> list = getAll(preloaded);
View Full Code Here

Examples of org.apache.shindig.gadgets.spec.GadgetSpec

    String xml =
        "<Module><ModulePrefs title=''>" +
        " <Preload href='" + PRELOAD_HREF + "' views='foo,bar,baz'/>" +
        " <Preload href='" + PRELOAD_HREF2 + "' views='bar'/>" +
        "</ModulePrefs><Content/></Module>";
    GadgetSpec spec = new GadgetSpec(GADGET_URL, xml);
    Preloader preloader = new HttpPreloader(requestPipeline);

    view = "foo";

    Gadget gadget = new Gadget()
        .setContext(context)
        .setSpec(spec)
        .setCurrentView(spec.getView(GadgetSpec.DEFAULT_VIEW));
    Collection<Callable<PreloadedData>> preloaded
        = preloader.createPreloadTasks(gadget);

    List<Object> list = getAll(preloaded);
    assertEquals(1, list.size());
View Full Code Here

Examples of org.apache.shindig.gadgets.spec.GadgetSpec

      if (exception != null) {
        throw exception;
      }

      try {
        GadgetSpec spec = new GadgetSpec(Uri.parse("#"), gadgets.get(context.getUrl()));
        View view = spec.getView(context.getView());
        return new Gadget()
            .setContext(context)
            .setSpec(spec)
            .setCurrentView(view);
      } catch (GadgetException e) {
View Full Code Here

Examples of org.apache.shindig.gadgets.spec.GadgetSpec

    public Gadget process(GadgetContext context) throws ProcessingException {
      if (exception != null) {
        throw exception;
      }
      try {
        GadgetSpec spec = new GadgetSpec(SPEC_URL, GADGET);
        View view = spec.getView(context.getView());
        return new Gadget()
            .setContext(context)
            .setSpec(spec)
            .setCurrentView(view);
      } catch (GadgetException e) {
View Full Code Here

Examples of org.apache.shindig.gadgets.spec.GadgetSpec

  private final FakeProxyRenderer proxyRenderer = new FakeProxyRenderer();
  private final CaptureRewriter captureRewriter = new CaptureRewriter();
  private HtmlRenderer renderer;

  private Gadget makeGadget(String content) throws GadgetException {
    GadgetSpec spec = new GadgetSpec(SPEC_URL,
        "<Module><ModulePrefs title=''/><Content><![CDATA[" + content + "]]></Content></Module>");

    return new Gadget()
        .setSpec(spec)
        .setContext(CONTEXT)
        .setCurrentView(spec.getView("default"));
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.spec.GadgetSpec

    EasyMock.replay(containerConfig);
  }

  @Test
  public void testSocialPreload() throws Exception {
    GadgetSpec spec = new GadgetSpec(GADGET_URL, XML);

    String socialResult = "[{id:'p', data:1}, {id:'a', data:2}]";
    RecordingRequestPipeline pipeline = new RecordingRequestPipeline(socialResult);
    PipelinedDataPreloader preloader = new PipelinedDataPreloader(pipeline, containerConfig);

    view = "profile";
    contextParams.put("st", "token");

    Gadget gadget = new Gadget()
        .setContext(context)
        .setSpec(spec)
        .setCurrentView(spec.getView("profile"));

    PipelinedData.Batch batch = getBatch(gadget);
    Collection<Callable<PreloadedData>> tasks = preloader.createPreloadTasks(
        context, batch);
    assertEquals(1, tasks.size());
View Full Code Here

Examples of org.apache.shindig.gadgets.spec.GadgetSpec

    assertTrue(request.getContentType().startsWith("application/json"));
  }

  @Test
  public void testSocialPreloadWithBatchError() throws Exception {
    GadgetSpec spec = new GadgetSpec(GADGET_URL, XML);

    String socialResult = "{code: 401, message: 'unauthorized'}";
    RecordingRequestPipeline pipeline = new RecordingRequestPipeline(socialResult);
    PipelinedDataPreloader preloader = new PipelinedDataPreloader(pipeline, containerConfig);

    view = "profile";
    contextParams.put("st", "token");

    Gadget gadget = new Gadget()
        .setContext(context)
        .setSpec(spec)
        .setCurrentView(spec.getView("profile"));

    PipelinedData.Batch batch = getBatch(gadget);
    Collection<Callable<PreloadedData>> tasks = preloader.createPreloadTasks(
        context, batch);
    assertEquals(1, tasks.size());
View Full Code Here

Examples of org.apache.shindig.gadgets.spec.GadgetSpec

    JsonAssert.assertJsonEquals(resultWithKeyP.toString(), resultsById.get("p"));
  }

  @Test
  public void testSocialPreloadWithHttpError() throws Exception {
    GadgetSpec spec = new GadgetSpec(GADGET_URL, XML);

    HttpResponse httpError = new HttpResponseBuilder()
        .setHttpStatusCode(HttpResponse.SC_INTERNAL_SERVER_ERROR)
        .create();
    RecordingRequestPipeline pipeline = new RecordingRequestPipeline(httpError);
    PipelinedDataPreloader preloader = new PipelinedDataPreloader(pipeline, containerConfig);

    view = "profile";
    contextParams.put("st", "token");

    Gadget gadget = new Gadget()
        .setContext(context)
        .setSpec(spec)
        .setCurrentView(spec.getView("profile"));

    PipelinedData.Batch batch = getBatch(gadget);
    Collection<Callable<PreloadedData>> tasks = preloader.createPreloadTasks(
        context, batch);
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.