You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by ap...@apache.org on 2010/06/23 17:28:35 UTC
svn commit: r957249 - in
/velocity/sandbox/maven-reorg/engine/trunk/velocity-engine: ./
src/test/java/classloader/ src/test/java/org/apache/velocity/test/
src/test/resources/classloader/
Author: apetrelli
Date: Wed Jun 23 15:28:34 2010
New Revision: 957249
URL: http://svn.apache.org/viewvc?rev=957249&view=rev
Log:
VELOCITYSB-4
A problematic test fix.
Added:
velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/src/test/java/classloader/
- copied from r957231, velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/src/test/resources/classloader/
Removed:
velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/src/test/java/classloader/Foo.class
velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/src/test/resources/classloader/
Modified:
velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/pom.xml
velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/src/test/java/classloader/Foo.java
velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/src/test/java/org/apache/velocity/test/ClassloaderChangeTestCase.java
Modified: velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/pom.xml
URL: http://svn.apache.org/viewvc/velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/pom.xml?rev=957249&r1=957248&r2=957249&view=diff
==============================================================================
--- velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/pom.xml (original)
+++ velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/pom.xml Wed Jun 23 15:28:34 2010
@@ -1,12 +1,131 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>velocity-engine-parent</artifactId>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>velocity-engine-parent</artifactId>
+ <groupId>org.apache.velocity</groupId>
+ <version>2.0.0-SNAPSHOT</version>
+ </parent>
<groupId>org.apache.velocity</groupId>
+ <artifactId>velocity-engine</artifactId>
<version>2.0.0-SNAPSHOT</version>
- </parent>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity-engine</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <name>Apache Velocity - Engine</name>
+ <name>Apache Velocity - Engine</name>
+
+ <build>
+ <testResources>
+ <testResource>
+ <targetPath>../filtered-testsources/java</targetPath>
+ <filtering>true</filtering>
+ <directory>src/test/java</directory>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ </testResources>
+ <testSourceDirectory>target/filtered-testsources/java</testSourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <useDefaultDelimiters>false</useDefaultDelimiters>
+ <delimiters>
+ <delimiter>${*}</delimiter>
+ </delimiters>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>oro</groupId>
+ <artifactId>oro</artifactId>
+ <version>2.0.8</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>avalon-framework</groupId>
+ <artifactId>avalon-framework</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.12</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>logkit</groupId>
+ <artifactId>logkit</artifactId>
+ <version>2.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.6</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>werken-xpath</groupId>
+ <artifactId>werken-xpath</artifactId>
+ <version>0.9.4</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.7.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.3.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
\ No newline at end of file
Modified: velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/src/test/java/classloader/Foo.java
URL: http://svn.apache.org/viewvc/velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/src/test/java/classloader/Foo.java?rev=957249&r1=957231&r2=957249&view=diff
==============================================================================
--- velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/src/test/java/classloader/Foo.java (original)
+++ velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/src/test/java/classloader/Foo.java Wed Jun 23 15:28:34 2010
@@ -1,3 +1,5 @@
+package classloader;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -14,7 +16,7 @@
* "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.
+ * under the License.
*/
/**
Modified: velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/src/test/java/org/apache/velocity/test/ClassloaderChangeTestCase.java
URL: http://svn.apache.org/viewvc/velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/src/test/java/org/apache/velocity/test/ClassloaderChangeTestCase.java?rev=957249&r1=957248&r2=957249&view=diff
==============================================================================
--- velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/src/test/java/org/apache/velocity/test/ClassloaderChangeTestCase.java (original)
+++ velocity/sandbox/maven-reorg/engine/trunk/velocity-engine/src/test/java/org/apache/velocity/test/ClassloaderChangeTestCase.java Wed Jun 23 15:28:34 2010
@@ -16,17 +16,18 @@ package org.apache.velocity.test;
* "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.
+ * under the License.
*/
-import java.io.File;
-import java.io.FileInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
import java.io.StringWriter;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.apache.commons.io.IOUtils;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeServices;
@@ -89,7 +90,7 @@ public class ClassloaderChangeTestCase e
*/
TestClassloader cl = new TestClassloader();
- Class fooclass = cl.loadClass("Foo");
+ Class<?> fooclass = cl.loadClass("Foo");
foo = fooclass.newInstance();
/*
@@ -163,37 +164,37 @@ public class ClassloaderChangeTestCase e
{
return true;
}
-}
-
-/**
- * Simple (real simple...) classloader that depends
- * on a Foo.class being located in the classloader
- * directory under test
- */
-class TestClassloader extends ClassLoader
-{
- private final static String testclass =
- "test/classloader/Foo.class";
-
- private Class fooClass = null;
- public TestClassloader()
- throws Exception
+ /**
+ * Simple (real simple...) classloader that depends
+ * on a Foo.class being located in the classloader
+ * directory under test
+ */
+ public static class TestClassloader extends ClassLoader
{
- File f = new File( testclass );
+ private final static String testclass =
+ "classloader/Foo.class";
+
+ private Class<?> fooClass = null;
- byte[] barr = new byte[ (int) f.length() ];
+ public TestClassloader()
+ throws Exception
+ {
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ InputStream fis = getClass().getResourceAsStream("/" + testclass);
+ IOUtils.copy(fis, os);
+ fis.close();
+ os.close();
- FileInputStream fis = new FileInputStream( f );
- fis.read( barr );
- fis.close();
+ byte[] barr = os.toByteArray();
- fooClass = defineClass("Foo", barr, 0, barr.length);
- }
+ fooClass = defineClass("Foo", barr, 0, barr.length);
+ }
- public Class findClass(String name)
- {
- return fooClass;
+ public Class<?> findClass(String name)
+ {
+ return fooClass;
+ }
}
}