ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1651055 - /webservices/wss4j/branches/1_6_x-fixes/src/test/java/org/apache/ws/security/message/SignatureTest.java
Date Mon, 12 Jan 2015 10:42:52 GMT
Author: coheigea
Date: Mon Jan 12 10:42:51 2015
New Revision: 1651055

URL: http://svn.apache.org/r1651055
Log:
Adding unit test

Modified:
    webservices/wss4j/branches/1_6_x-fixes/src/test/java/org/apache/ws/security/message/SignatureTest.java

Modified: webservices/wss4j/branches/1_6_x-fixes/src/test/java/org/apache/ws/security/message/SignatureTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/1_6_x-fixes/src/test/java/org/apache/ws/security/message/SignatureTest.java?rev=1651055&r1=1651054&r2=1651055&view=diff
==============================================================================
--- webservices/wss4j/branches/1_6_x-fixes/src/test/java/org/apache/ws/security/message/SignatureTest.java
(original)
+++ webservices/wss4j/branches/1_6_x-fixes/src/test/java/org/apache/ws/security/message/SignatureTest.java
Mon Jan 12 10:42:51 2015
@@ -835,6 +835,32 @@ public class SignatureTest extends org.j
             newSecEngine.processSecurityHeader(elem, data);
         assertTrue(handler.checkResults(results, actions));
     }
+    
+    @org.junit.Test
+    public void testCommentInSOAPBody() throws Exception {
+        WSSecSignature builder = new WSSecSignature();
+        builder.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
+        LOG.info("Before Signing....");
+        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
+        WSSecHeader secHeader = new WSSecHeader();
+        secHeader.insertSecurityHeader(doc);
+        Document signedDoc = builder.build(doc, crypto, secHeader);
+        
+        // Add a comment node
+        Element body = WSSecurityUtil.findBodyElement(signedDoc);
+        org.w3c.dom.Node commentNode = signedDoc.createComment("This is a comment");
+        body.getFirstChild().appendChild(commentNode);
+
+        // if (LOG.isDebugEnabled()) {
+            String outputString = 
+                XMLUtils.PrettyDocumentToString(signedDoc);
+            LOG.debug(outputString);
+            System.out.println(outputString);
+       //  }
+        
+        verify(signedDoc);
+    }
+    
 
     /**
      * Verifies the soap envelope.



Mime
View raw message