Examples of GadgetContext


Examples of org.apache.shindig.gadgets.GadgetContext

    HttpResponse response = new HttpResponse(PROXIED_HTML_CONTENT);

    pipeline.plainResponses.put(resolved, response);

    Gadget gadget = makeHrefGadget("none");
    gadget.setContext(new GadgetContext(gadget.getContext()) {
      @Override
      public String getParameter(String name) {
        return name.equals(HtmlRenderer.PATH_PARAM) ? relative.toString() : null;
      }
    });
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

    HttpRequest request = new HttpRequest(EXPECTED_PROXIED_HTML_HREF);
    HttpResponse response = new HttpResponse(PROXIED_HTML_CONTENT);
    pipeline.plainResponses.put(EXPECTED_PROXIED_HTML_HREF, response);

    Gadget gadget = makeHrefGadget("none");
    gadget.setContext(new GadgetContext(gadget.getContext()) {
      @Override
      public String getParameter(String name) {
        return name.equals(HtmlRenderer.PATH_PARAM) ? "$(^)$" : null;
      }
    });
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

    UriBuilder uri = new UriBuilder(PROXIED_HTML_HREF);
    uri.putQueryParameter("lang", "foo");
    uri.putQueryParameter("country", "BAR");

    Gadget gadget = makeHrefGadget("none");
    gadget.setContext(new GadgetContext() {
      @Override
      public Locale getLocale() {
        return new Locale("foo", "BAR");
      }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

    containerConfig = new FakeContainerConfig();
    renderer = new Renderer(processor, htmlRenderer, containerConfig, lockedDomainService);
  }

  private GadgetContext makeContext(final String view) {
    return new GadgetContext() {
      @Override
      public String getView() {
        return view;
      }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

public class VariableSubstituterTest {
  private final FakeMessageBundleFactory messageBundleFactory = new FakeMessageBundleFactory();
  private final VariableSubstituter substituter = new VariableSubstituter(messageBundleFactory);

  private GadgetSpec substitute(String xml) throws Exception {
    return substituter.substitute(new GadgetContext(), new GadgetSpec(Uri.parse("#"), xml));
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

                 "<ModulePrefs title='I heart __UP_foo__'/>" +
                 "<UserPref name='foo'/>" +
                 "<Content/>" +
                 "</Module>";
    GadgetSpec spec = new GadgetSpec(Uri.parse("#"), xml);
    GadgetContext context = new GadgetContext() {
      @Override
      public UserPrefs getUserPrefs() {
        return new UserPrefs(ImmutableMap.of("foo", "shindig"));
      }
    };
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

public class HttpGadgetContextTest extends ServletTestFixture {
  public void testIgnoreCacheParam() {
    expect(request.getParameter("nocache")).andReturn(Integer.toString(Integer.MAX_VALUE));
    replay();
    GadgetContext context = new HttpGadgetContext(request);
    assertTrue(context.getIgnoreCache());
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

    JSONObject context = new JSONObject()
        .put("language", Locale.US.getLanguage())
        .put("country", Locale.US.getCountry().toUpperCase())
        .put("context-field", "context-value");

    GadgetContext jsonContext = new JsonRpcGadgetContext(context, gadget);
    assertEquals(SPEC_URL, jsonContext.getUrl().toString());
    assertEquals(SPEC_ID, jsonContext.getModuleId());
    assertEquals(Locale.US.getLanguage(),
                 jsonContext.getLocale().getLanguage());
    assertEquals(Locale.US.getCountry(), jsonContext.getLocale().getCountry());

    for (String key : PREF_KEYS) {
      String value = jsonContext.getUserPrefs().getPref(key);
      assertEquals(prefs.get(key), value);
    }

    assertEquals("gadget-value", jsonContext.getParameter("gadget-field"));
    assertEquals("context-value", jsonContext.getParameter("context-field"));
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

        .append("</head><body").append(bodyAttr).append('>')
        .append(body)
        .append("</body></html>")
        .toString();

    GadgetContext context = new GadgetContext() {
      @Override
      public String getParameter(String name) {
        if (name.equals("libs")) {
          return "foo";
        }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

      "</ModulePrefs>" +
      "<Content type='html'/>" +
      "</Module>";

    final Collection<String> libs = Arrays.asList("foo", "bar", "baz");
    GadgetContext context = new GadgetContext() {
      @Override
      public String getParameter(String name) {
        if (name.equals("libs")) {
          return Join.join(":", libs);
        }
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.