Examples of GadgetContext


Examples of org.apache.shindig.gadgets.GadgetContext

  private void expectFeatureCalls(Gadget gadget,
                                  List<FeatureResource> gadgetResources,
                                  Set<String> externLibs,
                                  List<FeatureResource> externResources) {
    reset(featureRegistry);
    GadgetContext gadgetContext = gadget.getContext();
    List<String> gadgetFeatures = Lists.newLinkedList(gadget.getDirectFeatureDeps());
    List<String> allFeatures = Lists.newLinkedList(gadgetFeatures);
    List<String> allFeaturesAndLibs = Lists.newLinkedList(gadgetFeatures);
    allFeaturesAndLibs.addAll(externLibs);
    List<String> allRequiredFeatures = Lists.newLinkedList(getAllRequiredFeatures(gadget));
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

    containerConfig = new JsonContainerConfig(config, Expressions.forTesting());
    processor = new Processor(gadgetSpecFactory, substituter, containerConfig, blacklist, null);
  }

  private GadgetContext makeContext(final String view, final Uri specUrl) {
    return new GadgetContext() {
      @Override
      public Uri getUrl() {
        if (specUrl == null) {
          return null;
        }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

 
  private void setupGadget(String gadgetXml) throws SpecParserException, JSONException {
    gadgetSpec = new GadgetSpec(GADGET_URI, gadgetXml);
    gadget = new Gadget();
    gadget.setSpec(gadgetSpec);
    gadget.setContext(new GadgetContext() {

      @Override
      public Uri getUrl() {
        return GADGET_URI;
      }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

  public void testLocale() {
    expect(request.getParameter("lang")).andReturn(Locale.CHINA.getLanguage());
    expect(request.getParameter("country")).andReturn(Locale.CHINA.getCountry());
    replay();
    GadgetContext context = new HttpGadgetContext(request);
    assertEquals(Locale.CHINA, context.getLocale());
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

  }

  public void testDebug() {
    expect(request.getParameter("debug")).andReturn("1");
    replay();
    GadgetContext context = new HttpGadgetContext(request);
    assertTrue(context.getDebug());
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

  }

  public void testGetParameter() {
    expect(request.getParameter("foo")).andReturn("bar");
    replay();
    GadgetContext context = new HttpGadgetContext(request);
    assertEquals("bar", context.getParameter("foo"));
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

  }

  public void testGetHost() {
    expect(request.getHeader("Host")).andReturn("foo.org");
    replay();
    GadgetContext context = new HttpGadgetContext(request);
    assertEquals("foo.org", context.getHost());
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

  }

  public void testGetUserIp() {
    expect(request.getRemoteAddr()).andReturn("2.3.4.5");
    replay();
    GadgetContext context = new HttpGadgetContext(request);
    assertEquals("2.3.4.5", context.getUserIp());
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

  public void testGetSecurityToken() throws Exception {
    SecurityToken expected = new AnonymousSecurityToken();
    expect(request.getAttribute(AuthInfo.Attribute.SECURITY_TOKEN.getId())).andReturn(expected);
    replay();
    GadgetContext context = new HttpGadgetContext(request);
    assertEquals(expected, context.getToken());
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

    processor = new DefaultTemplateProcessor(expressions);
    resolver = new RootELResolver();
    parser = new SocialMarkupHtmlParser(new ParseModule.DOMImplementationProvider().get());
    Gadget gadget = new Gadget();
    gadget.setContext(new GadgetContext());
    context = new TemplateContext(gadget, variables);
   
    addVariable("foo", new JSONObject("{ title: 'bar' }"));
  }
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.