juergen 2004/02/10 09:21:00
Modified: testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tutil
TProcessorTask.java
Log:
print relative file names
Revision Changes Path
1.5 +51 -56
jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tutil/TProcessorTask.java
Index: TProcessorTask.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/testsuite/testsuite/junit/src/org/apache/slide/testsuite/testtools/tutil/TProcessorTask.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TProcessorTask.java 10 Feb 2004 10:03:56 -0000 1.4
+++ TProcessorTask.java 10 Feb 2004 17:21:00 -0000 1.5
@@ -74,7 +74,6 @@
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;
import org.jdom.JDOMException;
@@ -120,17 +119,16 @@
}
public void execute() throws BuildException {
int i;
- int max;
List lst;
- TProcessors tp;
- File file;
PrintStream out;
int okCount;
String host;
String port;
String user;
String password;
- boolean ok;
+ FileSet fs;
+ String[] files;
+ File dir;
host = getProperty("host");
port = getProperty("port");
@@ -145,45 +143,61 @@
check(urlEncoding, "urlEncoding");
check(tracingRequest, "tracingRequest");
- lst = new ArrayList();
- for (i = 0; i < filesets.size(); i++) {
- addFileset(lst, (FileSet) filesets.get(i));
- }
- log("selected " + lst.size() + " tests, writing results to " + result);
+ log("writing results to " + result);
+ lst = new ArrayList();
try {
out = new PrintStream(new FileOutputStream(result));
} catch (IOException e) {
throw new BuildException("cannot create result file " + result, e);
}
- okCount = 0;
- max = lst.size();
+
try {
- for (i = 0; i < max; i++) {
- file = (File) lst.get(i);
- try {
- tp = new TProcessors(config, host, port, user, password,
urlEncoding, tracingRequest, createProperties());
- } catch (JDOMException e) {
- throw new BuildException("initializing tprocessor failed", e);
- } catch (IOException e) {
- throw new BuildException("initializing tprocessor failed", e);
- }
- log((i + 1) + "/" + max + ": " + file.getPath());
- try {
- ok = tp.executeTestCase(file, out);
- } catch (Exception e) {
- throw new BuildException("execution failed: " + file, e);
- }
- if (ok) {
- okCount++;
- } else {
- log(" FAILED");
- }
+ okCount = 0;
+ for (i = 0; i < filesets.size(); i++) {
+ fs = (FileSet) filesets.get(i);
+ dir = fs.getDir(project);
+ log("entering directory: " + dir);
+ files = fs.getDirectoryScanner(project).getIncludedFiles();
+ okCount += execute(dir, files, out, host, port, user, password);
+ log("leaving directory: " + dir);
}
} finally {
out.close();
}
- log("result: " + okCount + "/" + lst.size() + " ok");
+ log("result: " + okCount + "/" + lst.size() + " ok, for details see " +
result);
+ }
+
+ private int execute(File dir, String[] files, PrintStream out, String host,
String port, String user, String password) {
+ int okCount;
+ int i;
+ String file;
+ TProcessors tp;
+ boolean ok;
+
+ okCount = 0;
+ for (i = 0; i < files.length; i++) {
+ try {
+ tp = new TProcessors(config, host, port, user, password,
urlEncoding, tracingRequest, createProperties());
+ } catch (JDOMException e) {
+ throw new BuildException("initializing tprocessor failed", e);
+ } catch (IOException e) {
+ throw new BuildException("initializing tprocessor failed", e);
+ }
+ file = files[i];
+ log((i + 1) + "/" + files.length + ": " + file);
+ try {
+ ok = tp.executeTestCase(new File(dir, file), out);
+ } catch (Exception e) {
+ throw new BuildException("execution failed: " + file, e);
+ }
+ if (ok) {
+ okCount++;
+ } else {
+ log(" FAILED");
+ }
+ }
+ return okCount;
}
private static final String PREFIX = "xdav.";
@@ -217,24 +231,5 @@
}
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]