You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by he...@apache.org on 2006/09/19 23:00:26 UTC
svn commit: r447969 [8/10] - in /jakarta/velocity/engine/trunk: ./ build/
build/xsl/ examples/anakia/build/ examples/anakia/xdocs/
examples/anakia/xdocs/about/ examples/anakia/xdocs/stylesheets/
examples/app_example1/ examples/app_example2/ examples/co...
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ClasspathResourceTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ClasspathResourceTestCase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ClasspathResourceTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ClasspathResourceTestCase.java Tue Sep 19 14:00:14 2006
@@ -89,14 +89,14 @@
Velocity.setProperty(
"classpath." + Velocity.RESOURCE_LOADER + ".cache", "false");
-
+
Velocity.setProperty(
"classpath." + Velocity.RESOURCE_LOADER + ".modificationCheckInterval",
"2");
Velocity.init();
}
-
+
public static Test suite ()
{
return new TestSuite(ClasspathResourceTestCase.class);
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/EventHandlingTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/EventHandlingTestCase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/EventHandlingTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/EventHandlingTestCase.java Tue Sep 19 14:00:14 2006
@@ -330,7 +330,7 @@
RuntimeServicesAware,ContextAware
{
private RuntimeServices rs;
-
+
public TestEventCartridge()
{
}
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ExceptionTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ExceptionTestCase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ExceptionTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ExceptionTestCase.java Tue Sep 19 14:00:14 2006
@@ -40,7 +40,7 @@
public class ExceptionTestCase extends BaseTestCase implements TemplateTestBase
{
VelocityEngine ve;
-
+
/**
* Default constructor.
*/
@@ -48,14 +48,14 @@
{
super(name);
}
-
+
public static Test suite ()
{
return new TestSuite(ExceptionTestCase.class);
}
- public void testReferenceInsertionEventHandlerException()
+ public void testReferenceInsertionEventHandlerException()
throws Exception
{
ve = new VelocityEngine();
@@ -63,13 +63,13 @@
ve.init();
assertException(ve);
}
-
+
/**
* Note - this is the one case where RuntimeExceptions *are not* passed through
* verbatim.
* @throws Exception
*/
- public void testMethodExceptionEventHandlerException()
+ public void testMethodExceptionEventHandlerException()
throws Exception
{
ve = new VelocityEngine();
@@ -80,8 +80,8 @@
assertMethodInvocationException(ve,context,"$test.getThrow()");
assertMethodInvocationException(ve,context,"$test.throw");
}
-
- public void testNullSetEventHandlerException()
+
+ public void testNullSetEventHandlerException()
throws Exception
{
ve = new VelocityEngine();
@@ -89,8 +89,8 @@
ve.init();
assertException(ve,"#set($test = $abc)");
}
-
- public void testIncludeEventHandlerException()
+
+ public void testIncludeEventHandlerException()
throws Exception
{
ve = new VelocityEngine();
@@ -98,27 +98,27 @@
ve.init();
assertException(ve,"#include('dummy')");
}
-
+
public void testResourceLoaderException()
throws Exception
{
ve = new VelocityEngine();
ve.setProperty(RuntimeConstants.RESOURCE_LOADER,"except");
ve.setProperty("except.resource.loader.class",ExceptionGeneratingResourceLoader.class.getName());
- try
+ try
{
ve.init(); // tries to get the macro file
ve.getTemplate("test.txt");
fail("Should have thrown RuntimeException");
- }
+ }
catch (RuntimeException E)
{
// do nothing
- }
+ }
}
-
-
- public void testDirectiveException()
+
+
+ public void testDirectiveException()
throws Exception
{
ve = new VelocityEngine();
@@ -127,8 +127,8 @@
assertException(ve,"#Exception() test #end");
}
-
-
+
+
public void assertException(VelocityEngine ve)
throws Exception
{
@@ -136,7 +136,7 @@
context.put ("test","test");
assertException(ve,context,"this is a $test");
}
-
+
public void assertException(VelocityEngine ve, String input)
throws Exception
{
@@ -144,16 +144,16 @@
context.put ("test","test");
assertException(ve,context,input);
}
-
+
public void assertException(VelocityEngine ve, Context context, String input)
throws Exception
{
- try
+ try
{
StringWriter writer = new StringWriter();
ve.evaluate(context,writer,"test",input);
fail("Expected RuntimeException");
- }
+ }
catch (RuntimeException E)
{
// do nothing
@@ -162,17 +162,17 @@
public void assertMethodInvocationException(VelocityEngine ve, Context context, String input)
throws Exception
{
- try
+ try
{
StringWriter writer = new StringWriter();
ve.evaluate(context,writer,"test",input);
fail("Expected MethodInvocationException");
- }
+ }
catch (MethodInvocationException E)
{
// do nothing
}
}
-
-
+
+
}
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/FilteredEventHandlingTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/FilteredEventHandlingTestCase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/FilteredEventHandlingTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/FilteredEventHandlingTestCase.java Tue Sep 19 14:00:14 2006
@@ -164,7 +164,7 @@
{
ve.evaluate( context, w, "test", "$test.get(0)");
fail ( "Method exception event test 1" );
- }
+ }
catch( MethodInvocationException mee )
{
// do nothing
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeErrorTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeErrorTestCase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeErrorTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IncludeErrorTestCase.java Tue Sep 19 14:00:14 2006
@@ -41,7 +41,7 @@
public class IncludeErrorTestCase extends BaseTestCase implements TemplateTestBase
{
VelocityEngine ve;
-
+
/**
* Default constructor.
*/
@@ -49,7 +49,7 @@
{
super(name);
}
-
+
public static Test suite ()
{
return new TestSuite(IncludeErrorTestCase.class);
@@ -66,27 +66,27 @@
- public void testMissingParseError() throws Exception
+ public void testMissingParseError() throws Exception
{
checkException("missingparse.vm",ResourceNotFoundException.class);
}
- public void testMissingIncludeError() throws Exception
+ public void testMissingIncludeError() throws Exception
{
checkException("missinginclude.vm",ResourceNotFoundException.class);
}
- public void testParseError() throws Exception
+ public void testParseError() throws Exception
{
checkException("parsemain.vm",ParseErrorException.class);
}
-
- public void testParseError2() throws Exception
+
+ public void testParseError2() throws Exception
{
checkException("parsemain2.vm",ParseErrorException.class);
}
-
-
+
+
/**
* Check that an exception is thrown for the given template
* @param templateName
@@ -100,21 +100,21 @@
StringWriter writer = new StringWriter();
Template template = ve.getTemplate(templateName, "UTF-8");
- try
+ try
{
template.merge(context, writer);
writer.flush();
fail("File should have thrown an exception");
- }
- catch (Exception E)
+ }
+ catch (Exception E)
{
assertTrue(exceptionClass.isAssignableFrom(E.getClass()));
}
- finally
+ finally
{
writer.close();
}
-
+
}
}
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/InfoTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/InfoTestCase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/InfoTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/InfoTestCase.java Tue Sep 19 14:00:14 2006
@@ -1,119 +1,119 @@
-package org.apache.velocity.test;
-
-import java.io.StringWriter;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-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.context.Context;
-import org.apache.velocity.test.misc.UberspectTestException;
-import org.apache.velocity.util.introspection.Info;
-
-
+package org.apache.velocity.test;
+
+import java.io.StringWriter;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+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.context.Context;
+import org.apache.velocity.test.misc.UberspectTestException;
+import org.apache.velocity.util.introspection.Info;
+
+
/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed 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.
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
*/
-
-
-/**
- * Test that the Info class in the Introspector holds the correct information.
- *
- * @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
- * @author <a href="mailto:isidore@setgame.com">Llewellyn Falco</a>
- * @version $Id$
- */
-public class InfoTestCase extends BaseTestCase implements TemplateTestBase
-{
- VelocityEngine ve;
-
- /**
- * Default constructor.
- */
- public InfoTestCase(String name)
- {
- super(name);
- }
-
- public static Test suite ()
- {
- return new TestSuite(InfoTestCase.class);
- }
-
- public void setUp() throws Exception
- {
- ve = new VelocityEngine();
- ve.setProperty(
- "runtime.introspector.uberspect", "org.apache.velocity.test.misc.UberspectTestImpl");
-
- ve.setProperty(
- Velocity.FILE_RESOURCE_LOADER_PATH, "test/info");
-
- ve.init();
- }
-
-
-
- public void testInfoProperty() throws Exception
- {
- // check property
- checkInfo("info1.vm", 1, 7);
- }
-
- public void testInfoMethod() throws Exception
- {
- // check method
- checkInfo("info2.vm", 1, 7);
- }
-
- public void checkInfo(String templateName,
- int expectedLine, int expectedCol) throws Exception
- {
- Context context = new VelocityContext();
- StringWriter writer = new StringWriter();
- Template template = ve.getTemplate(templateName, "UTF-8");
- Info info = null;
-
- context.put("main", this);
-
- try
- {
- template.merge(context, writer);
- writer.flush();
- fail("Uberspect should have thrown an exception");
- }
- catch (UberspectTestException E)
- {
- info = E.getInfo();
- }
- finally
- {
- writer.close();
- }
- assertInfoEqual(info, templateName, expectedLine, expectedCol);
-
- }
-
- private void assertInfoEqual(Info i, String name, int line, int column)
- {
- assertEquals("Template Name", name, i.getTemplateName());
- assertEquals("Template Line", line, i.getLine());
- assertEquals("Template Column", column, i.getColumn());
- }
-
-}
+
+
+/**
+ * Test that the Info class in the Introspector holds the correct information.
+ *
+ * @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
+ * @author <a href="mailto:isidore@setgame.com">Llewellyn Falco</a>
+ * @version $Id$
+ */
+public class InfoTestCase extends BaseTestCase implements TemplateTestBase
+{
+ VelocityEngine ve;
+
+ /**
+ * Default constructor.
+ */
+ public InfoTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite ()
+ {
+ return new TestSuite(InfoTestCase.class);
+ }
+
+ public void setUp() throws Exception
+ {
+ ve = new VelocityEngine();
+ ve.setProperty(
+ "runtime.introspector.uberspect", "org.apache.velocity.test.misc.UberspectTestImpl");
+
+ ve.setProperty(
+ Velocity.FILE_RESOURCE_LOADER_PATH, "test/info");
+
+ ve.init();
+ }
+
+
+
+ public void testInfoProperty() throws Exception
+ {
+ // check property
+ checkInfo("info1.vm", 1, 7);
+ }
+
+ public void testInfoMethod() throws Exception
+ {
+ // check method
+ checkInfo("info2.vm", 1, 7);
+ }
+
+ public void checkInfo(String templateName,
+ int expectedLine, int expectedCol) throws Exception
+ {
+ Context context = new VelocityContext();
+ StringWriter writer = new StringWriter();
+ Template template = ve.getTemplate(templateName, "UTF-8");
+ Info info = null;
+
+ context.put("main", this);
+
+ try
+ {
+ template.merge(context, writer);
+ writer.flush();
+ fail("Uberspect should have thrown an exception");
+ }
+ catch (UberspectTestException E)
+ {
+ info = E.getInfo();
+ }
+ finally
+ {
+ writer.close();
+ }
+ assertInfoEqual(info, templateName, expectedLine, expectedCol);
+
+ }
+
+ private void assertInfoEqual(Info i, String name, int line, int column)
+ {
+ assertEquals("Template Name", name, i.getTemplateName());
+ assertEquals("Template Line", line, i.getLine());
+ assertEquals("Template Column", column, i.getColumn());
+ }
+
+}
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IntrospectorTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IntrospectorTestCase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IntrospectorTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/IntrospectorTestCase.java Tue Sep 19 14:00:14 2006
@@ -37,7 +37,7 @@
*/
public class IntrospectorTestCase extends BaseTestCase
{
- private static MethodProvider mp;
+ private static MethodProvider mp;
public void setUp()
{
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MiscTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MiscTestCase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MiscTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/MiscTestCase.java Tue Sep 19 14:00:14 2006
@@ -71,7 +71,7 @@
arg = null;
res = StringUtils.nullTrim(arg);
assertNull(arg);
-
+
arg = " test ";
res = StringUtils.nullTrim(arg);
assertEquals("test",res);
@@ -79,19 +79,19 @@
arg = "test";
res = StringUtils.nullTrim(arg);
assertEquals("test",res);
-
+
List list = null;
assertNull(StringUtils.trimStrings(list));
-
+
list = new ArrayList();
assertEquals(new ArrayList(),StringUtils.trimStrings(list));
-
+
list.add("test");
list.add(" abc");
StringUtils.trimStrings(list);
assertEquals("test",list.get(0));
assertEquals("abc",list.get(1));
-
+
}
}
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ParseExceptionTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ParseExceptionTestCase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ParseExceptionTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ParseExceptionTestCase.java Tue Sep 19 14:00:14 2006
@@ -70,28 +70,28 @@
{
VelocityEngine ve = new VelocityEngine();
-
+
ve.setProperty("file.resource.loader.cache", "true");
ve.setProperty("file.resource.loader.path", FILE_RESOURCE_LOADER_PATH);
ve.init();
-
+
Writer writer = new StringWriter();
VelocityContext context = new VelocityContext();
- try
+ try
{
Template template = ve.getTemplate("badtemplate.vm");
template.merge(context, writer);
fail("Should have thown a ParseErrorException");
- }
- catch (ParseErrorException e)
+ }
+ catch (ParseErrorException e)
{
assertEquals("badtemplate.vm",e.getTemplateName());
assertEquals(5,e.getLineNumber());
assertEquals(9,e.getColumnNumber());
- }
+ }
finally
{
if (writer != null)
@@ -111,22 +111,22 @@
VelocityEngine ve = new VelocityEngine();
ve.init();
-
+
VelocityContext context = new VelocityContext();
-
+
Writer writer = new StringWriter();
-
- try
+
+ try
{
- ve.evaluate(context,writer,"test"," #set($abc) ");
+ ve.evaluate(context,writer,"test"," #set($abc) ");
fail("Should have thown a ParseErrorException");
- }
- catch (ParseErrorException e)
+ }
+ catch (ParseErrorException e)
{
assertEquals("test",e.getTemplateName());
assertEquals(1,e.getLineNumber());
assertEquals(13,e.getColumnNumber());
- }
+ }
finally
{
if (writer != null)
@@ -135,7 +135,7 @@
}
}
}
-
+
/**
* Tests that parseException has useful info when thrown in VelocityEngine.evaluate()
* and the problem comes from a macro definition
@@ -146,22 +146,22 @@
{
VelocityEngine ve = new VelocityEngine();
ve.init();
-
+
VelocityContext context = new VelocityContext();
-
+
Writer writer = new StringWriter();
-
- try
+
+ try
{
- ve.evaluate(context,writer,"testMacro","#macro($blarg) foo #end");
+ ve.evaluate(context,writer,"testMacro","#macro($blarg) foo #end");
fail("Should have thown a ParseErrorException");
- }
- catch (ParseErrorException e)
+ }
+ catch (ParseErrorException e)
{
assertEquals("testMacro",e.getTemplateName());
assertEquals(1,e.getLineNumber());
assertEquals(7,e.getColumnNumber());
- }
+ }
finally
{
if (writer != null)
@@ -170,7 +170,7 @@
}
}
}
-
+
/**
* Tests that parseException has useful info when thrown in VelocityEngine.evaluate()
* and the problem comes from a macro invocation
@@ -181,22 +181,22 @@
{
VelocityEngine ve = new VelocityEngine();
ve.init();
-
+
VelocityContext context = new VelocityContext();
-
+
Writer writer = new StringWriter();
-
- try
+
+ try
{
- ve.evaluate(context,writer,"testMacroInvoke", "#macro( foo $a) $a #end #foo(woogie)");
+ ve.evaluate(context,writer,"testMacroInvoke", "#macro( foo $a) $a #end #foo(woogie)");
fail("Should have thown a ParseErrorException");
- }
- catch (ParseErrorException e)
+ }
+ catch (ParseErrorException e)
{
assertEquals("testMacroInvoke",e.getTemplateName());
assertEquals(1,e.getLineNumber());
assertEquals(31,e.getColumnNumber());
- }
+ }
finally
{
if (writer != null)
@@ -205,5 +205,5 @@
}
}
}
-
+
}
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ResourceCachingTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ResourceCachingTestCase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ResourceCachingTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/ResourceCachingTestCase.java Tue Sep 19 14:00:14 2006
@@ -1,91 +1,91 @@
-package org.apache.velocity.test;
-
+package org.apache.velocity.test;
+
/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed 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.
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.StringWriter;
-import java.io.Writer;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.velocity.Template;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.VelocityEngine;
-
-/**
- * Test resource caching related issues.
- *
- * @author <a href="mailto:wglass@apache.org">Will Glass-Husain</a>
- * @version $Id$
- */
-public class ResourceCachingTestCase extends BaseTestCase
-{
- /**
- * Path for templates. This property will override the
- * value in the default velocity properties file.
- */
- private final static String FILE_RESOURCE_LOADER_PATH = "test/resourcecaching";
-
-
- /**
- * Default constructor.
- */
- public ResourceCachingTestCase(String name)
- {
- super(name);
- }
-
- public void setUp()
- throws Exception
- {
-
- }
-
- public static Test suite ()
- {
- return new TestSuite(ResourceCachingTestCase.class);
- }
-
- /**
- * Tests for fix of bug VELOCITY-98 where a #include followed by #parse
- * of the same file throws ClassCastException when caching is on.
- * @throws Exception
- */
- public void testIncludeParseCaching ()
- throws Exception
- {
-
- VelocityEngine ve = new VelocityEngine();
-
- ve.setProperty("file.resource.loader.cache", "true");
- ve.setProperty("file.resource.loader.path", FILE_RESOURCE_LOADER_PATH);
- ve.init();
-
- Template template = ve.getTemplate("testincludeparse.vm");
-
- Writer writer = new StringWriter();
-
- VelocityContext context = new VelocityContext();
-
- // will produce a ClassCastException if Velocity-98 is not solved
- template.merge(context, writer);
- writer.flush();
- writer.close();
- }
-
-
-}
+
+import java.io.StringWriter;
+import java.io.Writer;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.VelocityEngine;
+
+/**
+ * Test resource caching related issues.
+ *
+ * @author <a href="mailto:wglass@apache.org">Will Glass-Husain</a>
+ * @version $Id$
+ */
+public class ResourceCachingTestCase extends BaseTestCase
+{
+ /**
+ * Path for templates. This property will override the
+ * value in the default velocity properties file.
+ */
+ private final static String FILE_RESOURCE_LOADER_PATH = "test/resourcecaching";
+
+
+ /**
+ * Default constructor.
+ */
+ public ResourceCachingTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void setUp()
+ throws Exception
+ {
+
+ }
+
+ public static Test suite ()
+ {
+ return new TestSuite(ResourceCachingTestCase.class);
+ }
+
+ /**
+ * Tests for fix of bug VELOCITY-98 where a #include followed by #parse
+ * of the same file throws ClassCastException when caching is on.
+ * @throws Exception
+ */
+ public void testIncludeParseCaching ()
+ throws Exception
+ {
+
+ VelocityEngine ve = new VelocityEngine();
+
+ ve.setProperty("file.resource.loader.cache", "true");
+ ve.setProperty("file.resource.loader.path", FILE_RESOURCE_LOADER_PATH);
+ ve.init();
+
+ Template template = ve.getTemplate("testincludeparse.vm");
+
+ Writer writer = new StringWriter();
+
+ VelocityContext context = new VelocityContext();
+
+ // will produce a ClassCastException if Velocity-98 is not solved
+ template.merge(context, writer);
+ writer.flush();
+ writer.close();
+ }
+
+
+}
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/SetTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/SetTestCase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/SetTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/SetTestCase.java Tue Sep 19 14:00:14 2006
@@ -97,13 +97,13 @@
/**
* Check that #set does not accept nulls
*/
-
+
VelocityEngine ve = new VelocityEngine();
ve.addProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, FILE_RESOURCE_LOADER_PATH);
ve.init();
-
+
checkTemplate(ve,"set1");
-
+
/**
* Check that setting the property is the same as the default
*/
@@ -111,7 +111,7 @@
ve.addProperty(RuntimeConstants.SET_NULL_ALLOWED, "false");
ve.addProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, FILE_RESOURCE_LOADER_PATH);
ve.init();
-
+
checkTemplate(ve,"set1");
/**
@@ -121,7 +121,7 @@
ve.addProperty(RuntimeConstants.SET_NULL_ALLOWED, "true");
ve.addProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, FILE_RESOURCE_LOADER_PATH);
ve.init();
-
+
checkTemplate(ve,"set2");
}
@@ -148,7 +148,7 @@
if (!isMatch(RESULTS_DIR, COMPARE_DIR, templateName, RESULT_FILE_EXT, CMP_FILE_EXT))
{
fail("Output incorrect.");
- }
+ }
}
}
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/TemplateTestBase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/TemplateTestBase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/TemplateTestBase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/TemplateTestBase.java Tue Sep 19 14:00:14 2006
@@ -25,8 +25,8 @@
*/
public interface TemplateTestBase
{
- /**
- * Directory relative to the distribution root, where the
+ /**
+ * Directory relative to the distribution root, where the
* values to compare test results to are stored.
*/
public static final String TEST_COMPARE_DIR = "@test.dir@";
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/UberspectorTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/UberspectorTestCase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/UberspectorTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/UberspectorTestCase.java Tue Sep 19 14:00:14 2006
@@ -38,12 +38,12 @@
{
super(name);
}
-
+
public static Test suite()
{
return new TestSuite(UberspectorTestCase.class);
}
-
+
public void setUp()
throws Exception
{
@@ -54,7 +54,7 @@
public void testNullObjects()
throws Exception
{
- // How about some null objects... Gee, I'm mean. ;-)
+ // How about some null objects... Gee, I'm mean. ;-)
Uberspect u = ri.getUberspect();
VelPropertyGet getter = u.getPropertyGet(null, "foo", null);
@@ -89,7 +89,7 @@
assertNotNull(setter);
assertEquals("Found wrong method", "put", setter.getMethodName());
}
-
+
public void testNullPropertyGetter()
throws Exception
{
@@ -117,7 +117,7 @@
Map map = new HashMap();
// Don't screw up on null properties. That should map to put() on the GPO.
- VelPropertySet setter = u.getPropertySet(gpo, null, "", null);
+ VelPropertySet setter = u.getPropertySet(gpo, null, "", null);
assertNotNull(setter);
assertEquals("Found wrong method", "put", setter.getMethodName());
@@ -258,7 +258,7 @@
/*
- *
+ *
* public void testMapGetSet()
* throws Exception
* {
@@ -275,8 +275,8 @@
* assertEquals("Got wrong setter", "bar", setter.getMethodName());
* }
*/
-}
-
+}
+
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VelocimacroTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VelocimacroTestCase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VelocimacroTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/VelocimacroTestCase.java Tue Sep 19 14:00:14 2006
@@ -66,9 +66,9 @@
StringWriter writer = new StringWriter();
Velocity.evaluate(context, writer, "vm_chain1", template1);
-
+
String out = writer.toString();
-
+
if( !result1.equals( out ) )
{
fail("output incorrect.");
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/WrappedExceptionTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/WrappedExceptionTestCase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/WrappedExceptionTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/WrappedExceptionTestCase.java Tue Sep 19 14:00:14 2006
@@ -37,7 +37,7 @@
public class WrappedExceptionTestCase extends BaseTestCase implements TemplateTestBase
{
VelocityEngine ve;
-
+
/**
* Default constructor.
*/
@@ -45,7 +45,7 @@
{
super(name);
}
-
+
public static Test suite ()
{
return new TestSuite(WrappedExceptionTestCase.class);
@@ -65,12 +65,12 @@
Context context = new VelocityContext();
StringWriter writer = new StringWriter();
context.put("test",new TestProvider());
-
- try
- {
+
+ try
+ {
ve.evaluate(context,writer,"test","$test.getThrow()");
fail ("expected an exception");
- }
+ }
catch (MethodInvocationException E)
{
assertEquals(Exception.class,E.getCause().getClass());
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/ExceptionGeneratingDirective.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/ExceptionGeneratingDirective.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/ExceptionGeneratingDirective.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/ExceptionGeneratingDirective.java Tue Sep 19 14:00:14 2006
@@ -29,7 +29,7 @@
/**
* that always throws an exception. Used to test
* that RuntimeExceptions are passed through.
- *
+ *
* @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
* @version $Id$
*/
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/ExceptionGeneratingEventHandler.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/ExceptionGeneratingEventHandler.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/ExceptionGeneratingEventHandler.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/ExceptionGeneratingEventHandler.java Tue Sep 19 14:00:14 2006
@@ -24,7 +24,7 @@
/**
* Event handlers that always throws an exception. Used to test
* that RuntimeExceptions are passed through.
- *
+ *
* @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
* @version $Id$
*/
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/ExceptionGeneratingResourceLoader.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/ExceptionGeneratingResourceLoader.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/ExceptionGeneratingResourceLoader.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/ExceptionGeneratingResourceLoader.java Tue Sep 19 14:00:14 2006
@@ -26,7 +26,7 @@
/**
* Resource Loader that always throws an exception. Used to test
* that RuntimeExceptions are passed through.
- *
+ *
* @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
* @version $Id$
*/
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/GetPutObject.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/GetPutObject.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/GetPutObject.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/GetPutObject.java Tue Sep 19 14:00:14 2006
@@ -23,8 +23,8 @@
public Object get()
{
return value;
- }
-
+ }
+
public void put(final Object value)
{
this.value = value;
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/UberspectTestException.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/UberspectTestException.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/UberspectTestException.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/UberspectTestException.java Tue Sep 19 14:00:14 2006
@@ -1,57 +1,57 @@
-package org.apache.velocity.test.misc;
-
-import org.apache.velocity.util.introspection.Info;
-
+package org.apache.velocity.test.misc;
+
+import org.apache.velocity.util.introspection.Info;
+
/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed 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.
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
*/
-
-
-/**
- * Exception that returns an Info object for testing after a introspection problem.
- * This extends Error so that it will stop parsing and allow
- * internal info to be examined.
- *
- * @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
- * @author <a href="mailto:isidore@setgame.com">Llewellyn Falco</a>
- * @version $Id$
- */
-public class UberspectTestException extends RuntimeException
-{
-
- /**
- * Version Id for serializable
- */
- private static final long serialVersionUID = 3956896150436225712L;
-
- Info info;
-
- public UberspectTestException(String message, Info i)
- {
- super(message);
- info = i;
- }
-
- public Info getInfo()
- {
- return info;
- }
-
- public String getMessage()
- {
- return super.getMessage() + "\n failed at " + info;
- }
-
-}
+
+
+/**
+ * Exception that returns an Info object for testing after a introspection problem.
+ * This extends Error so that it will stop parsing and allow
+ * internal info to be examined.
+ *
+ * @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
+ * @author <a href="mailto:isidore@setgame.com">Llewellyn Falco</a>
+ * @version $Id$
+ */
+public class UberspectTestException extends RuntimeException
+{
+
+ /**
+ * Version Id for serializable
+ */
+ private static final long serialVersionUID = 3956896150436225712L;
+
+ Info info;
+
+ public UberspectTestException(String message, Info i)
+ {
+ super(message);
+ info = i;
+ }
+
+ public Info getInfo()
+ {
+ return info;
+ }
+
+ public String getMessage()
+ {
+ return super.getMessage() + "\n failed at " + info;
+ }
+
+}
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/UberspectTestImpl.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/UberspectTestImpl.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/UberspectTestImpl.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/UberspectTestImpl.java Tue Sep 19 14:00:14 2006
@@ -1,60 +1,60 @@
-package org.apache.velocity.test.misc;
-
-import org.apache.velocity.util.introspection.Info;
-import org.apache.velocity.util.introspection.UberspectImpl;
-import org.apache.velocity.util.introspection.VelMethod;
-import org.apache.velocity.util.introspection.VelPropertyGet;
-
+package org.apache.velocity.test.misc;
+
+import org.apache.velocity.util.introspection.Info;
+import org.apache.velocity.util.introspection.UberspectImpl;
+import org.apache.velocity.util.introspection.VelMethod;
+import org.apache.velocity.util.introspection.VelPropertyGet;
+
/*
- * Copyright 2000-2004 The Apache Software Foundation.
- *
- * Licensed 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.
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
*/
-
-/**
- * A introspector that allows testing when methods are not found.
- */
-public class UberspectTestImpl extends UberspectImpl
-{
-
- public VelMethod getMethod(Object obj, String methodName, Object[] args, Info i) throws Exception
- {
- VelMethod method = super.getMethod(obj, methodName, args, i);
-
- if (method == null)
- {
- if (obj == null)
- throw new UberspectTestException("Can't call method '" + methodName + "' on null object",i);
- else
- throw new UberspectTestException("Did not find method "+ obj.getClass().getName()+"."+methodName, i);
- }
-
- return method;
- }
-
- public VelPropertyGet getPropertyGet(Object obj, String identifier, Info i) throws Exception
- {
- VelPropertyGet propertyGet = super.getPropertyGet(obj, identifier, i);
-
- if (propertyGet == null)
- {
- if (obj == null)
- throw new UberspectTestException("Can't call getter '" + identifier + "' on null object",i);
- else
- throw new UberspectTestException("Did not find "+ obj.getClass().getName()+"."+identifier, i);
- }
-
- return propertyGet;
- }
-
+
+/**
+ * A introspector that allows testing when methods are not found.
+ */
+public class UberspectTestImpl extends UberspectImpl
+{
+
+ public VelMethod getMethod(Object obj, String methodName, Object[] args, Info i) throws Exception
+ {
+ VelMethod method = super.getMethod(obj, methodName, args, i);
+
+ if (method == null)
+ {
+ if (obj == null)
+ throw new UberspectTestException("Can't call method '" + methodName + "' on null object",i);
+ else
+ throw new UberspectTestException("Did not find method "+ obj.getClass().getName()+"."+methodName, i);
+ }
+
+ return method;
+ }
+
+ public VelPropertyGet getPropertyGet(Object obj, String identifier, Info i) throws Exception
+ {
+ VelPropertyGet propertyGet = super.getPropertyGet(obj, identifier, i);
+
+ if (propertyGet == null)
+ {
+ if (obj == null)
+ throw new UberspectTestException("Can't call getter '" + identifier + "' on null object",i);
+ else
+ throw new UberspectTestException("Did not find "+ obj.getClass().getName()+"."+identifier, i);
+ }
+
+ return propertyGet;
+ }
+
}
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/UberspectorTestObject.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/UberspectorTestObject.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/UberspectorTestObject.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/misc/UberspectorTestObject.java Tue Sep 19 14:00:14 2006
@@ -21,7 +21,7 @@
{
private String regular;
private String premium;
-
+
private boolean regularBool;
private boolean premiumBool;
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/provider/NullToStringObject.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/provider/NullToStringObject.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/provider/NullToStringObject.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/provider/NullToStringObject.java Tue Sep 19 14:00:14 2006
@@ -1,30 +1,30 @@
-package org.apache.velocity.test.provider;
-
+package org.apache.velocity.test.provider;
+
/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed 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.
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
*/
-
-/**
- * Used to confirm that a null to string is processed properly
- * @author <a href="mailto:wglass@apache.org">Will Glass-Husain</a>
- * @version $Id$
- */
-public class NullToStringObject
-{
- public String toString()
- {
- return null;
- }
-}
+
+/**
+ * Used to confirm that a null to string is processed properly
+ * @author <a href="mailto:wglass@apache.org">Will Glass-Husain</a>
+ * @version $Id$
+ */
+public class NullToStringObject
+{
+ public String toString()
+ {
+ return null;
+ }
+}
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/sql/DataSourceResourceLoaderTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/sql/DataSourceResourceLoaderTestCase.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/sql/DataSourceResourceLoaderTestCase.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/sql/DataSourceResourceLoaderTestCase.java Tue Sep 19 14:00:14 2006
@@ -46,7 +46,7 @@
private static final String RESULT_FILE_EXT = "res";
/**
- * Path to template file. This will get combined with the
+ * Path to template file. This will get combined with the
* application directory to form an absolute path
*/
private final static String DATA_PATH = TEST_COMPARE_DIR + "/ds";
@@ -80,7 +80,7 @@
assureResultsDirectoryExists(RESULTS_DIR);
DataSource ds = new HsqlDataSource("jdbc:hsqldb:.");
-
+
DataSourceResourceLoader rl = new DataSourceResourceLoader();
rl.setDataSource(ds);
@@ -146,22 +146,22 @@
FileOutputStream fos =
new FileOutputStream (
getFileName(RESULTS_DIR, templateName, RESULT_FILE_EXT));
-
+
Writer writer = new BufferedWriter(new OutputStreamWriter(fos));
-
+
VelocityContext context = new VelocityContext();
context.put("tool", new DSRLTCTool());
-
+
template.merge(context, writer);
writer.flush();
writer.close();
-
+
if (!isMatch(RESULTS_DIR, COMPARE_DIR, templateName,
RESULT_FILE_EXT, CMP_FILE_EXT))
{
fail("Output incorrect for Template: " + templateName);
}
-
+
return template;
}
@@ -171,7 +171,7 @@
{
return a + b;
}
-
+
public String getMessage()
{
return "And the result is:";
Modified: jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/sql/HsqlDataSource.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/sql/HsqlDataSource.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/sql/HsqlDataSource.java (original)
+++ jakarta/velocity/engine/trunk/src/test/org/apache/velocity/test/sql/HsqlDataSource.java Tue Sep 19 14:00:14 2006
@@ -12,16 +12,16 @@
public class HsqlDataSource implements DataSource {
private final String url;
-
+
private PrintWriter logWriter = null;
-
+
private int loginTimeout = 0;
-
+
public HsqlDataSource(final String url) throws Exception {
this.url = url;
Class.forName(jdbcDriver.class.getName());
}
-
+
public Connection getConnection() throws SQLException {
return DriverManager.getConnection(url, "sa", "");
}
Modified: jakarta/velocity/engine/trunk/test/classloader/Foo.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/test/classloader/Foo.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/test/classloader/Foo.java (original)
+++ jakarta/velocity/engine/trunk/test/classloader/Foo.java Tue Sep 19 14:00:14 2006
@@ -24,14 +24,14 @@
{
/*
* the ClassloaderChangeTest
- * depends on this string as
+ * depends on this string as
* is. If this changes (there is no reason
* to ever do that, BTW), then
* udpate ClassloaderChangeTest as well.
*/
- private static String MSG =
+ private static String MSG =
"Hello From Foo";
-
+
public String doIt()
{
return MSG;
Modified: jakarta/velocity/engine/trunk/test/texen-classpath/mkjar.sh
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/test/texen-classpath/mkjar.sh?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/test/texen-classpath/mkjar.sh (original)
+++ jakarta/velocity/engine/trunk/test/texen-classpath/mkjar.sh Tue Sep 19 14:00:14 2006
@@ -5,4 +5,4 @@
rm -f ../test.jar
rm *~
jar cvf ../test.jar *
-)
+)
Modified: jakarta/velocity/engine/trunk/whiteboard/daveb/ContextTool.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/daveb/ContextTool.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/daveb/ContextTool.java (original)
+++ jakarta/velocity/engine/trunk/whiteboard/daveb/ContextTool.java Tue Sep 19 14:00:14 2006
@@ -18,7 +18,7 @@
import org.apache.velocity.context.Context;
/**
- *
+ *
* @author <a href="mailto:daveb@miceda-data.com">Dave Bryson</a>
* @version $Id$
*/
@@ -26,8 +26,8 @@
{
/** Owner */
protected Context context;
-
- /**
+
+ /**
* keep a pointer to my context
* in case there's other stuff in there
* that I might want to use in the Tool
@@ -36,7 +36,7 @@
{
this.context = c;
}
-
+
/**
* Provides the name for the context
*/
Modified: jakarta/velocity/engine/trunk/whiteboard/daveb/ContextWithTools.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/daveb/ContextWithTools.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/daveb/ContextWithTools.java (original)
+++ jakarta/velocity/engine/trunk/whiteboard/daveb/ContextWithTools.java Tue Sep 19 14:00:14 2006
@@ -23,13 +23,13 @@
/**
* Just a demo context that loads it's own tools.
- *
+ *
* @author <a href="mailto:daveb@miceda-data.com">Dave Bryson</a>
* @version $Id$
*/
public class ContextWithTools extends AbstractContext
{
-
+
public ContextWithTools()
{
super();
@@ -43,7 +43,7 @@
private void loadTools()
{
String toolPackages = VelocityResources.getString("ContextTools");
- Enumeration tools = new StringTokenizer( toolPackages );
+ Enumeration tools = new StringTokenizer( toolPackages );
try
{
while ( tools.hasMoreElements() )
@@ -62,22 +62,22 @@
}
// Below: Implements the AbstractContext stuff
-
+
/** storage for key/value pairs */
private HashMap context = new HashMap();
-
+
/** chaining CTOR */
public ContextWithTools( Context context )
{
super( context );
loadTools();
}
-
+
public Object internalGet( String key )
{
return context.get( key );
- }
+ }
public Object internalPut( String key, Object value )
{
Modified: jakarta/velocity/engine/trunk/whiteboard/daveb/ToolOne.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/daveb/ToolOne.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/daveb/ToolOne.java (original)
+++ jakarta/velocity/engine/trunk/whiteboard/daveb/ToolOne.java Tue Sep 19 14:00:14 2006
@@ -16,8 +16,8 @@
import org.apache.velocity.context.*;
-/**
- * Test Tool
+/**
+ * Test Tool
*/
public class ToolOne extends ContextTool
{
@@ -28,7 +28,7 @@
{
return "toolone";
}
-
+
public String sayHello()
{
return "Hello from Tool one";
Modified: jakarta/velocity/engine/trunk/whiteboard/daveb/ToolTest.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/daveb/ToolTest.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/daveb/ToolTest.java (original)
+++ jakarta/velocity/engine/trunk/whiteboard/daveb/ToolTest.java Tue Sep 19 14:00:14 2006
@@ -35,14 +35,14 @@
try
{
Runtime.init( "myprops.properties" );
-
+
Template template = Runtime.getTemplate(templateFile);
ContextWithTools context = new ContextWithTools();
context.put("test", "HEY!");
-
+
Writer writer = new BufferedWriter(new OutputStreamWriter(System.out));
-
+
template.merge(context, writer);
writer.flush();
Modified: jakarta/velocity/engine/trunk/whiteboard/daveb/dajarred/Example.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/daveb/dajarred/Example.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/daveb/dajarred/Example.java (original)
+++ jakarta/velocity/engine/trunk/whiteboard/daveb/dajarred/Example.java Tue Sep 19 14:00:14 2006
@@ -37,12 +37,12 @@
public class Example
{
VelocityContext context = null;
-
+
private final static String JAR_RESOURCE_LOADER_PATH1 = "jar:file:test.jar!/";
private final static String JAR_RESOURCE_LOADER_PATH2 = "jar:file:template.jar!/";
-
+
public Example()
{
try
@@ -53,37 +53,37 @@
Runtime.init("velocity.properties");
//Runtime.setDefaultProperties();
-
+
//Runtime.setSourceProperty(Runtime.JAR_RESOURCE_LOADER_PATH, JAR_RESOURCE_LOADER_PATH1);
-
+
//Runtime.setSourceProperty(Runtime.JAR_RESOURCE_LOADER_PATH, JAR_RESOURCE_LOADER_PATH2);
-
+
//Runtime.init();
/*
- * Make a context object and populate with the data. This
+ * Make a context object and populate with the data. This
* is where the Velocity engine gets the data to resolve the
* references (ex. $list) in the template
*/
-
+
context = new VelocityContext();
context.put("list", getNames());
-
+
}
catch( Exception e )
{
Runtime.error("ERROR starting runtime: " + e );
}
}
-
+
public void getTemplate( String templateFile)
throws Exception{
try
{
-
+
Template template = null;
-
- try
+
+ try
{
template = Runtime.getTemplate(templateFile);
}
@@ -98,7 +98,7 @@
/*
* Now have the template engine process your template using the
- * data placed into the context. Think of it as a 'merge'
+ * data placed into the context. Think of it as a 'merge'
* of the template and the data to produce the output stream.
*/
@@ -137,20 +137,20 @@
public static void main(String[] args)
{
Example ex = new Example();
-
+
try
{
say( "Started..." );
-
+
say("get template from template.jar");
ex.getTemplate( "/template/test1.vm" );
-
+
say("get template from test.jar");
ex.getTemplate( "/example/test1.vm" );
-
+
say("try template from template.jar again");
ex.getTemplate( "/template/test2.vm" );
-
+
say("Try something that doesn't exist");
ex.getTemplate( "/example/yomama.vm" );
}
Modified: jakarta/velocity/engine/trunk/whiteboard/daveb/dajarred/build.xml
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/daveb/dajarred/build.xml?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/daveb/dajarred/build.xml (original)
+++ jakarta/velocity/engine/trunk/whiteboard/daveb/dajarred/build.xml Tue Sep 19 14:00:14 2006
@@ -2,30 +2,30 @@
<project name="TestJar" default="test" basedir=".">
-
+
<property name="build.compiler" value="classic"/>
-
+
<property name="build.dir" value="."/>
<property name="build.src" value="."/>
<property name="build.dest" value="."/>
-
+
<property name="ant.home" value="."/>
<property name="debug" value="on"/>
<property name="optimize" value="on"/>
<property name="deprecation" value="on"/>
-
-
+
+
<!-- =================================================================== -->
<!-- prints the environment -->
<!-- =================================================================== -->
<target name="env">
-
+
<echo message="build.compiler = ${build.compiler}"/>
<echo message="java.home = ${java.home}"/>
<echo message="user.home = ${user.home}"/>
<echo message="java.class.path = ${java.class.path}"/>
<echo message=""/>
-
+
</target>
@@ -33,16 +33,16 @@
<!-- Compiles the source directory w/o the j2ee dependent files -->
<!-- =================================================================== -->
<target name="compile">
-
- <delete file="Example.class"/>
-
+
+ <delete file="Example.class"/>
+
<javac srcdir="${build.src}"
destdir="${build.dest}"
debug="${debug}"
deprecation="${deprecation}"
optimize="${optimize}">
-
+
</javac>
</target>
Modified: jakarta/velocity/engine/trunk/whiteboard/daveb/dajarred/velocity.properties
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/daveb/dajarred/velocity.properties?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/daveb/dajarred/velocity.properties (original)
+++ jakarta/velocity/engine/trunk/whiteboard/daveb/dajarred/velocity.properties Tue Sep 19 14:00:14 2006
@@ -6,7 +6,7 @@
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
-# R U N T I M E L O G
+# R U N T I M E L O G
# ----------------------------------------------------------------------------
# This is the location of the Velocity Runtime log.
# ----------------------------------------------------------------------------
@@ -20,7 +20,7 @@
template.encoding=8859_1
# ----------------------------------------------------------------------------
-# C O N T E N T T Y P E
+# C O N T E N T T Y P E
# ----------------------------------------------------------------------------
# This is the default content type for the VelocityServlet.
# ----------------------------------------------------------------------------
@@ -46,7 +46,7 @@
# is governed.
# ----------------------------------------------------------------------------
-include.output.errormsg.start = <!-- include error :
+include.output.errormsg.start = <!-- include error :
include.output.errormsg.end = see error log -->
# ----------------------------------------------------------------------------
@@ -58,8 +58,8 @@
# ----------------------------------------------------------------------------
# T E M P L A T E L O A D E R S
# ----------------------------------------------------------------------------
-#
-#
+#
+#
# ----------------------------------------------------------------------------
resource.loader.1.public.name = Jar
@@ -85,7 +85,7 @@
# VELOCIMACRO GLOBAL LIBRARY
# ----------------------------------------------------------------------------
# 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
+# template path. You may remove it (either the file or this property) if
# you wish with no harm.
# ----------------------------------------------------------------------------
# velocimacro.library.global=VM_global_library.vm
Modified: jakarta/velocity/engine/trunk/whiteboard/daveb/myprops.properties
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/daveb/myprops.properties?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/daveb/myprops.properties (original)
+++ jakarta/velocity/engine/trunk/whiteboard/daveb/myprops.properties Tue Sep 19 14:00:14 2006
@@ -10,8 +10,8 @@
# #
# Path to templates.
-# Default=current directory
-# #
+# Default=current directory
+# #
template.path=.
# #
@@ -41,6 +41,6 @@
#
# Place to add context tools
-#
+#
ContextTools=ToolOne ToolTwo
Modified: jakarta/velocity/engine/trunk/whiteboard/daveb/pdfvsl/build.xml
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/daveb/pdfvsl/build.xml?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/daveb/pdfvsl/build.xml (original)
+++ jakarta/velocity/engine/trunk/whiteboard/daveb/pdfvsl/build.xml Tue Sep 19 14:00:14 2006
@@ -11,15 +11,15 @@
<target depends="prepare" name="prepare-error" unless="AnakiaTask.present">
<echo>
- AnakiaTask is not present! Please check to make sure that
+ AnakiaTask is not present! Please check to make sure that
velocity.jar is in your classpath.
</echo>
</target>
<target name="docs" depends="prepare-error" if="AnakiaTask.present">
<taskdef name="anakia" classname="org.apache.velocity.anakia.AnakiaTask"/>
- <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop"/>
-
+ <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop"/>
+
<delete dir="${docs.dest}"/>
<mkdir dir="${docs.dest}"/>
@@ -28,12 +28,12 @@
includes="**/*.xml"
lastModifiedCheck="true">
</anakia>
-
+
<!-- Make big XML doc here -->
-
- <fop fofile="${docs.dest}/anakia.fo"
+
+ <fop fofile="${docs.dest}/anakia.fo"
pdffile="${docs.dest}/anakia.pdf"
/>
-
+
</target>
</project>
Modified: jakarta/velocity/engine/trunk/whiteboard/daveb/pdfvsl/pdfsite.vsl
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/daveb/pdfvsl/pdfsite.vsl?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/daveb/pdfvsl/pdfsite.vsl (original)
+++ jakarta/velocity/engine/trunk/whiteboard/daveb/pdfvsl/pdfsite.vsl Tue Sep 19 14:00:14 2006
@@ -1,54 +1,54 @@
#document()
-<!-- Make a Section header bar -->
+<!-- Make a Section header bar -->
#macro ( makeSectionHeader $value )
#if ( $value.getAttributeValue("name") )
#set ( $titleName = $value.getAttributeValue("name") )
#else
- #set ( $titleName = "" )
+ #set ( $titleName = "" )
#end
- <fo:block font-size="14pt"
- font-family="sans-serif"
+ <fo:block font-size="14pt"
+ font-family="sans-serif"
line-height="24pt"
space-after.optimum="15pt"
background-color="blue"
color="white"
text-align="start"
padding-top="3pt">
- $titleName
- </fo:block>
+ $titleName
+ </fo:block>
#end
-<!-- Make a Paragraph -->
+<!-- Make a Paragraph -->
#macro ( makeParagraph $value )
<fo:block font-size="12pt"
- space-after.optimum="15pt"
+ space-after.optimum="15pt"
font-family="sans-serif"
background-color="white"
color="black"
text-align="start"
padding-top="3pt">
- $xmlout.outputString($value)
+ $xmlout.outputString($value)
</fo:block>
#end
<!-- Make a Source Code block -->
#macro ( makeSrc $value )
<fo:block font-size="12pt"
- space-after.optimum="15pt"
+ space-after.optimum="15pt"
font-family="sans-serif"
background-color="white"
color="gray"
text-align="start"
padding-top="3pt">
- $escape.getText($value.getText())
- </fo:block>
+ $escape.getText($value.getText())
+ </fo:block>
#end
<!-- Make an image link -->
#macro ( makeLink $value )
<fo:block font-size="12pt"
- space-after.optimum="15pt"
+ space-after.optimum="15pt"
font-family="sans-serif"
background-color="white"
color="gray"
@@ -66,15 +66,15 @@
<!-- defines the layout master -->
<fo:layout-master-set>
<fo:simple-page-master
- master-name="Velocity"
- page-height="8.5in"
- page-width="11in"
- margin-top="0.25in"
- margin-bottom="0.25in"
- margin-left="0.5in"
+ master-name="Velocity"
+ page-height="8.5in"
+ page-width="11in"
+ margin-top="0.25in"
+ margin-bottom="0.25in"
+ margin-left="0.5in"
margin-right="0.5in">
- <fo:region-before extent="0.25in"/>
- <fo:region-body margin-top="0.25in"/>
+ <fo:region-before extent="0.25in"/>
+ <fo:region-body margin-top="0.25in"/>
</fo:simple-page-master>
</fo:layout-master-set>
@@ -83,24 +83,24 @@
<!-- header -->
<fo:static-content flow-name="xsl-region-before">
- <fo:block
- text-align="end"
- font-size="10pt"
- font-family="serif"
+ <fo:block
+ text-align="end"
+ font-size="10pt"
+ font-family="serif"
color="black"
padding-right="3pt">
$root.getChild("properties").getChild("title").getText() pg <fo:page-number/>
</fo:block>
</fo:static-content>
-
+
<fo:flow flow-name="xsl-region-body">
-
+
#set ($allSections = $xpath.applyTo("body/section", $root))
<!-- Walk through the sections -->
#foreach ( $section in $allSections )
#makeSectionHeader($section)
- #foreach ( $item in $section.getChildren() )
+ #foreach ( $item in $section.getChildren() )
#if ( $item.getName().equals("p") )
#makeParagraph($item)
#elseif ( $item.getName().equals("source") )
@@ -110,7 +110,7 @@
#end
</fo:flow>
</fo:page-sequence>
- </fo:root>
+ </fo:root>
#end
Modified: jakarta/velocity/engine/trunk/whiteboard/daveb/pdfvsl/velocity.properties
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/daveb/pdfvsl/velocity.properties?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/daveb/pdfvsl/velocity.properties (original)
+++ jakarta/velocity/engine/trunk/whiteboard/daveb/pdfvsl/velocity.properties Tue Sep 19 14:00:14 2006
@@ -6,7 +6,7 @@
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
-# R U N T I M E L O G
+# R U N T I M E L O G
# ----------------------------------------------------------------------------
# This is the location of the Velocity Runtime log.
# ----------------------------------------------------------------------------
@@ -20,7 +20,7 @@
template.encoding=8859_1
# ----------------------------------------------------------------------------
-# C O N T E N T T Y P E
+# C O N T E N T T Y P E
# ----------------------------------------------------------------------------
# This is the default content type for the VelocityServlet.
# ----------------------------------------------------------------------------
@@ -46,7 +46,7 @@
# is governed.
# ----------------------------------------------------------------------------
-include.output.errormsg.start = <!-- include error :
+include.output.errormsg.start = <!-- include error :
include.output.errormsg.end = see error log -->
# ----------------------------------------------------------------------------
@@ -58,8 +58,8 @@
# ----------------------------------------------------------------------------
# T E M P L A T E L O A D E R S
# ----------------------------------------------------------------------------
-#
-#
+#
+#
# ----------------------------------------------------------------------------
resource.loader.1.public.name = File
@@ -84,7 +84,7 @@
# VELOCIMACRO GLOBAL LIBRARY
# ----------------------------------------------------------------------------
# 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
+# template path. You may remove it (either the file or this property) if
# you wish with no harm.
# ----------------------------------------------------------------------------
# velocimacro.library.global=VM_global_library.vm
Modified: jakarta/velocity/engine/trunk/whiteboard/geir/Delay.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/geir/Delay.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/geir/Delay.java (original)
+++ jakarta/velocity/engine/trunk/whiteboard/geir/Delay.java Tue Sep 19 14:00:14 2006
@@ -41,28 +41,28 @@
public String getName()
{
return "delay";
- }
-
+ }
+
public int getType()
{
return BLOCK;
- }
+ }
- public void init( RuntimeServices rs, InternalContextAdapter context, Node node)
+ public void init( RuntimeServices rs, InternalContextAdapter context, Node node)
throws Exception
{
super.init( rs, context, node );
astStrings = getASTAsStringArray( node.jjtGetChild(1) );
-
+
}
- public boolean render( InternalContextAdapter context,
+ public boolean render( InternalContextAdapter context,
Writer writer, Node node)
throws IOException
{
-
+
/*
* what is our arg?
*/
@@ -82,7 +82,7 @@
if ( ival > 1 )
{
writer.write("#delay( " + --ival + " )\n " );
-
+
for( int i = 0; i < astStrings.size(); i++ )
{
writer.write( (String) astStrings.get( i ) );
@@ -101,14 +101,14 @@
return true;
}
-
+
private static List getASTAsStringArray( Node rootNode )
{
/*
- * this assumes that we are passed in the root
+ * this assumes that we are passed in the root
* node of the code block
*/
-
+
Token t = rootNode.getFirstToken();
Token tLast = rootNode.getLastToken();
@@ -121,7 +121,7 @@
t = rootNode.getFirstToken();
- while( t != tLast )
+ while( t != tLast )
{
list.add( NodeUtils.tokenLiteral( t ) );
t = t.next;
Modified: jakarta/velocity/engine/trunk/whiteboard/geir/InstanceExample.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/geir/InstanceExample.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/geir/InstanceExample.java (original)
+++ jakarta/velocity/engine/trunk/whiteboard/geir/InstanceExample.java Tue Sep 19 14:00:14 2006
@@ -35,7 +35,7 @@
public static void main( String args[] )
{
/* first, we init the runtime engine. Defaults are fine. */
-
+
VelocityEngine ve1 = new VelocityEngine();
VelocityEngine ve2 = new VelocityEngine();
@@ -44,7 +44,7 @@
ve1.setProperty("runtime.log", "velengine1.log");
ve1.setProperty("file.resource.loader.path", "./template1");
ve1.init();
-
+
ve2.setProperty("runtime.log", "velengine2.log");
ve2.setProperty("file.resource.loader.path", "./template2");
ve2.init();
@@ -61,7 +61,7 @@
context.put("name", "Velocity");
context.put("project", "Jakarta");
-
+
/* lets render a template */
StringWriter w1 = new StringWriter();
Modified: jakarta/velocity/engine/trunk/whiteboard/geir/geir.vm
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/geir/geir.vm?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/geir/geir.vm (original)
+++ jakarta/velocity/engine/trunk/whiteboard/geir/geir.vm Tue Sep 19 14:00:14 2006
@@ -5,7 +5,7 @@
Hello from foo!
#foreach($i in $a)
foo: $i
- #end
+ #end
#end
#macro( floog $a)
Modified: jakarta/velocity/engine/trunk/whiteboard/geir/geir1.vm
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/geir/geir1.vm?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/geir/geir1.vm (original)
+++ jakarta/velocity/engine/trunk/whiteboard/geir/geir1.vm Tue Sep 19 14:00:14 2006
@@ -8,15 +8,15 @@
SetBangStart will output to stdout
#macro( bangstart $a)
- #set( $a.BangStart = 4 )
+ #set( $a.BangStart = 4 )
#end
#macro( bangstartII $a)
- #set( $a = 5 )
+ #set( $a = 5 )
#end
#macro( bar $b )
- $b.bang()
+ $b.bang()
#end
#bangstart( $provider )
Modified: jakarta/velocity/engine/trunk/whiteboard/geir/geir2.vm
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/geir/geir2.vm?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/geir/geir2.vm (original)
+++ jakarta/velocity/engine/trunk/whiteboard/geir/geir2.vm Tue Sep 19 14:00:14 2006
@@ -1,7 +1,7 @@
#macro( recurse $a )
-
+
#set($a = $a - 1 )
-
+
#if( $a > 0 )
#recurse($a)
#end
Modified: jakarta/velocity/engine/trunk/whiteboard/geir/geir3.vm
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/geir/geir3.vm?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/geir/geir3.vm (original)
+++ jakarta/velocity/engine/trunk/whiteboard/geir/geir3.vm Tue Sep 19 14:00:14 2006
@@ -1,7 +1,7 @@
This tests to make sure that we only alter either
the local arg in a VM, or the global context.
-So in foo, we are accessing the global 'b', and
+So in foo, we are accessing the global 'b', and
the fact that we were called from bar that has it's
arg of 'b' is irrelevant.
Modified: jakarta/velocity/engine/trunk/whiteboard/geir/velocity.properties
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/geir/velocity.properties?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/geir/velocity.properties (original)
+++ jakarta/velocity/engine/trunk/whiteboard/geir/velocity.properties Tue Sep 19 14:00:14 2006
@@ -1,4 +1,3 @@
-
resource.loader = url
url.resource.loader.class = org.apache.velocity.runtime.resource.loader.URLResourceLoader
url.resource.loader.root = http://localhost:8080/veltest/, file:///opt/
Modified: jakarta/velocity/engine/trunk/whiteboard/henning/jdk14/EscapeReference.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/henning/jdk14/EscapeReference.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/henning/jdk14/EscapeReference.java (original)
+++ jakarta/velocity/engine/trunk/whiteboard/henning/jdk14/EscapeReference.java Tue Sep 19 14:00:14 2006
@@ -27,34 +27,34 @@
/**
* Base class for escaping references. To use it, override the following methods:
* <DL>
- * <DT><code>String escape(String text)</code></DT>
+ * <DT><code>String escape(String text)</code></DT>
* <DD>escape the provided text</DD>
* <DT><code>String getMatchAttribute()</code></DT>
* <DD>retrieve the configuration attribute used to match references (see below)</DD>
* </DL>
- *
- * <P>By default, all references are escaped. However, by setting the match attribute
- * in the configuration file to a regular expression, users can specify which references
+ *
+ * <P>By default, all references are escaped. However, by setting the match attribute
+ * in the configuration file to a regular expression, users can specify which references
* to escape. For example the following configuration property tells the EscapeSqlReference
- * event handler to only escape references that start with "sql".
+ * event handler to only escape references that start with "sql".
* (e.g. <code>$sql</code>, <code>$sql.toString(),</code>, etc).
- *
+ *
* <PRE>
- * <CODE>eventhandler.escape.sql.match = /sql.*<!-- -->/
+ * <CODE>eventhandler.escape.sql.match = /sql.*<!-- -->/
* </CODE>
* </PRE>
* <!-- note: ignore empty HTML comment above - breaks up star slash avoiding javadoc end -->
*
* Regular expressions should follow the "regex5" format used by the java.util.regex package
- *
+ *
* @author <a href="mailto:wglass@forio.com">Will Glass-Husain </a>
* @version $Id$
*/
public abstract class EscapeReference implements ReferenceInsertionEventHandler,RuntimeServicesAware {
-
+
private RuntimeServices rs;
-
+
private String matchRegExp = null;
private Pattern pattern = null;
@@ -62,32 +62,32 @@
/**
* Escape the given text. Override this in a subclass to do the actual
* escaping.
- *
+ *
* @param text the text to escape
* @return the escaped text
*/
protected abstract String escape(Object text);
-
+
/**
- * Specify the configuration attribute that specifies the
+ * Specify the configuration attribute that specifies the
* regular expression. Ideally should be in a form
* <pre><code>eventhandler.escape.XYZ.match</code></pre>
- *
- * <p>where <code>XYZ</code> is the type of escaping being done.
+ *
+ * <p>where <code>XYZ</code> is the type of escaping being done.
* @return configuration attribute
*/
protected abstract String getMatchAttribute();
-
+
/**
* Escape the provided text if it matches the configured regular expression.
*/
- public Object referenceInsert(String reference, Object value)
+ public Object referenceInsert(String reference, Object value)
{
if(value == null)
{
- return value;
+ return value;
}
-
+
if (pattern == null)
{
return escape(value);
@@ -105,7 +105,7 @@
/**
* Called automatically when event cartridge is initialized.
*/
- public void setRuntimeServices(RuntimeServices rs) throws Exception
+ public void setRuntimeServices(RuntimeServices rs) throws Exception
{
this.rs = rs;
@@ -127,11 +127,11 @@
matchRegExp = null;
}
}
-
+
/**
* Test the regular expression for a well formed pattern
*/
- if (matchRegExp != null)
+ if (matchRegExp != null)
{
try
{
@@ -146,7 +146,7 @@
}
/**
- * Retrieve a reference to RuntimeServices. Use this for checking additional
+ * Retrieve a reference to RuntimeServices. Use this for checking additional
* configuration properties.
* @return
*/
@@ -154,5 +154,5 @@
{
return rs;
}
-
+
}
Modified: jakarta/velocity/engine/trunk/whiteboard/henning/jdk15/src/java/org/apache/velocity/util/introspection/JDK15UberspectImpl.java
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/henning/jdk15/src/java/org/apache/velocity/util/introspection/JDK15UberspectImpl.java?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/henning/jdk15/src/java/org/apache/velocity/util/introspection/JDK15UberspectImpl.java (original)
+++ jakarta/velocity/engine/trunk/whiteboard/henning/jdk15/src/java/org/apache/velocity/util/introspection/JDK15UberspectImpl.java Tue Sep 19 14:00:14 2006
@@ -44,7 +44,7 @@
}
else
{
- return super.getIterator(obj, i);
+ return super.getIterator(obj, i);
}
}
}
Modified: jakarta/velocity/engine/trunk/whiteboard/henning/using_ivy/build.properties
URL: http://svn.apache.org/viewvc/jakarta/velocity/engine/trunk/whiteboard/henning/using_ivy/build.properties?view=diff&rev=447969&r1=447968&r2=447969
==============================================================================
--- jakarta/velocity/engine/trunk/whiteboard/henning/using_ivy/build.properties (original)
+++ jakarta/velocity/engine/trunk/whiteboard/henning/using_ivy/build.properties Tue Sep 19 14:00:14 2006
@@ -85,7 +85,7 @@
# Settings for the proxy to use for download. Change this if you must
# use a proxy from your host. If the proxy.host property is unset, no
# proxy is used.
-proxy.host=
+proxy.host=
proxy.port= 80
#
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org