You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@apache.org on 2001/06/01 02:30:28 UTC
cvs commit: jakarta-tomcat-4.0/catalina/src/test/org/apache/naming/resources BaseDirContextTestCase.java FileDirContextTestCase.java WARDirContextTestCase.java
craigmcc 01/05/31 17:30:28
Modified: catalina build.xml
Added: catalina/src/test/org/apache/naming/resources
BaseDirContextTestCase.java
FileDirContextTestCase.java
WARDirContextTestCase.java
Log:
Infrastructure for JUnit tests on FileDirContext and WARDirContext (the
JNDI directory context implementations used to encapsulate the static
resouces of a web app). There's only a dummy test right now; that will
get changed next.
Revision Changes Path
1.43 +27 -2 jakarta-tomcat-4.0/catalina/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/build.xml,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- build.xml 2001/05/31 21:48:29 1.42
+++ build.xml 2001/06/01 00:30:26 1.43
@@ -19,6 +19,8 @@
<property name="test.failonerror" value="true"/>
<property name="test.runner" value="junit.textui.TestRunner"/>
+ <property name="test.webapp" value="${basedir}/../webapps/build/examples"/>
+ <property name="test.webapp.war" value="${java.io.tmpdir}/webapp.war"/>
<!-- ================== Derived Property Values ========================= -->
<property name="jaxp.jar" value="${catalina.jaxp.home}/jaxp.jar"/>
@@ -234,8 +236,31 @@
<!-- ==================== BUILD: Execute Unit Tests ===================== -->
<target name="test" if="junit.present"
description="Run all unit test cases"
- depends="build-tests,test-util"
->
+ depends="build-tests,test-dir-context,test-util">
+ </target>
+
+ <target name="test-dir-context" if="junit.present">
+
+ <echo message="Running FileDirContext tests"/>
+ <java classname="${test.runner}" fork="yes"
+ failonerror="${test.failonerror}">
+ <sysproperty key="doc.base" value="${test.webapp}"/>
+ <arg value="org.apache.naming.resources.FileDirContextTestCase"/>
+ <classpath refid="test.classpath"/>
+ </java>
+
+ <echo message="Running WARDirContext tests"/>
+ <jar jarfile="${test.webapp.war}">
+ <fileset dir="${test.webapp}"/>
+ </jar>
+ <java classname="${test.runner}" fork="yes"
+ failonerror="${test.failonerror}">
+ <sysproperty key="doc.base" value="${test.webapp.war}"/>
+ <arg value="org.apache.naming.resources.WARDirContextTestCase"/>
+ <classpath refid="test.classpath"/>
+ </java>
+ <delete file="${test.webapp.war}"/>
+
</target>
<target name="test-util" if="junit.present">
1.1 jakarta-tomcat-4.0/catalina/src/test/org/apache/naming/resources/BaseDirContextTestCase.java
Index: BaseDirContextTestCase.java
===================================================================
/*
* $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/test/org/apache/naming/resources/BaseDirContextTestCase.java,v 1.1 2001/06/01 00:30:27 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2001/06/01 00:30:27 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.naming.resources;
import javax.naming.directory.DirContext;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Basic unit tests for the <code>javax.naming.directory.DirContext</code>
* implementations. This class must be subclassed for each individual
* <code>DirContext</code> implementation.
*
* @author Craig R. McClanahan
* @version $Revision: 1.1 $ $Date: 2001/06/01 00:30:27 $
*/
public abstract class BaseDirContextTestCase extends TestCase {
// ----------------------------------------------------- Instance Variables
/**
* A directory context implementation to be tested.
*/
protected DirContext context = null;
/**
* The pathname of the document base directory for this directory context.
*/
protected String docBase = System.getProperty("doc.base");
// ----------------------------------------------------------- Constructors
/**
* Construct a new instance of this test case.
*
* @param name Name of the test case
*/
public BaseDirContextTestCase(String name) {
super(name);
}
// --------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case. This method
* <strong>MUST</strong> be implemented by a subclass.
*/
public abstract void setUp();
/**
* Return the tests included in this test suite. This method
* <strong>MUST</strong> be implemented by a subclass.
*/
// public abstract static Test suite();
/**
* Tear down instance variables required by this test case. This method
* <strong>MUST</strong> be implemented by a subclass.
*/
public abstract void tearDown();
// ------------------------------------------------ Individual Test Methods
public void testDummy() { ; }
}
1.1 jakarta-tomcat-4.0/catalina/src/test/org/apache/naming/resources/FileDirContextTestCase.java
Index: FileDirContextTestCase.java
===================================================================
/*
* $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/test/org/apache/naming/resources/FileDirContextTestCase.java,v 1.1 2001/06/01 00:30:27 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2001/06/01 00:30:27 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.naming.resources;
import javax.naming.directory.DirContext;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit tests for <code>org.apache.naming.resources.FileDirContext</code>.
*
* @author Craig R. McClanahan
* @version $Revision: 1.1 $ $Date: 2001/06/01 00:30:27 $
*/
public class FileDirContextTestCase extends BaseDirContextTestCase {
// ----------------------------------------------------------- Constructors
/**
* Construct a new instance of this test case.
*
* @param name Name of the test case
*/
public FileDirContextTestCase(String name) {
super(name);
}
// --------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case. This method
* <strong>MUST</strong> be implemented by a subclass.
*/
public void setUp() {
context = new FileDirContext();
((FileDirContext) context).setDocBase(docBase);
}
/**
* Return the tests included in this test suite. This method
* <strong>MUST</strong> be implemented by a subclass.
*/
public static Test suite() {
return (new TestSuite(FileDirContextTestCase.class));
}
/**
* Tear down instance variables required by this test case. This method
* <strong>MUST</strong> be implemented by a subclass.
*/
public void tearDown() {
context = null;
}
// ------------------------------------------------ Individual Test Methods
}
1.1 jakarta-tomcat-4.0/catalina/src/test/org/apache/naming/resources/WARDirContextTestCase.java
Index: WARDirContextTestCase.java
===================================================================
/*
* $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/test/org/apache/naming/resources/WARDirContextTestCase.java,v 1.1 2001/06/01 00:30:27 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2001/06/01 00:30:27 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.naming.resources;
import java.io.File;
import java.io.IOException;
import javax.naming.directory.DirContext;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit tests for <code>org.apache.naming.resources.WARDirContext</code>.
*
* @author Craig R. McClanahan
* @version $Revision: 1.1 $ $Date: 2001/06/01 00:30:27 $
*/
public class WARDirContextTestCase extends BaseDirContextTestCase {
// ----------------------------------------------------------- Constructors
/**
* Construct a new instance of this test case.
*
* @param name Name of the test case
*/
public WARDirContextTestCase(String name) {
super(name);
}
// --------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case. This method
* <strong>MUST</strong> be implemented by a subclass.
*/
public void setUp() {
context = new WARDirContext();
((WARDirContext) context).setDocBase(docBase);
}
/**
* Return the tests included in this test suite. This method
* <strong>MUST</strong> be implemented by a subclass.
*/
public static Test suite() {
return (new TestSuite(WARDirContextTestCase.class));
}
/**
* Tear down instance variables required by this test case. This method
* <strong>MUST</strong> be implemented by a subclass.
*/
public void tearDown() {
context = null;
}
// ------------------------------------------------ Individual Test Methods
}