Package org.apache.shindig.gadgets.variables

Examples of org.apache.shindig.gadgets.variables.Substitutions


  @Test
  public void relativeSubstitutionsOk() throws Exception {
    String xml = "<Preload href='__MSG_preload__'/>";

    Preload preload = new Preload(XmlUtil.parse(xml), SPEC_URL);
    Substitutions substituter = new Substitutions();
    substituter.addSubstitution(Substitutions.Type.MESSAGE, "preload", "relative");
    Preload substituted = preload.substitute(substituter);

    assertEquals(SPEC_URL.resolve(Uri.parse("relative")), substituted.getHref());
  }
View Full Code Here


  @Test
  public void arbitraryAttributes() throws Exception {
    String xml = "<Preload href='" + HREF + "' foo='bar' yo='momma' sub='__MSG_preload__'/>";

    Preload preload = new Preload(XmlUtil.parse(xml), SPEC_URL);
    Substitutions substituter = new Substitutions();
    substituter.addSubstitution(Substitutions.Type.MESSAGE, "preload", "stuff");
    Preload substituted = preload.substitute(substituter);
    assertEquals("bar", substituted.getAttributes().get("foo"));
    assertEquals("momma", substituted.getAttributes().get("yo"));
    assertEquals("stuff", substituted.getAttributes().get("sub"));
  }
View Full Code Here

        BidiSubstituter.RIGHT, BidiSubstituter.LTR, BidiSubstituter.RTL);
  }

  private void assertSubstitutions(String direction,
      String startEdge, String endEdge, String dir, String reverseDir) {
    Substitutions substitutions = new Substitutions();
    BidiSubstituter.addSubstitutions(substitutions, direction);

    assertEquals(startEdge, substitutions.getSubstitution(
        Substitutions.Type.BIDI, BidiSubstituter.START_EDGE));
    assertEquals(endEdge, substitutions.getSubstitution(
        Substitutions.Type.BIDI, BidiSubstituter.END_EDGE));
    assertEquals(dir, substitutions.getSubstitution(
        Substitutions.Type.BIDI, BidiSubstituter.DIR));
    assertEquals(reverseDir, substitutions.getSubstitution(
        Substitutions.Type.BIDI, BidiSubstituter.REVERSE_DIR));
  }
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.variables.Substitutions

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.