velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r938698 - in /velocity/engine/branches/1.6.x: src/test/org/apache/velocity/test/issues/Velocity717TestCase.java test/includeevent/macros2.vm test/includeevent/test8.vm
Date Tue, 27 Apr 2010 22:18:52 GMT
Author: nbubna
Date: Tue Apr 27 22:18:51 2010
New Revision: 938698

URL: http://svn.apache.org/viewvc?rev=938698&view=rev
Log:
add testcase for VELOCITY-717 (thanks to Jarkko Viinamaki)

Added:
    velocity/engine/branches/1.6.x/src/test/org/apache/velocity/test/issues/Velocity717TestCase.java
  (with props)
    velocity/engine/branches/1.6.x/test/includeevent/macros2.vm   (with props)
    velocity/engine/branches/1.6.x/test/includeevent/test8.vm   (with props)

Added: velocity/engine/branches/1.6.x/src/test/org/apache/velocity/test/issues/Velocity717TestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/1.6.x/src/test/org/apache/velocity/test/issues/Velocity717TestCase.java?rev=938698&view=auto
==============================================================================
--- velocity/engine/branches/1.6.x/src/test/org/apache/velocity/test/issues/Velocity717TestCase.java
(added)
+++ velocity/engine/branches/1.6.x/src/test/org/apache/velocity/test/issues/Velocity717TestCase.java
Tue Apr 27 22:18:51 2010
@@ -0,0 +1,89 @@
+package org.apache.velocity.test.issues;
+
+/*
+ * 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.*;
+import java.util.*;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.velocity.test.BaseTestCase;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+import org.apache.velocity.app.event.EventCartridge;
+import org.apache.velocity.app.event.IncludeEventHandler;
+import org.apache.velocity.context.Context;
+// import org.apache.velocity.runtime.RuntimeServices;
+import org.apache.velocity.runtime.RuntimeSingleton;
+
+/**
+ * https://issues.apache.org/jira/browse/VELOCITY-717
+ */
+public class Velocity717TestCase extends BaseTestCase implements IncludeEventHandler
+{
+    public Velocity717TestCase(String name)
+    {
+        super(name);
+    }
+
+    public void setUp()
+            throws Exception
+    {
+        Velocity.addProperty(Velocity.FILE_RESOURCE_LOADER_PATH,
+                             TEST_COMPARE_DIR + "/includeevent");
+        
+        // this setting enables "namespaces" (see VelocimacroManager)        
+        Velocity.addProperty(Velocity.VM_PERM_INLINE_LOCAL, "true");
+
+        Velocity.init();
+    }
+
+    /**
+     * Runs the test.
+     */
+    public void testIncludeEventHandlingWithNullReturn()
+            throws Exception
+    {
+        Template template1 = RuntimeSingleton.getTemplate(
+            getFileName(null, "test8", "vm"));
+
+        Writer writer = new BufferedWriter(new OutputStreamWriter(System.out));
+
+        Context context = new VelocityContext();
+
+        EventCartridge ec = new EventCartridge();
+        ec.addEventHandler(this);
+        ec.attachToContext( context );
+
+        template1.merge(context, writer);
+        writer.flush();
+        writer.close();
+    }
+
+    /**
+     * Sample handler with different behaviors for the different tests.
+     */
+    public String includeEvent( String includeResourcePath, String currentResourcePath, String
directiveName)
+    {
+         return null;
+    }
+}
\ No newline at end of file

Propchange: velocity/engine/branches/1.6.x/src/test/org/apache/velocity/test/issues/Velocity717TestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/engine/branches/1.6.x/src/test/org/apache/velocity/test/issues/Velocity717TestCase.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: velocity/engine/branches/1.6.x/src/test/org/apache/velocity/test/issues/Velocity717TestCase.java
------------------------------------------------------------------------------
    svn:keywords = Revision

Propchange: velocity/engine/branches/1.6.x/src/test/org/apache/velocity/test/issues/Velocity717TestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: velocity/engine/branches/1.6.x/test/includeevent/macros2.vm
URL: http://svn.apache.org/viewvc/velocity/engine/branches/1.6.x/test/includeevent/macros2.vm?rev=938698&view=auto
==============================================================================
--- velocity/engine/branches/1.6.x/test/includeevent/macros2.vm (added)
+++ velocity/engine/branches/1.6.x/test/includeevent/macros2.vm Tue Apr 27 22:18:51 2010
@@ -0,0 +1,3 @@
+#macro(foobar)
+  Jee!
+#end 
\ No newline at end of file

Propchange: velocity/engine/branches/1.6.x/test/includeevent/macros2.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/engine/branches/1.6.x/test/includeevent/macros2.vm
------------------------------------------------------------------------------
    svn:executable = *

Propchange: velocity/engine/branches/1.6.x/test/includeevent/macros2.vm
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: velocity/engine/branches/1.6.x/test/includeevent/test8.vm
URL: http://svn.apache.org/viewvc/velocity/engine/branches/1.6.x/test/includeevent/test8.vm?rev=938698&view=auto
==============================================================================
--- velocity/engine/branches/1.6.x/test/includeevent/test8.vm (added)
+++ velocity/engine/branches/1.6.x/test/includeevent/test8.vm Tue Apr 27 22:18:51 2010
@@ -0,0 +1,5 @@
+NPE test with parse
+
+#parse("macros2.vm")
+
+#foobar()

Propchange: velocity/engine/branches/1.6.x/test/includeevent/test8.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/engine/branches/1.6.x/test/includeevent/test8.vm
------------------------------------------------------------------------------
    svn:executable = *

Propchange: velocity/engine/branches/1.6.x/test/includeevent/test8.vm
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message