Author: thomas.diesler(a)jboss.com
Date: 2009-09-30 18:31:04 -0400 (Wed, 30 Sep 2009)
New Revision: 94184
Added:
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/scripts/assembly-ant-junit.xml
Modified:
projects/jboss-osgi/projects/aQute/trunk/aQute.bnd/src/main/java/aQute/bnd/test/ProjectLauncher.java
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/pom.xml
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/src/main/java/aQute/junit/runtime/GenericFramework.java
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/src/main/java/aQute/junit/runtime/Target.java
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/src/main/java/aQute/junit/runtime/XMLReport.java
projects/jboss-osgi/projects/aQute/trunk/pom.xml
Log:
Add standard Ant formatters.
Initial cut
Modified:
projects/jboss-osgi/projects/aQute/trunk/aQute.bnd/src/main/java/aQute/bnd/test/ProjectLauncher.java
===================================================================
---
projects/jboss-osgi/projects/aQute/trunk/aQute.bnd/src/main/java/aQute/bnd/test/ProjectLauncher.java 2009-09-30
20:38:36 UTC (rev 94183)
+++
projects/jboss-osgi/projects/aQute/trunk/aQute.bnd/src/main/java/aQute/bnd/test/ProjectLauncher.java 2009-09-30
22:31:04 UTC (rev 94184)
@@ -204,8 +204,14 @@
List<String> vmArguments = newList();
vmArguments.add(getProperty("java", "java"));
+
+ // export
ANT_OPTS="-Djpda=-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"
+ String jpda = System.getProperty("jpda");
+ if (jpda != null)
+ vmArguments.add(jpda);
+
doClasspath(vmArguments);
-
+
getArguments(targets, vmArguments, arguments);
vmArguments.add("aQute.junit.runtime.Target");
Modified: projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/pom.xml
===================================================================
--- projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/pom.xml 2009-09-30 20:38:36 UTC
(rev 94183)
+++ projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/pom.xml 2009-09-30 22:31:04 UTC
(rev 94184)
@@ -31,6 +31,10 @@
<!-- Dependencies -->
<dependencies>
<dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-junit</artifactId>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
@@ -51,6 +55,21 @@
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
+ <id>ant-junit</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>directory-single</goal>
+ </goals>
+ <configuration>
+ <finalName>classes</finalName>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>scripts/assembly-ant-junit.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ <execution>
<id>bundles</id>
<phase>test-compile</phase>
<goals>
Added:
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/scripts/assembly-ant-junit.xml
===================================================================
--- projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/scripts/assembly-ant-junit.xml
(rev 0)
+++
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/scripts/assembly-ant-junit.xml 2009-09-30
22:31:04 UTC (rev 94184)
@@ -0,0 +1,47 @@
+<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembl...
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-p...
http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+
+ <id>ant-junit</id>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <!-- Dependency Sets -->
+ <dependencySets>
+
+ <!-- bundles -->
+ <dependencySet>
+ <outputDirectory>/</outputDirectory>
+
<outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+ <includes>
+ <include>*:ant-junit:jar</include>
+ <include>*:ant:jar</include>
+ </includes>
+ <useStrictFiltering>false</useStrictFiltering>
+ <unpack>true</unpack>
+ <unpackOptions>
+ <includes>
+ <include>org/apache/tools/ant/BuildException.class</include>
+
<include>org/apache/tools/ant/taskdefs/optional/junit/BaseTest.class</include>
+
<include>org/apache/tools/ant/taskdefs/optional/junit/JUnitResultFormatter.class</include>
+
<include>org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskMirror.class</include>
+
<include>org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskMirror$JUnitResultFormatterMirror.class</include>
+
<include>org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskMirrorImpl$VmExitErrorTest.class</include>
+
<include>org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.class</include>
+
<include>org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.class</include>
+
<include>org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.class</include>
+
<include>org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.class</include>
+
<include>org/apache/tools/ant/taskdefs/optional/junit/XMLConstants.class</include>
+
<include>org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.class</include>
+
<include>org/apache/tools/ant/util/DOMElementWriter.class</include>
+ <include>org/apache/tools/ant/util/DateUtils.class</include>
+ <include>org/apache/tools/ant/util/FileUtils.class</include>
+ <include>org/apache/tools/ant/util/StringUtils.class</include>
+ <include>org/apache/tools/ant/util/TeeOutputStream.class</include>
+ </includes>
+ </unpackOptions>
+ </dependencySet>
+
+ </dependencySets>
+</assembly>
Modified:
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/src/main/java/aQute/junit/runtime/GenericFramework.java
===================================================================
---
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/src/main/java/aQute/junit/runtime/GenericFramework.java 2009-09-30
20:38:36 UTC (rev 94183)
+++
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/src/main/java/aQute/junit/runtime/GenericFramework.java 2009-09-30
22:31:04 UTC (rev 94184)
@@ -318,7 +318,7 @@
.println("------------------------------- REPORT
--------------------------");
out.println();
out.println("Framework " + framework);
- out.println("Framework "
+ out.println("SystemBundle "
+ (systemBundle == null ? "<>" :
systemBundle.getClass()
.toString()));
out.println("Storage " + storage);
Modified:
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/src/main/java/aQute/junit/runtime/Target.java
===================================================================
---
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/src/main/java/aQute/junit/runtime/Target.java 2009-09-30
20:38:36 UTC (rev 94183)
+++
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/src/main/java/aQute/junit/runtime/Target.java 2009-09-30
22:31:04 UTC (rev 94184)
@@ -1,11 +1,26 @@
package aQute.junit.runtime;
-import java.io.*;
-import java.util.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
-import junit.framework.*;
+import junit.framework.Test;
+import junit.framework.TestListener;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
-import org.osgi.framework.*;
+import org.apache.tools.ant.taskdefs.optional.junit.JUnitResultFormatter;
+import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest;
+import org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter;
+import org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
public class Target {
final List testNames = new ArrayList();
@@ -155,11 +170,26 @@
otl.begin(framework, targetBundle, flattened, realcount);
result.addListener(tl);
result.addListener(otl);
- suite.run(result);
+
+ // Add the standard plain and xml formatters
+ List<JUnitResultFormatter> formatters = new
ArrayList<JUnitResultFormatter>();
+ formatters.add(new XMLJUnitResultFormatter());
+ formatters.add(new PlainJUnitResultFormatter());
+ for (JUnitResultFormatter formatter : formatters)
+ result.addListener(formatter);
+
+ JUnitTest junitTest = new JUnitTest(target);
+ fireStartTestSuite(formatters, junitTest);
+ try {
+ suite.run(result);
+ } finally {
+ fireEndTestSuite(formatters, junitTest);
+ }
+
if (result.wasSuccessful())
return 0;
else
- return otl.errors;
+ return result.errorCount();
} catch (Throwable t) {
result.addError(null, t);
throw t;
@@ -188,6 +218,18 @@
return realCount;
}
+ private void fireStartTestSuite(List<JUnitResultFormatter> formatters,
JUnitTest junitTest) {
+ for (JUnitResultFormatter formatter : formatters) {
+ formatter.startTestSuite(junitTest);
+ }
+ }
+
+ private void fireEndTestSuite(List<JUnitResultFormatter> formatters, JUnitTest
junitTest) {
+ for (JUnitResultFormatter formatter : formatters) {
+ formatter.endTestSuite(junitTest);
+ }
+ }
+
/**
* Convert the test names to a test suite.
*
Modified:
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/src/main/java/aQute/junit/runtime/XMLReport.java
===================================================================
---
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/src/main/java/aQute/junit/runtime/XMLReport.java 2009-09-30
20:38:36 UTC (rev 94183)
+++
projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/src/main/java/aQute/junit/runtime/XMLReport.java 2009-09-30
22:31:04 UTC (rev 94184)
@@ -64,7 +64,8 @@
if (open)
out.println(">");
open = false;
- out.println(" <error name='" + test.toString() + "'
type='" + t.getClass().getName() + "'>");
+ if (test != null)
+ out.println(" <error name='" + test.toString() + "'
type='" + t.getClass().getName() + "'>");
out.println("<![CDATA[");
t.printStackTrace(out);
out.println("]]>");
Modified: projects/jboss-osgi/projects/aQute/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/aQute/trunk/pom.xml 2009-09-30 20:38:36 UTC (rev 94183)
+++ projects/jboss-osgi/projects/aQute/trunk/pom.xml 2009-09-30 22:31:04 UTC (rev 94184)
@@ -25,7 +25,7 @@
<!-- Properties -->
<properties>
- <version.apache.ant>1.7.0</version.apache.ant>
+ <version.apache.ant>1.7.1</version.apache.ant>
<version.junit>3.8.1</version.junit>
<version.osgi>r4v42</version.osgi>
</properties>
@@ -47,6 +47,11 @@
<version>${version.apache.ant}</version>
</dependency>
<dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-junit</artifactId>
+ <version>${version.apache.ant}</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${version.junit}</version>