Author: alexoree
Date: Fri Aug 23 15:46:17 2013
New Revision: 1516903

URL: http://svn.apache.org/r1516903
Log:
JUDDI-637 updating source code docs
JUDDI-600, revising the test case for WSDL to UDDI via http connection, test 
now checks for connectivity before attempting the test to support offline 
builds (the test is just skipped then)

Modified:
    
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ReadWSDL.java
    
juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/ReadWSDLTest.java

Modified: 
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ReadWSDL.java
URL: 
http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ReadWSDL.java?rev=1516903&r1=1516902&r2=1516903&view=diff
==============================================================================
--- 
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ReadWSDL.java
 (original)
+++ 
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ReadWSDL.java
 Fri Aug 23 15:46:17 2013
@@ -33,7 +33,7 @@ import com.ibm.wsdl.factory.WSDLFactoryI
 /**
  * A WSDL parser/reader
  * @author <a href="mailto:[email protected]";>Kurt T Stam</a>
- * Modified for supporting http based credentials by Alex O'Ree
+ * @author <a href="mailto:[email protected]";>Alex O'Ree</a> - Modified for 
supporting http based credentials
  */
 public class ReadWSDL {
        
@@ -105,10 +105,18 @@ public class ReadWSDL {
                return readWSDL(wsdlUrl, null, null);
        }
 
+        /**
+         * It is optional to ignore SSL errors when attempting to parse a 
remote WSDL via https
+         * @return true if we are ignoring SSL errors
+         */
     public boolean isIgnoreSSLErrors() {
         return IgnoreSSLErrors;
     }
 
+    /**
+     * It is optional to ignore SSL errors when attempting to parse a remote 
WSDL via https
+     * @param IgnoreSSLErrors 
+     */
     public void setIgnoreSSLErrors(boolean IgnoreSSLErrors) {
         this.IgnoreSSLErrors = IgnoreSSLErrors;
     }

Modified: 
juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/ReadWSDLTest.java
URL: 
http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/ReadWSDLTest.java?rev=1516903&r1=1516902&r2=1516903&view=diff
==============================================================================
--- 
juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/ReadWSDLTest.java
 (original)
+++ 
juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/ReadWSDLTest.java
 Fri Aug 23 15:46:17 2013
@@ -14,9 +14,11 @@
  */
 package org.apache.juddi.v3.client.mapping;
 
+import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.net.UnknownHostException;
 
 import javax.wsdl.Definition;
 import javax.wsdl.WSDLException;
@@ -37,12 +39,53 @@ public class ReadWSDLTest {
         Assert.assertNotNull(definition);
     }
 
+    private static boolean IsReachable(String url) {
+        System.out.println("Testing connectivity to " + url);
+        try {
+            //make a URL to a known source
+            URL url2 = new URL(url);
+
+            //open a connection to that source
+            HttpURLConnection urlConnect = (HttpURLConnection) 
url2.openConnection();
+
+            //trying to retrieve data from the source. If there
+            //is no connection, this line will fail
+            Object objData = urlConnect.getContent();
+            urlConnect.disconnect();
+
+        } catch (Exception e) {
+            System.out.println("Connectivity failed " + e.getMessage());
+            return false;
+        }
+        System.out.println("Connectivity passed" );
+        return true;
+
+    }
+
+    /**
+     * normally, this test will work correctly if and only if you're connected
+     * to the big bad internet. if you happen to be offline, this test will
+     * fail.
+     */
     @Test
-    public void readFromURL() throws WSDLException, URISyntaxException, 
MalformedURLException, Exception {
+    public void readFromURL() throws MalformedURLException, Exception {
+        
+        boolean b = 
IsReachable("http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl";);
+        if (!b) {
+            System.out.println("Skipping test for a remote WSDL due to 
connectivity problems");
+        }
+
 
+        org.junit.Assume.assumeTrue(b);
         ReadWSDL readWSDL = new ReadWSDL();
-        Definition definition = readWSDL.readWSDL(new 
URL("http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl";));
-        Assert.assertNotNull(definition);
+        Definition definition = null;
+        try {
+            definition = readWSDL.readWSDL(new 
URL("http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl";));
+            Assert.assertNotNull(definition);
+        } catch (UnknownHostException ex) {
+        }
+
+
     }
 
     @Test



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to