Examples of Substitutions


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

  @Test
  public void testContentSubstitution() throws Exception {
    String xml
        = "<Content type=\"html\">Hello, __MSG_world__ __MODULE_ID__</Content>";

    Substitutions substituter = new Substitutions();
    substituter.addSubstitution(Type.MESSAGE, "world", "foo __UP_planet____BIDI_START_EDGE__");
    substituter.addSubstitution(Type.USER_PREF, "planet", "Earth");
    substituter.addSubstitution(Type.BIDI, "START_EDGE", "right");
    substituter.addSubstitution(Type.MODULE, "ID", "3");

    View view = new View("test",
        Arrays.asList(XmlUtil.parse(xml)), SPEC_URL).substitute(substituter);
    assertEquals("Hello, foo Earthright 3", view.getContent());
  }
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.