[wise-commits] wise SVN: r582 - in core/trunk/core/src: main/java/org/jboss/wise/core/client/impl/reflection/builder and 1 other directories.

wise-commits at lists.jboss.org wise-commits at lists.jboss.org
Thu Jul 4 08:28:41 EDT 2013


Author: alessio.soldano at jboss.com
Date: 2013-07-04 08:28:40 -0400 (Thu, 04 Jul 2013)
New Revision: 582

Added:
   core/trunk/core/src/test/java/org/jboss/wise/core/client/WSDLParserTest.java
Modified:
   core/trunk/core/src/main/java/org/jboss/wise/core/client/WSDLParser.java
   core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/builder/ReflectionBasedWSDynamicClientBuilder.java
Log:
[WISE-207] Adding test and fixing issue with locally stored wsdls


Modified: core/trunk/core/src/main/java/org/jboss/wise/core/client/WSDLParser.java
===================================================================
--- core/trunk/core/src/main/java/org/jboss/wise/core/client/WSDLParser.java	2013-07-04 10:28:53 UTC (rev 581)
+++ core/trunk/core/src/main/java/org/jboss/wise/core/client/WSDLParser.java	2013-07-04 12:28:40 UTC (rev 582)
@@ -27,6 +27,7 @@
 import static org.jboss.wsf.spi.util.StAXUtils.match;
 import static org.jboss.wsf.spi.util.StAXUtils.nextElement;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
@@ -63,11 +64,18 @@
     private static final String TARGET_NAMESPACE = "targetNamespace";
 
     public static Set<String> searchNonSoapServices(String wsdlUrl) throws WiseRuntimeException {
+	URL url;
 	try {
-	    return searchNonSoapServices(new URL(wsdlUrl));
-	} catch (MalformedURLException mue) {
-	    throw new WiseRuntimeException(mue);
+	    url = new URL(wsdlUrl);
+	} catch (MalformedURLException e) {
+	    File file = new File(wsdlUrl);
+	    try {
+		url = file.toURI().toURL();
+	    } catch (MalformedURLException mue) {
+		throw new WiseRuntimeException(mue);
+	    }
 	}
+	return searchNonSoapServices(url);
     }
     
     public static Set<String> searchNonSoapServices(URL wsdlUrl) throws WiseRuntimeException {

Modified: core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/builder/ReflectionBasedWSDynamicClientBuilder.java
===================================================================
--- core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/builder/ReflectionBasedWSDynamicClientBuilder.java	2013-07-04 10:28:53 UTC (rev 581)
+++ core/trunk/core/src/main/java/org/jboss/wise/core/client/impl/reflection/builder/ReflectionBasedWSDynamicClientBuilder.java	2013-07-04 12:28:40 UTC (rev 582)
@@ -293,7 +293,6 @@
 		    : new WSDLResolver(tmpDir);
 	    File wsdlFile = resolver.retrieveWsdlFile(new URL(getWsdlURL()));
 	    String result = wsdlFile.getAbsolutePath();
-	    logger.info("Main wsdl file stored locally: " + result);
 	    return result;
 	} catch (Exception e) {
 	    throw new WiseRuntimeException(e);

Added: core/trunk/core/src/test/java/org/jboss/wise/core/client/WSDLParserTest.java
===================================================================
--- core/trunk/core/src/test/java/org/jboss/wise/core/client/WSDLParserTest.java	                        (rev 0)
+++ core/trunk/core/src/test/java/org/jboss/wise/core/client/WSDLParserTest.java	2013-07-04 12:28:40 UTC (rev 582)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wise.core.client;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URL;
+import java.util.Set;
+
+import org.junit.Test;
+
+public class WSDLParserTest {
+
+    @Test
+    public void testParser() throws Exception {
+	URL wsdlURL = Thread.currentThread().getContextClassLoader().getResource("./AddNumbersMultiplePorts.wsdl");
+        Set<String> excludedPorts = WSDLParser.searchNonSoapServices(wsdlURL);
+        assertEquals(1, excludedPorts.size());
+        assertEquals("AddNumbersPortHttp", excludedPorts.iterator().next());
+    }
+}



More information about the wise-commits mailing list