tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r619973 - in /incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp: TuscanyServletFilter.java junit/WebTestRunner.java
Date Fri, 08 Feb 2008 18:27:59 GMT
Author: rfeng
Date: Fri Feb  8 10:27:57 2008
New Revision: 619973

URL: http://svn.apache.org/viewvc?rev=619973&view=rev
Log:
Disable the WebTestRunner if the junit.jar is not present 

Modified:
    incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.java
    incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/junit/WebTestRunner.java

Modified: incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.java?rev=619973&r1=619972&r2=619973&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.java
(original)
+++ incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.java
Fri Feb  8 10:27:57 2008
@@ -43,10 +43,15 @@
     //private static final Logger logger = Logger.getLogger(WebAppServletHost.class.getName());
 
     private WebAppServletHost servletHost;
-    private WebTestRunner testRunner = new WebTestRunner();
+    private WebTestRunner testRunner;
 
     public void init(final FilterConfig config) throws ServletException {
-        testRunner.init(config);
+        try {
+            testRunner = new WebTestRunner();
+            testRunner.init(config);
+        } catch (NoClassDefFoundError e) {
+            // Ignore the error
+        }
 
         // TODO: must be a better way to get this than using a static
         servletHost = WebAppServletHost.getInstance();
@@ -72,7 +77,9 @@
     }
 
     public void destroy() {
-        testRunner.destroy();
+        if (testRunner != null) {
+            testRunner.destroy();
+        }
         WebAppServletHost.getInstance().destroy();
     }
 
@@ -89,7 +96,7 @@
             path = "/";
         }
 
-        if (testRunner.isJunitEnabled()) {
+        if (testRunner != null && testRunner.isJunitEnabled()) {
             // This request is to run the test cases
             // The path is /junit or /junit?<testCaseClassName>
             if (path.equals("/junit")) {

Modified: incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/junit/WebTestRunner.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/junit/WebTestRunner.java?rev=619973&r1=619972&r2=619973&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/junit/WebTestRunner.java
(original)
+++ incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/junit/WebTestRunner.java
Fri Feb  8 10:27:57 2008
@@ -58,6 +58,8 @@
 
     private FilterConfig config;
     private boolean junitEnabled = true;
+    private Set<String> allTestCases;
+    private ClassLoader testClassLoader;
 
     private Set<String> findTestCases(String testJarPath) throws IOException {
         Pattern pattern = getTestCasePattern();
@@ -119,9 +121,6 @@
     public void destroy() {
     }
 
-    private Set<String> allTestCases;
-    private ClassLoader testClassLoader;
-
     private void init() throws IOException {
         testClassLoader = Thread.currentThread().getContextClassLoader();
         allTestCases = new HashSet<String>();
@@ -233,6 +232,7 @@
         String param = config.getInitParameter(JUNIT_ENABLED);
         if (param != null && param.trim().equals("false")) {
             junitEnabled = false;
+            return;
         }
         try {
             init();



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message