cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sea...@apache.org
Subject svn commit: r695977 - in /cxf/trunk: rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/ rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/ systests/src/test/java/org/apache/cxf/systest/handlers/ systests/src/test/java/org/apache/cxf/systest/provider/ sys...
Date Tue, 16 Sep 2008 17:07:33 GMT
Author: seanoc
Date: Tue Sep 16 10:07:32 2008
New Revision: 695977

URL: http://svn.apache.org/viewvc?rev=695977&view=rev
Log:
Removed further references to NodeList

Modified:
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptorTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/AttachmentProviderXMLClientServerTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java?rev=695977&r1=695976&r2=695977&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java Tue
Sep 16 10:07:32 2008
@@ -41,7 +41,6 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-//import org.w3c.dom.NodeList;
 
 import org.apache.cxf.binding.Binding;
 import org.apache.cxf.binding.soap.Soap11;
@@ -311,7 +310,6 @@
             if (header != null) {
                 Unmarshaller unmarshaller = 
                     getJAXBContext().createUnmarshaller();
-//                NodeList headerElements = header.getChildNodes();
                 Iterator<Header> iter = header.iterator();
                 while (iter.hasNext()) {
                     Object node = iter.next().getObject();
@@ -342,33 +340,6 @@
                                 requested.add(ar);
                             }
                         }
-//                for (int i = 0; i < headerElements.getLength(); i++) {
-//                    Node node = headerElements.item(i);
-//                    if (Node.ELEMENT_NODE != node.getNodeType()) {
-//                        continue;
-//                    }
-//                    Element headerElement = (Element)headerElements.item(i);
-//                    String headerURI = headerElement.getNamespaceURI();
-//                    String localName = headerElement.getLocalName();
-//                    if (RMConstants.getNamespace().equals(headerURI)) {
-//                        LOG.log(Level.FINE, "decoding RM header {0}", localName);
-//                        if (RMConstants.getSequenceName().equals(localName)) {
-//                            SequenceType s = decodeProperty(SequenceType.class,
-//                                                            headerElement,
-//                                                            unmarshaller);
-//                            
-//                            rmps.setSequence(s);
-//                        } else if (RMConstants.getSequenceAckName().equals(localName))
{
-//                            SequenceAcknowledgement ack = decodeProperty(SequenceAcknowledgement.class,
-//                                                            headerElement,
-//                                                            unmarshaller);
-//                            acks.add(ack);                            
-//                        } else if (RMConstants.getAckRequestedName().equals(localName))
{
-//                            AckRequestedType ar = decodeProperty(AckRequestedType.class,
-//                                                            headerElement,
-//                                                            unmarshaller);
-//                            requested.add(ar);
-//                        }
                     }
                 }
                 if (acks.size() > 0) {
@@ -455,15 +426,6 @@
                 iter.remove();
             }
         }
-        
-//        NodeList headerElements =
-//            header.getElementsByTagNameNS(RMConstants.getNamespace(), "*");
-//        for (int i = 0; i < headerElements.getLength(); i++) {
-//            Node headerElement = headerElements.item(i);
-//            if (RMConstants.getNamespace().equals(headerElement.getNamespaceURI())) {
-//                header.removeChild(headerElement);
-//            }
-//        }
     }
     
     

Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptorTest.java?rev=695977&r1=695976&r2=695977&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptorTest.java
(original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptorTest.java
Tue Sep 16 10:07:32 2008
@@ -34,7 +34,6 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.w3c.dom.Element;
-//import org.w3c.dom.NodeList;
 
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.binding.soap.SoapFault;
@@ -359,7 +358,6 @@
 
         for (String name : names) {
             boolean found = false;
-//            NodeList headerElements = header.getChildNodes();
             Iterator<Header> iter = header.iterator();
             while (iter.hasNext()) {
                 Object obj = iter.next().getObject();
@@ -378,20 +376,6 @@
                     }
                 }
             }
-//            for (int i = 0; i < headerElements.getLength(); i++) {
-//                Element headerElement = (Element)headerElements.item(i);
-//                String namespace = headerElement.getNamespaceURI();
-//                String localName = headerElement.getLocalName();
-//                if (RMConstants.getNamespace().equals(namespace)
-//                    && localName.equals(name)) {
-//                    found = true;
-//                    break;
-//                } else if (RMConstants.getAddressingNamespace().equals(namespace)
-//                    && localName.equals(name)) {
-//                    found = true;
-//                    break;
-//                }
-//            }
             assertTrue("Could not find header element " + name, found);
         }
 
@@ -416,22 +400,6 @@
                 assertTrue("Unexpected header element " + localName, found);
             }
         }
-//        NodeList headerElements = header.getChildNodes();
-//        for (int i = 0; i < headerElements.getLength(); i++) {
-//            Element headerElement = (Element)headerElements.item(i);  
-//            String namespace = headerElement.getNamespaceURI();
-//            String localName = headerElement.getLocalName();
-//            assertTrue(RMConstants.getNamespace().equals(namespace) 
-//                || RMConstants.getAddressingNamespace().equals(namespace));
-//            boolean found = false;
-//            for (String name : names) {
-//                if (localName.equals(name)) {
-//                    found = true;
-//                    break;
-//                }
-//            }
-//            assertTrue("Unexpected header element " + localName, found);
-//        }
     }
     
     private SoapMessage setUpInboundMessage(String resource) throws XMLStreamException {

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java?rev=695977&r1=695976&r2=695977&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
Tue Sep 16 10:07:32 2008
@@ -29,6 +29,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.soap.Detail;
 import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPConstants;
 import javax.xml.soap.SOAPFault;
 import javax.xml.soap.SOAPMessage;
@@ -49,12 +50,11 @@
 import javax.xml.ws.soap.SOAPFaultException;
 
 import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import org.apache.cxf.BusException;
 import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.handler_test.HandlerTest;
 import org.apache.handler_test.HandlerTestService;
@@ -1073,7 +1073,7 @@
         String[] handlerNames = {"soapHandler4", "soapHandler3", "handler2", "handler1",
"servant",
                                  "handler1", "handler2", "soapHandler3", "soapHandler4"};
 
-        List<String> resp = getHandlerNames(inMsg.getSOAPBody().getChildNodes());
+        List<String> resp = getHandlerNames(inMsg.getSOAPBody());
         assertEquals(handlerNames.length, resp.size());
 
         Iterator iter = resp.iterator();
@@ -1090,17 +1090,10 @@
         }
     }
 
-    List<String> getHandlerNames(NodeList nodes) throws Exception {
+    List<String> getHandlerNames(SOAPBody soapBody) throws Exception {
+        
+        Element elNode = DOMUtils.getFirstElement(soapBody);
         List<String> stringList = null;
-        Node elNode = null;
-        for (int idx = 0; idx < nodes.getLength(); idx++) {
-            Node n = nodes.item(idx);
-            if (n.getNodeType() == Node.ELEMENT_NODE) {
-                elNode = n;
-                break;
-            }
-        }
-
         JAXBContext jaxbCtx = JAXBContext.newInstance(PingResponse.class);
         Unmarshaller um = jaxbCtx.createUnmarshaller();
         Object obj = um.unmarshal(elNode);

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/AttachmentProviderXMLClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/AttachmentProviderXMLClientServerTest.java?rev=695977&r1=695976&r2=695977&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/AttachmentProviderXMLClientServerTest.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/AttachmentProviderXMLClientServerTest.java
Tue Sep 16 10:07:32 2008
@@ -22,12 +22,13 @@
 import java.io.InputStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.util.List;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
 
 import org.apache.cxf.common.util.Base64Utility;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -72,8 +73,8 @@
 
         Document result = XMLUtils.parse(root);
         
-        NodeList resList = result.getDocumentElement().getElementsByTagName("att");
-        assertEquals("Two attachments must've been encoded", 2, resList.getLength());
+        List<Element> resList = DOMUtils.findAllElementsByTagName(result.getDocumentElement(),
"att");
+        assertEquals("Two attachments must've been encoded", 2, resList.size());
         
         verifyAttachment(resList, "foo", "foobar");
         verifyAttachment(resList, "bar", "barbaz");
@@ -83,10 +84,9 @@
         assertTrue(input.contains("ABCDEFGHIJKLMNOP"));
     }
 
-    private void verifyAttachment(NodeList atts, String contentId, String value) {
+    private void verifyAttachment(List<Element> atts, String contentId, String value)
{
 
-        for (int i = 0; i < atts.getLength(); i++) {
-            Element expElem = (Element)atts.item(i);
+        for (Element expElem : atts) {
             String child = expElem.getFirstChild().getNodeValue();
             String contentIdVal = expElem.getAttribute("contentId");
             if (contentId.equals(contentIdVal)

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java?rev=695977&r1=695976&r2=695977&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java
Tue Sep 16 10:07:32 2008
@@ -34,7 +34,6 @@
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
 
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
@@ -95,16 +94,14 @@
             hdr.setPrefix(ver.getHeader().getPrefix());
             
             marshallFrom("urn:piggyback_responder", hdr, getMarshaller());
-            NodeList nl = hdr.getChildNodes();
-            for (int i = 0; i < nl.getLength(); i++) {
-                Object obj = nl.item(i);
-                if (obj instanceof Element) {
-                    Element elem = (Element) obj;
-                    Header holder = new Header(
-                            new QName(elem.getNamespaceURI(), elem.getLocalName()), 
-                            elem, null);
-                    header.add(holder);
-                }
+            Element elem = DOMUtils.getFirstElement(hdr);
+            while (elem != null) {
+                Header holder = new Header(
+                        new QName(elem.getNamespaceURI(), elem.getLocalName()), 
+                        elem, null);
+                header.add(holder);
+                
+                elem = DOMUtils.getNextElement(elem);
             }
             
         } catch (Exception e) {

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java?rev=695977&r1=695976&r2=695977&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
Tue Sep 16 10:07:32 2008
@@ -171,14 +171,17 @@
     
     private void buildHandlerChains() {
 
-        for (Element jaxwsBinding : jaxwsBindingsMap.keySet()) {
-            NodeList nl = jaxwsBinding.getElementsByTagNameNS(ToolConstants.HANDLER_CHAINS_URI,
-                                                              ToolConstants.HANDLER_CHAINS);
-            if (nl.getLength() == 0) {
+        for (Element jaxwsBinding : jaxwsBindingsMap.keySet()) {            
+            List<Element> elemList = 
+                DOMUtils.findAllElementsByTagNameNS(jaxwsBinding, 
+                                                    ToolConstants.HANDLER_CHAINS_URI, 
+                                                    ToolConstants.HANDLER_CHAINS);      
  
+            if (elemList.size() == 0) {
                 continue;
-            }
+            }         
             // take the first one, anyway its 1 handler-config per customization
-            this.handlerChains = (Element)nl.item(0);
+            this.handlerChains = elemList.get(0);
+ 
             return;
         }
 
@@ -393,16 +396,16 @@
 
         Element cloneEle = (Element)cloneNode;
         cloneEle.removeAttribute("node");
-        for (int i = 0; i < cloneNode.getChildNodes().getLength(); i++) {
-            Node child = cloneNode.getChildNodes().item(i);
-            if (child.getNodeType() == Element.ELEMENT_NODE) {
-                Element childElement = (Element)child;
-                Node attrNode = childElement.getAttributeNode("node");
-                if (attrNode != null) {
-                    cloneNode.removeChild(child);
-                }
-            }
+        
+        Element elem = DOMUtils.getFirstElement(cloneNode);
+        while (elem != null) {
+            Node attrNode = elem.getAttributeNode("node");
+            if (attrNode != null) {
+                cloneNode.removeChild(elem);
+            }        
+            elem = DOMUtils.getNextElement(elem);       
         }
+
         firstChild.appendChild(cloneNode);
     }
 



Mime
View raw message