Author: ruchithf
Date: Sat Nov 18 17:09:36 2006
New Revision: 476672

URL: http://svn.apache.org/viewvc?view=rev&rev=476672
Log:
Fixed WS-COMMONS-129

Added:
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImportTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/sigEncr.xml
   (with props)
Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java?view=diff&rev=476672&r1=476671&r2=476672
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
 Sat Nov 18 17:09:36 2006
@@ -343,7 +343,7 @@
         }
 
         // If deep, replicate and attach the kids.
-        if (deep) {
+        if (deep && !(importedNode instanceof Attr)) {
             for (Node srckid = importedNode.getFirstChild(); srckid != null; 
                     srckid = srckid.getNextSibling()) {
                 newNode.appendChild(importNode(srckid, true));

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?view=diff&rev=476672&r1=476671&r2=476672
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
 Sat Nov 18 17:09:36 2006
@@ -412,6 +412,14 @@
             // This is a ns declaration
             this.declareNamespace(attr.getNodeValue(), DOMUtil
                     .getLocalName(attr.getName()));
+            
+            //Don't add this to attr list, since its a namespace
+            return attr;
+        } else if(attr.getNodeName().equals(OMConstants.XMLNS_NS_PREFIX)) {
+            this.declareDefaultNamespace(attr.getValue());
+            
+            //Don't add this to attr list, since its a namespace
+            return attr;
         }
         if (this.attributes == null) {
             this.attributes = new AttributeMap(this);
@@ -437,6 +445,8 @@
         if (name.startsWith(OMConstants.XMLNS_NS_PREFIX + ":")) {
             // This is a ns declaration
             this.declareNamespace(value, DOMUtil.getLocalName(name));
+        } else if(name.equals(OMConstants.XMLNS_NS_PREFIX)) {
+            this.declareDefaultNamespace(value);
         } else {
             this.setAttributeNode(new AttrImpl(this.ownerNode, name, value,
                     this.factory));

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImportTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImportTest.java?view=auto&rev=476672
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImportTest.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImportTest.java
 Sat Nov 18 17:09:36 2006
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMTestUtils;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import java.io.FileInputStream;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author Ruchith Fernando ([EMAIL PROTECTED])
+ */
+public class ElementImportTest extends TestCase  {
+
+    public void testImport() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            Document doc = dbf.newDocumentBuilder().parse(
+                    new FileInputStream("test-resources/xml/sigEncr.xml"));
+            Node n = new 
OMDOMFactory().getDocument().importNode(doc.getDocumentElement(), true);
+            OMTestUtils.compare(doc.getDocumentElement(), (OMElement)n);
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+}

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/sigEncr.xml
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/sigEncr.xml?view=auto&rev=476672
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/sigEncr.xml
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/sigEncr.xml
 Sat Nov 18 17:09:36 2006
@@ -0,0 +1,67 @@
+<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";>
+    <s:Header>
+        <o:Security s:mustUnderstand="1" 
xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";>
+            <u:Timestamp u:Id="uuid-c46b1c73-532c-4ee6-ab98-4f985c232697-11">
+                <u:Created>2005-10-25T06:29:20.734Z</u:Created>
+                <u:Expires>2005-10-25T06:34:20.734Z</u:Expires>
+            </u:Timestamp>
+            <o:BinarySecurityToken 
u:Id="uuid-c46b1c73-532c-4ee6-ab98-4f985c232697-8" 
+                
ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3";
 
EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary";>MIIDDDCCAfSgAwIBAgIQM6YEf7FVYx/tZyEXgVComTANBgkqhkiG9w0BAQUFADAwMQ4wDAYDVQQKDAVPQVNJUzEeMBwGA1UEAwwVT0FTSVMgSW50ZXJvcCBUZXN0IENBMB4XDTA1MDMxOTAwMDAwMFoXDTE4MDMxOTIzNTk1OVowQjEOMAwGA1UECgwFT0FTSVMxIDAeBgNVBAsMF09BU0lTIEludGVyb3AgVGVzdCBDZXJ0MQ4wDAYDVQQDDAVBbGljZTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAoqi99By1VYo0aHrkKCNT4DkIgPL/SgahbeKdGhrbu3K2XG7arfD9tqIBIKMfrX4Gp90NJa85AV1yiNsEyvq+mUnMpNcKnLXLOjkTmMCqDYbbkehJlXPnaWLzve+mW0pJdPxtf3rbD4PS/cBQIvtpjmrDAU8VsZKT8DN5Kyz+EZsCAwEAAaOBkzCBkDAJBgNVHRMEAjAAMDMGA1UdHwQsMCowKKImhiRodHRwOi8vaW50ZXJvcC5iYnRlc3QubmV0L2NybC9jYS5jcmwwDgYDVR0PAQH/BAQDAgSwMB0GA1UdDgQWBBQK4l0TUHZ1QV3V2QtlLNDm+PoxiDAfBgNVHSMEGDAWgBTAnSj8wes1oR3WqqqgHBpNwkkPDzANBgkqkiG9w0BAQUFAAOCAQEABTqpOpvW+6yrLXyUlP2xJbEkohXHI5OWwKWleOb9hlkhWntUalfcFOJAgUyH30
 
TTpHldzx1+vK2LPzhoUFKYHE1IyQvokBN2JjFO64BQukCKnZhldLRPxGhfkTdxQgdf5rCK/wh3xVsZCNTfuMNmlAM6lOAg8QduDah3WFZpEA0s2nwQaCNQTNMjJC8tav1CBr6+E5FAmwPXP7pJxn9Fw9OXRyqbRA4v2y7YpbGkG2GI9UvOHw6SGvf4FRSthMMO35YbpikGsLix3vAsXWWi4rwfVOYzQK0OFPNi9RMCUdSH06m9uLWckiCxjos0FQODZE9l4ATGy9s9hNVwryOJTw==</o:BinarySecurityToken>
+            <e:EncryptedKey Id="_0" 
xmlns:e="http://www.w3.org/2001/04/xmlenc#";>
+                <e:EncryptionMethod 
Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
+                <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#";>
+                    <o:SecurityTokenReference>
+                        <o:KeyIdentifier 
ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier";>Xeg55vRyK3ZhAEhEf+YT0z986L0=</o:KeyIdentifier>
+                    </o:SecurityTokenReference>
+                </KeyInfo>
+                <e:CipherData>
+                    
<e:CipherValue>DehTcxm9AOypz3ab5b69IAItCvPyV2Gi3PMHGZnWGx57d/jByRT4v9SIAjKWGycJLHzrZwyjR70A9EYsOx+WegP/g6vR8gIF5rB5ZvwDt4SFygr7/H+WD9LqYxry9pa56W+kjPxrKeezoGv5ypoVIYmK2ZgV7khnKaqkxt5CMkg=</e:CipherValue>
+                </e:CipherData>
+            </e:EncryptedKey>
+            
+            <e:ReferenceList xmlns:e="http://www.w3.org/2001/04/xmlenc#";>
+                <e:DataReference URI="#_3"/>
+            </e:ReferenceList>
+            <Signature xmlns="http://www.w3.org/2000/09/xmldsig#";>
+                <SignedInfo>
+                    <CanonicalizationMethod 
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
+                    <SignatureMethod 
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
+                    <Reference URI="#_2">
+                        <Transforms>
+                            <Transform 
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
+                        </Transforms>
+                        <DigestMethod 
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
+                        <DigestValue>dTi3g3L9keG20RK45/u2YZAnweg=</DigestValue>
+                    </Reference>
+                    <Reference 
URI="#uuid-c46b1c73-532c-4ee6-ab98-4f985c232697-11">
+                        <Transforms>
+                            <Transform 
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
+                        </Transforms>
+                        <DigestMethod 
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
+                        <DigestValue>MzDBhmUoanHfvbzmwAZDnynYZ5Y=</DigestValue>
+                    </Reference>
+                </SignedInfo>
+                
<SignatureValue>BVTlgwgGNYJ4Zi3j0rZmgfRPYCGKE5hO/5Jd7IcGgRToRT60eQbD+2iTccdnIpjNeSejPvWRz/VUsO9yKB/fPWTHTFXwt4wk38K6Yjl9iyD4nQl9q6begRcM/mvm2679FqPkHx09AjcdtRNfwOrv0KOp5q5AoEsH24X+HCmM/+4=</SignatureValue>
+                <KeyInfo>
+                    <o:SecurityTokenReference>
+                        <o:Reference 
ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3";
 URI="#uuid-c46b1c73-532c-4ee6-ab98-4f985c232697-8"/>
+                    </o:SecurityTokenReference>
+                </KeyInfo>
+            </Signature>
+        </o:Security>
+    </s:Header>
+    <s:Body u:Id="_2">
+        <e:EncryptedData Id="_3" 
Type="http://www.w3.org/2001/04/xmlenc#Content"; 
xmlns:e="http://www.w3.org/2001/04/xmlenc#";>
+            <e:EncryptionMethod 
Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
+            <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#";>
+                <o:SecurityTokenReference 
xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";>
+                    <o:Reference URI="#_0"/>
+                </o:SecurityTokenReference>
+            </KeyInfo>
+            <e:CipherData>
+                
<e:CipherValue>k3lw5A1UYUrr+7SBvnh3HcbxUoPFGYP2QIsIv8//Z0P9drAbKi/rhrMFaecBdmUTYIBOKsm/jaijsIzTQ5DJ/A==</e:CipherValue>
+            </e:CipherData>
+        </e:EncryptedData>
+    </s:Body>
+</s:Envelope>
+

Propchange: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/sigEncr.xml
------------------------------------------------------------------------------
    svn:executable = *



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to