Examples of RuntimeInstance


Examples of org.apache.velocity.runtime.RuntimeInstance

        initVelocityRuntime();
    }

    private static void initVelocityRuntime() {
        // init static velocity engine
        sharedRuntime = new RuntimeInstance();

        // set null logger
        sharedRuntime.addProperty(
                RuntimeConstants.RUNTIME_LOG_LOGSYSTEM,
                new NullLogSystem());
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

  private VelocityUtils() {
  }

  public static RuntimeServices newRuntime() {
    try {
      RuntimeInstance runtime = new RuntimeInstance();
      runtime.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new SLF4JLogChute());
      runtime.setProperty(RuntimeConstants.RUNTIME_REFERENCES_STRICT, true);
      runtime.init();
      return runtime;
    } catch (Exception e) {
      throw new NotifyRuntimeException("failed to init velocity runtime", e);
    }
  }
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

  private VelocityUtils() {
  }

  public static RuntimeServices newRuntime() {
    try {
      RuntimeInstance runtime = new RuntimeInstance();
      runtime.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new SLF4JLogChute());
      runtime.setProperty(RuntimeConstants.RUNTIME_REFERENCES_STRICT, true);
      runtime.init();
      return runtime;
    } catch (Exception e) {
      throw new NotifyRuntimeException("failed to init velocity runtime", e);
    }
  }
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

        assertContextValue("b", "b");
    }

    public void testLocalscopePutDoesntLeakButGetDoes()
    {
        RuntimeInstance instance = new RuntimeInstance();
        instance.setProperty(RuntimeConstants.VM_CONTEXT_LOCALSCOPE, Boolean.TRUE);
        instance.init();

        VelocityContext base = new VelocityContext();
        base.put("outsideVar", "value1");

        ProxyVMContext vm =
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

public class EvaluateContextTestCase extends TestCase
{
    public void testLocalscopePutDoesntLeakButGetDoes()
    throws Exception
    {
        RuntimeInstance instance;
       
        instance = new RuntimeInstance();
        instance.setProperty(RuntimeConstants.EVALUATE_CONTEXT_CLASS, VelocityContext.class.getName());
        instance.init();

        VelocityContext base = new VelocityContext();
        base.put("outsideVar", "value1");

        EvaluateContext evc = new EvaluateContext(new InternalContextAdapterImpl(base), instance);
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

     * @throws Exception
     */
    public void testSetLocalContext()
    throws Exception
    {
        RuntimeInstance instance = new RuntimeInstance();
        instance.setProperty(RuntimeConstants.EVALUATE_CONTEXT_CLASS, TestContext.class.getName());
        instance.init();

        VelocityContext base = new VelocityContext();
        base.put("outsideVar", "value1");
        EvaluateContext evc = new EvaluateContext(new InternalContextAdapterImpl(base), instance);

View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

        VelocityContext base = new VelocityContext();

        try
        {
            // initialize with bad class name
            RuntimeInstance instance = new RuntimeInstance();
            instance.setProperty(RuntimeConstants.EVALUATE_CONTEXT_CLASS, "org.apache");
            instance.init();
            EvaluateContext evc = new EvaluateContext(new InternalContextAdapterImpl(base), instance);
            fail ("Expected an exception");
        }
        catch (Exception e) {}
       
        try
        {
            // initialize with class not implementing Context
            RuntimeInstance instance = new RuntimeInstance();
            instance.setProperty(RuntimeConstants.EVALUATE_CONTEXT_CLASS, org.apache.velocity.test.EvaluateContextTestCase.class.getName());
            instance.init();
            EvaluateContext evc = new EvaluateContext(new InternalContextAdapterImpl(base), instance);
            fail ("Expected an exception");
        }
        catch (Exception e) {}
    }      
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

  private VelocityUtils() {
  }

  public static RuntimeServices newRuntime() {
    try {
      RuntimeInstance runtime = new RuntimeInstance();
      runtime.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new SLF4JLogChute());
      runtime.setProperty(RuntimeConstants.RUNTIME_REFERENCES_STRICT, true);
      runtime.init();
      return runtime;
    } catch (Exception e) {
      throw new NotifyRuntimeException("failed to init velocity runtime", e);
    }
  }
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

public class EvaluateContextTestCase extends TestCase
{
    public void testLocalscopePutDoesntLeakButGetDoes()
    throws Exception
    {
        RuntimeInstance instance;
       
        instance = new RuntimeInstance();
        instance.setProperty(RuntimeConstants.VM_CONTEXT_LOCALSCOPE, Boolean.TRUE);
        instance.init();

        VelocityContext base = new VelocityContext();
        base.put("outsideVar", "value1");

        EvaluateContext evc = new EvaluateContext(new InternalContextAdapterImpl(base), instance);
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

     * @throws Exception
     */
    public void testSetLocalContext()
    throws Exception
    {
        RuntimeInstance instance = new RuntimeInstance();
        instance.setProperty(RuntimeConstants.EVALUATE_CONTEXT_CLASS, TestContext.class.getName());
        instance.init();

        VelocityContext base = new VelocityContext();
        base.put("outsideVar", "value1");
        EvaluateContext evc = new EvaluateContext(new InternalContextAdapterImpl(base), instance);

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.