You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2015/01/12 11:48:20 UTC
svn commit: r1651058 -
/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureTest.java
Author: coheigea
Date: Mon Jan 12 10:48:19 2015
New Revision: 1651058
URL: http://svn.apache.org/r1651058
Log:
Adding unit test
Modified:
webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureTest.java
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureTest.java?rev=1651058&r1=1651057&r2=1651058&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureTest.java Mon Jan 12 10:48:19 2015
@@ -898,6 +898,32 @@ public class SignatureTest extends org.j
newSecEngine.processSecurityHeader(doc, "", data);
assertTrue(handler.checkResults(results, Collections.singletonList(WSConstants.SIGN)));
}
+
+ @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.