juergen 2004/02/06 07:55:15
Modified: testsuite build.xml
testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor
TProcessors.java
Added: testsuite .cvsignore tp.properties.tamino
testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tutil
TProcessorTask.java
Log:
add ant tasks for TProcessor (Michael)
Revision Changes Path
1.9 +73 -68 jakarta-slide/testsuite/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-slide/testsuite/build.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- build.xml 5 Feb 2004 11:14:28 -0000 1.8
+++ build.xml 6 Feb 2004 15:55:15 -0000 1.9
@@ -59,74 +59,6 @@
<mkdir dir="${dist}" />
<move todir="${dist}" file="${basedir}/../testsuite.zip" />
</target>
- <!-- =============================================================== -->
- <target name="functional-test" description="Run the functional tests">
- <property name="xdav.home" value="${basedir}" />
- <property name="xdav.host" value="localhost" />
- <property name="xdav.port" value="8888" />
- <property name="xdav.user" value="guest" />
- <property name="xdav.password" value="guest" />
- <property name="xdav.workdb" value="xdavtest" />
- <property name="xdav.workhost" value="localhost" />
- <property name="xdav.globalVariableDomainName" value="localhost" />
- <property name="xdav.globalVariableServerName" value="slide" />
- <property name="xdav.globalVariableIterationCount" value="1" />
- <property name="xdav.globalVariableIterationCountSmall" value="5" />
- <property name="xdav.globalVariablePerformanceIterations" value="5" />
- <property name="xdav.globalVariableUsers" value="1" />
- <property name="xdav.globalVariableGroup" value="group" />
- <property name="xdav.globalVariableCollection" value="files" />
-
- <!-- Depend on $DAV_AUTH, assume none for now -->
- <property name="xdav.globalVariableRootUserPath"
- value="/${xdav.globalVariableServerName}/unauthenticated" />
- <property name="xdav.globalVariableUserPath"
- value="${xdav.globalVariableRootUserPath}" />
-
- <property name="tprocessor.exclude" value="-exclude *multi-user\\copy*
-exclude *ACL* -exclude *groupFunctional*" />
-
- <java
classname="org.apache.slide.testsuite.testtools.walker.MultiTProcessorExecuter"
fork="yes">
- <sysproperty key="xdav.home" value="${xdav.home}" />
- <sysproperty key="xdav.host" value="${xdav.host}" />
- <sysproperty key="xdav.port" value="${xdav.port}" />
- <sysproperty key="xdav.user" value="${xdav.user}" />
- <sysproperty key="xdav.password" value="${xdav.password}" />
- <sysproperty key="xdav.workdb" value="${xdav.workdb}" />
- <sysproperty key="xdav.workhost" value="${xdav.workhost}" />
- <sysproperty key="xdav.globalVariableDomainName"
- value="${xdav.globalVariableDomainName}" />
- <sysproperty key="xdav.globalVariableServerName"
- value="${xdav.globalVariableServerName}" />
- <sysproperty key="xdav.globalVariableIterationCount"
- value="${xdav.globalVariableIterationCount}" />
- <sysproperty key="xdav.globalVariableIterationCountSmall"
- value="${xdav.globalVariableIterationCountSmall}" />
- <sysproperty key="xdav.globalVariablePerformanceIterations"
- value="${xdav.globalVariablePerformanceIterations}" />
- <sysproperty key="xdav.globalVariableUsers"
- value="${xdav.globalVariableUsers}" />
- <sysproperty key="xdav.globalVariableGroupsColl"
- value="groups" />
- <sysproperty key="xdav.globalVariableRolesColl"
- value="roles" />
- <sysproperty key="xdav.globalVariableGroup"
- value="${xdav.globalVariableGroup}" />
- <sysproperty key="xdav.globalVariableCollection"
- value="${xdav.globalVariableCollection}" />
- <sysproperty key="xdav.globalVariableRootUserPath"
- value="${xdav.globalVariableRootUserPath}" />
- <sysproperty key="xdav.globalVariableUserPath"
- value="${xdav.globalVariableUserPath}" />
- <sysproperty key="xdav.urlencoding" value="UTF-8" />
- <sysproperty key="httpclient.authentication.premptive" value="true" />
- <arg line="${tprocessor.exclude} *cases\\functional*" />
- <classpath>
- <fileset dir="${lib}" >
- <include name="*.jar" />
- </fileset>
- </classpath>
- </java>
- </target>
<!-- =============================================================== -->
<target name="all">
@@ -134,4 +66,77 @@
<antcall target="dist" />
</target>
+ <!-- =============================================================== -->
+
+ <target name="tp.functional" description="Runs functional tests">
+ <property name="tp.include" value="functional/**/*.xml"/>
+ <antcall target="tp.run"/>
+ </target>
+ <target name="tp.bind" description="Runs BIND tests">
+ <property name="tp.include" value="BIND/**/*.xml"/>
+ <antcall target="tp.run"/>
+ </target>
+ <target name="tp.deltav" description="Runs DeltaV tests">
+ <property name="tp.include" value="DeltaV/**/*.xml"/>
+ <antcall target="tp.run"/>
+ </target>
+ <target name="tp.dasl" description="Runs DASL tests">
+ <property name="tp.include" value="DASL/**/*.xml"/>
+ <antcall target="tp.run"/>
+ </target>
+ <target name="tp.bind" description="Runs bind tests">
+ <property name="tp.include" value="BIND/**/*.xml"/>
+ <antcall target="tp.run"/>
+ </target>
+ <target name="tp.i18n" description="Runs I18N tests">
+ <property name="tp.include" value="I18N/**/*.xml"/>
+ <antcall target="tp.run"/>
+ </target>
+ <target name="tp.acl" description="Runs ACL tests">
+ <property name="tp.include" value="ACL/**/*.xml"/>
+ <antcall target="tp.run"/>
+ </target>
+ <target name="tp.multiuser" description="Runs multi-user tests">
+ <property name="tp.include" value="multi-user/**/*.xml"/>
+ <antcall target="tp.run">
+ <!-- TODO -->
+ <param name="xdav.globalVariableUsers" value="4"/>
+ <param name="xdav.globalVariableIterationCount" value="4"/>
+ <param name="xdav.globalVariableIterationCountSmall" value="2"/>
+ </antcall>
+ </target>
+ <target name="tp.stores" description="Creates the initial stores">
+ <property name="tp.include" value="configuration/create_webdav_stores.xml"/>
+ <antcall target="tp.run"/>
+ </target>
+ <target name="tp.pattern" description=
+ "Runs all tests matched by the pattern specified by -Dtp.pattern=pattern.
Always use slashes, even on windows!">
+ <property name="tp.include" value="${tp.pattern}"/>
+ <antcall target="tp.invoke"/>
+ </target>
+
+ <target name="tp.run" depends="tp.props">
+ <taskdef name="tprocessor"
classname="org.apache.slide.testsuite.testtools.tutil.TProcessorTask">
+ <classpath>
+ <fileset dir="${lib}" >
+ <include name="*.jar" />
+ </fileset>
+ </classpath>
+ </taskdef>
+ <tprocessor config="${basedir}/testsuite/junit/tprocessor.xml"
+ urlEncoding="UTF-8" tracingRequest="xar"
result="${basedir}/result.xml">
+ <fileset dir="${basedir}/testsuite/junit/xmltestcases">
+ <include name="${tp.include}"/>
+ <exclude name="**/*UNEXPL*/**/*.xml"/>
+ <exclude name="**/*cross*.xml"/>
+ </fileset>
+ </tprocessor>
+ </target>
+
+ <target name="tp.props">
+ <property name="tp.props" location="${basedir}/tp.properties"/>
+ <available file="${tp.props}" type="file" property="tp.exists" />
+ <fail unless="tp.exists" message="${tp.props} not found. Please copy one of the
sample properties files and adjust it to your environment."/>
+ <property file="${tp.props}" prefix="xdav"/>
+ </target>
</project>
1.1 jakarta-slide/testsuite/.cvsignore
Index: .cvsignore
===================================================================
tp.properties
1.1 jakarta-slide/testsuite/tp.properties.tamino
Index: tp.properties.tamino
===================================================================
user = usr
password = usr
host = localhost
port = 8080
workhost = bolrep2
workdb = mhm
globalVariableCollection = testcoll
globalVariableUsers = 1
globalVariableIterationCount = 1
globalVariableIterationCountSmall = 1
globalVariablePerformanceIterations = 1
globalVariableDomainName = ${xdav.host}
globalVariableGroup = group
globalVariableGroupsColl = groups
globalVariableUsersColl = users
globalVariableRolesColl = roles
globalVariableRootUserPath = /webdav/administration/security/userdb
globalVariableUserPath = /webdav/administration/security/userdb/users/${user}
globalVariableServerName = webdav
globalVariableXMLReference=
1.74 +43 -23
jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/TProcessors.java
Index: TProcessors.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tprocessor/TProcessors.java,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- TProcessors.java 29 Jan 2004 13:08:37 -0000 1.73
+++ TProcessors.java 6 Feb 2004 15:55:15 -0000 1.74
@@ -81,6 +81,7 @@
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
+import java.util.Properties;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.Vector;
@@ -143,7 +144,7 @@
/** home */
- String xdavhome;
+ File config;
/** port */
String port;
@@ -189,19 +190,41 @@
/** The absolute path name of the execute input file **/
private String globalTestFileName = null;
+ private final Properties properties;
+
+ /** Configures from System properties **/
+ public static TProcessors create() {
+ String home;
+ File config;
+
+ home = System.getProperty("xdav.home");
+ if (home == null) {
+ System.out.println("xdav.home is not set!");
+ throw new Error("xdav.home is not set!");
+ }
+ config = new File(home + File.separator + "testsuite" + File.separator +
"junit" + File.separator + "tprocessor.xml");
+ return new TProcessors(config, System.getProperty("xdav.host"),
+ System.getProperty("xdav.port"),
System.getProperty("xdav.user"),
+ System.getProperty("xdav.password"),
System.getProperty("xdav.urlencoding"),
+ System.getProperty("xdav.tracingRequest", "none"),
+ System.getProperties());
+ }
+
/**
* Constructor
*/
- public TProcessors (){
-
- xdavhome = System.getProperty("xdav.home");
- host = System.getProperty("xdav.host");
- port = System.getProperty("xdav.port");
- defaultUser = System.getProperty("xdav.user");
- defaultPassword = System.getProperty("xdav.password");
- defaultUrlEncoding = System.getProperty("xdav.urlencoding");
- tracingRequest = System.getProperty("xdav.tracingRequest", "none");
+ public TProcessors (File config, String host, String port, String defaultUser,
+ String defaultPassword, String defaultUrlEncoding, String
tracingRequest,
+ Properties properties) {
+ this.config = config;
+ this.host = host;
+ this.port = port;
+ this.defaultUser = defaultUser;
+ this.defaultPassword = defaultPassword;
+ this.defaultUrlEncoding = defaultUrlEncoding;
+ this.tracingRequest = tracingRequest;
+ this.properties = properties;
if (defaultUrlEncoding == null) {
defaultUrlEncoding = "UTF-8";
@@ -216,7 +239,7 @@
System.out.println("xdav.host is not set!");
throw new Error("xdav.host is not set!");
}
- if (xdavhome == null) {
+ if (config == null) {
System.out.println("xdav.home is not set!");
throw new Error("xdav.home is not set!");
}
@@ -231,10 +254,7 @@
startUp.put("port", new Integer(port));
- try { xdavConfiguration = new XConf(new File(xdavhome +
- File.separator +
"testsuite"+
- File.separator + "junit"+
- File.separator +
"tprocessor.xml")); }
+ try { xdavConfiguration = new XConf(config); }
catch (Exception e) { e.printStackTrace(); }
@@ -325,7 +345,7 @@
TArgs arg = new TArgs (args);
- TProcessors tp = new TProcessors();
+ TProcessors tp = TProcessors.create();
if(!tp.processStartUp( args )){
System.exit(-1);
}
@@ -437,8 +457,8 @@
* @param WeddavClient client, File
*/
- private boolean executeTestCase( File testfile, PrintStream xmlresultPar ){
- boolean result= true;
+ public boolean executeTestCase( File testfile, PrintStream xmlresultPar ){
+ boolean result= true; // TODO: not used
long time = System.currentTimeMillis();
if (xmlresultPar != null){
@@ -1795,7 +1815,7 @@
key.equals("port")||
key.equals("workdb")||
key.equals("workhost") ) {
- return System.getProperty("xdav." + key, "");
+ return properties.getProperty("xdav." + key, "");
}
else {
HashtableStack vars =
(HashtableStack)knownVarsByThread.get(Thread.currentThread().getName());
1.1
jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tutil/TProcessorTask.java
Index: TProcessorTask.java
===================================================================
// �{header}:
//
// This is file src/de/mlhartme/packlet/builder/AddFiles.java,
// Packlet version 0.3 Copyright � 2002 Michael Hartmeier
//
// Packlet is licensed under the terms of the GNU Lesser General Public License.
// It is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the file license.txt for details.
//
// �.
package org.apache.slide.testsuite.testtools.tutil;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.apache.slide.testsuite.testtools.tprocessor.TProcessors;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
public class TProcessorTask extends Task {
private File config;
private File result;
private String urlEncoding;
private String tracingRequest;
private final List filesets;
public TProcessorTask() {
super();
filesets = new ArrayList();
}
public void addFileset(FileSet set) {
filesets.add(set);
}
public void setConfig(File config) {
if (!config.isFile()) {
throw new BuildException("no such file: " + config);
}
this.config = config;
}
public void setUrlEncoding(String urlEncoding) {
this.urlEncoding = urlEncoding;
}
public void setTracingRequest(String tracingRequest) {
this.tracingRequest = tracingRequest;
}
public void setResult(File result) {
this.result = result;
}
private static void check(Object attr, String name) throws BuildException {
if (attr == null) {
throw new BuildException("'" + name + "' attribute not set");
}
}
public void execute() throws BuildException {
int i;
List lst;
TProcessors tp;
Iterator iter;
File file;
PrintStream out;
int ok;
String host;
String port;
String user;
String password;
host = getProperty("host");
port = getProperty("port");
user = getProperty("user");
password = getProperty("password");
check(config, "config");
check(result, "result");
check(host, "host");
check(port, "port");
check(user, "user");
check(password, "password");
check(urlEncoding, "urlEncoding");
check(tracingRequest, "tracingRequest");
lst = new ArrayList();
for (i = 0; i < filesets.size(); i++) {
addFileset(lst, (FileSet) filesets.get(i));
}
System.out.println("selected " + lst.size() + " tests");
System.out.println("writing results to " + result);
iter = lst.iterator();
try {
out = new PrintStream(new FileOutputStream(result));
} catch (IOException e) {
throw new BuildException("cannot create result file " + result, e);
}
ok = 0;
try {
while (iter.hasNext()) {
file = (File) iter.next();
tp = new TProcessors(config, host, port, user, password,
urlEncoding, tracingRequest, createProperties());
if (tp.executeTestCase(file, out)) {
ok++;
}
}
} finally {
out.close();
}
System.out.println("result: " + ok + "/" + lst.size() + " ok");
}
private static final String PREFIX = "xdav.";
private Properties createProperties() {
Properties props;
Iterator iter;
Map.Entry entry;
String key;
props = new Properties();
iter = project.getProperties().entrySet().iterator();
while (iter.hasNext()) {
entry = (Map.Entry) iter.next();
key = (String) entry.getKey();
if (key.startsWith(PREFIX)) {
props.put(key, entry.getValue());
}
}
return props;
}
private String getProperty(String name) throws BuildException {
String value;
String fullName;
fullName = PREFIX + name;
value = project.getProperty(fullName);
if (value == null) {
throw new BuildException("mandatory property not found: " + fullName);
}
return value;
}
public void addFileset(List lst, FileSet fs) {
DirectoryScanner ds;
File fromDir;
ds = fs.getDirectoryScanner(project);
fromDir = fs.getDir(project);
add(lst, fromDir, ds.getIncludedFiles());
}
public void add(List lst, File fromDir, String[] files) {
int i;
String file;
for (i = 0; i < files.length; i++) {
file = files[i];
lst.add(new File(fromDir, file).getAbsoluteFile());
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]