geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/test/org/apache/geronimo/deployment/scanner WebDAVScannerTest.java
Date Tue, 12 Aug 2003 20:26:31 GMT
jboynes     2003/08/12 13:26:31

  Modified:    modules/core/src/test/org/apache/geronimo/deployment/scanner
                        WebDAVScannerTest.java
  Log:
  Make test silently pass if a WebDAV server is not available
  
  Revision  Changes    Path
  1.2       +21 -3     incubator-geronimo/modules/core/src/test/org/apache/geronimo/deployment/scanner/WebDAVScannerTest.java
  
  Index: WebDAVScannerTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/deployment/scanner/WebDAVScannerTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WebDAVScannerTest.java	12 Aug 2003 07:10:16 -0000	1.1
  +++ WebDAVScannerTest.java	12 Aug 2003 20:26:31 -0000	1.2
  @@ -56,8 +56,11 @@
   package org.apache.geronimo.deployment.scanner;
   
   import java.net.URL;
  +import java.net.URLConnection;
   import java.util.Iterator;
   import java.util.Set;
  +import java.io.IOException;
  +import java.io.InputStream;
   
   import junit.framework.TestCase;
   
  @@ -67,11 +70,14 @@
    * @version $Revision$ $Date$
    */
   public class WebDAVScannerTest extends TestCase {
  +    private boolean testedServer;
  +    private boolean haveServer;
       private WebDAVScanner scanner;
       private URL baseURL;
   
       public void testScan() throws Exception {
  -        scanner = new WebDAVScanner(baseURL, false);
  +        if (!haveServer) return;
  +
           Set result = scanner.scan();
           for (Iterator i = result.iterator(); i.hasNext();) {
               URLInfo urlInfo = (URLInfo) i.next();
  @@ -80,7 +86,8 @@
       }
   
       public void testTypes() throws Exception {
  -        scanner = new WebDAVScanner(baseURL, false);
  +        if (!haveServer) return;
  +
           Set result = scanner.scan();
           for (Iterator i = result.iterator(); i.hasNext();) {
               URLInfo urlInfo = (URLInfo) i.next();
  @@ -90,5 +97,16 @@
   
       protected void setUp() throws Exception {
           baseURL = new URL("http://localhost/testScan/");
  +        if (!testedServer) {
  +            testedServer = true;
  +            try {
  +                InputStream is = baseURL.openStream();
  +                is.close();
  +                haveServer = true;
  +            } catch (IOException e) {
  +                haveServer = false;
  +            }
  +        }
  +        scanner = new WebDAVScanner(baseURL, false);
       }
   }
  
  
  

Mime
View raw message