Examples of RuntimeInstance


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

            throws Exception
    {
        Method verifyMethod = TestInterface.class.getMethod("getTestValue", new Class[0]);


        RuntimeInstance ri = new RuntimeInstance();
        Introspector introspector = ri.getIntrospector();

        Method testMethod = introspector.getMethod(TestObject.class, "getTestValue", new Object[0]);
        assertNotNull(testMethod);
        assertEquals("Method object does not match!", verifyMethod, testMethod);
    }
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

    private RuntimeInstance instance;

    public void setUp() throws Exception
    {
        this.instance = new RuntimeInstance();
        this.instance.setProperty(RuntimeConstants.VM_CONTEXT_LOCALSCOPE, Boolean.TRUE);
        this.instance.init();
    }
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

    }

    public void setUp()
            throws Exception
    {
        ri = new RuntimeInstance();
        ri.init();
    }
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

    }

    public void testRuntimeInstanceProperties()
    {
        // check that runtime instance properties can be set and retrieved
        RuntimeInstance ri = new RuntimeInstance();
        ri.setProperty("baabaa.test","the answer");
        assertEquals("the answer",ri.getProperty("baabaa.test"));
    }
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

        ps.setProperty("runtime.log.warn.stacktrace", "false");
        ps.setProperty("runtime.log.info.stacktrace", "false");
        ps.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.SimpleLog4JLogSystem");
        ps.setProperty("runtime.log.logsystem.log4j.category", "velocity_log");

        rtInstance = new RuntimeInstance();

        try {
            rtInstance.init(ps);
        } catch (Exception e) {
            throw ArgoException.raise(e);
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

    }

    @Before
    public void init() throws Exception {
        ExtendedProperties config = new ExtendedProperties();
        RuntimeServices rsvc = new RuntimeInstance();

        config.setProperty("path", "/templates");
        config.setProperty("resource.loader", "");

        rsvc.setConfiguration(config);
        rsvc.setProperty(RUNTIME_LOG_LOGSYSTEM, new Slf4jLogChute(log));
        rsvc.setApplicationAttribute(SpringResourceLoaderAdapter.SPRING_RESOURCE_LOADER_KEY, factory);

        rsvc.init();

        velocityLoader = new SpringResourceLoaderAdapter();
        velocityLoader.commonInit(rsvc, config);
        velocityLoader.init(config);
    }
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

    }

    @Before
    public void init() throws Exception {
        ExtendedProperties config = new ExtendedProperties();
        RuntimeServices rsvc = new RuntimeInstance();

        config.setProperty("resource.loader", "");
        config.setProperty(PreloadedResourceLoader.PRELOADED_RESOURCES_KEY, preloadingResources());

        rsvc.setConfiguration(config);
        rsvc.setProperty(RUNTIME_LOG_LOGSYSTEM, new Slf4jLogChute(log));

        rsvc.init();

        velocityLoader = new PreloadedResourceLoader();
        velocityLoader.commonInit(rsvc, config);
        velocityLoader.init(config);
    }
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

    @Before
    public void init() throws Exception {
        ExtendedProperties config = new ExtendedProperties();

        rsvc = new RuntimeInstance();
        rsvc.setConfiguration(config);
        rsvc.init();

        eventCartridge = new CloneableEventCartridge();
        handler = new MyHandler();
View Full Code Here

Examples of org.apache.velocity.runtime.RuntimeInstance

        eventCartridge.initOnce(rsvc);
        assertSame(rsvc, handler.getRuntimeServices());

        // 第二次初始化无效
        eventCartridge.initOnce(new RuntimeInstance());
        assertSame(rsvc, handler.getRuntimeServices());
    }
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.