Copied: velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/OldPropertiesTestCase.java (from r1854852, velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ClassloaderChangeTestCase.java) URL: http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/OldPropertiesTestCase.java?p2=velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/OldPropertiesTestCase.java&p1=velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ClassloaderChangeTestCase.java&r1=1854852&r2=1854947&rev=1854947&view=diff ============================================================================== --- velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ClassloaderChangeTestCase.java (original) +++ velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/OldPropertiesTestCase.java Wed Mar 6 21:19:34 2019 @@ -19,18 +19,34 @@ package org.apache.velocity.test; * under the License. */ +import com.sun.org.apache.bcel.internal.classfile.Deprecated; +import com.sun.org.apache.xerces.internal.impl.xpath.regex.Match; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; -import org.apache.velocity.VelocityContext; +import org.apache.commons.lang3.StringUtils; import org.apache.velocity.app.VelocityEngine; +import org.apache.velocity.exception.VelocityException; +import org.apache.velocity.runtime.DeprecatedRuntimeConstants; +import org.apache.velocity.runtime.RuntimeConstants; +import org.apache.velocity.runtime.RuntimeInstance; import org.apache.velocity.test.misc.TestLogger; -import org.apache.velocity.util.introspection.IntrospectorCache; +import org.apache.velocity.util.DeprecationAwareExtProperties; +import org.apache.velocity.util.ExtProperties; import java.io.ByteArrayOutputStream; +import java.io.File; import java.io.InputStream; -import java.io.StringWriter; +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Tests if we can hand Velocity an arbitrary class for logging. @@ -38,17 +54,15 @@ import java.io.StringWriter; * @author <a href="mailto:[email protected]">Geir Magnusson Jr.</a> * @version $Id$ */ -public class ClassloaderChangeTestCase extends TestCase +public class OldPropertiesTestCase extends TestCase implements TemplateTestBase { private VelocityEngine ve = null; private TestLogger logger = null; - private static String OUTPUT = "Hello From Foo"; - /** * Default constructor. */ - public ClassloaderChangeTestCase(String name) + public OldPropertiesTestCase(String name) { super(name); } @@ -56,112 +70,112 @@ public class ClassloaderChangeTestCase e public void setUp() throws Exception { - ve = new VelocityEngine(); - logger = new TestLogger(false, true); - logger.setEnabledLevel(TestLogger.LOG_LEVEL_DEBUG); - ve.setProperty(VelocityEngine.RUNTIME_LOG_INSTANCE, logger); - ve.init(); } public static Test suite () { - return new TestSuite(ClassloaderChangeTestCase.class); + return new TestSuite(OldPropertiesTestCase.class); + } + + static Pattern propPattern = Pattern.compile("^([a-z._]+)\\s*=\\s*[^#]+.*$", Pattern.CASE_INSENSITIVE); + static Pattern warnPattern = Pattern.compile("^\\s*\\[warn\\]\\s*configuration key '([a-z._]+)' has been deprecated in favor of '([a-z._]+)'$", Pattern.CASE_INSENSITIVE); + + static class Translator extends DeprecationAwareExtProperties + { + @Override + public String translateKey(String oldName) { return super.translateKey(oldName); } } /** - * Runs the test. + * Check old properties setting and retrieval */ - public void testClassloaderChange() + public void testOldProperties() throws Exception { - logger.on(); + String oldProperties = TEST_COMPARE_DIR + "/oldproperties/velocity.properties"; + ve = new VelocityEngine(); + logger = new TestLogger(false, true); + logger.setEnabledLevel(TestLogger.LOG_LEVEL_WARN); - VelocityContext vc = new VelocityContext(); - Object foo = null; + // put our test logger where it belongs for this test + Field loggerField = DeprecationAwareExtProperties.class.getDeclaredField("logger"); + loggerField.setAccessible(true); + loggerField.set(null, logger); - /* - * first, we need a classloader to make our foo object - */ - - TestClassloader cl = new TestClassloader(); - Class<?> fooclass = cl.loadClass("Foo"); - foo = fooclass.newInstance(); - - /* - * put it into the context - */ - vc.put("foo", foo); - - /* - * and render something that would use it - * that will get it into the introspector cache - */ - StringWriter writer = new StringWriter(); - ve.evaluate( vc, writer, "test", "$foo.doIt()"); - - /* - * Check to make sure ok. note the obvious - * dependency on the Foo class... - */ + logger.on(); + ve.setProperties(oldProperties); + logger.off(); + + Translator translator = new Translator(); - if ( !writer.toString().equals( OUTPUT )) + // check getting old/new values + List<String> oldPropSettings = FileUtils.readLines(new File(oldProperties)); + Set<String> oldKeys = new HashSet<String>(); + for (String oldProp : oldPropSettings) { - fail("Output from doIt() incorrect"); + Matcher matcher = propPattern.matcher(oldProp); + if (matcher.matches()) + { + String propName = matcher.group(1); + String translated = translator.translateKey(propName); + if (!translated.equals(propName)) + { + Object oldKeyValue = ve.getProperty(propName); + Object newKeyValue = ve.getProperty(translated); + assertEquals(oldKeyValue, newKeyValue); + oldKeys.add(propName); + } + } } - /* - * and do it again :) - */ - cl = new TestClassloader(); - fooclass = cl.loadClass("Foo"); - foo = fooclass.newInstance(); - - vc.put("foo", foo); - - writer = new StringWriter(); - ve.evaluate( vc, writer, "test", "$foo.doIt()"); - - if ( !writer.toString().equals( OUTPUT )) + // check warnings in the logs + String log = logger.getLog(); + String logLines[] = log.split("\\r?\\n"); + for (String logLine : logLines) { - fail("Output from doIt() incorrect"); + Matcher matcher = warnPattern.matcher(logLine); + if (matcher.matches() && matcher.groupCount() == 2) + { + String oldName = matcher.group(1); + assertTrue(oldKeys.remove(oldName)); + } } - - if (!logger.getLog().contains(IntrospectorCache.CACHEDUMP_MSG)) + if (oldKeys.size() > 0) { - fail("Didn't see introspector cache dump."); + fail("No warning detected for the following properties: " + StringUtils.join(oldKeys, ", ")); } } /** - * Simple (real simple...) classloader that depends - * on a Foo.class being located in the classloader - * directory under test + * Check default properties */ - public static class TestClassloader extends ClassLoader + public void testNewProperties() + throws Exception { - private final static String testclass = - "classloader/Foo.class"; - - private Class<?> fooClass = null; - - public TestClassloader() - throws Exception - { - ByteArrayOutputStream os = new ByteArrayOutputStream(); - InputStream fis = getClass().getResourceAsStream("/" + testclass); - IOUtils.copy(fis, os); - fis.close(); - os.close(); - - byte[] barr = os.toByteArray(); + ve = new VelocityEngine(); + logger = new TestLogger(false, true); + logger.setEnabledLevel(TestLogger.LOG_LEVEL_WARN); - fooClass = defineClass("classloader.Foo", barr, 0, barr.length); - } + // put our test logger where it belongs for this test + Field loggerField = DeprecationAwareExtProperties.class.getDeclaredField("logger"); + loggerField.setAccessible(true); + loggerField.set(null, logger); + logger.on(); + ve.init(); + logger.off(); - public Class<?> findClass(String name) + // check warnings in the logs + String log = logger.getLog(); + String logLines[] = log.split("\\r?\\n"); + for (String logLine : logLines) { - return fooClass; + Matcher matcher = warnPattern.matcher(logLine); + if (matcher.matches() && matcher.groupCount() == 2) + { + fail("Default properties contain deprecated property '" + matcher.group(1) + "', deprecated in favor of '" + matcher.group(2) + "'"); + } } + } }
Modified: velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ParseWithMacroLibsTestCase.java URL: http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ParseWithMacroLibsTestCase.java?rev=1854947&r1=1854946&r2=1854947&view=diff ============================================================================== --- velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ParseWithMacroLibsTestCase.java (original) +++ velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/ParseWithMacroLibsTestCase.java Wed Mar 6 21:19:34 2019 @@ -195,7 +195,7 @@ public class ParseWithMacroLibsTestCase ve.setProperty("file.resource.loader.cache", cache); ve.setProperty( Velocity.RUNTIME_LOG_INSTANCE, new TestLogger()); - ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "file"); + ve.setProperty(RuntimeConstants.RESOURCE_LOADERS, "file"); ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, TEST_COMPARE_DIR + "/parsemacros"); ve.init(); @@ -224,7 +224,7 @@ public class ParseWithMacroLibsTestCase ve1.setProperty("file.resource.loader.cache", Boolean.TRUE); ve1.setProperty( Velocity.RUNTIME_LOG_INSTANCE, new TestLogger()); - ve1.setProperty(RuntimeConstants.RESOURCE_LOADER, "file"); + ve1.setProperty(RuntimeConstants.RESOURCE_LOADERS, "file"); ve1.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, TEST_COMPARE_DIR + "/parsemacros"); ve1.init(); @@ -274,7 +274,7 @@ public class ParseWithMacroLibsTestCase ve1.setProperty("file.resource.loader.cache", Boolean.TRUE); ve1.setProperty( Velocity.RUNTIME_LOG_INSTANCE, new TestLogger()); - ve1.setProperty(RuntimeConstants.RESOURCE_LOADER, "file"); + ve1.setProperty(RuntimeConstants.RESOURCE_LOADERS, "file"); ve1.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, TEST_COMPARE_DIR + "/parsemacros"); ve1.init(); Modified: velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/SpaceGobblingTestCase.java URL: http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/SpaceGobblingTestCase.java?rev=1854947&r1=1854946&r2=1854947&view=diff ============================================================================== --- velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/SpaceGobblingTestCase.java (original) +++ velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/SpaceGobblingTestCase.java Wed Mar 6 21:19:34 2019 @@ -70,7 +70,7 @@ public class SpaceGobblingTestCase exten { VelocityEngine ve = new VelocityEngine(); ve.setProperty(Velocity.RUNTIME_LOG_INSTANCE, log); - ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "file"); + ve.setProperty(RuntimeConstants.RESOURCE_LOADERS, "file"); ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, TEST_COMPARE_DIR + "/gobbling"); ve.setProperty(RuntimeConstants.SPACE_GOBBLING, mode.toString()); ve.init(); Modified: velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/StringResourceLoaderRepositoryTestCase.java URL: http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/StringResourceLoaderRepositoryTestCase.java?rev=1854947&r1=1854946&r2=1854947&view=diff ============================================================================== --- velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/StringResourceLoaderRepositoryTestCase.java (original) +++ velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/StringResourceLoaderRepositoryTestCase.java Wed Mar 6 21:19:34 2019 @@ -50,7 +50,7 @@ public class StringResourceLoaderReposit public void setUp() throws Exception { Velocity.reset(); - Velocity.setProperty(Velocity.RESOURCE_LOADER, "string"); + Velocity.setProperty(Velocity.RESOURCE_LOADERS, "string"); Velocity.addProperty("string.resource.loader.class", StringResourceLoader.class.getName()); Velocity.addProperty("string.resource.loader.modificationCheckInterval", "1"); Velocity.setProperty(Velocity.RUNTIME_LOG_INSTANCE, new TestLogger()); @@ -71,7 +71,7 @@ public class StringResourceLoaderReposit { VelocityEngine engine = new VelocityEngine(); TestLogger logger = new TestLogger(); - engine.setProperty(Velocity.RESOURCE_LOADER, "string"); + engine.setProperty(Velocity.RESOURCE_LOADERS, "string"); engine.addProperty("string.resource.loader.class", StringResourceLoader.class.getName()); if (repoName != null) { Modified: velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/StringResourceLoaderTestCase.java URL: http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/StringResourceLoaderTestCase.java?rev=1854947&r1=1854946&r2=1854947&view=diff ============================================================================== --- velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/StringResourceLoaderTestCase.java (original) +++ velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/StringResourceLoaderTestCase.java Wed Mar 6 21:19:34 2019 @@ -71,7 +71,7 @@ public class StringResourceLoaderTestCas Velocity.reset(); - Velocity.setProperty(Velocity.RESOURCE_LOADER, "string"); + Velocity.setProperty(Velocity.RESOURCE_LOADERS, "string"); Velocity.addProperty("string.resource.loader.class", StringResourceLoader.class.getName()); Velocity.addProperty("string.resource.loader.modificationCheckInterval", "1"); Modified: velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/VMLibraryTestCase.java URL: http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/VMLibraryTestCase.java?rev=1854947&r1=1854946&r2=1854947&view=diff ============================================================================== --- velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/VMLibraryTestCase.java (original) +++ velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/VMLibraryTestCase.java Wed Mar 6 21:19:34 2019 @@ -78,7 +78,7 @@ public class VMLibraryTestCase extends B ve1.setProperty( Velocity.RUNTIME_LOG_INSTANCE, new TestLogger()); - ve1.setProperty(RuntimeConstants.RESOURCE_LOADER, "file"); + ve1.setProperty(RuntimeConstants.RESOURCE_LOADERS, "file"); ve1.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, TEST_COMPARE_DIR + "/macrolibs"); ve1.init(); @@ -97,7 +97,7 @@ public class VMLibraryTestCase extends B ve2.setProperty( Velocity.RUNTIME_LOG_INSTANCE, new TestLogger()); - ve2.setProperty(RuntimeConstants.RESOURCE_LOADER, "file"); + ve2.setProperty(RuntimeConstants.RESOURCE_LOADERS, "file"); ve2.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, TEST_COMPARE_DIR + "/macrolibs"); ve2.init(); Modified: velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity702TestCase.java URL: http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity702TestCase.java?rev=1854947&r1=1854946&r2=1854947&view=diff ============================================================================== --- velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity702TestCase.java (original) +++ velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity702TestCase.java Wed Mar 6 21:19:34 2019 @@ -37,7 +37,7 @@ public class Velocity702TestCase extends public void setUpEngine(VelocityEngine engine) { - engine.setProperty(RuntimeConstants.RESOURCE_LOADER, "high,low"); + engine.setProperty(RuntimeConstants.RESOURCE_LOADERS, "high,low"); engine.addProperty("high.resource.loader.class", StringResourceLoader.class.getName()); engine.addProperty("high.resource.loader.cache", "false"); engine.addProperty("high.resource.loader.repository.name", "high"); Modified: velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity747TestCase.java URL: http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity747TestCase.java?rev=1854947&r1=1854946&r2=1854947&view=diff ============================================================================== --- velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity747TestCase.java (original) +++ velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity747TestCase.java Wed Mar 6 21:19:34 2019 @@ -59,7 +59,7 @@ public class Velocity747TestCase extends engine1.setProperty(RuntimeConstants.RUNTIME_LOG_INSTANCE, log); engine2 = new VelocityEngine(); - engine2.setProperty(RuntimeConstants.RESOURCE_LOADER, "file,string"); + engine2.setProperty(RuntimeConstants.RESOURCE_LOADERS, "file,string"); engine2.addProperty("file.resource.loader.path", TEST_COMPARE_DIR + "/issues/velocity-747/"); engine2.addProperty("file.resource.loader.cache", "true"); engine2.addProperty("file.resource.loader.modificationCheckInterval", "-1"); Modified: velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ConversionHandlerTestCase.java URL: http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ConversionHandlerTestCase.java?rev=1854947&r1=1854946&r2=1854947&view=diff ============================================================================== --- velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ConversionHandlerTestCase.java (original) +++ velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ConversionHandlerTestCase.java Wed Mar 6 21:19:34 2019 @@ -114,7 +114,7 @@ public class ConversionHandlerTestCase e RuntimeInstance ve = new RuntimeInstance(); ve.setProperty( Velocity.VM_PERM_INLINE_LOCAL, Boolean.TRUE); ve.setProperty(Velocity.RUNTIME_LOG_INSTANCE, log); - ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "file"); + ve.setProperty(RuntimeConstants.RESOURCE_LOADERS, "file"); ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, TEST_COMPARE_DIR + "/conversion"); ve.init(); Uberspect uberspect = ve.getUberspect(); @@ -196,7 +196,7 @@ public class ConversionHandlerTestCase e RuntimeInstance ve = new RuntimeInstance(); ve.setProperty( Velocity.VM_PERM_INLINE_LOCAL, Boolean.TRUE); ve.setProperty(Velocity.RUNTIME_LOG_INSTANCE, log); - ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "file"); + ve.setProperty(RuntimeConstants.RESOURCE_LOADERS, "file"); ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, TEST_COMPARE_DIR + "/conversion"); ve.setProperty(RuntimeConstants.CONVERSION_HANDLER_INSTANCE, new MyCustomConverter()); ve.init(); @@ -277,7 +277,7 @@ public class ConversionHandlerTestCase e VelocityEngine ve = new VelocityEngine(); ve.setProperty( Velocity.VM_PERM_INLINE_LOCAL, Boolean.TRUE); ve.setProperty(Velocity.RUNTIME_LOG_INSTANCE, log); - ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "file"); + ve.setProperty(RuntimeConstants.RESOURCE_LOADERS, "file"); ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, TEST_COMPARE_DIR + "/conversion"); if (withConversionsHandler) { Modified: velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/resources/configuration/compare/output.cmp URL: http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/resources/configuration/compare/output.cmp?rev=1854947&r1=1854946&r2=1854947&view=diff ============================================================================== --- velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/resources/configuration/compare/output.cmp (original) +++ velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/resources/configuration/compare/output.cmp Wed Mar 6 21:19:34 2019 @@ -12,14 +12,14 @@ Testing order of keys ... 08 09 10 -resource.loader -file.resource.loader.class -file.resource.loader.description -file.resource.loader.path -classpath.resource.loader.class -classpath.resource.loader.description -datasource.resource.loader.class -datasource.resource.loader.description +resource.loaders +resource.loader.file.class +resource.loader.file.description +resource.loader.file.path +resource.loader.classpath.class +resource.loader.classpath.description +resource.loader.datasource.class +resource.loader.datasource.description logger.type config.string.value config.boolean.value Added: velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/resources/oldproperties/velocity.properties URL: http://svn.apache.org/viewvc/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/resources/oldproperties/velocity.properties?rev=1854947&view=auto ============================================================================== --- velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/resources/oldproperties/velocity.properties (added) +++ velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/resources/oldproperties/velocity.properties Wed Mar 6 21:19:34 2019 @@ -0,0 +1,258 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# ---------------------------------------------------------------------------- +# This controls whether invalid references are logged. +# ---------------------------------------------------------------------------- + +runtime.log.invalid.references = true + +# ---------------------------------------------------------------------------- +# T E M P L A T E E N C O D I N G +# ---------------------------------------------------------------------------- + +input.encoding=UTF-8 + +# ---------------------------------------------------------------------------- +# Strings interning +# ---------------------------------------------------------------------------- +# Set to true to optimize memory, to false to optimize speed + +runtime.string.interning = true + +# ---------------------------------------------------------------------------- +# F O R E A C H P R O P E R T I E S +# ---------------------------------------------------------------------------- +# This property controls how many loops #foreach can execute. The default +# is -1, which means there is no limit. +# ---------------------------------------------------------------------------- + +directive.foreach.maxloops = -1 + +# ---------------------------------------------------------------------------- +# I F P R O P E R T I E S +# ---------------------------------------------------------------------------- +# This property controls whether empty strings and collections, +# as long as zero numbers, do evaluate to false. +# ---------------------------------------------------------------------------- + +directive.if.emptycheck = true + +# ---------------------------------------------------------------------------- +# I N C L U D E P R O P E R T I E S +# ---------------------------------------------------------------------------- +# These are the properties that governed the way #include'd content +# is governed. +# ---------------------------------------------------------------------------- + +directive.include.output.errormsg.start = <!-- include error : +directive.include.output.errormsg.end = see error log --> + +# ---------------------------------------------------------------------------- +# P A R S E P R O P E R T I E S +# ---------------------------------------------------------------------------- + +directive.parse.max.depth = 10 + +# ---------------------------------------------------------------------------- +# S C O P E P R O P E R T I E S +# ---------------------------------------------------------------------------- +# These are the properties that govern whether or not a Scope object +# is automatically provided for each of the given scopes to serve as a +# scope-safe reference namespace and "label" for #break calls. The default +# for most of these is false. Note that <bodymacroname> should be replaced by +# name of macros that take bodies for which you want to suppress the scope. +# ---------------------------------------------------------------------------- +# template.provide.scope.control = false +# evaluate.provide.scope.control = false +foreach.provide.scope.control = true +# macro.provide.scope.control = false +# define.provide.scope.control = false +# <bodymacroname>.provide.scope.control = false + +# ---------------------------------------------------------------------------- +# T E M P L A T E L O A D E R S +# ---------------------------------------------------------------------------- +# +# +# ---------------------------------------------------------------------------- + +resource.loader = file + +file.resource.loader.description = Velocity File Resource Loader +file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader +file.resource.loader.path = . +file.resource.loader.cache = false +file.resource.loader.modificationCheckInterval = 2 + +# ---------------------------------------------------------------------------- +# VELOCIMACRO PROPERTIES +# ---------------------------------------------------------------------------- +# global : name of default global library. It is expected to be in the regular +# template path. You may remove it (either the file or this property) if +# you wish with no harm. +# ---------------------------------------------------------------------------- +# velocimacro.library = VM_global_library.vm + +velocimacro.permissions.allow.inline = true +velocimacro.permissions.allow.inline.to.replace.global = false +velocimacro.permissions.allow.inline.local.scope = false +velocimacro.max.depth = 20 + +# ---------------------------------------------------------------------------- +# VELOCIMACRO STRICT MODE +# ---------------------------------------------------------------------------- +# if true, will throw an exception for incorrect number +# of arguments. false by default (for backwards compatibility) +# but this option will eventually be removed and will always +# act as if true +# ---------------------------------------------------------------------------- +velocimacro.arguments.strict = false + +# ---------------------------------------------------------------------------- +# VELOCIMACRO BODY REFERENCE +# ---------------------------------------------------------------------------- +# Defines name of the reference that can be used to render the AST block passed to +# block macro call as an argument inside a macro. +# ---------------------------------------------------------------------------- +velocimacro.body.reference=bodyContent + +# ---------------------------------------------------------------------------- +# VELOCIMACRO PRESERVE ARGUMENTS LITERALS +# ---------------------------------------------------------------------------- +# if true, when a macro has to render a null or invalid argument reference +# which is not quiet, it will print the provided literal reference instead +# of the one found in the body of the macro +# ---------------------------------------------------------------------------- +velocimacro.preserve.arguments.literals = false + + +# ---------------------------------------------------------------------------- +# STRICT REFERENCE MODE +# ---------------------------------------------------------------------------- +# if true, will throw a MethodInvocationException for references +# that are not defined in the context, or have not been defined +# with a #set directive. This setting will also throw an exception +# if an attempt is made to call a non-existing property on an object +# or if the object is null. When this property is true then property +# 'directive.set.null.allowed' is also set to true. +# ---------------------------------------------------------------------------- +runtime.references.strict = false + +# ---------------------------------------------------------------------------- +# INTERPOLATION +# ---------------------------------------------------------------------------- +# turn off and on interpolation of references and directives in string +# literals. ON by default :) +# ---------------------------------------------------------------------------- +runtime.interpolate.string.literals = true + + +# ---------------------------------------------------------------------------- +# RESOURCE MANAGEMENT +# ---------------------------------------------------------------------------- +# Allows alternative ResourceManager and ResourceCache implementations +# to be plugged in. +# ---------------------------------------------------------------------------- +resource.manager.class = org.apache.velocity.runtime.resource.ResourceManagerImpl +resource.manager.cache.class = org.apache.velocity.runtime.resource.ResourceCacheImpl + +# ---------------------------------------------------------------------------- +# PARSER POOL +# ---------------------------------------------------------------------------- +# Selects a custom factory class for the parser pool. Must implement +# ParserPool. parser.pool.size is used by the default implementation +# ParserPoolImpl +# ---------------------------------------------------------------------------- + +parser.pool.class = org.apache.velocity.runtime.ParserPoolImpl +parser.pool.size = 20 + + +# ---------------------------------------------------------------------------- +# EVENT HANDLER +# ---------------------------------------------------------------------------- +# Allows alternative event handlers to be plugged in. Note that each +# class property is actually a comma-separated list of classes (which will +# be called in order). +# ---------------------------------------------------------------------------- +# eventhandler.referenceinsertion.class = +# eventhandler.nullset.class = +# eventhandler.methodexception.class = +# eventhandler.include.class = + + +# ---------------------------------------------------------------------------- +# PLUGGABLE INTROSPECTOR +# ---------------------------------------------------------------------------- +# Allows alternative introspection and all that can of worms brings. +# ---------------------------------------------------------------------------- + +runtime.introspector.uberspect = org.apache.velocity.util.introspection.UberspectImpl + +# ---------------------------------------------------------------------------- +# CONVERSION HANDLER +# ---------------------------------------------------------------------------- +# Sets the data types Conversion Handler used by the default uberspector +# ---------------------------------------------------------------------------- + +runtime.conversion.handler.class = org.apache.velocity.util.introspection.TypeConversionHandlerImpl + + +# ---------------------------------------------------------------------------- +# SECURE INTROSPECTOR +# ---------------------------------------------------------------------------- +# If selected, prohibits methods in certain classes and packages from being +# accessed. +# ---------------------------------------------------------------------------- + +introspector.restrict.packages = java.lang.reflect + +# The two most dangerous classes + +introspector.restrict.classes = java.lang.Class +introspector.restrict.classes = java.lang.ClassLoader + +# Restrict these for extra safety + +introspector.restrict.classes = java.lang.Compiler +introspector.restrict.classes = java.lang.InheritableThreadLocal +introspector.restrict.classes = java.lang.Package +introspector.restrict.classes = java.lang.Process +introspector.restrict.classes = java.lang.Runtime +introspector.restrict.classes = java.lang.RuntimePermission +introspector.restrict.classes = java.lang.SecurityManager +introspector.restrict.classes = java.lang.System +introspector.restrict.classes = java.lang.Thread +introspector.restrict.classes = java.lang.ThreadGroup +introspector.restrict.classes = java.lang.ThreadLocal + +# ---------------------------------------------------------------------------- +# SPACE GOBBLING +# ---------------------------------------------------------------------------- +# Possible values: none, bc (aka Backward Compatible), lines, structured +# ---------------------------------------------------------------------------- + +space.gobbling = lines + +# ---------------------------------------------------------------------------- +# HYPHEN IN IDENTIFIERS +# ---------------------------------------------------------------------------- +# Set to true to allow '-' in reference identifiers (backward compatibility option) +# ---------------------------------------------------------------------------- + +parser.allow_hyphen_in_identifiers = false
