You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by nb...@apache.org on 2010/01/11 20:51:04 UTC
svn commit: r898032 [1/2] - in /velocity/engine/trunk/src:
java/org/apache/velocity/ java/org/apache/velocity/context/
java/org/apache/velocity/exception/
java/org/apache/velocity/runtime/directive/
java/org/apache/velocity/runtime/parser/node/ java/or...
Author: nbubna
Date: Mon Jan 11 19:51:03 2010
New Revision: 898032
URL: http://svn.apache.org/viewvc?rev=898032&view=rev
Log:
VELOCITY-674 remove unused imports, add serialVersionUIDs and other things Eclipse complains about (thanks to Jarkko Viinamaki who really needs to finish getting his commit perms)
Modified:
velocity/engine/trunk/src/java/org/apache/velocity/VelocityContext.java
velocity/engine/trunk/src/java/org/apache/velocity/context/ChainedInternalContextAdapter.java
velocity/engine/trunk/src/java/org/apache/velocity/context/EvaluateContext.java
velocity/engine/trunk/src/java/org/apache/velocity/context/ProxyVMContext.java
velocity/engine/trunk/src/java/org/apache/velocity/exception/MathException.java
velocity/engine/trunk/src/java/org/apache/velocity/exception/MethodInvocationException.java
velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Block.java
velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/BlockMacro.java
velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Evaluate.java
velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Stop.java
velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/StopCommand.java
velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIndex.java
velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java
velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceCacheImpl.java
velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoaderFactory.java
velocity/engine/trunk/src/java/org/apache/velocity/util/ClassUtils.java
velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/IntrospectorCacheImpl.java
velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/LinkingUberspector.java
velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/MethodMap.java
velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java
velocity/engine/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/BaseTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/DefineTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/ForeachTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeEventHandlingTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/ScopeTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/StaticUtilityMethodsTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/StrictCompareTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/StrictEscapeTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/StrictForeachTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/StrictMathTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/StrictReferenceTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/StringConcatenationTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/StringResourceLoaderRepositoryTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/TextblockTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/VarargMethodsTestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity537TestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity615TestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity625TestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity629TestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity62TestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity630TestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity631TestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity667TestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity689TestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity701TestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity702TestCase.java
velocity/engine/trunk/src/test/org/apache/velocity/test/sql/BaseSQLTest.java
velocity/engine/trunk/src/test/org/apache/velocity/test/sql/DataSourceResourceLoaderTestCase.java
Modified: velocity/engine/trunk/src/java/org/apache/velocity/VelocityContext.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/VelocityContext.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/VelocityContext.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/VelocityContext.java Mon Jan 11 19:51:03 2010
@@ -20,12 +20,10 @@
*/
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import org.apache.velocity.context.AbstractContext;
import org.apache.velocity.context.Context;
-import org.apache.velocity.runtime.RuntimeServices;
/**
* General purpose implemention of the application Context
Modified: velocity/engine/trunk/src/java/org/apache/velocity/context/ChainedInternalContextAdapter.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/context/ChainedInternalContextAdapter.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/context/ChainedInternalContextAdapter.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/context/ChainedInternalContextAdapter.java Mon Jan 11 19:51:03 2010
@@ -19,16 +19,10 @@
* under the License.
*/
-import java.util.HashSet;
-import java.util.Set;
import java.util.List;
-import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.event.EventCartridge;
-import org.apache.velocity.runtime.RuntimeConstants;
-import org.apache.velocity.runtime.RuntimeServices;
import org.apache.velocity.runtime.resource.Resource;
-import org.apache.velocity.util.ClassUtils;
import org.apache.velocity.util.introspection.IntrospectionCacheData;
/**
Modified: velocity/engine/trunk/src/java/org/apache/velocity/context/EvaluateContext.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/context/EvaluateContext.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/context/EvaluateContext.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/context/EvaluateContext.java Mon Jan 11 19:51:03 2010
@@ -21,15 +21,11 @@
import java.util.HashSet;
import java.util.Set;
-import java.util.List;
import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.event.EventCartridge;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.RuntimeServices;
-import org.apache.velocity.runtime.resource.Resource;
import org.apache.velocity.util.ClassUtils;
-import org.apache.velocity.util.introspection.IntrospectionCacheData;
/**
* This is a special, internal-use-only context implementation to be
Modified: velocity/engine/trunk/src/java/org/apache/velocity/context/ProxyVMContext.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/context/ProxyVMContext.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/context/ProxyVMContext.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/context/ProxyVMContext.java Mon Jan 11 19:51:03 2010
@@ -22,10 +22,8 @@
import java.io.StringWriter;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
-import org.apache.velocity.app.event.EventCartridge;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.runtime.Renderable;
@@ -33,9 +31,6 @@
import org.apache.velocity.runtime.parser.ParserTreeConstants;
import org.apache.velocity.runtime.parser.node.ASTReference;
import org.apache.velocity.runtime.parser.node.Node;
-import org.apache.velocity.runtime.parser.node.ASTBlock;
-import org.apache.velocity.runtime.resource.Resource;
-import org.apache.velocity.util.introspection.IntrospectionCacheData;
/**
* Context for Velocity macro arguments.
Modified: velocity/engine/trunk/src/java/org/apache/velocity/exception/MathException.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/exception/MathException.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/exception/MathException.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/exception/MathException.java Mon Jan 11 19:51:03 2010
@@ -28,6 +28,8 @@
*/
public class MathException extends VelocityException
{
+ private static final long serialVersionUID = -7966507088645215583L;
+
public MathException(final String exceptionMessage)
{
super(exceptionMessage);
Modified: velocity/engine/trunk/src/java/org/apache/velocity/exception/MethodInvocationException.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/exception/MethodInvocationException.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/exception/MethodInvocationException.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/exception/MethodInvocationException.java Mon Jan 11 19:51:03 2010
@@ -1,6 +1,5 @@
package org.apache.velocity.exception;
-import org.apache.commons.lang.StringUtils;
import org.apache.velocity.runtime.log.Log;
/*
Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Block.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Block.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Block.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Block.java Mon Jan 11 19:51:03 2010
@@ -1,178 +1,177 @@
-package org.apache.velocity.runtime.directive;
-
-/*
- * 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.
- */
-
-import java.io.Writer;
-import java.io.IOException;
-import java.io.StringWriter;
-
-import org.apache.commons.lang.text.StrBuilder;
-import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.exception.TemplateInitException;
-import org.apache.velocity.exception.VelocityException;
-import org.apache.velocity.runtime.Renderable;
-import org.apache.velocity.runtime.RuntimeServices;
-import org.apache.velocity.runtime.log.Log;
-import org.apache.velocity.runtime.parser.node.Node;
-
-/**
- * Directive that puts an unrendered AST block in the context
- * under the specified key, postponing rendering until the
- * reference is used and rendered.
- *
- * @author Andrew Tetlaw
- * @author Nathan Bubna
- * @author <a href="mailto:wyla@removethis.sci.fi">Jarkko Viinamaki</a>
- * @since 1.7
- * @version $Id: Block.java 686842 2008-08-18 18:29:31Z nbubna $
- */
-public abstract class Block extends Directive
-{
- protected Node block;
- protected Log log;
- protected int maxDepth;
- protected String key;
-
- /**
- * Return type of this directive.
- */
- public int getType()
- {
- return BLOCK;
- }
-
- /**
- * simple init - get the key
- */
- public void init(RuntimeServices rs, InternalContextAdapter context, Node node)
- throws TemplateInitException
- {
- super.init(rs, context, node);
-
- log = rs.getLog();
-
- /**
- * No checking is done. We just grab the last child node and assume
- * that it's the block!
- */
- block = node.jjtGetChild(node.jjtGetNumChildren() - 1);
- }
-
- public boolean render(InternalContextAdapter context, Writer writer)
- {
- preRender(context);
- try
- {
- return block.render(context, writer);
- }
- catch (IOException e)
- {
- String msg = "Failed to render " + id(context) + " to writer "
- + " at " + Log.formatFileString(this);
-
- log.error(msg, e);
- throw new RuntimeException(msg, e);
- }
- catch (StopCommand stop)
- {
- if (!stop.isFor(this))
- {
- throw stop;
- }
- return true;
- }
- finally
- {
- postRender(context);
- }
- }
-
- /**
- * Creates a string identifying the source and location of the block
- * definition, and the current template being rendered if that is
- * different.
- */
- protected String id(InternalContextAdapter context)
- {
- StrBuilder str = new StrBuilder(100)
- .append("block $").append(key);
- if (!context.getCurrentTemplateName().equals(getTemplateName()))
- {
- str.append(" used in ").append(context.getCurrentTemplateName());
- }
- return str.toString();
- }
-
- /**
- * actual class placed in the context, holds the context
- * being used for the render, as well as the parent (which already holds
- * everything else we need).
- */
- public static class Reference implements Renderable
- {
- private InternalContextAdapter context;
- private Block parent;
- private int depth;
-
- public Reference(InternalContextAdapter context, Block parent)
- {
- this.context = context;
- this.parent = parent;
- }
-
- /**
- * Render the AST of this block into the writer using the context.
- */
- public boolean render(InternalContextAdapter context, Writer writer)
- {
- depth++;
- if (depth > parent.maxDepth)
- {
- /* this is only a debug message, as recursion can
- * happen in quasi-innocent situations and is relatively
- * harmless due to how we handle it here.
- * this is more to help anyone nuts enough to intentionally
- * use recursive block definitions and having problems
- * pulling it off properly.
- */
- parent.log.debug("Max recursion depth reached for " + parent.id(context)
- + " at " + Log.formatFileString(parent));
- depth--;
- return false;
- }
- else
- {
- parent.render(context, writer);
- depth--;
- return true;
- }
- }
-
- public String toString()
- {
- Writer writer = new StringWriter();
- if (render(context, writer))
- {
- return writer.toString();
- }
- return null;
- }
- }
-}
+package org.apache.velocity.runtime.directive;
+
+/*
+ * 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.
+ */
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+
+import org.apache.commons.lang.text.StrBuilder;
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.exception.TemplateInitException;
+import org.apache.velocity.runtime.Renderable;
+import org.apache.velocity.runtime.RuntimeServices;
+import org.apache.velocity.runtime.log.Log;
+import org.apache.velocity.runtime.parser.node.Node;
+
+/**
+ * Directive that puts an unrendered AST block in the context
+ * under the specified key, postponing rendering until the
+ * reference is used and rendered.
+ *
+ * @author Andrew Tetlaw
+ * @author Nathan Bubna
+ * @author <a href="mailto:wyla@removethis.sci.fi">Jarkko Viinamaki</a>
+ * @since 1.7
+ * @version $Id: Block.java 686842 2008-08-18 18:29:31Z nbubna $
+ */
+public abstract class Block extends Directive
+{
+ protected Node block;
+ protected Log log;
+ protected int maxDepth;
+ protected String key;
+
+ /**
+ * Return type of this directive.
+ */
+ public int getType()
+ {
+ return BLOCK;
+ }
+
+ /**
+ * simple init - get the key
+ */
+ public void init(RuntimeServices rs, InternalContextAdapter context, Node node)
+ throws TemplateInitException
+ {
+ super.init(rs, context, node);
+
+ log = rs.getLog();
+
+ /**
+ * No checking is done. We just grab the last child node and assume
+ * that it's the block!
+ */
+ block = node.jjtGetChild(node.jjtGetNumChildren() - 1);
+ }
+
+ public boolean render(InternalContextAdapter context, Writer writer)
+ {
+ preRender(context);
+ try
+ {
+ return block.render(context, writer);
+ }
+ catch (IOException e)
+ {
+ String msg = "Failed to render " + id(context) + " to writer "
+ + " at " + Log.formatFileString(this);
+
+ log.error(msg, e);
+ throw new RuntimeException(msg, e);
+ }
+ catch (StopCommand stop)
+ {
+ if (!stop.isFor(this))
+ {
+ throw stop;
+ }
+ return true;
+ }
+ finally
+ {
+ postRender(context);
+ }
+ }
+
+ /**
+ * Creates a string identifying the source and location of the block
+ * definition, and the current template being rendered if that is
+ * different.
+ */
+ protected String id(InternalContextAdapter context)
+ {
+ StrBuilder str = new StrBuilder(100)
+ .append("block $").append(key);
+ if (!context.getCurrentTemplateName().equals(getTemplateName()))
+ {
+ str.append(" used in ").append(context.getCurrentTemplateName());
+ }
+ return str.toString();
+ }
+
+ /**
+ * actual class placed in the context, holds the context
+ * being used for the render, as well as the parent (which already holds
+ * everything else we need).
+ */
+ public static class Reference implements Renderable
+ {
+ private InternalContextAdapter context;
+ private Block parent;
+ private int depth;
+
+ public Reference(InternalContextAdapter context, Block parent)
+ {
+ this.context = context;
+ this.parent = parent;
+ }
+
+ /**
+ * Render the AST of this block into the writer using the context.
+ */
+ public boolean render(InternalContextAdapter context, Writer writer)
+ {
+ depth++;
+ if (depth > parent.maxDepth)
+ {
+ /* this is only a debug message, as recursion can
+ * happen in quasi-innocent situations and is relatively
+ * harmless due to how we handle it here.
+ * this is more to help anyone nuts enough to intentionally
+ * use recursive block definitions and having problems
+ * pulling it off properly.
+ */
+ parent.log.debug("Max recursion depth reached for " + parent.id(context)
+ + " at " + Log.formatFileString(parent));
+ depth--;
+ return false;
+ }
+ else
+ {
+ parent.render(context, writer);
+ depth--;
+ return true;
+ }
+ }
+
+ public String toString()
+ {
+ Writer writer = new StringWriter();
+ if (render(context, writer))
+ {
+ return writer.toString();
+ }
+ return null;
+ }
+ }
+}
Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/BlockMacro.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/BlockMacro.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/BlockMacro.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/BlockMacro.java Mon Jan 11 19:51:03 2010
@@ -21,9 +21,9 @@
import java.io.IOException;
import java.io.Writer;
+
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.TemplateInitException;
-import org.apache.velocity.runtime.Renderable;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.RuntimeServices;
import org.apache.velocity.runtime.parser.node.Node;
Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Evaluate.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Evaluate.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Evaluate.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Evaluate.java Mon Jan 11 19:51:03 2010
@@ -25,7 +25,6 @@
import org.apache.velocity.context.EvaluateContext;
import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.context.InternalContextAdapterImpl;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Stop.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Stop.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Stop.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Stop.java Mon Jan 11 19:51:03 2010
@@ -20,9 +20,9 @@
*/
import java.io.Writer;
+
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.VelocityException;
-import org.apache.velocity.runtime.RuntimeInstance;
import org.apache.velocity.runtime.RuntimeServices;
import org.apache.velocity.runtime.log.Log;
import org.apache.velocity.runtime.parser.node.Node;
Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/StopCommand.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/StopCommand.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/StopCommand.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/StopCommand.java Mon Jan 11 19:51:03 2010
@@ -1,89 +1,90 @@
-package org.apache.velocity.runtime.directive;
-
-/*
- * 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.
- */
-
-import org.apache.velocity.Template;
-import org.apache.velocity.runtime.RuntimeInstance;
-import org.apache.velocity.runtime.directive.Evaluate;
-
-/**
- * Stop command for directive Control objects. In an ideal JDK,
- * this would be able to extend a RuntimeThrowable class, but we
- * don't have that. So to avoid the interface changes needed by
- * extending Throwable and the potential errant catches were we
- * to extend RuntimeException, we'll have to extend Error,
- * despite the fact that this is never an error.
- *
- * @author Nathan Bubna
- * @version $Id$
- */
-public class StopCommand extends Error
-{
- private Object stopMe;
- private boolean nearest = false;
-
- public StopCommand()
- {
- this.nearest = true;
- }
-
- public StopCommand(String message)
- {
- super(message);
- }
-
- public StopCommand(Object stopMe)
- {
- this.stopMe = stopMe;
- }
-
- public String getMessage()
- {
- if (stopMe != null)
- {
- // only create a useful message if requested (which is unlikely)
- return "StopCommand: "+stopMe;
- }
- else
- {
- return "StopCommand: "+super.getMessage();
- }
- }
-
- public boolean isFor(Object that)
- {
- if (nearest) // if we're stopping at the first chance
- {
- // save that for message
- stopMe = that;
- return true;
- }
- else if (stopMe != null) // if we have a specified stopping point
- {
- return (that == stopMe);
- }
- else // only stop for the top :)
- {
- return (that instanceof Template ||
- that instanceof RuntimeInstance ||
- that instanceof Evaluate);
- }
- }
-}
+package org.apache.velocity.runtime.directive;
+
+/*
+ * 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.
+ */
+
+import org.apache.velocity.Template;
+import org.apache.velocity.runtime.RuntimeInstance;
+import org.apache.velocity.runtime.directive.Evaluate;
+
+/**
+ * Stop command for directive Control objects. In an ideal JDK,
+ * this would be able to extend a RuntimeThrowable class, but we
+ * don't have that. So to avoid the interface changes needed by
+ * extending Throwable and the potential errant catches were we
+ * to extend RuntimeException, we'll have to extend Error,
+ * despite the fact that this is never an error.
+ *
+ * @author Nathan Bubna
+ * @version $Id$
+ */
+public class StopCommand extends Error
+{
+ private static final long serialVersionUID = 2577683435802825964L;
+ private Object stopMe;
+ private boolean nearest = false;
+
+ public StopCommand()
+ {
+ this.nearest = true;
+ }
+
+ public StopCommand(String message)
+ {
+ super(message);
+ }
+
+ public StopCommand(Object stopMe)
+ {
+ this.stopMe = stopMe;
+ }
+
+ public String getMessage()
+ {
+ if (stopMe != null)
+ {
+ // only create a useful message if requested (which is unlikely)
+ return "StopCommand: "+stopMe;
+ }
+ else
+ {
+ return "StopCommand: "+super.getMessage();
+ }
+ }
+
+ public boolean isFor(Object that)
+ {
+ if (nearest) // if we're stopping at the first chance
+ {
+ // save that for message
+ stopMe = that;
+ return true;
+ }
+ else if (stopMe != null) // if we have a specified stopping point
+ {
+ return (that == stopMe);
+ }
+ else // only stop for the top :)
+ {
+ return (that instanceof Template ||
+ that instanceof RuntimeInstance ||
+ that instanceof Evaluate);
+ }
+ }
+}
Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java Mon Jan 11 19:51:03 2010
@@ -22,7 +22,6 @@
import java.io.IOException;
import java.io.Writer;
-import org.apache.commons.lang.StringUtils;
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.context.ProxyVMContext;
import org.apache.velocity.exception.MacroOverflowException;
@@ -33,8 +32,6 @@
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.RuntimeServices;
import org.apache.velocity.runtime.log.Log;
-import org.apache.velocity.runtime.parser.ParserTreeConstants;
-import org.apache.velocity.runtime.parser.node.ASTDirective;
import org.apache.velocity.runtime.parser.node.Node;
import org.apache.velocity.runtime.parser.node.SimpleNode;
@@ -186,7 +183,6 @@
*/
if (maxCallDepth > 0 && maxCallDepth == vmc.getCurrentMacroCallDepth())
{
- String templateName = vmc.getCurrentTemplateName();
Object[] stack = vmc.getMacroNameStack();
StringBuffer out = new StringBuffer(100)
Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIndex.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIndex.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIndex.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIndex.java Mon Jan 11 19:51:03 2010
@@ -7,10 +7,7 @@
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.log.Log;
import org.apache.velocity.runtime.parser.Parser;
-import org.apache.velocity.runtime.parser.node.ASTMethod.MethodCacheKey;
import org.apache.velocity.util.ClassUtils;
-import org.apache.velocity.util.introspection.Info;
-import org.apache.velocity.util.introspection.IntrospectionCacheData;
import org.apache.velocity.util.introspection.VelMethod;
/*
Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java Mon Jan 11 19:51:03 2010
@@ -33,7 +33,6 @@
import org.apache.velocity.runtime.parser.Parser;
import org.apache.velocity.util.ClassUtils;
import org.apache.velocity.util.introspection.Info;
-import org.apache.velocity.util.introspection.IntrospectionCacheData;
import org.apache.velocity.util.introspection.VelMethod;
/**
Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java Mon Jan 11 19:51:03 2010
@@ -23,9 +23,6 @@
import org.apache.commons.lang.text.StrBuilder;
import org.apache.velocity.context.InternalContextAdapter;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.TemplateInitException;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.runtime.RuntimeConstants;
@@ -33,7 +30,6 @@
import org.apache.velocity.runtime.parser.ParseException;
import org.apache.velocity.runtime.parser.Parser;
import org.apache.velocity.runtime.parser.Token;
-import org.apache.velocity.runtime.visitor.BaseVisitor;
/**
* ASTStringLiteral support. Will interpolate!
Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceCacheImpl.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceCacheImpl.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceCacheImpl.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceCacheImpl.java Mon Jan 11 19:51:03 2010
@@ -20,10 +20,8 @@
*/
import java.util.Collections;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
import java.util.Iterator;
+import java.util.Map;
import org.apache.commons.collections.map.LRUMap;
import org.apache.velocity.runtime.RuntimeConstants;
Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoaderFactory.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoaderFactory.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoaderFactory.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoaderFactory.java Mon Jan 11 19:51:03 2010
@@ -22,7 +22,6 @@
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.runtime.RuntimeServices;
import org.apache.velocity.util.ClassUtils;
-import org.apache.velocity.util.StringUtils;
/**
* Factory to grab a template loader.
Modified: velocity/engine/trunk/src/java/org/apache/velocity/util/ClassUtils.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/util/ClassUtils.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/util/ClassUtils.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/util/ClassUtils.java Mon Jan 11 19:51:03 2010
@@ -24,7 +24,6 @@
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.VelocityException;
-import org.apache.velocity.runtime.RuntimeServices;
import org.apache.velocity.runtime.parser.node.SimpleNode;
import org.apache.velocity.runtime.parser.node.ASTMethod.MethodCacheKey;
import org.apache.velocity.util.introspection.Info;
Modified: velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/IntrospectorCacheImpl.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/IntrospectorCacheImpl.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/IntrospectorCacheImpl.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/IntrospectorCacheImpl.java Mon Jan 11 19:51:03 2010
@@ -21,7 +21,6 @@
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
Modified: velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/LinkingUberspector.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/LinkingUberspector.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/LinkingUberspector.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/LinkingUberspector.java Mon Jan 11 19:51:03 2010
@@ -21,9 +21,6 @@
import java.util.Iterator;
-import org.apache.velocity.runtime.RuntimeServices;
-import org.apache.velocity.util.RuntimeServicesAware;
-
/**
* <p>
* When the runtime.introspection.uberspect configuration property contains several
Modified: velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/MethodMap.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/MethodMap.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/MethodMap.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/MethodMap.java Mon Jan 11 19:51:03 2010
@@ -21,11 +21,10 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+
import org.apache.velocity.util.MapFactory;
/**
Modified: velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java Mon Jan 11 19:51:03 2010
@@ -20,7 +20,6 @@
*/
import java.lang.reflect.Array;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Enumeration;
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/AbsoluteFileResourceLoaderTestCase.java Mon Jan 11 19:51:03 2010
@@ -28,10 +28,8 @@
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.Velocity;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
-import org.apache.velocity.runtime.RuntimeSingleton;
import org.apache.velocity.test.misc.TestLogChute;
/**
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/BaseTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/BaseTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/BaseTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/BaseTestCase.java Mon Jan 11 19:51:03 2010
@@ -22,19 +22,18 @@
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+
import junit.framework.TestCase;
+
import org.apache.oro.text.perl.Perl5Util;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.util.StringUtils;
import org.apache.velocity.runtime.RuntimeConstants;
-import org.apache.velocity.test.misc.TestLogChute;
import org.apache.velocity.runtime.resource.loader.StringResourceLoader;
import org.apache.velocity.runtime.resource.util.StringResourceRepository;
+import org.apache.velocity.test.misc.TestLogChute;
+import org.apache.velocity.util.StringUtils;
/**
* Base test case that provides utility methods for
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/DefineTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/DefineTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/DefineTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/DefineTestCase.java Mon Jan 11 19:51:03 2010
@@ -19,7 +19,6 @@
* under the License.
*/
-import org.apache.velocity.VelocityContext;
/**
* This class tests the #define directive
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/ForeachTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/ForeachTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/ForeachTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/ForeachTestCase.java Mon Jan 11 19:51:03 2010
@@ -19,17 +19,11 @@
* under the License.
*/
-import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import junit.framework.TestCase;
-
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.Velocity;
import org.apache.velocity.runtime.RuntimeConstants;
-import org.apache.velocity.test.misc.TestLogChute;
import org.apache.velocity.test.provider.ForeachMethodCallHelper;
/**
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeEventHandlingTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeEventHandlingTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeEventHandlingTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeEventHandlingTestCase.java Mon Jan 11 19:51:03 2010
@@ -23,8 +23,6 @@
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
import junit.framework.Test;
import junit.framework.TestSuite;
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/ScopeTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/ScopeTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/ScopeTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/ScopeTestCase.java Mon Jan 11 19:51:03 2010
@@ -1,327 +1,326 @@
-package org.apache.velocity.test;
-
-/*
- * 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.
- */
-
-import java.util.HashMap;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.runtime.RuntimeConstants;
-import org.apache.velocity.runtime.directive.Scope;
-
-/**
- * This class tests the directive scope controls
- */
-public class ScopeTestCase extends BaseTestCase
-{
- public ScopeTestCase(String name)
- {
- super(name);
- }
-
- protected void setUpEngine(VelocityEngine engine)
- {
- engine.setProperty("a.provide.scope.control", "true");
- engine.setProperty("define.provide.scope.control", "true");
- engine.setProperty("evaluate.provide.scope.control", "true");
- engine.setProperty("foo.provide.scope.control", "true");
- engine.setProperty("macro.provide.scope.control", "true");
- engine.setProperty("template.provide.scope.control", "true");
- engine.setProperty("vm.provide.scope.control", "true");
- engine.setProperty(RuntimeConstants.SET_NULL_ALLOWED, Boolean.TRUE);
- }
-
- public void testScopeGetLeakIntoInner()
- {
- addTemplate("foo", "#foreach($i in [1..1])#set($foreach.a=$i)"+
- "#foreach($j in [2..2])$foreach.a#set($foreach.a=$j)"+
- "#foreach($k in [3..3])$foreach.a#end#end$foreach.a#end");
- assertTmplEquals("121", "foo");
- }
-
- public void testScopeGetLeakDoesntHideNullset()
- {
- addTemplate("a", "#macro(a)#set($macro.a='a')#b()$macro.a#end"+
- "#macro(b)$macro.a#set($macro.a=$null)$!macro.a#end"+
- "#a()");
- assertTmplEquals("aa", "a");
- }
-
- public void testRootTemplateMergeScope()
- {
- addTemplate("foo", "foo#break($template)bar");
- assertTmplEquals("foo", "foo");
- assertNull(context.get("template"));
- }
-
- public void testParseScope()
- {
- addTemplate("test", "$template.depth"+
- "$!parse.parent.depth"+
- "#set( $template.foo = 'bar' )"+
- "$template.foo"+
- "#break($template)"+
- "woogie");
- assertEvalEquals("1bar", "#parse( 'test' )");
- assertNull(context.get("template"));
- }
-
- public void testNestedParseScope()
- {
- HashMap grab = new HashMap();
- context.put("grab", grab);
-
- addTemplate("inner", "Inner depth: $template.depth"+
- "#set( $template.foo = '?' )"+
- "$!grab.put('inner',$template)"+
- "#break($template)$template.foo");
- addTemplate("outer", "#set( $template.foo = '!' )"+
- "Outer depth: $template.depth "+
- "#parse('inner')"+
- "$!grab.put('outer', $template)"+
- "$template.foo");
- assertEvalEquals("Outer depth: 1 Inner depth: 2!", "#parse('outer')");
- // make extra sure that the outer control was restored after the stop
- assertFalse(grab.get("inner") == grab.get("outer"));
- // make sure the outer control was cleaned up
- assertNull(context.get("template"));
-
- addTemplate("3", "$template.topmost.foo#set( $template.topmost.foo = 'bar' )");
- addTemplate("2", "#parse( '3' )$!parse.foo");
- addTemplate("1", "#set( $template.foo = 'foo' )#parse('2')$template.foo");
- assertEvalEquals("foobar", "#parse('1')$!parse");
- // make sure the top control was cleaned up
- assertNull(context.get("template"));
- }
-
- public void testForeachScope()
- {
- String template = "#foreach( $i in [0..2] )"+
- "#if( $i > 1 )#break($foreach)#end"+
- "$foreach.index:$foreach.count:$foreach.hasNext,"+
- "#end";
- assertEvalEquals("0:1:true,1:2:true,", template);
- assertNull(context.get("foreach"));
- }
-
- public void testNestedForeachScope()
- {
- String template = "#foreach( $i in [1..5] )"+
- "#foreach( $j in [1..2] )"+
- "#if ( $i > $foreach.count + $foreach.index + $foreach.depth )#break($foreach.topmost)#end"+
- "#end"+
- "$i"+
- "#end";
- assertEvalEquals("123", template);
- assertNull(context.get("foreach"));
- }
-
- public void testMacroScope()
- {
- String template = "#macro( foo $i )"+
- "#if($i > 2 )#break($macro)#end"+
- "$i#end"+
- "#foo( 0 )#foo( 1 )#foo( 2 )";
- assertEvalEquals("012", template);
- assertNull(context.get("macro"));
- }
-
- public void testRecursiveMacroScope()
- {
- String template = "#macro( foo )$macro.depth"+
- "#if($macro.depth > 2 )#break($macro.topmost)#end"+
- "#foo()#end#foo()";
- assertEvalEquals("123", template);
- assertNull(context.get("macro"));
- }
-
- public void testNestedMacroScope()
- {
- String template = "#macro( a )$macro.depth#set($macro.c = 'a')$macro.c#end"+
- "#macro( b )#set($macro.c = 'b' )#a()$macro.c#end"+
- "#b()";
- assertEvalEquals("2ab", template);
- assertNull(context.get("macro"));
- }
-
- public void testBodyMacroScope()
- {
- String template = "#macro( foo $bar )$bodyContent$macro.bar#end"+
- "#@foo( 'bar' )#set( $macro.bar = 'foo'+$bar )"+
- "#set( $foo.d = $foo.depth )$foo.d #end";
- assertEvalEquals("1 foobar", template);
- assertNull(context.get("foo"));
- assertNull(context.get("macro"));
- }
-
- public void testRecursiveBodyMacroScope()
- {
- engine.setProperty(RuntimeConstants.VM_MAX_DEPTH, "5");
- String template = "#macro( foo )$bodyContent$macro.i#end"+
- "#@foo()#set( $macro.i = \"$!macro.i$foo.depth,\" )"+
- "$!bodyContent#end";
- assertEvalEquals("1,2,3,4,5,", template);
- assertNull(context.get("foo"));
- assertNull(context.get("macro"));
- }
-
- public void testDefineScope()
- {
- String template = "#define( $foo )#set( $define.bar = 'bar'+$define.depth )$define.bar#end$foo";
- assertEvalEquals("bar1", template);
- assertNull(context.get("define"));
- }
-
- public void testNestedDefineScope()
- {
- String template = "#define($a)$b c#end"+
- "#define($b)$define.depth#break($define.topmost)#end"+
- "$a";
- assertEvalEquals("2", template);
- assertNull(context.get("define"));
- }
-
- public void testRecursiveDefineScope()
- {
- engine.setProperty(RuntimeConstants.DEFINE_DIRECTIVE_MAXDEPTH, "10");
- String template = "#define($a)$define.depth"+
- "#if($define.depth == 5)#break($define)#end,$a#end$a";
- assertEvalEquals("1,2,3,4,5", template);
- assertNull(context.get("define"));
- }
-
- public void testRootEvaluateScope()
- {
- assertEvalEquals("1", "$evaluate.depth");
- assertEvalEquals("foo", "foo#break($evaluate)bar");
- assertNull(context.get("evaluate"));
- }
-
- public void testEvaluateScope()
- {
- context.put("h", "#");
- context.put("d", "$");
- String template = "${h}set( ${d}evaluate.foo = 'bar' )"+
- "${d}evaluate.foo ${d}evaluate.depth";
- addTemplate("eval", "#evaluate(\""+template+"\")");
- assertTmplEquals("bar 1", "eval");
- assertNull(context.get("evaluate"));
- assertNull(context.get("template"));
- }
-
- public void testNestedEvaluateScope()
- {
- context.put("h", "#");
- context.put("d", "$");
- addTemplate("e", "#evaluate(\"${h}evaluate( '${d}evaluate.depth${h}stop(${d}evaluate) blah' )\")");
- assertTmplEquals("2", "e");
- assertNull(context.get("evaluate"));
- assertNull(context.get("template"));
- }
-
- public void testTurningOffTemplateScope()
- {
- engine.setProperty("template."+RuntimeConstants.PROVIDE_SCOPE_CONTROL, "false");
- // root
- addTemplate("test", "$template.depth");
- assertTmplEquals("$template.depth", "test");
- // #parse
- assertEvalEquals("$template.depth", "#parse('test')");
- }
-
- public void testTurningOffEvaluateScope()
- {
- engine.setProperty("evaluate."+RuntimeConstants.PROVIDE_SCOPE_CONTROL, "false");
- // root
- assertSchmoo("$evaluate.depth");
- // #evaluate
- assertEvalEquals("$evaluate.depth", "#evaluate( '$evaluate.depth' )");
- }
-
- public void testTurningOffMacroScope()
- {
- engine.setProperty("macro."+RuntimeConstants.PROVIDE_SCOPE_CONTROL, "false");
- engine.setProperty("foo."+RuntimeConstants.PROVIDE_SCOPE_CONTROL, "false");
- // macro definition
- assertEvalEquals("$macro", "#macro(a)$macro#end#a()");
- // macro body
- assertEvalEquals("$macro $foo", "#macro(foo)$bodyContent#end#@foo()$macro $foo#end");
- }
-
- public void testTurningOffDefineScope()
- {
- engine.setProperty("define."+RuntimeConstants.PROVIDE_SCOPE_CONTROL, "false");
- assertEvalEquals("$define", "#define($a)$define#end$a");
- }
-
- public void testTurningOffForeachScope()
- {
- engine.setProperty("foreach."+RuntimeConstants.PROVIDE_SCOPE_CONTROL, "false");
- assertEvalEquals("$foreach$foreach", "#foreach($i in [0..1])$foreach#end");
- }
-
- public void testTemplateReplaced()
- {
- context.put("template", "foo");
- addTemplate("test", "$template.replaced");
- assertTmplEquals("foo", "test");
- assertEvalEquals("foo", "#parse('test')");
- assertContextValue("template", "foo");
- }
-
- public void testEvaluateReplaced()
- {
- context.put("evaluate","foo");
- assertEvalEquals("foo", "$evaluate.replaced");
- assertEvalEquals("foo", "#evaluate('$evaluate.replaced')");
- assertContextValue("evaluate", "foo");
- }
-
- public void testMacroReplaced()
- {
- context.put("macro", "foo");
- assertEvalEquals("foo foo foo", "$macro #macro(a)$macro.replaced#end#a() $macro");
- assertContextValue("macro", "foo");
- }
-
- public void testForeachReplaced()
- {
- context.put("foreach", "foo");
- assertEvalEquals("foofoofoo", "$foreach#foreach($i in [1..1])$foreach.replaced#end$foreach");
- assertEquals("foo", context.get("foreach"));
- context.put("foreach", "a");
- assertEvalEquals("a", "#foreach($i in [1..1])#foreach($j in [1..1])$foreach.replaced#end#end");
- assertContextValue("foreach", "a");
- }
-
- public void testDefineReplaced()
- {
- context.put("define", "a");
- assertEvalEquals("a", "#define($a)$define.replaced#end$a");
- assertContextValue("define", "a");
- }
-
- public void testBodyContentReplaced()
- {
- context.put("vm", "a");
- assertEvalEquals("a", "#macro(vm)$bodyContent#end#@vm()$vm.replaced#end");
- assertContextValue("vm", "a");
- }
-
-}
+package org.apache.velocity.test;
+
+/*
+ * 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.
+ */
+
+import java.util.HashMap;
+
+import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.runtime.RuntimeConstants;
+
+/**
+ * This class tests the directive scope controls
+ */
+public class ScopeTestCase extends BaseTestCase
+{
+ public ScopeTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected void setUpEngine(VelocityEngine engine)
+ {
+ engine.setProperty("a.provide.scope.control", "true");
+ engine.setProperty("define.provide.scope.control", "true");
+ engine.setProperty("evaluate.provide.scope.control", "true");
+ engine.setProperty("foo.provide.scope.control", "true");
+ engine.setProperty("macro.provide.scope.control", "true");
+ engine.setProperty("template.provide.scope.control", "true");
+ engine.setProperty("vm.provide.scope.control", "true");
+ engine.setProperty(RuntimeConstants.SET_NULL_ALLOWED, Boolean.TRUE);
+ }
+
+ public void testScopeGetLeakIntoInner()
+ {
+ addTemplate("foo", "#foreach($i in [1..1])#set($foreach.a=$i)"+
+ "#foreach($j in [2..2])$foreach.a#set($foreach.a=$j)"+
+ "#foreach($k in [3..3])$foreach.a#end#end$foreach.a#end");
+ assertTmplEquals("121", "foo");
+ }
+
+ public void testScopeGetLeakDoesntHideNullset()
+ {
+ addTemplate("a", "#macro(a)#set($macro.a='a')#b()$macro.a#end"+
+ "#macro(b)$macro.a#set($macro.a=$null)$!macro.a#end"+
+ "#a()");
+ assertTmplEquals("aa", "a");
+ }
+
+ public void testRootTemplateMergeScope()
+ {
+ addTemplate("foo", "foo#break($template)bar");
+ assertTmplEquals("foo", "foo");
+ assertNull(context.get("template"));
+ }
+
+ public void testParseScope()
+ {
+ addTemplate("test", "$template.depth"+
+ "$!parse.parent.depth"+
+ "#set( $template.foo = 'bar' )"+
+ "$template.foo"+
+ "#break($template)"+
+ "woogie");
+ assertEvalEquals("1bar", "#parse( 'test' )");
+ assertNull(context.get("template"));
+ }
+
+ public void testNestedParseScope()
+ {
+ HashMap grab = new HashMap();
+ context.put("grab", grab);
+
+ addTemplate("inner", "Inner depth: $template.depth"+
+ "#set( $template.foo = '?' )"+
+ "$!grab.put('inner',$template)"+
+ "#break($template)$template.foo");
+ addTemplate("outer", "#set( $template.foo = '!' )"+
+ "Outer depth: $template.depth "+
+ "#parse('inner')"+
+ "$!grab.put('outer', $template)"+
+ "$template.foo");
+ assertEvalEquals("Outer depth: 1 Inner depth: 2!", "#parse('outer')");
+ // make extra sure that the outer control was restored after the stop
+ assertFalse(grab.get("inner") == grab.get("outer"));
+ // make sure the outer control was cleaned up
+ assertNull(context.get("template"));
+
+ addTemplate("3", "$template.topmost.foo#set( $template.topmost.foo = 'bar' )");
+ addTemplate("2", "#parse( '3' )$!parse.foo");
+ addTemplate("1", "#set( $template.foo = 'foo' )#parse('2')$template.foo");
+ assertEvalEquals("foobar", "#parse('1')$!parse");
+ // make sure the top control was cleaned up
+ assertNull(context.get("template"));
+ }
+
+ public void testForeachScope()
+ {
+ String template = "#foreach( $i in [0..2] )"+
+ "#if( $i > 1 )#break($foreach)#end"+
+ "$foreach.index:$foreach.count:$foreach.hasNext,"+
+ "#end";
+ assertEvalEquals("0:1:true,1:2:true,", template);
+ assertNull(context.get("foreach"));
+ }
+
+ public void testNestedForeachScope()
+ {
+ String template = "#foreach( $i in [1..5] )"+
+ "#foreach( $j in [1..2] )"+
+ "#if ( $i > $foreach.count + $foreach.index + $foreach.depth )#break($foreach.topmost)#end"+
+ "#end"+
+ "$i"+
+ "#end";
+ assertEvalEquals("123", template);
+ assertNull(context.get("foreach"));
+ }
+
+ public void testMacroScope()
+ {
+ String template = "#macro( foo $i )"+
+ "#if($i > 2 )#break($macro)#end"+
+ "$i#end"+
+ "#foo( 0 )#foo( 1 )#foo( 2 )";
+ assertEvalEquals("012", template);
+ assertNull(context.get("macro"));
+ }
+
+ public void testRecursiveMacroScope()
+ {
+ String template = "#macro( foo )$macro.depth"+
+ "#if($macro.depth > 2 )#break($macro.topmost)#end"+
+ "#foo()#end#foo()";
+ assertEvalEquals("123", template);
+ assertNull(context.get("macro"));
+ }
+
+ public void testNestedMacroScope()
+ {
+ String template = "#macro( a )$macro.depth#set($macro.c = 'a')$macro.c#end"+
+ "#macro( b )#set($macro.c = 'b' )#a()$macro.c#end"+
+ "#b()";
+ assertEvalEquals("2ab", template);
+ assertNull(context.get("macro"));
+ }
+
+ public void testBodyMacroScope()
+ {
+ String template = "#macro( foo $bar )$bodyContent$macro.bar#end"+
+ "#@foo( 'bar' )#set( $macro.bar = 'foo'+$bar )"+
+ "#set( $foo.d = $foo.depth )$foo.d #end";
+ assertEvalEquals("1 foobar", template);
+ assertNull(context.get("foo"));
+ assertNull(context.get("macro"));
+ }
+
+ public void testRecursiveBodyMacroScope()
+ {
+ engine.setProperty(RuntimeConstants.VM_MAX_DEPTH, "5");
+ String template = "#macro( foo )$bodyContent$macro.i#end"+
+ "#@foo()#set( $macro.i = \"$!macro.i$foo.depth,\" )"+
+ "$!bodyContent#end";
+ assertEvalEquals("1,2,3,4,5,", template);
+ assertNull(context.get("foo"));
+ assertNull(context.get("macro"));
+ }
+
+ public void testDefineScope()
+ {
+ String template = "#define( $foo )#set( $define.bar = 'bar'+$define.depth )$define.bar#end$foo";
+ assertEvalEquals("bar1", template);
+ assertNull(context.get("define"));
+ }
+
+ public void testNestedDefineScope()
+ {
+ String template = "#define($a)$b c#end"+
+ "#define($b)$define.depth#break($define.topmost)#end"+
+ "$a";
+ assertEvalEquals("2", template);
+ assertNull(context.get("define"));
+ }
+
+ public void testRecursiveDefineScope()
+ {
+ engine.setProperty(RuntimeConstants.DEFINE_DIRECTIVE_MAXDEPTH, "10");
+ String template = "#define($a)$define.depth"+
+ "#if($define.depth == 5)#break($define)#end,$a#end$a";
+ assertEvalEquals("1,2,3,4,5", template);
+ assertNull(context.get("define"));
+ }
+
+ public void testRootEvaluateScope()
+ {
+ assertEvalEquals("1", "$evaluate.depth");
+ assertEvalEquals("foo", "foo#break($evaluate)bar");
+ assertNull(context.get("evaluate"));
+ }
+
+ public void testEvaluateScope()
+ {
+ context.put("h", "#");
+ context.put("d", "$");
+ String template = "${h}set( ${d}evaluate.foo = 'bar' )"+
+ "${d}evaluate.foo ${d}evaluate.depth";
+ addTemplate("eval", "#evaluate(\""+template+"\")");
+ assertTmplEquals("bar 1", "eval");
+ assertNull(context.get("evaluate"));
+ assertNull(context.get("template"));
+ }
+
+ public void testNestedEvaluateScope()
+ {
+ context.put("h", "#");
+ context.put("d", "$");
+ addTemplate("e", "#evaluate(\"${h}evaluate( '${d}evaluate.depth${h}stop(${d}evaluate) blah' )\")");
+ assertTmplEquals("2", "e");
+ assertNull(context.get("evaluate"));
+ assertNull(context.get("template"));
+ }
+
+ public void testTurningOffTemplateScope()
+ {
+ engine.setProperty("template."+RuntimeConstants.PROVIDE_SCOPE_CONTROL, "false");
+ // root
+ addTemplate("test", "$template.depth");
+ assertTmplEquals("$template.depth", "test");
+ // #parse
+ assertEvalEquals("$template.depth", "#parse('test')");
+ }
+
+ public void testTurningOffEvaluateScope()
+ {
+ engine.setProperty("evaluate."+RuntimeConstants.PROVIDE_SCOPE_CONTROL, "false");
+ // root
+ assertSchmoo("$evaluate.depth");
+ // #evaluate
+ assertEvalEquals("$evaluate.depth", "#evaluate( '$evaluate.depth' )");
+ }
+
+ public void testTurningOffMacroScope()
+ {
+ engine.setProperty("macro."+RuntimeConstants.PROVIDE_SCOPE_CONTROL, "false");
+ engine.setProperty("foo."+RuntimeConstants.PROVIDE_SCOPE_CONTROL, "false");
+ // macro definition
+ assertEvalEquals("$macro", "#macro(a)$macro#end#a()");
+ // macro body
+ assertEvalEquals("$macro $foo", "#macro(foo)$bodyContent#end#@foo()$macro $foo#end");
+ }
+
+ public void testTurningOffDefineScope()
+ {
+ engine.setProperty("define."+RuntimeConstants.PROVIDE_SCOPE_CONTROL, "false");
+ assertEvalEquals("$define", "#define($a)$define#end$a");
+ }
+
+ public void testTurningOffForeachScope()
+ {
+ engine.setProperty("foreach."+RuntimeConstants.PROVIDE_SCOPE_CONTROL, "false");
+ assertEvalEquals("$foreach$foreach", "#foreach($i in [0..1])$foreach#end");
+ }
+
+ public void testTemplateReplaced()
+ {
+ context.put("template", "foo");
+ addTemplate("test", "$template.replaced");
+ assertTmplEquals("foo", "test");
+ assertEvalEquals("foo", "#parse('test')");
+ assertContextValue("template", "foo");
+ }
+
+ public void testEvaluateReplaced()
+ {
+ context.put("evaluate","foo");
+ assertEvalEquals("foo", "$evaluate.replaced");
+ assertEvalEquals("foo", "#evaluate('$evaluate.replaced')");
+ assertContextValue("evaluate", "foo");
+ }
+
+ public void testMacroReplaced()
+ {
+ context.put("macro", "foo");
+ assertEvalEquals("foo foo foo", "$macro #macro(a)$macro.replaced#end#a() $macro");
+ assertContextValue("macro", "foo");
+ }
+
+ public void testForeachReplaced()
+ {
+ context.put("foreach", "foo");
+ assertEvalEquals("foofoofoo", "$foreach#foreach($i in [1..1])$foreach.replaced#end$foreach");
+ assertEquals("foo", context.get("foreach"));
+ context.put("foreach", "a");
+ assertEvalEquals("a", "#foreach($i in [1..1])#foreach($j in [1..1])$foreach.replaced#end#end");
+ assertContextValue("foreach", "a");
+ }
+
+ public void testDefineReplaced()
+ {
+ context.put("define", "a");
+ assertEvalEquals("a", "#define($a)$define.replaced#end$a");
+ assertContextValue("define", "a");
+ }
+
+ public void testBodyContentReplaced()
+ {
+ context.put("vm", "a");
+ assertEvalEquals("a", "#macro(vm)$bodyContent#end#@vm()$vm.replaced#end");
+ assertContextValue("vm", "a");
+ }
+
+}
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/StaticUtilityMethodsTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/StaticUtilityMethodsTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/StaticUtilityMethodsTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/StaticUtilityMethodsTestCase.java Mon Jan 11 19:51:03 2010
@@ -19,7 +19,6 @@
* under the License.
*/
-import org.apache.velocity.VelocityContext;
/**
* This class tests support for putting static utility classes
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/StrictCompareTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/StrictCompareTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/StrictCompareTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/StrictCompareTestCase.java Mon Jan 11 19:51:03 2010
@@ -19,9 +19,7 @@
* under the License.
*/
-import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.VelocityException;
-import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.runtime.RuntimeConstants;
/**
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/StrictEscapeTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/StrictEscapeTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/StrictEscapeTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/StrictEscapeTestCase.java Mon Jan 11 19:51:03 2010
@@ -17,8 +17,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.runtime.RuntimeConstants;
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/StrictForeachTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/StrictForeachTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/StrictForeachTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/StrictForeachTestCase.java Mon Jan 11 19:51:03 2010
@@ -21,7 +21,7 @@
import java.util.ArrayList;
import java.util.Iterator;
-import org.apache.velocity.VelocityContext;
+
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.runtime.RuntimeConstants;
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/StrictMathTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/StrictMathTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/StrictMathTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/StrictMathTestCase.java Mon Jan 11 19:51:03 2010
@@ -19,7 +19,6 @@
* under the License.
*/
-import org.apache.velocity.VelocityContext;
import org.apache.velocity.exception.MathException;
import org.apache.velocity.runtime.RuntimeConstants;
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/StrictReferenceTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/StrictReferenceTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/StrictReferenceTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/StrictReferenceTestCase.java Mon Jan 11 19:51:03 2010
@@ -228,7 +228,7 @@
public void setProp(String val)
{
- this.prop = prop;
+ this.prop = val;
}
public String getNullVal()
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/StringConcatenationTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/StringConcatenationTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/StringConcatenationTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/StringConcatenationTestCase.java Mon Jan 11 19:51:03 2010
@@ -19,9 +19,6 @@
* under the License.
*/
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.exception.MathException;
-import org.apache.velocity.runtime.RuntimeConstants;
/**
* This class tests support for string concatenation.
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/StringResourceLoaderRepositoryTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/StringResourceLoaderRepositoryTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/StringResourceLoaderRepositoryTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/StringResourceLoaderRepositoryTestCase.java Mon Jan 11 19:51:03 2010
@@ -20,9 +20,9 @@
*/
import java.io.StringWriter;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+
import junit.framework.TestCase;
+
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/TextblockTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/TextblockTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/TextblockTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/TextblockTestCase.java Mon Jan 11 19:51:03 2010
@@ -19,8 +19,7 @@
* under the License.
*/
-import org.apache.velocity.runtime.RuntimeConstants;
-import org.apache.velocity.runtime.parser.node.ASTTextblock;
+import org.apache.velocity.runtime.parser.node.ASTTextblock;
/**
* This class tests the Textblock directive.
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/VarargMethodsTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/VarargMethodsTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/VarargMethodsTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/VarargMethodsTestCase.java Mon Jan 11 19:51:03 2010
@@ -19,7 +19,6 @@
* under the License.
*/
-import java.util.Arrays;
import org.apache.velocity.VelocityContext;
/**
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity537TestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity537TestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity537TestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity537TestCase.java Mon Jan 11 19:51:03 2010
@@ -23,9 +23,8 @@
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.runtime.RuntimeSingleton;
-import org.apache.velocity.test.misc.TestLogChute;
import org.apache.velocity.test.BaseTestCase;
+import org.apache.velocity.test.misc.TestLogChute;
/**
* Test Case for <a href="https://issues.apache.org/jira/browse/VELOCITY-537">Velocity Issue 537</a>.
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity615TestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity615TestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity615TestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity615TestCase.java Mon Jan 11 19:51:03 2010
@@ -20,8 +20,6 @@
*/
import org.apache.velocity.test.BaseTestCase;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.runtime.RuntimeConstants;
/**
* This class tests VELOCITY-615.
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity625TestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity625TestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity625TestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity625TestCase.java Mon Jan 11 19:51:03 2010
@@ -20,8 +20,6 @@
*/
import org.apache.velocity.test.BaseTestCase;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.runtime.RuntimeConstants;
/**
* This class tests VELOCITY-625.
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity629TestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity629TestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity629TestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity629TestCase.java Mon Jan 11 19:51:03 2010
@@ -20,7 +20,6 @@
*/
import org.apache.velocity.test.BaseTestCase;
-import org.apache.velocity.runtime.RuntimeConstants;
/**
* This class tests VELOCITY-629. Make sure string literals
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity62TestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity62TestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity62TestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity62TestCase.java Mon Jan 11 19:51:03 2010
@@ -19,9 +19,8 @@
* under the License.
*/
-import org.apache.velocity.test.BaseTestCase;
-import org.apache.velocity.VelocityContext;
import org.apache.velocity.runtime.RuntimeConstants;
+import org.apache.velocity.test.BaseTestCase;
/**
* This class tests VELOCITY-62.
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity630TestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity630TestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity630TestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity630TestCase.java Mon Jan 11 19:51:03 2010
@@ -20,7 +20,6 @@
*/
import org.apache.velocity.test.BaseTestCase;
-import org.apache.velocity.runtime.RuntimeConstants;
/**
* This class tests VELOCITY-630.
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity631TestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity631TestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity631TestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity631TestCase.java Mon Jan 11 19:51:03 2010
@@ -20,7 +20,6 @@
*/
import org.apache.velocity.test.BaseTestCase;
-import org.apache.velocity.runtime.RuntimeConstants;
/**
* This class tests VELOCITY-631.
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity667TestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity667TestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity667TestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity667TestCase.java Mon Jan 11 19:51:03 2010
@@ -20,7 +20,6 @@
*/
import org.apache.velocity.test.BaseTestCase;
-import org.apache.velocity.runtime.RuntimeConstants;
/**
* This class tests VELOCITY-667. Make "#macro" throws a parse exception