cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r585002 - in /incubator/cxf/branches/2.0.x-fixes: ./ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/ws...
Date Tue, 16 Oct 2007 02:31:55 GMT
Author: dkulp
Date: Mon Oct 15 19:31:53 2007
New Revision: 585002

URL: http://svn.apache.org/viewvc?rev=585002&view=rev
Log:
Merged revisions 584059 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r584059 | ema | 2007-10-12 02:02:07 -0400 (Fri, 12 Oct 2007) | 2 lines
  
  Fixed issue CXF-1106
  Fixed typo Glen pointed out
........

Added:
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1106/
      - copied from r584059, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1106/
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1106/binding.xml
      - copied unchanged from r584059, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1106/binding.xml
Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomNodeSelector.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/CustomizedWSDLLocator.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomNodeSelector.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomNodeSelector.java?rev=585002&r1=585001&r2=585002&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomNodeSelector.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomNodeSelector.java
Mon Oct 15 19:31:53 2007
@@ -24,6 +24,7 @@
 
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 import org.apache.cxf.helpers.MapNamespaceContext;
 import org.apache.cxf.helpers.XPathUtils;
@@ -68,9 +69,18 @@
 
     public Node queryNode(final Node target, final String expression) {
         XPathUtils xpath = new XPathUtils(context);
-
+       
         Node node = (Node) xpath.getValue(expression, target, XPathConstants.NODE);
 
         return node;
     }
+    
+    public NodeList queryNodes(final Node target, final String expression) {
+        XPathUtils xpath = new XPathUtils(context);
+       
+        NodeList nodeList = (NodeList) xpath.getValue(expression, target, XPathConstants.NODESET);
+
+        return nodeList;
+    }
+    
 }

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java?rev=585002&r1=585001&r2=585002&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
Mon Oct 15 19:31:53 2007
@@ -86,7 +86,11 @@
         String[] bindingFiles;
         try {
             wsdlURL = URIParserUtil.getAbsoluteURI((String)env.get(ToolConstants.CFG_WSDLURL));
-            wsdlNode = getTargetNode(this.wsdlURL);
+            try {
+                wsdlNode = getTargetNode(this.wsdlURL);
+            } catch (IOException e) {
+               // do nothing
+            }
             customizedElements.put(wsdlURL.toString(), wsdlNode);
             bindingFiles = (String[])env.get(ToolConstants.CFG_BINDING);
             if (bindingFiles == null) {
@@ -116,20 +120,21 @@
         buildHandlerChains();
     }
 
-    public Element getTargetNode(String wsdlLoc) {
+    public Element getTargetNode(String wsdlLoc) throws IOException {
         Document doc = null;
         InputStream ins = null;
         try {
             URIResolver resolver = new URIResolver(wsdlLoc);
             ins = resolver.getInputStream();
         } catch (IOException e1) {
-            throw new ToolException(e1);
+            throw e1;
+            
         }
 
         try {
             doc = DOMUtils.readXml(ins);
         } catch (Exception e) {
-            Message msg = new Message("CAN_NOT_READ_AS_ELEMENT", LOG, new Object[] {wsdlLoc});
+            Message msg = new Message("CAN_NOT_READ_AS_ELEMENT", LOG, new Object[]{wsdlLoc});
             throw new ToolException(msg, e);
         }
 
@@ -189,9 +194,12 @@
         Element jaxbBindingElement = getJaxbBindingElement(jaxwsBindingNode);
         appendJaxbVersion((Element)schemaNode);
         if (jaxbBindingElement != null) {
-            copyAllJaxbDeclarations(nodeSelector.queryNode(schemaNode,
-                                                           jaxbBindingElement.getAttribute("node")),
-                                    jaxbBindingElement);
+            NodeList nlist = nodeSelector.queryNodes(schemaNode,
+                                                    jaxbBindingElement.getAttribute("node"));
+            for (int i = 0; i < nlist.getLength(); i++) {
+                Node node = nlist.item(i);
+                copyAllJaxbDeclarations(node, jaxbBindingElement);
+            }
             return;
         }
 
@@ -242,16 +250,19 @@
 
             nodeSelector.addNamespaces(bindings);
 
-            Node node = nodeSelector.queryNode(targetNode, expression);
-            if (node == null) {
+            NodeList nodeList = nodeSelector.queryNodes(targetNode, expression);
+            if (nodeList == null || nodeList.getLength() == 0) {
                 throw new ToolException(new Message("NODE_NOT_EXISTS",
                                                     LOG, new Object[] {expression}));
             }
 
-            if (hasJaxbBindingDeclaration(bindings)) {
-                copyAllJaxbDeclarations(node, bindings);
-            } else {
-                copyBindingsToWsdl(node, bindings, nodeSelector.getNamespaceContext());
+            for (int i = 0; i < nodeList.getLength(); i++) {
+                Node node = nodeList.item(i);
+                if (hasJaxbBindingDeclaration(bindings)) {
+                    copyAllJaxbDeclarations(node, bindings);
+                } else {
+                    copyBindingsToWsdl(node, bindings, nodeSelector.getNamespaceContext());
+                }
             }
         }
 
@@ -369,7 +380,7 @@
         if (isValidJaxwsBindingFile(bindingFile, reader)) {
             
             String wsdlLocation = root.getAttribute("wsdlLocation");
-            Element targetNode;
+            Element targetNode = null;
             if (!StringUtils.isEmpty(wsdlLocation)) {
                 URI wsdlURI = null;
                 try {
@@ -391,7 +402,13 @@
                     }
 
                 }
-                targetNode = this.getTargetNode(wsdlURI.toString());
+                try {
+                    targetNode = this.getTargetNode(wsdlURI.toString());
+                } catch (IOException e) {
+                    Message msg = new Message("POINT_TO_WSDL_DOES_NOT_EXIST", 
+                                              LOG, new Object[]{bindingFile, wsdlURI.toString()});
+                    throw new ToolException(msg, e);
+                }
                 if (targetNode == null) {
                     Message msg = new Message("CAN_NOT_FIND_BINDING_WSDL", 
                                               LOG, new Object[] {wsdlURI.normalize(), bindingFile});
@@ -400,7 +417,11 @@
                 }
                 root.setAttribute("wsdlLocation", wsdlURI.toString());                
             } else {
-                targetNode = this.getTargetNode(wsdlURL);
+                try {
+                    targetNode = getTargetNode(wsdlURL);
+                } catch (IOException e) {
+                    //do nothing
+                }
                 root.setAttribute("wsdlLocation", wsdlURL);   
             }
             jaxwsBindingsMap.put(root, targetNode);
@@ -417,7 +438,7 @@
                     jaxbBindings.add(newis);
                     tmpFile.deleteOnExit();
                 } catch (Exception e) {
-                    Message msg = new Message("FAILED_TO_ADD_SCHEMALOACTION", LOG, bindingFile);
+                    Message msg = new Message("FAILED_TO_ADD_SCHEMALOCATION", LOG, bindingFile);
                     throw new ToolException(msg, e);
                 }                
             } else {

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties?rev=585002&r1=585001&r2=585002&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
Mon Oct 15 19:31:53 2007
@@ -20,11 +20,12 @@
 #
 STAX_PARSER_ERROR = StAX parser error, check your external binding file(s)
 UNKNOWN_BINDING_FILE= Unknown external binding files : {0}
-CAN_NOT_FIND_BINDING_WSDL = Can not read the specified wsdl {0} that external binding file
{1} points
+CAN_NOT_FIND_BINDING_WSDL = Can not read the specified wsdl {0} that external binding file
{1} points to
 JAXWSBINDINGS_WSDLLOC_ERROR = Attribute wsdlLocation value {0} in jaxws binding element is
not an URI
 ERROR_TARGETNODE_WITH_XPATH = XPath query {0} is identifying either multiple or no target
nodes.
 XPATH_ERROR = XPath query error , check the query expression : {0}
 NOT_URI = Can not construct new URI with this string : {0}
 CAN_NOT_READ_AS_ELEMENT = Can not read this file to a xml element : {0}
 NODE_NOT_EXISTS = Can not find any node with the XPath {0}
-FAILED_TO_ADD_SCHEMALOACTION = Failed to inject schmeaLoaction for binding file {0}
\ No newline at end of file
+FAILED_TO_ADD_SCHEMALOCATION = Failed to inject schmeaLoaction for binding file {0}
+POINT_TO_WSDL_DOES_NOT_EXIST  = Binding file : {0} points to wsdl(resovled as {1}) does not
exist 
\ No newline at end of file

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/CustomizedWSDLLocator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/CustomizedWSDLLocator.java?rev=585002&r1=585001&r2=585002&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/CustomizedWSDLLocator.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/CustomizedWSDLLocator.java
Mon Oct 15 19:31:53 2007
@@ -41,8 +41,8 @@
     private Catalog catalogResolver;
    
     private Map<String, Element> elementMap;
-    private String lastestImportURI;
-    private boolean resolveFormMap;
+    private String latestImportURI;
+    private boolean resolveFromMap;
     
     public CustomizedWSDLLocator(String wsdlUrl, Map<String, Element> map) {
         this.wsdlUrl = wsdlUrl;
@@ -95,8 +95,8 @@
         return baseUri;
     }
     public String getLatestImportURI() {
-        if (this.resolveFormMap) {
-            return this.lastestImportURI;
+        if (this.resolveFromMap) {
+            return this.latestImportURI;
             
         }
         return resolver.getLatestImportURI();
@@ -117,15 +117,15 @@
 
                 InputSource ins = new InputSource(new StringReader(content));
                 ins.setSystemId(importURI.toString());
-                this.resolveFormMap = true;
-                this.lastestImportURI = importURI.toString();
+                this.resolveFromMap = true;
+                this.latestImportURI = importURI.toString();
                 return ins;    
             }
             
         } catch (URISyntaxException e) {
-            throw new RuntimeException("Resolve " + importLocation + "Failed: ", e);    
   
+            throw new RuntimeException("Failed to Resolve " + importLocation, e);       

         } 
-        resolveFormMap = false;
+        resolveFromMap = false;
         return resolve(importedUri, baseUri);
     }
     public void close() {

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java?rev=585002&r1=585001&r2=585002&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
Mon Oct 15 19:31:53 2007
@@ -167,7 +167,7 @@
     }
 
     private Definition buildCustomizedDefinition() throws Exception {      
-        Map<String, Element> eleMap = cusParser.getCustomizedWSDLElements();
+        Map<String, Element> eleMap = cusParser.getCustomizedWSDLElements();      
 
         String wsdlUrl = URIParserUtil.getAbsoluteURI((String)context.get(ToolConstants.CFG_WSDLURL));
         CustomizedWSDLLocator wsdlLocator = new CustomizedWSDLLocator(wsdlUrl, eleMap);
         wsdlLocator.setCatalogResolver(OASISCatalogManager.getCatalogManager(bus).getCatalog());

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=585002&r1=585001&r2=585002&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Mon Oct 15 19:31:53 2007
@@ -742,6 +742,7 @@
         assertNotNull("Customization Fault Class is not generated", serviceClz);
 
     }
+    
     @Test
     public void testReuseJaxwsBindingFile() throws Exception {
         env.put(ToolConstants.CFG_WSDLURL, 
@@ -789,8 +790,31 @@
         processor.setContext(env);
         processor.execute();
         Class customizedClz = classLoader.loadClass("org.apache.oneway.types.CreateProcess$MyProcess");
-        assertNotNull("Failed to generate customized class for hello_world_oneway.wsdl",
customizedClz);    
-    
+        assertNotNull("Failed to generate customized class for hello_world_oneway.wsdl",

+                      customizedClz);        
     }    
+    
+    @Test
+    public void testBindingXPath() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, 
+                getLocation("/wsdl2java_wsdl/hello_world.wsdl"));
+        env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf1106/binding.xml"));
+        processor.setContext(env);
+        processor.execute();
+        Class clz = classLoader
+        .loadClass("org.apache.hello_world_soap_http.Greeter");
+        assertNotNull("Failed to generate SEI class", clz);
+        Method[] methods = clz.getMethods();
+        assertEquals("jaxws binding file parse error, number of generated method is not expected"
+                     , 14, methods.length);
+        
+        boolean existSayHiAsyn = false;
+        for (Method m : methods) {
+            if (m.getName().equals("sayHiAsyn")) {
+                existSayHiAsyn = true;
+            }             
+        }
+        assertFalse("sayHiAsyn method should not be generated", existSayHiAsyn);
+    }
     
 }



Mime
View raw message