ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1720192 [24/33] - in /webservices/wss4j/trunk: bindings/src/main/java/org/apache/wss4j/binding/wss10/ bindings/src/main/java/org/apache/wss4j/binding/wss11/ bindings/src/main/java/org/apache/wss4j/binding/wssc13/ bindings/src/main/java/org...
Date Tue, 15 Dec 2015 16:40:42 GMT
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/XOPAttachmentTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/XOPAttachmentTest.java?rev=1720192&r1=1720191&r2=1720192&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/XOPAttachmentTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/XOPAttachmentTest.java Tue Dec 15 16:40:37 2015
@@ -56,23 +56,23 @@ import org.w3c.dom.Node;
  */
 public class XOPAttachmentTest extends org.junit.Assert {
 
-    private static final String SOAP_BODY = 
-        "<add xmlns=\"http://ws.apache.org/counter/counter_port_type\">" 
-        + "<value xmlns=\"\">15</value>" 
+    private static final String SOAP_BODY =
+        "<add xmlns=\"http://ws.apache.org/counter/counter_port_type\">"
+        + "<value xmlns=\"\">15</value>"
         + "</add>";
-    
+
     private static final String SOAP_HEADER_MSG = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
         "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" +
-        "   <soapenv:Header>" + 
-        "       <foo:bar1 xmlns:foo=\"urn:foo.bar\" >baz1</foo:bar1>" + 
-        "       <foo:foobar xmlns:foo=\"urn:foo.bar\" >baz</foo:foobar>" + 
+        "   <soapenv:Header>" +
+        "       <foo:bar1 xmlns:foo=\"urn:foo.bar\" >baz1</foo:bar1>" +
+        "       <foo:foobar xmlns:foo=\"urn:foo.bar\" >baz</foo:foobar>" +
         "       <foo:bar2 xmlns:foo=\"urn:foo.bar\" >baz2</foo:bar2>" +
         "   </soapenv:Header>" +
         "   <soapenv:Body>" +
         "      <ns1:testMethod xmlns:ns1=\"http://axis/service/security/test6/LogTestService8\"></ns1:testMethod>" +
         "   </soapenv:Body>" +
         "</soapenv:Envelope>";
-    
+
     private static final org.slf4j.Logger LOG =
             org.slf4j.LoggerFactory.getLogger(XOPAttachmentTest.class);
 
@@ -95,7 +95,7 @@ public class XOPAttachmentTest extends o
         }
     }
 
-    // Set up a test to encrypt the SOAP Body + an attachment, which is the same content as 
+    // Set up a test to encrypt the SOAP Body + an attachment, which is the same content as
     // the SOAP Body. Then replace the encrypted SOAP Body with a xop:Include to the attachment,
     // and modify the request to remove the encryption stuff pointing to the attachment.
     // (NOTE: This test was before we supported creating requests with xop:Include)
@@ -117,47 +117,47 @@ public class XOPAttachmentTest extends o
         attachment.setId(attachmentId);
         attachment.setSourceStream(new ByteArrayInputStream(SOAP_BODY.getBytes(StandardCharsets.UTF_8)));
 
-        AttachmentCallbackHandler attachmentCallbackHandler = 
+        AttachmentCallbackHandler attachmentCallbackHandler =
             new AttachmentCallbackHandler(Collections.singletonList(attachment));
         encrypt.setAttachmentCallbackHandler(attachmentCallbackHandler);
         List<Attachment> encryptedAttachments = attachmentCallbackHandler.getResponseAttachments();
 
         Document encryptedDoc = encrypt.build(doc, crypto, secHeader);
-        
+
         // Find the SOAP Body + replace with a xop:Include to the attachment!
         Element soapBody = WSSecurityUtil.findBodyElement(encryptedDoc);
         assertNotNull(soapBody);
-        Element encryptedData = 
+        Element encryptedData =
             XMLUtils.getDirectChildElement(soapBody, "EncryptedData", WSConstants.ENC_NS);
         encryptedData.removeAttributeNS(null, "Type");
-        Element cipherData = 
+        Element cipherData =
             XMLUtils.getDirectChildElement(encryptedData, "CipherData", WSConstants.ENC_NS);
         assertNotNull(cipherData);
-        Element cipherValue = 
+        Element cipherValue =
             XMLUtils.getDirectChildElement(cipherData, "CipherValue", WSConstants.ENC_NS);
         assertNotNull(cipherValue);
-        
+
         XMLUtils.setNamespace(cipherValue, WSS4JConstants.XOP_NS, "xop");
-        
+
         Element cipherValueChild = encryptedDoc.createElementNS(WSConstants.XOP_NS, "Include");
         cipherValueChild.setAttributeNS(null, "href", "cid:" + encryptedAttachments.get(0).getId());
         cipherValue.replaceChild(cipherValueChild, cipherValue.getFirstChild());
-        
+
         // Remove EncryptedData structure from the security header (which encrypted the attachment
         // in the first place)
-        Element securityHeader = 
+        Element securityHeader =
             WSSecurityUtil.findWsseSecurityHeaderBlock(encryptedDoc, encryptedDoc.getDocumentElement(), false);
-        Element encryptedAttachmentData = 
+        Element encryptedAttachmentData =
             XMLUtils.getDirectChildElement(securityHeader, "EncryptedData", WSConstants.ENC_NS);
         assertNotNull(encryptedAttachmentData);
         String encryptedDataId = encryptedAttachmentData.getAttributeNS(null, "Id");
         securityHeader.removeChild(encryptedAttachmentData);
 
         // Now get EncryptedKey + remove the reference to the EncryptedData above
-        Element encryptedKey = 
+        Element encryptedKey =
             XMLUtils.getDirectChildElement(securityHeader, "EncryptedKey", WSConstants.ENC_NS);
         assertNotNull(encryptedKey);
-        Element referenceList = 
+        Element referenceList =
             XMLUtils.getDirectChildElement(encryptedKey, "ReferenceList", WSConstants.ENC_NS);
         assertNotNull(referenceList);
         Node child = referenceList.getFirstChild();
@@ -172,7 +172,7 @@ public class XOPAttachmentTest extends o
             }
             child = child.getNextSibling();
         }
-        
+
         if (LOG.isDebugEnabled()) {
             String outputString = XMLUtils.PrettyDocumentToString(encryptedDoc);
             LOG.debug(outputString);
@@ -181,11 +181,11 @@ public class XOPAttachmentTest extends o
 
         attachmentCallbackHandler = new AttachmentCallbackHandler(encryptedAttachments);
         verify(encryptedDoc, attachmentCallbackHandler);
-        
+
         String processedDoc = XMLUtils.PrettyDocumentToString(encryptedDoc);
         assertTrue(processedDoc.contains(SOAP_BODY));
     }
-    
+
     @org.junit.Test
     public void testEncryptedSOAPBody() throws Exception {
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
@@ -195,7 +195,7 @@ public class XOPAttachmentTest extends o
 
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         AttachmentCallbackHandler outboundAttachmentCallback = new AttachmentCallbackHandler();
         encrypt.setAttachmentCallbackHandler(outboundAttachmentCallback);
         encrypt.setStoreBytesInAttachment(true);
@@ -203,22 +203,22 @@ public class XOPAttachmentTest extends o
         encrypt.getParts().add(new WSEncryptionPart("Body", "http://schemas.xmlsoap.org/soap/envelope/", "Content"));
 
         Document encryptedDoc = encrypt.build(doc, crypto, secHeader);
-        
+
         List<Attachment> encryptedAttachments = outboundAttachmentCallback.getResponseAttachments();
         assertNotNull(encryptedAttachments);
         // Should have EncryptedKey + EncryptedData stored in attachments...
         assertTrue(encryptedAttachments.size() == 2);
-        
+
         if (LOG.isDebugEnabled()) {
             String outputString = XMLUtils.PrettyDocumentToString(encryptedDoc);
             LOG.debug(outputString);
             // System.out.println(outputString);
         }
 
-        AttachmentCallbackHandler inboundAttachmentCallback = 
+        AttachmentCallbackHandler inboundAttachmentCallback =
             new AttachmentCallbackHandler(encryptedAttachments);
         verify(encryptedDoc, inboundAttachmentCallback);
-        
+
         String processedDoc = XMLUtils.PrettyDocumentToString(encryptedDoc);
         assertTrue(processedDoc.contains(SOAP_BODY));
     }
@@ -229,66 +229,66 @@ public class XOPAttachmentTest extends o
         WSSecSignature builder = new WSSecSignature();
         builder.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
         builder.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
-        
+
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         AttachmentCallbackHandler outboundAttachmentCallback = new AttachmentCallbackHandler();
         builder.setAttachmentCallbackHandler(outboundAttachmentCallback);
         builder.setStoreBytesInAttachment(true);
-        
+
         Document signedDoc = builder.build(doc, crypto, secHeader);
-        
+
         List<Attachment> signedAttachments = outboundAttachmentCallback.getResponseAttachments();
         assertNotNull(signedAttachments);
         assertTrue(signedAttachments.size() == 1);
 
         if (LOG.isDebugEnabled()) {
             LOG.debug("After Signing....");
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(signedDoc);
             LOG.debug(outputString);
         }
-        
-        AttachmentCallbackHandler inboundAttachmentCallback = 
+
+        AttachmentCallbackHandler inboundAttachmentCallback =
             new AttachmentCallbackHandler(signedAttachments);
         verify(signedDoc, inboundAttachmentCallback);
     }
-    
+
     @org.junit.Test
     public void testSignedSOAPBodyAndBinarySecurityToken() throws Exception {
         WSSecSignature builder = new WSSecSignature();
         builder.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
         builder.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
         builder.setIncludeSignatureToken(true);
-        
+
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         AttachmentCallbackHandler outboundAttachmentCallback = new AttachmentCallbackHandler();
         builder.setAttachmentCallbackHandler(outboundAttachmentCallback);
         builder.setStoreBytesInAttachment(true);
-        
+
         Document signedDoc = builder.build(doc, crypto, secHeader);
-        
+
         List<Attachment> signedAttachments = outboundAttachmentCallback.getResponseAttachments();
         assertNotNull(signedAttachments);
         assertTrue(signedAttachments.size() == 1);
 
         if (LOG.isDebugEnabled()) {
             LOG.debug("After Signing....");
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(signedDoc);
             LOG.debug(outputString);
         }
-        
-        AttachmentCallbackHandler inboundAttachmentCallback = 
+
+        AttachmentCallbackHandler inboundAttachmentCallback =
             new AttachmentCallbackHandler(signedAttachments);
         verify(signedDoc, inboundAttachmentCallback);
     }
-    
+
     @org.junit.Test
     public void testEncryptedHeaderAsEncryptedData() throws Exception {
         Document doc = SOAPUtil.toSOAPPart(SOAP_HEADER_MSG);
@@ -298,7 +298,7 @@ public class XOPAttachmentTest extends o
 
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         AttachmentCallbackHandler outboundAttachmentCallback = new AttachmentCallbackHandler();
         encrypt.setAttachmentCallbackHandler(outboundAttachmentCallback);
         encrypt.setStoreBytesInAttachment(true);
@@ -310,23 +310,23 @@ public class XOPAttachmentTest extends o
         encrypt.getParts().add(encP);
 
         Document encryptedDoc = encrypt.build(doc, crypto, secHeader);
-        
+
         List<Attachment> encryptedAttachments = outboundAttachmentCallback.getResponseAttachments();
         assertNotNull(encryptedAttachments);
         // Should have EncryptedKey + EncryptedData + the header stored in attachments...
         assertTrue(encryptedAttachments.size() == 3);
-        
+
         if (LOG.isDebugEnabled()) {
             String outputString = XMLUtils.PrettyDocumentToString(encryptedDoc);
             LOG.debug(outputString);
             // System.out.println(outputString);
         }
 
-        AttachmentCallbackHandler inboundAttachmentCallback = 
+        AttachmentCallbackHandler inboundAttachmentCallback =
             new AttachmentCallbackHandler(encryptedAttachments);
         verify(encryptedDoc, inboundAttachmentCallback);
     }
-    
+
     @org.junit.Test
     public void testEncryptedHeaderasEncryptedHeader() throws Exception {
         Document doc = SOAPUtil.toSOAPPart(SOAP_HEADER_MSG);
@@ -336,7 +336,7 @@ public class XOPAttachmentTest extends o
 
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         AttachmentCallbackHandler outboundAttachmentCallback = new AttachmentCallbackHandler();
         encrypt.setAttachmentCallbackHandler(outboundAttachmentCallback);
         encrypt.setStoreBytesInAttachment(true);
@@ -348,30 +348,30 @@ public class XOPAttachmentTest extends o
         encrypt.getParts().add(encP);
 
         Document encryptedDoc = encrypt.build(doc, crypto, secHeader);
-        
+
         List<Attachment> encryptedAttachments = outboundAttachmentCallback.getResponseAttachments();
         assertNotNull(encryptedAttachments);
         // Should have EncryptedKey + EncryptedData + the header stored in attachments...
         assertTrue(encryptedAttachments.size() == 3);
-        
+
         if (LOG.isDebugEnabled()) {
             String outputString = XMLUtils.PrettyDocumentToString(encryptedDoc);
             LOG.debug(outputString);
         }
 
-        AttachmentCallbackHandler inboundAttachmentCallback = 
+        AttachmentCallbackHandler inboundAttachmentCallback =
             new AttachmentCallbackHandler(encryptedAttachments);
         verify(encryptedDoc, inboundAttachmentCallback);
     }
-    
+
     @org.junit.Test
     public void testDerivedEncryptedSOAPBody() throws Exception {
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         AttachmentCallbackHandler outboundAttachmentCallback = new AttachmentCallbackHandler();
-        
+
         //EncryptedKey
         WSSecEncryptedKey encrKeyBuilder = new WSSecEncryptedKey();
         encrKeyBuilder.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e");
@@ -382,7 +382,7 @@ public class XOPAttachmentTest extends o
 
         //Key information from the EncryptedKey
         byte[] ek = encrKeyBuilder.getEphemeralKey();
-        String tokenIdentifier = encrKeyBuilder.getId();  
+        String tokenIdentifier = encrKeyBuilder.getId();
 
         //Derived key encryption
         WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt();
@@ -394,34 +394,34 @@ public class XOPAttachmentTest extends o
 
         encrKeyBuilder.prependToHeader(secHeader);
         encrKeyBuilder.prependBSTElementToHeader(secHeader);
-        
+
         List<Attachment> encryptedAttachments = outboundAttachmentCallback.getResponseAttachments();
         assertNotNull(encryptedAttachments);
         // Should have EncryptedKey + EncryptedData stored in attachments...
         assertTrue(encryptedAttachments.size() == 2);
-        
+
         if (LOG.isDebugEnabled()) {
             String outputString = XMLUtils.PrettyDocumentToString(encryptedDoc);
             LOG.debug(outputString);
             // System.out.println(outputString);
         }
 
-        AttachmentCallbackHandler inboundAttachmentCallback = 
+        AttachmentCallbackHandler inboundAttachmentCallback =
             new AttachmentCallbackHandler(encryptedAttachments);
         verify(encryptedDoc, inboundAttachmentCallback);
-        
+
         String processedDoc = XMLUtils.PrettyDocumentToString(encryptedDoc);
         assertTrue(processedDoc.contains(SOAP_BODY));
     }
-    
+
     @org.junit.Test
     public void testDerivedSignedSOAPBody() throws Exception {
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         AttachmentCallbackHandler outboundAttachmentCallback = new AttachmentCallbackHandler();
-        
+
         //EncryptedKey
         WSSecEncryptedKey encrKeyBuilder = new WSSecEncryptedKey();
         encrKeyBuilder.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e");
@@ -432,7 +432,7 @@ public class XOPAttachmentTest extends o
 
         //Key information from the EncryptedKey
         byte[] ek = encrKeyBuilder.getEphemeralKey();
-        String tokenIdentifier = encrKeyBuilder.getId();  
+        String tokenIdentifier = encrKeyBuilder.getId();
 
         //Derived key encryption
         WSSecDKSign sigBuilder = new WSSecDKSign();
@@ -444,41 +444,41 @@ public class XOPAttachmentTest extends o
 
         encrKeyBuilder.prependToHeader(secHeader);
         encrKeyBuilder.prependBSTElementToHeader(secHeader);
-        
+
         List<Attachment> signedAttachments = outboundAttachmentCallback.getResponseAttachments();
         assertNotNull(signedAttachments);
         assertTrue(signedAttachments.size() == 1);
-        
+
         if (LOG.isDebugEnabled()) {
             String outputString = XMLUtils.PrettyDocumentToString(signedDoc);
             LOG.debug(outputString);
         }
 
-        AttachmentCallbackHandler inboundAttachmentCallback = 
+        AttachmentCallbackHandler inboundAttachmentCallback =
             new AttachmentCallbackHandler(signedAttachments);
         verify(signedDoc, inboundAttachmentCallback);
-        
+
         String processedDoc = XMLUtils.PrettyDocumentToString(signedDoc);
         assertTrue(processedDoc.contains(SOAP_BODY));
     }
-    
+
     @org.junit.Test
     public void testSignedEncryptedSOAPBody() throws Exception {
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         AttachmentCallbackHandler outboundAttachmentCallback = new AttachmentCallbackHandler();
-        
+
         WSSecSignature builder = new WSSecSignature();
         builder.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
         builder.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
-        
+
         builder.setAttachmentCallbackHandler(outboundAttachmentCallback);
         builder.setStoreBytesInAttachment(true);
         builder.getParts().add(new WSEncryptionPart("Body", "http://schemas.xmlsoap.org/soap/envelope/", "Content"));
         builder.build(doc, crypto, secHeader);
-        
+
         WSSecEncrypt encrypt = new WSSecEncrypt();
         encrypt.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
         encrypt.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
@@ -488,125 +488,125 @@ public class XOPAttachmentTest extends o
         encrypt.getParts().add(new WSEncryptionPart("Body", "http://schemas.xmlsoap.org/soap/envelope/", "Content"));
 
         Document encryptedDoc = encrypt.build(doc, crypto, secHeader);
-        
+
         List<Attachment> encryptedAttachments = outboundAttachmentCallback.getResponseAttachments();
         assertNotNull(encryptedAttachments);
         assertTrue(encryptedAttachments.size() == 3);
-        
+
         if (LOG.isDebugEnabled()) {
             String outputString = XMLUtils.PrettyDocumentToString(encryptedDoc);
             LOG.debug(outputString);
             // System.out.println(outputString);
         }
 
-        AttachmentCallbackHandler inboundAttachmentCallback = 
+        AttachmentCallbackHandler inboundAttachmentCallback =
             new AttachmentCallbackHandler(encryptedAttachments);
         verify(encryptedDoc, inboundAttachmentCallback);
-        
+
         String processedDoc = XMLUtils.PrettyDocumentToString(encryptedDoc);
         assertTrue(processedDoc.contains(SOAP_BODY));
     }
-    
+
     @org.junit.Test
     public void testSignedEncryptedSOAPBodyViaHandler() throws Exception {
         final WSSConfig cfg = WSSConfig.getNewInstance();
         final RequestData reqData = new RequestData();
         reqData.setWssConfig(cfg);
         reqData.setUsername("16c73ab6-b892-458f-abf5-2f875f74882e");
-        
+
         AttachmentCallbackHandler outboundAttachmentCallback = new AttachmentCallbackHandler();
         reqData.setAttachmentCallbackHandler(outboundAttachmentCallback);
-        
-        
+
+
         java.util.Map<String, Object> config = new java.util.TreeMap<String, Object>();
         config.put(WSHandlerConstants.SIG_PROP_FILE, "crypto.properties");
         config.put(WSHandlerConstants.ENC_PROP_FILE, "crypto.properties");
-        config.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference"); 
+        config.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference");
         config.put("password", "security");
         config.put(WSHandlerConstants.STORE_BYTES_IN_ATTACHMENT, "true");
         reqData.setMsgContext(config);
-        
+
         final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         CustomHandler handler = new CustomHandler();
         List<HandlerAction> actions = new ArrayList<>();
         actions.add(new HandlerAction(WSConstants.SIGN));
         actions.add(new HandlerAction(WSConstants.ENCR));
-        
+
         handler.send(
-            doc, 
-            reqData, 
+            doc,
+            reqData,
             actions,
             true
         );
-        String outputString = 
+        String outputString =
             XMLUtils.PrettyDocumentToString(doc);
         if (LOG.isDebugEnabled()) {
             LOG.debug("Signed message:");
             LOG.debug(outputString);
         }
-        
+
         List<Attachment> encryptedAttachments = outboundAttachmentCallback.getResponseAttachments();
         assertNotNull(encryptedAttachments);
         assertTrue(encryptedAttachments.size() == 3);
-        
-        AttachmentCallbackHandler inboundAttachmentCallback = 
+
+        AttachmentCallbackHandler inboundAttachmentCallback =
             new AttachmentCallbackHandler(encryptedAttachments);
         verify(doc, inboundAttachmentCallback);
-        
+
         String processedDoc = XMLUtils.PrettyDocumentToString(doc);
         assertTrue(processedDoc.contains(SOAP_BODY));
     }
-    
+
     @org.junit.Test
     public void testEncryptedSignedSOAPBodyViaHandler() throws Exception {
         final WSSConfig cfg = WSSConfig.getNewInstance();
         final RequestData reqData = new RequestData();
         reqData.setWssConfig(cfg);
         reqData.setUsername("16c73ab6-b892-458f-abf5-2f875f74882e");
-        
+
         AttachmentCallbackHandler outboundAttachmentCallback = new AttachmentCallbackHandler();
         reqData.setAttachmentCallbackHandler(outboundAttachmentCallback);
-        
-        
+
+
         java.util.Map<String, Object> config = new java.util.TreeMap<String, Object>();
         config.put(WSHandlerConstants.SIG_PROP_FILE, "crypto.properties");
         config.put(WSHandlerConstants.ENC_PROP_FILE, "crypto.properties");
-        config.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference"); 
+        config.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference");
         config.put("password", "security");
         config.put(WSHandlerConstants.STORE_BYTES_IN_ATTACHMENT, "true");
         reqData.setMsgContext(config);
-        
+
         final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         CustomHandler handler = new CustomHandler();
         List<HandlerAction> actions = new ArrayList<>();
         actions.add(new HandlerAction(WSConstants.ENCR));
         actions.add(new HandlerAction(WSConstants.SIGN));
-        
+
         handler.send(
-            doc, 
-            reqData, 
+            doc,
+            reqData,
             actions,
             true
         );
-        String outputString = 
+        String outputString =
             XMLUtils.PrettyDocumentToString(doc);
         if (LOG.isDebugEnabled()) {
             LOG.debug("Signed message:");
             LOG.debug(outputString);
         }
-        
+
         List<Attachment> encryptedAttachments = outboundAttachmentCallback.getResponseAttachments();
         assertNotNull(encryptedAttachments);
         assertTrue(encryptedAttachments.size() == 0);
-        
-        AttachmentCallbackHandler inboundAttachmentCallback = 
+
+        AttachmentCallbackHandler inboundAttachmentCallback =
             new AttachmentCallbackHandler(encryptedAttachments);
         verify(doc, inboundAttachmentCallback);
-        
+
         String processedDoc = XMLUtils.PrettyDocumentToString(doc);
         assertTrue(processedDoc.contains(SOAP_BODY));
     }
-    
+
     /**
      * Verifies the soap envelope.
      * This method verifies all the signature generated.

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BSTKerberosTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BSTKerberosTest.java?rev=1720192&r1=1720191&r2=1720192&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BSTKerberosTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BSTKerberosTest.java Tue Dec 15 16:40:37 2015
@@ -56,20 +56,20 @@ import java.util.Arrays;
  * This is a test for the Kerberos Token Profile 1.1
  */
 public class BSTKerberosTest extends org.junit.Assert {
-    private static final org.slf4j.Logger LOG = 
+    private static final org.slf4j.Logger LOG =
         org.slf4j.LoggerFactory.getLogger(BSTKerberosTest.class);
     private static final String AP_REQ = WSConstants.WSS_GSS_KRB_V5_AP_REQ;
-    private static final String BASE64_NS = 
+    private static final String BASE64_NS =
         WSConstants.SOAPMESSAGE_NS + "#Base64Binary";
     private WSSecurityEngine secEngine = new WSSecurityEngine();
     private CallbackHandler callbackHandler = new KeystoreCallbackHandler();
     private Crypto crypto = null;
-    
+
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         SecurityTestUtil.cleanup();
     }
-    
+
     public BSTKerberosTest() throws Exception {
         WSSConfig.init();
         crypto = CryptoFactory.getInstance();
@@ -84,25 +84,25 @@ public class BSTKerberosTest extends org
 
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         BinarySecurity bst = new BinarySecurity(doc);
         bst.setValueType(AP_REQ);
         bst.setEncodingType(BASE64_NS);
         bst.setToken("12345678".getBytes());
         WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
-        
+
         if (LOG.isDebugEnabled()) {
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(doc);
             LOG.debug(outputString);
         }
-        
+
         assertTrue(AP_REQ.equals(bst.getValueType()));
         assertTrue(BASE64_NS.equals(bst.getEncodingType()));
         assertTrue(bst.getToken() != null);
     }
-    
-    
+
+
     /**
      * A test for signing a Kerberos BST
      */
@@ -112,33 +112,33 @@ public class BSTKerberosTest extends org
 
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         BinarySecurity bst = new BinarySecurity(doc);
         bst.setValueType(AP_REQ);
         bst.setEncodingType(BASE64_NS);
         bst.setToken("12345678".getBytes());
         bst.setID("Id-" + bst.hashCode());
         WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
-        
+
         WSSecSignature sign = new WSSecSignature();
         sign.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
         sign.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
-        
+
         WSEncryptionPart encP =
             new WSEncryptionPart(bst.getID());
         sign.getParts().add(encP);
-        
+
         Document signedDoc = sign.build(doc, crypto, secHeader);
-        
+
         if (LOG.isDebugEnabled()) {
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(signedDoc);
             LOG.debug(outputString);
         }
-        
+
         verify(signedDoc);
     }
-    
+
     /**
      * A test for signing a Kerberos BST as well as a Timestamp
      */
@@ -148,36 +148,36 @@ public class BSTKerberosTest extends org
 
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         BinarySecurity bst = new BinarySecurity(doc);
         bst.setValueType(AP_REQ);
         bst.setEncodingType(BASE64_NS);
         bst.setToken("12345678".getBytes());
         bst.setID("Id-" + bst.hashCode());
         WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
-        
+
         WSSecTimestamp timestamp = new WSSecTimestamp();
         timestamp.setTimeToLive(600);
         timestamp.build(doc, secHeader);
-        
+
         WSSecSignature sign = new WSSecSignature();
         sign.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
         sign.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
-        
+
         sign.getParts().add(new WSEncryptionPart(bst.getID()));
         sign.getParts().add(new WSEncryptionPart(timestamp.getId()));
-        
+
         Document signedDoc = sign.build(doc, crypto, secHeader);
-        
+
         if (LOG.isDebugEnabled()) {
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(signedDoc);
             LOG.debug(outputString);
         }
-        
+
         verify(signedDoc);
     }
-    
+
     /**
      * Test Validating a Kerberos BinarySecurityToken
      */
@@ -187,31 +187,31 @@ public class BSTKerberosTest extends org
 
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         BinarySecurity bst = new BinarySecurity(doc);
         bst.setValueType(AP_REQ);
         bst.setEncodingType(BASE64_NS);
         bst.setToken("12345678".getBytes());
         WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
-        
+
         if (LOG.isDebugEnabled()) {
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(doc);
             LOG.debug(outputString);
         }
-        
+
         WSHandlerResult results = verify(doc);
-        WSSecurityEngineResult actionResult = 
+        WSSecurityEngineResult actionResult =
             results.getActionResults().get(WSConstants.BST).get(0);
         BinarySecurity token =
             (BinarySecurity)actionResult.get(WSSecurityEngineResult.TAG_BINARY_SECURITY_TOKEN);
         assertTrue(token != null);
-        
+
         assertTrue(AP_REQ.equals(token.getValueType()));
         assertTrue(BASE64_NS.equals(token.getEncodingType()));
         assertTrue(token.getToken() != null);
     }
-    
+
     /**
      * Test Validating a Kerberos BinarySecurityToken using a custom Validator instance.
      */
@@ -221,34 +221,34 @@ public class BSTKerberosTest extends org
 
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         BinarySecurity bst = new BinarySecurity(doc);
         bst.setValueType(AP_REQ);
         bst.setEncodingType(BASE64_NS);
         bst.setToken("12345678".getBytes());
         WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
-        
+
         if (LOG.isDebugEnabled()) {
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(doc);
             LOG.debug(outputString);
         }
-        
+
         WSSecurityEngine customEngine = new WSSecurityEngine();
         WSSConfig wssConfig = WSSConfig.getNewInstance();
         wssConfig.setValidator(WSConstants.BINARY_TOKEN, new KerberosValidator());
         customEngine.setWssConfig(wssConfig);
         customEngine.processSecurityHeader(doc, null, callbackHandler, crypto);
-        
+
         bst.setToken("12345679".getBytes());
         try {
             customEngine.processSecurityHeader(doc, null, callbackHandler, crypto);
             fail("Failure expected on a bad token");
         } catch (WSSecurityException ex) {
-            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); 
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_AUTHENTICATION);
         }
     }
-    
+
     /**
      * A test for signing using a direct reference to a Kerberos token
      */
@@ -258,36 +258,36 @@ public class BSTKerberosTest extends org
 
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         BinarySecurity bst = new BinarySecurity(doc);
         bst.setValueType(AP_REQ);
         bst.setEncodingType(BASE64_NS);
-        
+
         KeyGenerator keyGen = KeyGenerator.getInstance("AES");
         keyGen.init(128);
         SecretKey key = keyGen.generateKey();
         byte[] keyData = key.getEncoded();
-        
+
         bst.setToken(keyData);
         bst.setID("Id-" + bst.hashCode());
         WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
-        
+
         WSSecSignature sign = new WSSecSignature();
         sign.setSignatureAlgorithm(SignatureMethod.HMAC_SHA1);
         sign.setKeyIdentifierType(WSConstants.CUSTOM_SYMM_SIGNING);
         sign.setCustomTokenValueType(AP_REQ);
         sign.setCustomTokenId(bst.getID());
         sign.setSecretKey(keyData);
-        
+
         Document signedDoc = sign.build(doc, crypto, secHeader);
-        
+
         if (LOG.isDebugEnabled()) {
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(signedDoc);
             LOG.debug(outputString);
         }
     }
-    
+
     /**
      * A test for signing using a KeyIdentifier to a Kerberos token
      */
@@ -297,38 +297,38 @@ public class BSTKerberosTest extends org
 
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         BinarySecurity bst = new BinarySecurity(doc);
         bst.setValueType(AP_REQ);
         bst.setEncodingType(BASE64_NS);
-        
+
         KeyGenerator keyGen = KeyGenerator.getInstance("AES");
         keyGen.init(128);
         SecretKey key = keyGen.generateKey();
         byte[] keyData = key.getEncoded();
-        
+
         bst.setToken(keyData);
         bst.setID("Id-" + bst.hashCode());
         WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
-        
+
         WSSecSignature sign = new WSSecSignature();
         sign.setSignatureAlgorithm(SignatureMethod.HMAC_SHA1);
         sign.setKeyIdentifierType(WSConstants.CUSTOM_KEY_IDENTIFIER);
         sign.setCustomTokenValueType(WSConstants.WSS_KRB_KI_VALUE_TYPE);
-        
+
         byte[] digestBytes = KeyUtils.generateDigest(keyData);
         sign.setCustomTokenId(Base64.encode(digestBytes));
         sign.setSecretKey(keyData);
-        
+
         Document signedDoc = sign.build(doc, crypto, secHeader);
-        
+
         if (LOG.isDebugEnabled()) {
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(signedDoc);
             LOG.debug(outputString);
         }
     }
-    
+
     /**
      * A test for encryption using a direct reference to a Kerberos token
      */
@@ -338,20 +338,20 @@ public class BSTKerberosTest extends org
 
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         BinarySecurity bst = new BinarySecurity(doc);
         bst.setValueType(AP_REQ);
         bst.setEncodingType(BASE64_NS);
-        
+
         KeyGenerator keyGen = KeyGenerator.getInstance("AES");
         keyGen.init(128);
         SecretKey key = keyGen.generateKey();
         byte[] keyData = key.getEncoded();
-        
+
         bst.setToken(keyData);
         bst.setID("Id-" + bst.hashCode());
         WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
-        
+
         WSSecEncrypt builder = new WSSecEncrypt();
         builder.setSymmetricEncAlgorithm(WSConstants.AES_128);
         builder.setSymmetricKey(key);
@@ -359,14 +359,14 @@ public class BSTKerberosTest extends org
         builder.setCustomReferenceValue(AP_REQ);
         builder.setEncKeyId(bst.getID());
         Document encryptedDoc = builder.build(doc, crypto, secHeader);
-        
+
         if (LOG.isDebugEnabled()) {
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(encryptedDoc);
             LOG.debug(outputString);
         }
     }
-    
+
     /**
      * A test for encryption using a Key Identifier to a Kerberos token
      */
@@ -376,60 +376,60 @@ public class BSTKerberosTest extends org
 
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         BinarySecurity bst = new BinarySecurity(doc);
         bst.setValueType(AP_REQ);
         bst.setEncodingType(BASE64_NS);
-        
+
         KeyGenerator keyGen = KeyGenerator.getInstance("AES");
         keyGen.init(128);
         SecretKey key = keyGen.generateKey();
         byte[] keyData = key.getEncoded();
-        
+
         bst.setToken(keyData);
         bst.setID("Id-" + bst.hashCode());
         WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
-        
+
         WSSecEncrypt builder = new WSSecEncrypt();
         builder.setSymmetricEncAlgorithm(WSConstants.AES_128);
         builder.setSymmetricKey(key);
         builder.setEncryptSymmKey(false);
         builder.setCustomReferenceValue(WSConstants.WSS_KRB_KI_VALUE_TYPE);
-        
+
         byte[] digestBytes = KeyUtils.generateDigest(keyData);
         builder.setEncKeyId(Base64.encode(digestBytes));
-        
+
         Document encryptedDoc = builder.build(doc, crypto, secHeader);
-        
+
         if (LOG.isDebugEnabled()) {
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(encryptedDoc);
             LOG.debug(outputString);
         }
     }
 
 
-    
+
     /**
      * Verifies the soap envelope
      * <p/>
-     * 
-     * @param doc 
+     *
+     * @param doc
      * @throws Exception Thrown when there is a problem in verification
      */
     private WSHandlerResult verify(Document doc) throws Exception {
-        WSHandlerResult results = 
+        WSHandlerResult results =
             secEngine.processSecurityHeader(doc, null, callbackHandler, crypto);
         if (LOG.isDebugEnabled()) {
             LOG.debug("Verfied and decrypted message:");
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(doc);
             LOG.debug(outputString);
         }
         return results;
     }
 
-    
+
     /**
      * A dummy validator for a Kerberos BST token.
      */
@@ -444,14 +444,14 @@ public class BSTKerberosTest extends org
             if (!AP_REQ.equals(token.getValueType())) {
                 throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE);
             }
-            
+
             byte[] tokenBytes = token.getToken();
             if (!Arrays.equals(tokenBytes, "12345678".getBytes())) {
                 throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION);
             }
             return credential;
         }
-        
+
     }
-    
+
 }

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BinarySecurityTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BinarySecurityTokenTest.java?rev=1720192&r1=1720191&r2=1720192&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BinarySecurityTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BinarySecurityTokenTest.java Tue Dec 15 16:40:37 2015
@@ -45,15 +45,15 @@ import java.security.cert.X509Certificat
  * This is a test for constructing and processing BinarySecurityTokens.
  */
 public class BinarySecurityTokenTest extends org.junit.Assert {
-    private static final org.slf4j.Logger LOG = 
+    private static final org.slf4j.Logger LOG =
         org.slf4j.LoggerFactory.getLogger(BinarySecurityTokenTest.class);
     private Crypto crypto = null;
-    
+
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         SecurityTestUtil.cleanup();
     }
-    
+
     public BinarySecurityTokenTest() throws Exception {
         crypto = CryptoFactory.getInstance("wss40.properties");
     }
@@ -67,38 +67,38 @@ public class BinarySecurityTokenTest ext
 
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         X509Security bst = new X509Security(doc);
         CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
         cryptoType.setAlias("wss40");
         X509Certificate[] certs = crypto.getX509Certificates(cryptoType);
         bst.setX509Certificate(certs[0]);
-        
+
         WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
-        
+
         if (LOG.isDebugEnabled()) {
             LOG.debug("BST output");
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(doc);
             LOG.debug(outputString);
         }
-        
+
         WSSecurityEngine secEngine = new WSSecurityEngine();
         secEngine.setWssConfig(WSSConfig.getNewInstance());
-        WSHandlerResult results = 
+        WSHandlerResult results =
             secEngine.processSecurityHeader(doc, null, null, crypto);
-        
+
         WSSecurityEngineResult actionResult =
             results.getActionResults().get(WSConstants.BST).get(0);
         BinarySecurity token =
             (BinarySecurity)actionResult.get(WSSecurityEngineResult.TAG_BINARY_SECURITY_TOKEN);
         assertNotNull(token);
-        
+
         BinarySecurity clone = new BinarySecurity(token.getElement(), new BSPEnforcer(true));
         assertTrue(clone.equals(token));
         assertTrue(clone.hashCode() == token.hashCode());
     }
-    
+
     /**
      * A unit test for an PKIPath BinarySecurityToken
      */
@@ -108,34 +108,34 @@ public class BinarySecurityTokenTest ext
 
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         PKIPathSecurity bst = new PKIPathSecurity(doc);
         CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
         cryptoType.setAlias("wss40");
         X509Certificate[] certs = crypto.getX509Certificates(cryptoType);
         bst.setX509Certificates(certs, crypto);
-        
+
         WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
-        
+
         if (LOG.isDebugEnabled()) {
             LOG.debug("PKIPath output");
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(doc);
             LOG.debug(outputString);
         }
-        
+
         WSSecurityEngine secEngine = new WSSecurityEngine();
         secEngine.setWssConfig(WSSConfig.getNewInstance());
-        WSHandlerResult results = 
+        WSHandlerResult results =
             secEngine.processSecurityHeader(doc, null, null, crypto);
-        
+
         WSSecurityEngineResult actionResult =
             results.getActionResults().get(WSConstants.BST).get(0);
         PKIPathSecurity token =
             (PKIPathSecurity)actionResult.get(WSSecurityEngineResult.TAG_BINARY_SECURITY_TOKEN);
         assertNotNull(token);
     }
-    
+
     /**
      * A unit test for a custom BinarySecurityToken
      */
@@ -145,19 +145,19 @@ public class BinarySecurityTokenTest ext
 
         WSSecHeader secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
-        
+
         BinarySecurity bst = new BinarySecurity(doc);
         bst.setToken("12435677".getBytes());
-        
+
         WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
-        
+
         if (LOG.isDebugEnabled()) {
             LOG.debug("Custom Token output");
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(doc);
             LOG.debug(outputString);
         }
-        
+
         WSSecurityEngine secEngine = new WSSecurityEngine();
         secEngine.setWssConfig(WSSConfig.getNewInstance());
         // Processing should fail as we have no ValueType attribute
@@ -165,9 +165,9 @@ public class BinarySecurityTokenTest ext
             secEngine.processSecurityHeader(doc, null, null, crypto);
             fail("Expected failure on no ValueType");
         } catch (WSSecurityException ex) {
-            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
-        
+
         doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         bst = new BinarySecurity(doc);
         bst.setToken("12435677".getBytes());
@@ -175,8 +175,8 @@ public class BinarySecurityTokenTest ext
         secHeader = new WSSecHeader(doc);
         secHeader.insertSecurityHeader();
         WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
-        
-        WSHandlerResult results = 
+
+        WSHandlerResult results =
             secEngine.processSecurityHeader(doc, null, null, crypto);
         WSSecurityEngineResult actionResult =
             results.getActionResults().get(WSConstants.BST).get(0);
@@ -184,5 +184,5 @@ public class BinarySecurityTokenTest ext
             (BinarySecurity)actionResult.get(WSSecurityEngineResult.TAG_BINARY_SECURITY_TOKEN);
         assertNotNull(token);
     }
-    
+
 }

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/DerivedKeyTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/DerivedKeyTokenTest.java?rev=1720192&r1=1720191&r2=1720192&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/DerivedKeyTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/DerivedKeyTokenTest.java Tue Dec 15 16:40:37 2015
@@ -48,12 +48,12 @@ public class DerivedKeyTokenTest extends
     private DerivedKeyToken token;
     private DerivedKeyToken tokenEqual;
     private DerivedKeyToken tokenNotEqual;
-    
+
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         SecurityTestUtil.cleanup();
     }
-    
+
     public DerivedKeyTokenTest() throws Exception {
         token = new DerivedKeyToken(createReferenceDocument(
                 TEST_TOKEN_TEMPLATE,
@@ -75,9 +75,9 @@ public class DerivedKeyTokenTest extends
         assertTrue(tokenEqual.equals(token));
         assertFalse(token.equals(tokenNotEqual));
         assertFalse(token.equals(null));
-        assertFalse(token.equals("string"));        
+        assertFalse(token.equals("string"));
     }
-    
+
     @org.junit.Test
     public void testHashcode() throws Exception{
         assertEquals(token.hashCode(), tokenEqual.hashCode());

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/ReferenceTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/ReferenceTest.java?rev=1720192&r1=1720191&r2=1720192&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/ReferenceTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/ReferenceTest.java Tue Dec 15 16:40:37 2015
@@ -29,8 +29,8 @@ import org.apache.wss4j.dom.engine.WSSCo
  */
 public class ReferenceTest extends org.junit.Assert {
 
-    private static final String 
-    TEST_REFERENCE_TEMPLATE = 
+    private static final String
+    TEST_REFERENCE_TEMPLATE =
             "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
         +   "<wss:Reference "
         +       "xmlns:wss=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" "
@@ -39,8 +39,8 @@ public class ReferenceTest extends org.j
         +       "/>"
         ;
 
-    private static final String 
-    BOGUS_REFERENCE_TEMPLATE = 
+    private static final String
+    BOGUS_REFERENCE_TEMPLATE =
             "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
         +   "<wss:Reference "
         +       "xmlns:wss=\"http://something-completely-different\" "
@@ -52,20 +52,20 @@ public class ReferenceTest extends org.j
     private Reference ref;
     private Reference refEqual;
     private Reference refNotEqual;
-    
+
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         SecurityTestUtil.cleanup();
     }
-    
+
     public ReferenceTest() throws Exception{
         ref = new Reference (createReferenceDocument(TEST_REFERENCE_TEMPLATE, "test", "equalscheck").getDocumentElement());
         refEqual = new Reference (createReferenceDocument(TEST_REFERENCE_TEMPLATE, "test", "equalscheck").getDocumentElement());
         refNotEqual = new Reference (createReferenceDocument(TEST_REFERENCE_TEMPLATE, "test", "unequalscheck").getDocumentElement());
         WSSConfig.init();
     }
-    
- 
+
+
     @org.junit.Test
     public void testConstructor() throws Exception {
         //
@@ -75,7 +75,7 @@ public class ReferenceTest extends org.j
             new Reference((org.w3c.dom.Element) null);
             fail("Expected failure on null Element passed to ctor");
         } catch (final WSSecurityException ex) {
-            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
         //
         // The XML doesn't conform to the WSS namespace
@@ -89,7 +89,7 @@ public class ReferenceTest extends org.j
             );
             fail("Expected failure on bogus template");
         } catch (final WSSecurityException ex) {
-            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE);
         }
         //
         // create a Reference from valid XML
@@ -107,7 +107,7 @@ public class ReferenceTest extends org.j
             ).getDocumentElement()
         );
     }
-    
+
     @org.junit.Test
     public void
     testAccessors() throws Exception {
@@ -120,22 +120,22 @@ public class ReferenceTest extends org.j
         assertEquals(ref.getValueType(), "foo");
         assertEquals(ref.getURI(), "bar");
     }
-    
+
     @org.junit.Test
     public void testEquals() throws Exception{
         assertTrue(ref.equals(refEqual));
         assertTrue(refEqual.equals(ref));
         assertFalse(ref.equals(refNotEqual));
         assertFalse(ref.equals(null));
-        assertFalse(ref.equals("string"));        
+        assertFalse(ref.equals("string"));
     }
-    
+
     @org.junit.Test
     public void testHashcode() throws Exception{
         assertEquals(ref.hashCode(), refEqual.hashCode());
         assertFalse(ref.hashCode() == refNotEqual.hashCode());
     }
-    
+
     private static org.w3c.dom.Document
     createReferenceDocument(
         final String template,
@@ -144,7 +144,7 @@ public class ReferenceTest extends org.j
     ) throws javax.xml.parsers.ParserConfigurationException,
              org.xml.sax.SAXException,
              java.io.IOException {
-        final java.io.InputStream in = 
+        final java.io.InputStream in =
             new java.io.ByteArrayInputStream(
                 template.replaceFirst(
                     "TheValueType", valueType
@@ -152,7 +152,7 @@ public class ReferenceTest extends org.j
                     "TheURI", uri
                 ).getBytes()
             );
-        final javax.xml.parsers.DocumentBuilderFactory factory = 
+        final javax.xml.parsers.DocumentBuilderFactory factory =
             javax.xml.parsers.DocumentBuilderFactory.newInstance();
         factory.setNamespaceAware(true);
         final javax.xml.parsers.DocumentBuilder builder = factory.newDocumentBuilder();

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/SecurityTokenReferenceTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/SecurityTokenReferenceTest.java?rev=1720192&r1=1720191&r2=1720192&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/SecurityTokenReferenceTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/SecurityTokenReferenceTest.java Tue Dec 15 16:40:37 2015
@@ -38,25 +38,25 @@ import org.w3c.dom.Element;
  * Some tests for the SecurityTokenReference class.
  */
 public class SecurityTokenReferenceTest extends org.junit.Assert {
-    private static final org.slf4j.Logger LOG = 
+    private static final org.slf4j.Logger LOG =
         org.slf4j.LoggerFactory.getLogger(SecurityTokenReferenceTest.class);
-    
+
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         SecurityTestUtil.cleanup();
     }
-    
+
     public SecurityTokenReferenceTest() {
         WSSConfig.init();
     }
-    
+
     /**
      * Test for a Reference with no URI
      */
     @org.junit.Test
     public void testReferenceNoURI() throws Exception {
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        
+
         // Create the STR
         SecurityTokenReference str = new SecurityTokenReference(doc);
         str.addWSSENamespace();
@@ -64,11 +64,11 @@ public class SecurityTokenReferenceTest
         ref.setValueType(WSConstants.WSS_ENC_KEY_VALUE_TYPE);
         ref.setURI(null);
         str.setReference(ref);
-        
+
         if (LOG.isDebugEnabled()) {
             LOG.debug(str.toString());
         }
-        
+
         // Process the STR
         Element strElement = str.getElement();
         try {
@@ -85,42 +85,42 @@ public class SecurityTokenReferenceTest
     @org.junit.Test
     public void testMultipleChildren() throws Exception {
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        
+
         // Create the STR
         SecurityTokenReference str = new SecurityTokenReference(doc);
         str.addWSSENamespace();
         str.setKeyIdentifierEncKeySHA1("123456");
         Element strElement = str.getElement();
-        
+
         Reference ref = new Reference(doc);
         ref.setValueType(WSConstants.WSS_ENC_KEY_VALUE_TYPE);
         ref.setURI("#123");
         strElement.appendChild(ref.getElement());
-        
+
         if (LOG.isDebugEnabled()) {
             LOG.debug(str.toString());
         }
-        
+
         BSPEnforcer bspEnforcer = new BSPEnforcer();
         // Process the STR
         try {
             new SecurityTokenReference(strElement,bspEnforcer);
             fail("Failure expected on multiple data references");
         } catch (WSSecurityException ex) {
-            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
-        
+
         bspEnforcer.setIgnoredBSPRules(Collections.singletonList(BSPRule.R3061));
         new SecurityTokenReference(strElement, bspEnforcer);
     }
-    
+
     /**
      * Test for a SecurityTokenReference having a Key Identifier with no ValueType
      */
     @org.junit.Test
     public void testKeyIdentifierNoValueType() throws Exception {
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        
+
         // Create the STR
         SecurityTokenReference str = new SecurityTokenReference(doc);
         str.addWSSENamespace();
@@ -130,87 +130,87 @@ public class SecurityTokenReferenceTest
         if (LOG.isDebugEnabled()) {
             LOG.debug(str.toString());
         }
-        
+
         BSPEnforcer bspEnforcer = new BSPEnforcer();
         // Process the STR
         try {
             new SecurityTokenReference(strElement,bspEnforcer);
             fail("Failure expected on a Key Identifier with no ValueType");
         } catch (WSSecurityException ex) {
-            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
-        
+
         bspEnforcer.setIgnoredBSPRules(Collections.singletonList(BSPRule.R3054));
     }
-    
+
     /**
      * Test for a SecurityTokenReference having a Key Identifier with a bad EncodingType
      */
     @org.junit.Test
     public void testKeyIdentifierBadEncodingType() throws Exception {
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        
+
         // Create the STR
         SecurityTokenReference str = new SecurityTokenReference(doc);
         str.addWSSENamespace();
         Element strElement = str.getElement();
-        
+
         Element keyId = doc.createElementNS(WSConstants.WSSE_NS, "wsse:KeyIdentifier");
         keyId.setAttributeNS(null, "ValueType", SecurityTokenReference.ENC_KEY_SHA1_URI);
         keyId.setAttributeNS(null, "EncodingType", "http://bad_encoding");
         keyId.appendChild(doc.createTextNode("#123"));
         strElement.appendChild(keyId);
-        
+
         if (LOG.isDebugEnabled()) {
             LOG.debug(str.toString());
         }
-        
+
         BSPEnforcer bspEnforcer = new BSPEnforcer();
         // Process the STR
         try {
             new SecurityTokenReference(strElement,bspEnforcer);
             fail("Failure expected on a Key Identifier with a Bad EncodingType");
         } catch (WSSecurityException ex) {
-            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
-        
+
         bspEnforcer.setIgnoredBSPRules(Collections.singletonList(BSPRule.R3071));
     }
-    
-    
+
+
     /**
      * Test for a SecurityTokenReference having a Key Identifier with no EncodingType
      */
     @org.junit.Test
     public void testKeyIdentifierNoEncodingType() throws Exception {
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        
+
         // Create the STR
         SecurityTokenReference str = new SecurityTokenReference(doc);
         str.addWSSENamespace();
         Element strElement = str.getElement();
-        
+
         Element keyId = doc.createElementNS(WSConstants.WSSE_NS, "wsse:KeyIdentifier");
         keyId.setAttributeNS(null, "ValueType", SecurityTokenReference.ENC_KEY_SHA1_URI);
         keyId.appendChild(doc.createTextNode("#123"));
         strElement.appendChild(keyId);
-        
+
         if (LOG.isDebugEnabled()) {
             LOG.debug(str.toString());
         }
-        
+
         BSPEnforcer bspEnforcer = new BSPEnforcer();
         // Process the STR
         try {
             new SecurityTokenReference(strElement,bspEnforcer);
             fail("Failure expected on a Key Identifier with no EncodingType");
         } catch (WSSecurityException ex) {
-            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
-        
+
         bspEnforcer.setIgnoredBSPRules(Collections.singletonList(BSPRule.R3070));
     }
-    
+
     /**
      * Test for a SecurityTokenReference having a Key Identifier with no EncodingType, but
      * it should pass as the ValueType is for a SAML Assertion.
@@ -218,61 +218,61 @@ public class SecurityTokenReferenceTest
     @org.junit.Test
     public void testKeyIdentifierSAMLNoEncodingType() throws Exception {
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        
+
         // Create the STR
         SecurityTokenReference str = new SecurityTokenReference(doc);
         str.addWSSENamespace();
         Element strElement = str.getElement();
-        
+
         Element keyId = doc.createElementNS(WSConstants.WSSE_NS, "wsse:KeyIdentifier");
         keyId.setAttributeNS(null, "ValueType", WSConstants.WSS_SAML_KI_VALUE_TYPE);
         keyId.appendChild(doc.createTextNode("#123"));
         strElement.appendChild(keyId);
-        
+
         if (LOG.isDebugEnabled()) {
             LOG.debug(str.toString());
         }
-        
+
         BSPEnforcer bspEnforcer = new BSPEnforcer();
         new SecurityTokenReference(strElement, bspEnforcer);
     }
-    
+
     /**
-     * Test for a SecurityTokenReference having an Embedded Child, which in turn has a 
+     * Test for a SecurityTokenReference having an Embedded Child, which in turn has a
      * SecurityTokenReference child.
      */
     @org.junit.Test
     public void testEmbeddedSTRChild() throws Exception {
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        
+
         // Create the STR
         SecurityTokenReference str = new SecurityTokenReference(doc);
         str.addWSSENamespace();
         Element strElement = str.getElement();
-        
+
         Element embedded = doc.createElementNS(WSConstants.WSSE_NS, "wsse:Embedded");
         str = new SecurityTokenReference(doc);
         str.addWSSENamespace();
         embedded.appendChild(str.getElement());
-        
+
         strElement.appendChild(embedded);
-        
+
         if (LOG.isDebugEnabled()) {
             LOG.debug(DOM2Writer.nodeToString(strElement));
         }
-        
+
         BSPEnforcer bspEnforcer = new BSPEnforcer();
         // Process the STR
         try {
             new SecurityTokenReference(strElement,bspEnforcer);
             fail("Failure expected on an Embedded Child with a SecurityTokenReference child");
         } catch (WSSecurityException ex) {
-            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
-        
+
         bspEnforcer.setIgnoredBSPRules(Collections.singletonList(BSPRule.R3056));
     }
-    
+
     /**
      * Test for a SecurityTokenReference having an Embedded Child, which has multiple
      * children.
@@ -280,34 +280,34 @@ public class SecurityTokenReferenceTest
     @org.junit.Test
     public void testMultipleEmbeddedChildren() throws Exception {
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
-        
+
         // Create the STR
         SecurityTokenReference str = new SecurityTokenReference(doc);
         str.addWSSENamespace();
         Element strElement = str.getElement();
-        
+
         Element embedded = doc.createElementNS(WSConstants.WSSE_NS, "wsse:Embedded");
         Element embedded1 = doc.createElementNS(WSConstants.WSSE_NS, "wsse:Reference");
         Element embedded2 = doc.createElementNS(WSConstants.WSSE_NS, "wsse:Reference");
         embedded.appendChild(embedded1);
         embedded.appendChild(embedded2);
-        
+
         strElement.appendChild(embedded);
-        
+
         if (LOG.isDebugEnabled()) {
             LOG.debug(DOM2Writer.nodeToString(strElement));
         }
-        
+
         BSPEnforcer bspEnforcer = new BSPEnforcer();
         // Process the STR
         try {
             new SecurityTokenReference(strElement,bspEnforcer);
             fail("Failure expected on an Embedded Child with multiple children");
         } catch (WSSecurityException ex) {
-            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
-        
+
         bspEnforcer.setIgnoredBSPRules(Collections.singletonList(BSPRule.R3060));
     }
-    
+
 }

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/WCFUsernameTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/WCFUsernameTokenTest.java?rev=1720192&r1=1720191&r2=1720192&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/WCFUsernameTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/WCFUsernameTokenTest.java Tue Dec 15 16:40:37 2015
@@ -45,10 +45,10 @@ import org.w3c.dom.Document;
  * qualified (incorrectly). WSS-199 added the ability to process these Username Tokens.
  */
 public class WCFUsernameTokenTest extends org.junit.Assert {
-    private static final org.slf4j.Logger LOG = 
+    private static final org.slf4j.Logger LOG =
         org.slf4j.LoggerFactory.getLogger(WCFUsernameTokenTest.class);
-    private static final String SOAPUTMSG = 
-        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" 
+    private static final String SOAPUTMSG =
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
         + "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" "
         + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
         + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
@@ -57,21 +57,21 @@ public class WCFUsernameTokenTest extend
         + "xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">"
         + "<wsse:UsernameToken wsu:Id=\"UsernameToken-29477163\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">"
         + "<wsse:Username>wernerd</wsse:Username>"
-        + "<wsse:Password " 
+        + "<wsse:Password "
         + "wsse:Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">verySecret</wsse:Password>"
         + "</wsse:UsernameToken></wsse:Security></SOAP-ENV:Header>"
-        + "<SOAP-ENV:Body>" 
-        + "<add xmlns=\"http://ws.apache.org/counter/counter_port_type\">" 
-        + "<value xmlns=\"\">15</value>" + "</add>" 
+        + "<SOAP-ENV:Body>"
+        + "<add xmlns=\"http://ws.apache.org/counter/counter_port_type\">"
+        + "<value xmlns=\"\">15</value>" + "</add>"
         + "</SOAP-ENV:Body>\r\n       \r\n" + "</SOAP-ENV:Envelope>";
-    
+
     private CallbackHandler callbackHandler = new UsernamePasswordCallbackHandler();
-    
+
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         SecurityTestUtil.cleanup();
     }
-    
+
     /**
      * Test that adds a UserNameToken with a namespace qualified type. This should fail
      * as WSS4J rejects these tokens by default.
@@ -82,7 +82,7 @@ public class WCFUsernameTokenTest extend
 
         if (LOG.isDebugEnabled()) {
             LOG.debug("Message with UserNameToken PW Digest:");
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(doc);
             LOG.debug(outputString);
         }
@@ -90,11 +90,11 @@ public class WCFUsernameTokenTest extend
             verify(doc);
             fail("Failure expected on a bad password type");
         } catch (WSSecurityException ex) {
-            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
     }
-    
-    
+
+
     /**
      * Test that adds a UserNameToken with a namespace qualified type. This should pass
      * as WSS4J has been configured to accept these tokens.
@@ -105,26 +105,26 @@ public class WCFUsernameTokenTest extend
 
         if (LOG.isDebugEnabled()) {
             LOG.debug("Message with UserNameToken PW Digest:");
-            String outputString = 
+            String outputString =
                 XMLUtils.PrettyDocumentToString(doc);
             LOG.debug(outputString);
         }
-        
+
         RequestData requestData = new RequestData();
         requestData.setAllowNamespaceQualifiedPasswordTypes(true);
         requestData.setWssConfig(WSSConfig.getNewInstance());
         requestData.setIgnoredBSPRules(Collections.singletonList(BSPRule.R4201));
         verify(doc, requestData);
     }
-    
-    
+
+
     /**
      * Verifies the soap envelope
      */
     private WSHandlerResult verify(Document doc) throws Exception {
         return verify(doc, new ArrayList<BSPRule>(0));
     }
-    
+
     /**
      * Verifies the soap envelope
      */
@@ -137,7 +137,7 @@ public class WCFUsernameTokenTest extend
         requestData.setCallbackHandler(callbackHandler);
         return secEngine.processSecurityHeader(doc, requestData);
     }
-    
+
     /**
      * Verifies the soap envelope
      */
@@ -148,6 +148,6 @@ public class WCFUsernameTokenTest extend
         requestData.setCallbackHandler(callbackHandler);
         return secEngine.processSecurityHeader(doc, requestData);
     }
-    
+
 
 }

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/misc/FaultCodeTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/misc/FaultCodeTest.java?rev=1720192&r1=1720191&r2=1720192&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/misc/FaultCodeTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/misc/FaultCodeTest.java Tue Dec 15 16:40:37 2015
@@ -52,12 +52,12 @@ import org.w3c.dom.Document;
 public class FaultCodeTest extends org.junit.Assert implements CallbackHandler {
     private WSSecurityEngine secEngine = new WSSecurityEngine();
     private Crypto crypto = null;
-    
+
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         SecurityTestUtil.cleanup();
     }
-    
+
     public FaultCodeTest() throws Exception {
         crypto = CryptoFactory.getInstance("wss40.properties");
         WSSConfig.init();
@@ -74,9 +74,9 @@ public class FaultCodeTest extends org.j
         builder.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
-        secHeader.insertSecurityHeader();        
+        secHeader.insertSecurityHeader();
         Document encryptedDoc = builder.build(doc, crypto, secHeader);
-        
+
         try {
             verify(encryptedDoc);
             fail("Failure expected with a bad password");
@@ -87,7 +87,7 @@ public class FaultCodeTest extends org.j
             assertTrue(ex.getFaultCode().equals(faultCode));
         }
     }
-    
+
     /**
      * Test for the wsse:UnsupportedAlgorithm faultcode. This will fail due to the argument
      * passed to getCipherInstance.
@@ -105,7 +105,7 @@ public class FaultCodeTest extends org.j
             assertTrue(ex.getFaultCode().equals(faultCode));
         }
     }
-    
+
     /**
      * Test for the wsse:MessageExpired faultcode. This will fail due to the argument
      * passed to setTimeToLive.
@@ -114,12 +114,12 @@ public class FaultCodeTest extends org.j
     public void testMessageExpired() throws Exception {
         WSSecTimestamp builder = new WSSecTimestamp();
         builder.setTimeToLive(-1);
-        
+
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
-        secHeader.insertSecurityHeader();        
+        secHeader.insertSecurityHeader();
         Document timestampedDoc = builder.build(doc, secHeader);
-        
+
         try {
             verify(timestampedDoc);
             fail("Failure expected on an expired message");
@@ -130,7 +130,7 @@ public class FaultCodeTest extends org.j
             assertTrue(ex.getFaultCode().equals(faultCode));
         }
     }
-    
+
     /**
      * Test for the wsse:FailedAuthentication faultcode. This will fail due to a bad password in
      * the callback handler.
@@ -141,12 +141,12 @@ public class FaultCodeTest extends org.j
         builder.addCreated();
         builder.addNonce();
         builder.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
-        
+
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
-        secHeader.insertSecurityHeader();        
+        secHeader.insertSecurityHeader();
         Document timestampedDoc = builder.build(doc, secHeader);
-        
+
         try {
             verify(timestampedDoc);
             fail("Failure expected on a bad password");
@@ -157,7 +157,7 @@ public class FaultCodeTest extends org.j
             assertTrue(ex.getFaultCode().equals(faultCode));
         }
     }
-    
+
     /**
      * Test for the wsse:InvalidSecurityToken faultcode. This will fail due to the fact
      * that a null username is used.
@@ -168,12 +168,12 @@ public class FaultCodeTest extends org.j
         builder.addCreated();
         builder.addNonce();
         builder.setUserInfo(null, "security");
-        
+
         Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         WSSecHeader secHeader = new WSSecHeader(doc);
-        secHeader.insertSecurityHeader();        
+        secHeader.insertSecurityHeader();
         builder.build(doc, secHeader);
-        
+
         try {
             new UsernameToken(doc.getDocumentElement(), false, new BSPEnforcer());
             fail("Failure expected on an invalid security token");
@@ -184,9 +184,9 @@ public class FaultCodeTest extends org.j
             assertTrue(ex.getFaultCode().equals(faultCode));
         }
     }
-    
+
     /**
-     * Test for the wsse:InvalidSecurity faultcode. 
+     * Test for the wsse:InvalidSecurity faultcode.
      */
     @org.junit.Test
     public void testInvalidSecurity() throws Exception {
@@ -200,19 +200,19 @@ public class FaultCodeTest extends org.j
             assertTrue(ex.getFaultCode().equals(faultCode));
         }
     }
-    
-    
+
+
     /**
      * Verifies the soap envelope.
-     * 
+     *
      * @param doc soap envelope
      * @throws java.lang.Exception Thrown when there is a problem in verification
      */
     private void verify(Document doc) throws Exception {
         secEngine.processSecurityHeader(doc, null, this, crypto);
     }
-    
-    
+
+
     public void handle(Callback[] callbacks)
         throws IOException, UnsupportedCallbackException {
         for (int i = 0; i < callbacks.length; i++) {



Mime
View raw message