Package org.apache.shindig.gadgets

Examples of org.apache.shindig.gadgets.Gadget


    String expected = attr + "=\"" + rewritten + "\"";
    testMarkup(markUp, expected);
  }

  private void testMarkup(String markup, String expected, List<String> msgs) throws GadgetException{
    Gadget gadget = makeGadget();
    for (GadgetHtmlParser parser : parsers) {
      MutableContent mc = new MutableContent(parser, markup);
      rewriter.rewrite(gadget, mc);

      String actual = mc.getContent();
View Full Code Here


      }
    }
  }

  private Gadget makeGadget() throws GadgetException {
    Gadget gadget = EasyMock.createNiceMock(Gadget.class);
    GadgetContext context = EasyMock.createNiceMock(GadgetContext.class);

    expect(context.getUrl()).andReturn(Uri.parse("http://example.com/gadget.xml")).anyTimes();
    expect(context.getContainer()).andReturn("cajaContainer").anyTimes();
    expect(context.getDebug()).andReturn(false).anyTimes();

    expect(gadget.getContext()).andReturn(context).anyTimes();
    expect(gadget.getAllFeatures()).andReturn(ImmutableList.of("caja")).anyTimes();
    expect(gadget.requiresCaja()).andReturn(true).anyTimes();

    replay(context, gadget);
    return gadget;
  }
View Full Code Here

         "'gadgets.features':{views:" +
           "{aliased: {aliases: ['some-alias', 'alias']}}" +
         "}}}");

    containerConfig = new JsonContainerConfig(config, Expressions.forTesting());
    Gadget gadget = mock(Gadget.class);
    processor = mock(Processor.class);
    Capture<GadgetContext> context = new Capture<GadgetContext>();
    expect(processor.process(EasyMock.capture(context))).andReturn(gadget).anyTimes();
    ldService = new HashLockedDomainService(containerConfig, false, mock(LockedDomainPrefixGenerator.class));
    handler = new MakeRequestHandler(containerConfig, pipeline, rewriterRegistry, feedProcessorProvider, gadgetAdminStore, processor, ldService);
View Full Code Here

    Map<String, String> prefs = Maps.newHashMap();
    prefs.put(prefKey, prefVal);
    List<String> features = Lists.newArrayList();

    // Make the gadget.
    Gadget gadget = mockGadget(
        SPEC_URI.toString(),
        false,  // not type=url
        false,  // isDebug
        false,  // ignoreCache
        false,  // sanitize
View Full Code Here

    Map<String, String> prefs = Maps.newHashMap();
    prefs.put(prefKey, prefVal);
    List<String> features = Lists.newArrayList();

    // Make the gadget.
    Gadget gadget = mockGadget(
        SPEC_URI.toString(),
        false,  // not type=url
        false,  // isDebug
        false,  // ignoreCache
        false,  // sanitize
View Full Code Here

    Map<String, String> prefs = Maps.newHashMap();
    prefs.put(prefKey, prefVal);
    List<String> features = Lists.newArrayList();

    // Make the gadget.
    Gadget gadget = mockGadget(
        SPEC_URI.toString(),
        false,  // not type=url
        false,  // isDebug
        false,  // ignoreCache
        false,  // sanitize
View Full Code Here

    Map<String, String> prefs = Maps.newHashMap();
    prefs.put(prefKey, prefVal);
    List<String> features = Lists.newArrayList("rpc", "setprefs");

    // Make the gadget.
    Gadget gadget = mockGadget(
        gadgetSite,
        true,   // type=url
        true,   // isDebug
        true,   // ignoreCache
        true,   // sanitize
View Full Code Here

    Map<String, String> prefs = Maps.newHashMap();
    prefs.put(prefKey, prefVal);
    List<String> features = Lists.newArrayList();

    // Make the gadget.
    Gadget gadget = mockGadget(
        gadgetSite,
        true,   // type=url
        true,   // isDebug
        true,   // ignoreCache
        true,   // sanitize
View Full Code Here

    assertTrue(managerTpl.addExtrasCalled());
  }

  @Test
  public void securityTokenAddedWhenGadgetNeedsItFragment() throws Exception {
    Gadget gadget = mockGadget(SECURITY_TOKEN_FEATURE_NAME);
    TestDefaultIframeUriManager manager = makeManager(false, false);
    manager.setTokenForRendering(false);
    Uri result = manager.makeRenderingUri(gadget);
    assertNotNull(result);
    UriBuilder uri = new UriBuilder(result);
View Full Code Here

    assertTrue(manager.tokenForRenderingCalled());
  }

  @Test
  public void securityTokenAddedWhenGadgetNeedsItQuery() throws Exception {
    Gadget gadget = mockGadget(SECURITY_TOKEN_FEATURE_NAME);
    TestDefaultIframeUriManager manager = makeManager(false, false);
    manager.setTokenForRendering(true);
    Uri result = manager.makeRenderingUri(gadget);
    assertNotNull(result);
    UriBuilder uri = new UriBuilder(result);
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.Gadget

Copyright © 2018 www.massapicom. 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.