Package org.apache.shindig.gadgets.spec

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


        "    <msg name='bar'>baz</msg>" +
        "  </Locale>" +
        "</ModulePrefs>" +
        "<Content>__MSG_foo__ - __MSG_bar__</Content>" +
        "</Module>";
    GadgetSpec spec = substitute(xml);

    assertEquals("bar - baz", spec.getView("default").getContent());
  }
View Full Code Here


  }

  @Test
  public void bidiSubstituted() throws Exception {
    String xml = "<Module><ModulePrefs title='__BIDI_END_EDGE__ way'/><Content/></Module>";
    GadgetSpec spec = substitute(xml);

    assertEquals("right way", spec.getModulePrefs().getTitle());
  }
View Full Code Here

  }

  @Test
  public void moduleIdSubstituted() throws Exception {
    String xml = "<Module><ModulePrefs title='Module is: __MODULE_ID__'/><Content/></Module>";
    GadgetSpec spec = substitute(xml);

    assertEquals("Module is: 0", spec.getModulePrefs().getTitle());
  }
View Full Code Here

    String xml = "<Module>" +
                 "<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"));
      }
    };

    spec = substituter.substitute(context, spec);

    assertEquals("I heart shindig", spec.getModulePrefs().getTitle());
  }
View Full Code Here

    Injector injector = Guice.createInjector(new ParseModule(), new PropertiesModule());
    parser = injector.getInstance(GadgetHtmlParser.class);
  }

  private Gadget makeGadgetWithSpec(String gadgetXml) throws GadgetException {
    GadgetSpec spec = new GadgetSpec(SPEC_URL, gadgetXml);
    return new Gadget()
        .setContext(context)
        .setPreloads(ImmutableList.<PreloadedData>of())
        .setSpec(spec);
  }
View Full Code Here

    rewriter = new PipelineDataGadgetRewriter(new PipelineExecutor(preloader, preloaderService,
        Expressions.forTesting()));
  }

  private void setupGadget(String gadgetXml) throws SpecParserException {
    gadgetSpec = new GadgetSpec(GADGET_URI, gadgetXml);
    gadget = new Gadget();
    gadget.setSpec(gadgetSpec);
    gadget.setContext(new GadgetContext() {});
    gadget.setCurrentView(gadgetSpec.getView("default"));
View Full Code Here

                 "      <Param name=\"include-tags\">" + StringUtils.join(tags, ",") + "</Param>\n" +
                 "</Optional>" +
                 "</ModulePrefs>" +
                 "<Content type=\"html\">Hello!</Content>" +
                 "</Module>";
    return new GadgetSpec(SPEC_URL, xml);
  }
View Full Code Here

    String xml = "<Module>" +
                 "<ModulePrefs title=\"title\">" +
                 "</ModulePrefs>" +
                 "<Content type=\"html\">Hello!</Content>" +
                 "</Module>";
    return new GadgetSpec(SPEC_URL, xml);
  }
View Full Code Here

  MutableContent rewriteContent(GadgetRewriter rewriter, String s, final String container)
      throws Exception {
    MutableContent mc = new MutableContent(parser, s);

    GadgetSpec spec = new GadgetSpec(SPEC_URL,
        "<Module><ModulePrefs title=''/><Content><![CDATA[" + s + "]]></Content></Module>");

    GadgetContext context = new GadgetContext() {
      @Override
      public Uri getUrl() {
View Full Code Here

  private OAuth2SpecInfo lookupSpecInfo(final SecurityToken securityToken,
      final OAuth2Arguments arguments, final Uri gadgetUri) throws OAuth2RequestException {
    log.entering(CLASS, "lookupSpecInfo", new Object[] { securityToken, arguments, gadgetUri });

    final GadgetSpec spec = this.findSpec(securityToken, arguments, gadgetUri);
    final OAuth2Spec oauthSpec = spec.getModulePrefs().getOAuth2Spec();
    if (oauthSpec == null) {
      throw new OAuth2RequestException(OAuth2Error.LOOKUP_SPEC_PROBLEM,
          "Failed to retrieve OAuth URLs, spec for gadget " + securityToken.getAppUrl()
          + " does not contain OAuth element.", null);
    }
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.spec.GadgetSpec

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.