Tabnine Logo
Jelly.compileScript
Code IndexAdd Tabnine to your IDE (free)

How to use
compileScript
method
in
org.apache.commons.jelly.Jelly

Best Java code snippets using org.apache.commons.jelly.Jelly.compileScript (Showing top 20 results out of 315)

origin: commons-jelly/commons-jelly

/**
 * A script should fail to parse if it declares tags that don't exist.
 */
public void testNonexistentTags() throws Exception {
  setUp("nonexistentTags1.jelly");
  try {
    Script script = jelly.compileScript();
    fail("Scripts should throw JellyException when it declares a nonexistent tag.");
  } catch (JellyException e) {
  }
}
origin: commons-jelly/commons-jelly

  public void testNamespaceNotDefined() throws Exception {
    Script script = jelly.compileScript();
    script.run(context,xmlOutput);
    assertTrue("should not have set 'usedDefaultNamespace' variable",
          context.getVariable("usedDefaultNamespace") == null);
  }
}
origin: commons-jelly/commons-jelly

public void testInnermost() throws Exception {
  // performs no includes
  setUp("c.jelly");
  Script script = jelly.compileScript();
  script.run(context,xmlOutput);
  assertTrue("should have set 'c' variable to 'true'",
        context.getVariable("c").equals("true"));
}
origin: commons-jelly/commons-jelly

public void testMiddle() throws Exception {
  // performs one include
  setUp("b.jelly");
  Script script = jelly.compileScript();
  script.run(context,xmlOutput);
  assertTrue("should have set 'c' variable to 'true'",
        context.getVariable("c").equals("true"));
  assertTrue("should have set 'b' variable to 'true'",
        context.getVariable("b").equals("true"));
}
origin: commons-jelly/commons-jelly

public void testOutputGood() throws Exception {
  setUpScript("outputGood.jelly");
  Script script = getJelly().compileScript();
  
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  
  script.run(getJellyContext(),XMLOutput.createXMLOutput(bos));
  assertEquals("<html></html>x",bos.toString());
}

origin: commons-jelly/commons-jelly

public void testOutputBad() throws Exception {
  setUpScript("outputBad.jelly");
  Script script = getJelly().compileScript();
  
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  
  script.run(getJellyContext(),XMLOutput.createXMLOutput(bos));
  assertEquals("<html></html>",bos.toString());
}

origin: commons-jelly/commons-jelly

public void testOutermost() throws Exception {
  // performs one nested include
  setUp("a.jelly");
  Script script = jelly.compileScript();
  script.run(context,xmlOutput);
  assertTrue("should have set 'c' variable to 'true'",
        context.getVariable("c").equals("true"));
  assertTrue("should have set 'b' variable to 'true'",
        context.getVariable("b").equals("true"));
  assertTrue("should have set 'a' variable to 'true'",
        context.getVariable("a").equals("true"));
}
origin: commons-jelly/commons-jelly

public void testNamespaceDefined() throws Exception {
  jelly.setDefaultNamespaceURI("jelly:core");
  Script script = jelly.compileScript();
  script.run(context,xmlOutput);
  assertTrue("should have set 'usedDefaultNamespace' variable",
        context.getVariable("usedDefaultNamespace") != null);
}
origin: commons-jelly/commons-jelly

public void testOutputBadGood() throws Exception {
  setUpScript("outputBad.jelly");
  Script script = getJelly().compileScript();
  
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  
  XMLOutput ouput = XMLOutput.createXMLOutput(bos);
  
  script.run(getJellyContext(),ouput);
  ouput.flush();
  assertEquals("<html></html>",bos.toString());
}

origin: commons-jelly/commons-jelly

public void testMultipleDefaults() throws Exception {
  setUpScript("testSwitchTag.jelly");
  Script script = getJelly().compileScript();
  getJellyContext().setVariable("multiple.defaults",new Boolean(true));
  try {
    script.run(getJellyContext(),getXMLOutput());
    fail("Expected JellyException");
  } catch(JellyException e) {
    // expected
  }
}
origin: commons-jelly/commons-jelly

public void testCaseWithoutValue() throws Exception {
  setUpScript("testSwitchTag.jelly");
  Script script = getJelly().compileScript();
  getJellyContext().setVariable("case.without.value",new Boolean(true));
  try {
    script.run(getJellyContext(),getXMLOutput());
    fail("Expected MissingAttributeException");
  } catch(MissingAttributeException e) {
    // expected
  }
}
origin: commons-jelly/commons-jelly

/**
 *  Gets the System property 'java.runtime.version' and compares it with,
 *  well, the same system property
 */
 public void testSimpleSystemInvoke() throws Exception {
  setUpScript( "testInvokeStaticTag.jelly" );
  Script script = getJelly().compileScript();
  getJellyContext().setVariable( "test.simpleSystemInvoke",Boolean.TRUE );
  getJellyContext().setVariable( "propertyName", "java.runtime.version" );
  script.run( getJellyContext(),getXMLOutput() );
  assertTrue( System.getProperty( "java.runtime.version" ).equals( getJellyContext().getVariable("propertyName" ) ) );
}
origin: commons-jelly/commons-jelly

public void testSimpleFileTag() throws Exception
{
  setUpScript("testFileTag.jelly");
  Script script = getJelly().compileScript();
  script.run(getJellyContext(), getXMLOutput());
  String data = (String)getJellyContext().getVariable("testFileTag");
  //FIXME This doesn't take into account attribute ordering
  assertEquals("fully qualified attributes not passed",
      "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"></html>",
      data);
}
origin: commons-jelly/commons-jelly

public void testSimpleBreakTag() throws Exception
{
  setUpScript("testBreakTag.jelly");
  Script script = getJelly().compileScript();
  script.run(getJellyContext(), getXMLOutput());
  String simpleResult = (String) getJellyContext().getVariable("simpleResult");
  assertEquals("simpleResult", "12345", simpleResult);
}
origin: commons-jelly/commons-jelly

public void testConditionalBreakTag() throws Exception
{
  setUpScript("testBreakTag.jelly");
  Script script = getJelly().compileScript();
  script.run(getJellyContext(), getXMLOutput());
  String simpleResult = (String) getJellyContext().getVariable("conditionalResult");
  assertEquals("conditionalResult", "12345", simpleResult);
}
origin: commons-jelly/commons-jelly

public void testVarNoBreakTag() throws Exception
{
  setUpScript("testBreakTag.jelly");
  Script script = getJelly().compileScript();
  script.run(getJellyContext(), getXMLOutput());
  String varNotBroken = (String) getJellyContext().getVariable("varNotBroken");
  assertEquals("varNotBroken", "false", varNotBroken);
}
origin: commons-jelly/commons-jelly

public void testSimpleFileTag() throws Exception
{
  setUpScript("testChooseTag.jelly");
  Script script = getJelly().compileScript();
  script.run(getJellyContext(), getXMLOutput());
  String resultTrue = (String) getJellyContext().getVariable("result.true");
  String resultFalse = (String) getJellyContext().getVariable("result.false");
  assertEquals("result.true", "AC", resultTrue);
  assertEquals("result.false", "BC", resultFalse);
}
origin: commons-jelly/commons-jelly

public void testNewWithNullArg() throws Exception {
  setUpScript("testNewTag.jelly");
  Script script = getJelly().compileScript();
  getJellyContext().setVariable("test.newWithNullArg",Boolean.TRUE);
  script.run(getJellyContext(),getXMLOutput());
  assertNotNull(getJellyContext().getVariable("foo"));
  assertTrue(getJellyContext().getVariable("foo") instanceof Customer);
  Customer customer = (Customer)(getJellyContext().getVariable("foo"));
  assertNull(customer.getName());
}
origin: commons-jelly/commons-jelly

public void testInvokeWithReturnedValueAsArg() throws Exception {
  setUpScript("testInvokeTag.jelly");
  Script script = getJelly().compileScript();
  getJellyContext().setVariable("test.invokeWithReturnedValueAsArg",Boolean.TRUE);
  script.run(getJellyContext(),getXMLOutput());
  assertNotNull(getJellyContext().getVariable("customer"));
  assertTrue(getJellyContext().getVariable("customer") instanceof Customer);
  Customer customer = (Customer)(getJellyContext().getVariable("customer"));
  assertEquals("Jane Doe",customer.getName());
  assertEquals("Chicago",customer.getCity());
}
origin: commons-jelly/commons-jelly

  public void testNewWithUseBeanArg() throws Exception {
    setUpScript("testNewTag.jelly");
    Script script = getJelly().compileScript();
    getJellyContext().setVariable("test.newWithUseBeanArg",Boolean.TRUE);
    script.run(getJellyContext(),getXMLOutput());
    assertNotNull(getJellyContext().getVariable("foo"));
    assertTrue(getJellyContext().getVariable("foo") instanceof Customer);
    Customer customer = (Customer)(getJellyContext().getVariable("foo"));
    assertEquals("Jane Doe",customer.getName());
    assertEquals("Chicago",customer.getCity());
    assertEquals("Location",customer.getLocation());
  }
}
org.apache.commons.jellyJellycompileScript

Javadoc

Compiles the script

Popular methods of Jelly

  • <init>
  • setScript
    Sets the script URL to use as an absolute URL or a relative filename
  • setUrl
    Sets the script URL to use
  • getJellyBuildDate
  • getJellyContext
    The context to use
  • getJellyVersion
  • getRootContext
    Gets the root context
  • getUrl
  • loadJellyProperties
    Attempts to load jelly.properties from the current directory, the users home directory or from the c
  • loadProperties
    Loads the properties from the given input stream
  • readBuildTimestampResource
  • resolveURL
  • readBuildTimestampResource,
  • resolveURL,
  • setDefaultNamespaceURI,
  • setValidateXML

Popular in Java

  • Start an intent from android
  • getContentResolver (Context)
  • compareTo (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • JCheckBox (javax.swing)
  • JList (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now