[jboss-cvs] JBossAS SVN: r94276 - projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/src/main/java/aQute/junit/runtime.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Oct 2 12:08:40 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-10-02 12:08:39 -0400 (Fri, 02 Oct 2009)
New Revision: 94276

Modified:
   projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/src/main/java/aQute/junit/runtime/Target.java
Log:
Print setup error to XML report 

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-10-02 15:34:47 UTC (rev 94275)
+++ projects/jboss-osgi/projects/aQute/trunk/aQute.runtime/src/main/java/aQute/junit/runtime/Target.java	2009-10-02 16:08:39 UTC (rev 94276)
@@ -2,8 +2,10 @@
 
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileOutputStream;
 import java.io.FileReader;
 import java.io.IOException;
+import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Iterator;
@@ -17,13 +19,11 @@
 
 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.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 
 public class Target {
     final List             testNames  = new ArrayList();
-    List                   flattened;
     int                    port       = -1;
     boolean                keepAlive;
     String                 target;
@@ -138,28 +138,37 @@
      * @throws Throwable
      */
     private int doTesting(TestReporter testSuiteReport) throws Throwable {
-        if (framework.activate() == false)
-            throw new IllegalStateException("Framework does not activate");
-        	
-        boolean report = properties.containsKey("report");
-        if (report)
-            framework.report(System.out);
+        
+    	Bundle targetBundle;
+        
+		try {
+			if (framework.activate() == false)
+			    throw new IllegalStateException("Framework does not activate");
+				
+			boolean report = properties.containsKey("report");
+			if (report)
+			    framework.report(System.out);
 
-        Bundle targetBundle = framework.getBundle(target);
-        if (targetBundle == null)
-            throw new IllegalArgumentException("No target specified");
+			targetBundle = framework.getBundle(target);
+			if (targetBundle == null)
+			    throw new IllegalArgumentException("No target specified");
 
-        // Verify if we have any test names set
-        if (testNames.size() == 0)
-            checkTestCases(targetBundle);
+			// Verify if we have any test names set
+			if (testNames.size() == 0)
+			    checkTestCases(targetBundle);
 
-        if (testNames.size() == 0) {
-            System.out
-                    .println("No test cases to run, waiting for the framework to quit");
-            framework.waitForStop(0);
-            System.out.println("And the framework is gone!");
-            return 0;
-        }
+			if (testNames.size() == 0) {
+			    System.out.println("No test cases to run, waiting for the framework to quit");
+			    framework.waitForStop(0);
+			    System.out.println("And the framework is gone!");
+			    return 0;
+			}
+		} catch (Throwable th) {
+			FileOutputStream fos = new FileOutputStream(reportName);
+			th.printStackTrace(new PrintStream(fos));
+			fos.close();
+			throw th;
+		}
 
         int allErrors = 0;
         




More information about the jboss-cvs-commits mailing list