Package org.apache.shindig.gadgets

Examples of org.apache.shindig.gadgets.Gadget


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

    Gadget gadget = makeGadgetWithSpec(gadgetXml);

    expectFeatureCalls(gadget,
        ImmutableList.of(inline("foo_content();", "foo_content_debug();")),
        ImmutableSet.<String>of(),
        ImmutableList.<FeatureResource>of());
View Full Code Here


        }
        return null;
      }
    };

    Gadget gadget = makeGadgetWithSpec(gadgetXml).setContext(context);

    expectFeatureCalls(gadget,
        ImmutableList.of(inline("foo_content();", "foo_content_debug();"),
                         extern("http://example.org/external.js", "dbg")),
        ImmutableSet.of("baz"),
View Full Code Here

        rewritten.contains("<script src=\"http://example.org/external.js\">"));
  }

  @Test(expected = RewritingException.class)
  public void exceptionWhenFeatureNotAllowed() throws Exception {
    Gadget gadget = makeDefaultGadget();
    reset(gadgetAdminStore);
    expect(gadgetAdminStore.checkFeatureAdminInfo(isA(Gadget.class))).andReturn(false);
    replay(gadgetAdminStore);
    rewrite(gadget, BODY_CONTENT);
  }
View Full Code Here

        }
        return null;
      }
    };

    Gadget gadget = makeGadgetWithSpec(gadgetXml).setContext(context);
    FeatureResource fooResource = inline("foo-content", "foo-debug");
    expectFeatureCalls(gadget,
        ImmutableList.of(fooResource),
        libs,
        ImmutableList.of(fooResource, inline("bar-c", "bar-d"), inline("baz-c", "baz-d")));
View Full Code Here

        }
        return null;
      }
    };

    Gadget gadget = makeGadgetWithSpec(gadgetXml).setContext(context);
    reset(gadgetAdminStore);
    Feature denied = mock(Feature.class);
    expect(denied.getName()).andReturn("hello");
    expect(gadgetAdminStore.checkFeatureAdminInfo(isA(Gadget.class))).andReturn(true);
    expect(gadgetAdminStore.isAllowedFeature(eq(denied), isA(Gadget.class))).andReturn(false);
View Full Code Here

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

    Gadget gadget = makeGadgetWithSpec(gadgetXml);

    expectFeatureCalls(gadget,
        ImmutableList.of(inline("foo", "dbg")),
        ImmutableSet.<String>of(),
        ImmutableList.<FeatureResource>of());
View Full Code Here

        }
        return null;
      }
    };

    Gadget gadget = makeGadgetWithSpec(gadgetXml).setContext(context);

    expectFeatureCalls(gadget,
        ImmutableList.of(inline("foo", "foo-dbg")),
        ImmutableSet.of("bar"),
        ImmutableList.of(inline("bar", "bar-dbg")));
View Full Code Here

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

    Gadget gadget = makeGadgetWithSpec(gadgetXml);

    expectFeatureCalls(gadget,
        ImmutableList.of(inline("foo", "foo-dbg"), inline("foo2", "foo2-dbg")),
        ImmutableSet.<String>of(),
        ImmutableList.<FeatureResource>of());
View Full Code Here

      "<UserPref name='pref_one' default_value='default_one'/>" +
      "<UserPref name='pref_two'/>" +
      "<Content type='html'/>" +
      "</Module>";

    Gadget gadget = makeGadgetWithSpec(gadgetXml);

    String rewritten = rewrite(gadget, "");

    Pattern prefsPattern
        = Pattern.compile("(?:.*)gadgets\\.Prefs\\.setMessages_\\((.*)\\);(?:.*)", Pattern.DOTALL);
View Full Code Here

        "\"contentUrl\":\"http://foo.com/bar/baz.html\"" +
        (auth == null ? "" : ",\"authorization\":\"" + auth + '\"') +
        (oauthToken == null ? "" : ",\"oauthTokenName\":\"tokenName\"") +
        '}';

    Gadget gadget = makeGadgetWithSpec(gadgetXml);
    gadget.setCurrentView(gadget.getSpec().getView("default"));
    String rewritten = rewrite(gadget, BODY_CONTENT);

    assertXhrConfigContains(message, expected, rewritten);
  }
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.