Modified: webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/UTSignatureTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/UTSignatureTest.java?rev=1043958&r1=1043957&r2=1043958&view=diff ============================================================================== --- webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/UTSignatureTest.java (original) +++ webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/UTSignatureTest.java Thu Dec 9 13:10:11 2010 @@ -50,19 +50,6 @@ import java.util.List; */ public class UTSignatureTest extends org.junit.Assert { private static final Log LOG = LogFactory.getLog(UTSignatureTest.class); - private static final String SOAPMSG = - "<?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\">" - + "<SOAP-ENV:Body>" - + "<add xmlns=\"http://ws.apache.org/counter/counter_port_type\">" - + "<value xmlns=\"\">15</value>" - + "</add>" - + "</SOAP-ENV:Body>" - + "</SOAP-ENV:Envelope>"; - private WSSecurityEngine secEngine = new WSSecurityEngine(); private CallbackHandler callbackHandler = new UsernamePasswordCallbackHandler(); private Crypto crypto = CryptoFactory.getInstance(); @@ -72,7 +59,7 @@ public class UTSignatureTest extends org */ @org.junit.Test public void testSignature() throws Exception { - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); @@ -116,7 +103,7 @@ public class UTSignatureTest extends org */ @org.junit.Test public void testBadUserSignature() throws Exception { - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); @@ -168,7 +155,7 @@ public class UTSignatureTest extends org final java.util.List<Integer> actions = new java.util.ArrayList<Integer>(); actions.add(new Integer(WSConstants.UT_SIGN)); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); CustomHandler handler = new CustomHandler(); handler.send( WSConstants.UT_SIGN, @@ -215,7 +202,7 @@ public class UTSignatureTest extends org final java.util.List<Integer> actions = new java.util.ArrayList<Integer>(); actions.add(new Integer(WSConstants.UT_SIGN)); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); CustomHandler handler = new CustomHandler(); handler.send( WSConstants.UT_SIGN,
Modified: webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/UTWseSignatureTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/UTWseSignatureTest.java?rev=1043958&r1=1043957&r2=1043958&view=diff ============================================================================== --- webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/UTWseSignatureTest.java (original) +++ webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/UTWseSignatureTest.java Thu Dec 9 13:10:11 2010 @@ -42,19 +42,6 @@ import javax.security.auth.callback.Call */ public class UTWseSignatureTest extends org.junit.Assert { private static final Log LOG = LogFactory.getLog(UTWseSignatureTest.class); - private static final String SOAPMSG = - "<?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\">" - + "<SOAP-ENV:Body>" - + "<add xmlns=\"http://ws.apache.org/counter/counter_port_type\">" - + "<value xmlns=\"\">15</value>" - + "</add>" - + "</SOAP-ENV:Body>" - + "</SOAP-ENV:Envelope>"; - private WSSecurityEngine secEngine = new WSSecurityEngine(); private CallbackHandler callbackHandler = new UsernamePasswordCallbackHandler(); @@ -66,7 +53,7 @@ public class UTWseSignatureTest extends */ @org.junit.Test public void testUsernameTokenSigning() throws Exception { - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); @@ -106,7 +93,7 @@ public class UTWseSignatureTest extends */ @org.junit.Test public void testWSS226() throws Exception { - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); @@ -162,7 +149,7 @@ public class UTWseSignatureTest extends @org.junit.Test public void testWSS226Handler() throws Exception { CustomHandler handler = new CustomHandler(); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); RequestData reqData = new RequestData(); reqData.setWssConfig(WSSConfig.getNewInstance()); @@ -211,7 +198,7 @@ public class UTWseSignatureTest extends */ @org.junit.Test public void testUsernameTokenSigningDigest() throws Exception { - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Modified: webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/UsernameTokenTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/UsernameTokenTest.java?rev=1043958&r1=1043957&r2=1043958&view=diff ============================================================================== --- webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/UsernameTokenTest.java (original) +++ webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/UsernameTokenTest.java Thu Dec 9 13:10:11 2010 @@ -49,19 +49,6 @@ import java.security.MessageDigest; */ public class UsernameTokenTest extends org.junit.Assert implements CallbackHandler { private static final Log LOG = LogFactory.getLog(UsernameTokenTest.class); - private static final String SOAPMSG = - "<?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\">" - + "<SOAP-ENV:Body>" - + "<add xmlns=\"http://ws.apache.org/counter/counter_port_type\">" - + "<value xmlns=\"\">15</value>" - + "</add>" - + "</SOAP-ENV:Body>" - + "</SOAP-ENV:Envelope>"; - private static final String SOAPUTMSG = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" " @@ -124,7 +111,7 @@ public class UsernameTokenTest extends o WSSecUsernameToken builder = new WSSecUsernameToken(); builder.setUserInfo("wernerd", "verySecret"); LOG.info("Before adding UsernameToken PW Digest...."); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document signedDoc = builder.build(doc, secHeader); @@ -164,7 +151,7 @@ public class UsernameTokenTest extends o builder.setPasswordsAreEncoded(true); builder.setUserInfo("wernerd", Base64.encode(MessageDigest.getInstance("SHA-1").digest("verySecret".getBytes("UTF-8")))); LOG.info("Before adding UsernameToken PW Digest...."); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document signedDoc = builder.build(doc, secHeader); @@ -191,7 +178,7 @@ public class UsernameTokenTest extends o WSSecUsernameToken builder = new WSSecUsernameToken(); builder.setUserInfo("badusername", "verySecret"); LOG.info("Before adding UsernameToken PW Digest...."); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document signedDoc = builder.build(doc, secHeader); @@ -222,7 +209,7 @@ public class UsernameTokenTest extends o WSSecUsernameToken builder = new WSSecUsernameToken(); builder.setUserInfo("wernerd", "verySecre"); LOG.info("Before adding UsernameToken PW Digest...."); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document signedDoc = builder.build(doc, secHeader); @@ -252,7 +239,7 @@ public class UsernameTokenTest extends o builder.setPasswordType(WSConstants.PASSWORD_TEXT); builder.setUserInfo("wernerd", "verySecret"); LOG.info("Before adding UsernameToken PW Text...."); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document signedDoc = builder.build(doc, secHeader); @@ -282,7 +269,7 @@ public class UsernameTokenTest extends o builder.setUserInfo("wernerd", passwdDigest); LOG.info("Before adding UsernameToken PW Text...."); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document signedDoc = builder.build(doc, secHeader); @@ -303,7 +290,7 @@ public class UsernameTokenTest extends o builder.setPasswordType(WSConstants.PASSWORD_TEXT); builder.setUserInfo("wernerd", "verySecre"); LOG.info("Before adding UsernameToken PW Text...."); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document signedDoc = builder.build(doc, secHeader); @@ -373,7 +360,7 @@ public class UsernameTokenTest extends o builder.setPasswordType(null); builder.setUserInfo("nopassuser", null); LOG.info("Before adding UsernameToken with no password...."); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document signedDoc = builder.build(doc, secHeader); @@ -400,7 +387,7 @@ public class UsernameTokenTest extends o builder.setPasswordType(WSConstants.PASSWORD_TEXT); builder.setUserInfo("emptyuser", ""); LOG.info("Before adding UsernameToken with an empty password...."); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document signedDoc = builder.build(doc, secHeader); @@ -438,7 +425,7 @@ public class UsernameTokenTest extends o builder.setPasswordType(null); builder.setUserInfo("wernerd", null); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document signedDoc = builder.build(doc, secHeader); @@ -468,7 +455,7 @@ public class UsernameTokenTest extends o builder.setPasswordType("RandomType"); builder.setUserInfo("customUser", "randomPass"); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document signedDoc = builder.build(doc, secHeader); @@ -498,7 +485,7 @@ public class UsernameTokenTest extends o builder.setPasswordType("RandomType"); builder.setUserInfo("customUser", "randomPass"); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document signedDoc = builder.build(doc, secHeader); @@ -537,7 +524,7 @@ public class UsernameTokenTest extends o builder.setPasswordType(WSConstants.PASSWORD_DIGEST); builder.setUserInfo("wernerd", "BAD_PASSWORD"); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document utDoc = builder.build(doc, secHeader); @@ -580,7 +567,7 @@ public class UsernameTokenTest extends o builder.setPasswordType(WSConstants.PASSWORD_DIGEST); builder.setUserInfo("wernerd", "BAD_PASSWORD"); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document utDoc = builder.build(doc, secHeader); @@ -620,7 +607,7 @@ public class UsernameTokenTest extends o WSSecUsernameToken builder = new WSSecUsernameToken(); builder.setUserInfo("wernerd", "verySecret"); LOG.info("Before adding UsernameToken PW Digest...."); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document signedDoc = builder.build(doc, secHeader); @@ -632,9 +619,10 @@ public class UsernameTokenTest extends o /** * Test that adds a UserNameToken via WSHandler */ + @org.junit.Test public void testUsernameTokenWSHandler() throws Exception { CustomHandler handler = new CustomHandler(); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); RequestData reqData = new RequestData(); java.util.Map<String, Object> config = new java.util.TreeMap<String, Object>(); @@ -662,7 +650,7 @@ public class UsernameTokenTest extends o @org.junit.Test public void testUsernameTokenWSHandlerEmptyPassword() throws Exception { CustomHandler handler = new CustomHandler(); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); RequestData reqData = new RequestData(); java.util.Map<String, Object> config = new java.util.TreeMap<String, Object>(); Modified: webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/token/BSTKerberosTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/token/BSTKerberosTest.java?rev=1043958&r1=1043957&r2=1043958&view=diff ============================================================================== --- webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/token/BSTKerberosTest.java (original) +++ webservices/wss4j/trunk/src/test/java/org/apache/ws/security/message/token/BSTKerberosTest.java Thu Dec 9 13:10:11 2010 @@ -48,19 +48,6 @@ public class BSTKerberosTest extends org "http://docs.oasis-open.org/wss/oasis-wss-kerberos-token-profile-1.1#Kerberosv5_AP_REQ"; private static final String BASE64_NS = WSConstants.SOAPMESSAGE_NS + "#Base64Binary"; - private static final String SOAPMSG = - "<?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\">" - + "<SOAP-ENV:Body>" - + "<add xmlns=\"http://ws.apache.org/counter/counter_port_type\">" - + "<value xmlns=\"\">15</value>" - + "</add>" - + "</SOAP-ENV:Body>" - + "</SOAP-ENV:Envelope>"; - private WSSecurityEngine secEngine = new WSSecurityEngine(); private CallbackHandler callbackHandler = new KeystoreCallbackHandler(); private Crypto crypto = CryptoFactory.getInstance(); @@ -70,7 +57,7 @@ public class BSTKerberosTest extends org */ @org.junit.Test public void testCreateBinarySecurityToken() throws Exception { - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSConfig.getNewInstance(); WSSecHeader secHeader = new WSSecHeader(); @@ -99,7 +86,7 @@ public class BSTKerberosTest extends org */ @org.junit.Test public void testSignBST() throws Exception { - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSConfig.getNewInstance(); WSSecHeader secHeader = new WSSecHeader(); @@ -138,7 +125,7 @@ public class BSTKerberosTest extends org */ @org.junit.Test public void testSignBSTTimestamp() throws Exception { - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSConfig.getNewInstance(); WSSecHeader secHeader = new WSSecHeader(); Modified: webservices/wss4j/trunk/src/test/java/org/apache/ws/security/misc/FaultCodeTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/misc/FaultCodeTest.java?rev=1043958&r1=1043957&r2=1043958&view=diff ============================================================================== --- webservices/wss4j/trunk/src/test/java/org/apache/ws/security/misc/FaultCodeTest.java (original) +++ webservices/wss4j/trunk/src/test/java/org/apache/ws/security/misc/FaultCodeTest.java Thu Dec 9 13:10:11 2010 @@ -47,19 +47,6 @@ import java.io.IOException; * standard fault codes and fault strings for error propagation. */ public class FaultCodeTest extends org.junit.Assert implements CallbackHandler { - private static final String SOAPMSG = - "<?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\">" - + "<SOAP-ENV:Body>" - + "<add xmlns=\"http://ws.apache.org/counter/counter_port_type\">" - + "<value xmlns=\"\">15</value>" - + "</add>" - + "</SOAP-ENV:Body>" - + "</SOAP-ENV:Envelope>"; - private WSSecurityEngine secEngine = new WSSecurityEngine(); private Crypto crypto = CryptoFactory.getInstance(); @@ -72,7 +59,7 @@ public class FaultCodeTest extends org.j WSSecEncrypt builder = new WSSecEncrypt(); builder.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security"); builder.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document encryptedDoc = builder.build(doc, crypto, secHeader); @@ -131,7 +118,7 @@ public class FaultCodeTest extends org.j WSSecTimestamp builder = new WSSecTimestamp(); builder.setTimeToLive(-1); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document timestampedDoc = builder.build(doc, secHeader); @@ -158,7 +145,7 @@ public class FaultCodeTest extends org.j builder.addNonce(); builder.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security"); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); Document timestampedDoc = builder.build(doc, secHeader); @@ -185,7 +172,7 @@ public class FaultCodeTest extends org.j builder.addNonce(); builder.setUserInfo(null, "security"); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); builder.build(doc, secHeader); Modified: webservices/wss4j/trunk/src/test/java/org/apache/ws/security/processor/EncryptedKeyDataRefTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/processor/EncryptedKeyDataRefTest.java?rev=1043958&r1=1043957&r2=1043958&view=diff ============================================================================== --- webservices/wss4j/trunk/src/test/java/org/apache/ws/security/processor/EncryptedKeyDataRefTest.java (original) +++ webservices/wss4j/trunk/src/test/java/org/apache/ws/security/processor/EncryptedKeyDataRefTest.java Thu Dec 9 13:10:11 2010 @@ -55,17 +55,6 @@ import org.w3c.dom.Element; */ public class EncryptedKeyDataRefTest extends org.junit.Assert { private static final Log LOG = LogFactory.getLog(EncryptedKeyDataRefTest.class); - private static final String SOAPMSG = - "<?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\">" - + "<SOAP-ENV:Body>" - + "<ns1:testMethod xmlns:ns1=\"uri:LogTestService2\"></ns1:testMethod>" - + "</SOAP-ENV:Body>" - + "</SOAP-ENV:Envelope>"; - private WSSecurityEngine secEngine = new WSSecurityEngine(); private CallbackHandler callbackHandler = new KeystoreCallbackHandler(); private Crypto crypto = CryptoFactory.getInstance("wss40.properties"); @@ -79,7 +68,7 @@ public class EncryptedKeyDataRefTest ext */ @org.junit.Test public void testDataRefEncryptedKeyProcessor() throws Exception { - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecEncrypt builder = new WSSecEncrypt(); builder.setUserInfo("wss40"); builder.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE); @@ -97,8 +86,10 @@ public class EncryptedKeyDataRefTest ext * Set up the parts structure to encrypt the body */ List<WSEncryptionPart> parts = new ArrayList<WSEncryptionPart>(); - WSEncryptionPart encP = new WSEncryptionPart("testMethod", "uri:LogTestService2", - "Element"); + WSEncryptionPart encP = + new WSEncryptionPart( + "add", "http://ws.apache.org/counter/counter_port_type", "Element" + ); parts.add(encP); /* @@ -167,8 +158,11 @@ public class EncryptedKeyDataRefTest ext WSDataRef dataRef = (WSDataRef) obj; // Check whether QName is correctly set - assertEquals("testMethod", dataRef.getName().getLocalPart()); - assertEquals("uri:LogTestService2", dataRef.getName().getNamespaceURI()); + assertEquals("add", dataRef.getName().getLocalPart()); + assertEquals( + "http://ws.apache.org/counter/counter_port_type", + dataRef.getName().getNamespaceURI() + ); // Check whether wsu:Id is set assertNotNull(dataRef.getWsuId()); Modified: webservices/wss4j/trunk/src/test/java/org/apache/ws/security/processor/ReferenceListDataRefTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/processor/ReferenceListDataRefTest.java?rev=1043958&r1=1043957&r2=1043958&view=diff ============================================================================== --- webservices/wss4j/trunk/src/test/java/org/apache/ws/security/processor/ReferenceListDataRefTest.java (original) +++ webservices/wss4j/trunk/src/test/java/org/apache/ws/security/processor/ReferenceListDataRefTest.java Thu Dec 9 13:10:11 2010 @@ -55,17 +55,6 @@ import org.w3c.dom.Element; */ public class ReferenceListDataRefTest extends org.junit.Assert { private static final Log LOG = LogFactory.getLog(ReferenceListDataRefTest.class); - private static final String SOAPMSG = - "<?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\">" - + "<SOAP-ENV:Body>" - + "<ns1:testMethod xmlns:ns1=\"uri:LogTestService2\"></ns1:testMethod>" - + "</SOAP-ENV:Body>" - + "</SOAP-ENV:Envelope>"; - private WSSecurityEngine secEngine = new WSSecurityEngine(); private CallbackHandler callbackHandler = new KeystoreCallbackHandler(); private Crypto crypto = CryptoFactory.getInstance("wss40.properties"); @@ -79,7 +68,7 @@ public class ReferenceListDataRefTest ex */ @org.junit.Test public void testDataRefReferenceListProcessor() throws Exception { - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecEncrypt builder = new WSSecEncrypt(); builder.setUserInfo("wss40"); builder.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE); @@ -97,8 +86,10 @@ public class ReferenceListDataRefTest ex * Set up the parts structure to encrypt the body */ List<WSEncryptionPart> parts = new ArrayList<WSEncryptionPart>(); - WSEncryptionPart encP = new WSEncryptionPart("testMethod", "uri:LogTestService2", - "Element"); + WSEncryptionPart encP = + new WSEncryptionPart( + "add", "http://ws.apache.org/counter/counter_port_type", "Element" + ); parts.add(encP); /* @@ -163,8 +154,11 @@ public class ReferenceListDataRefTest ex WSDataRef dataRef = (WSDataRef) obj; // Check whether QName is correctly set - assertEquals("testMethod", dataRef.getName().getLocalPart()); - assertEquals("uri:LogTestService2", dataRef.getName().getNamespaceURI()); + assertEquals("add", dataRef.getName().getLocalPart()); + assertEquals( + "http://ws.apache.org/counter/counter_port_type", + dataRef.getName().getNamespaceURI() + ); // Check whether wsu:Id is set assertNotNull(dataRef.getWsuId()); Modified: webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlReferenceTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlReferenceTest.java?rev=1043958&r1=1043957&r2=1043958&view=diff ============================================================================== --- webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlReferenceTest.java (original) +++ webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlReferenceTest.java Thu Dec 9 13:10:11 2010 @@ -50,17 +50,6 @@ import javax.security.auth.callback.Call */ public class SamlReferenceTest extends org.junit.Assert { private static final Log LOG = LogFactory.getLog(SamlReferenceTest.class); - private static final String SOAPMSG = - "<?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\">" - + "<SOAP-ENV:Body>" - + "<ns1:testMethod xmlns:ns1=\"uri:LogTestService2\"></ns1:testMethod>" - + "</SOAP-ENV:Body>" - + "</SOAP-ENV:Envelope>"; - private WSSecurityEngine secEngine = new WSSecurityEngine(); private CallbackHandler callbackHandler = new KeystoreCallbackHandler(); @@ -74,7 +63,7 @@ public class SamlReferenceTest extends o public void testSAMLEncryptedKey() throws Exception { // Create a SAML assertion SAMLIssuer saml = SAMLIssuerFactory.getInstance("saml4.properties"); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); saml.setInstanceDoc(doc); Crypto hokCrypto = CryptoFactory.getInstance("crypto.properties"); saml.setUserCrypto(hokCrypto); @@ -96,7 +85,10 @@ public class SamlReferenceTest extends o builder.prepare(doc, hokCrypto); List<WSEncryptionPart> parts = new ArrayList<WSEncryptionPart>(); - WSEncryptionPart encP = new WSEncryptionPart("testMethod", "uri:LogTestService2", "Element"); + WSEncryptionPart encP = + new WSEncryptionPart( + "add", "http://ws.apache.org/counter/counter_port_type", "Element" + ); parts.add(encP); Element refElement = builder.encryptForRef(null, parts); builder.addInternalRefElement(refElement); @@ -129,7 +121,7 @@ public class SamlReferenceTest extends o */ @org.junit.Test public void testKeyIdentifier() throws Exception { - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); @@ -182,7 +174,7 @@ public class SamlReferenceTest extends o secEngine.processSecurityHeader(doc, null, callbackHandler, verifyCrypto); String outputString = org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc); - assertTrue(outputString.indexOf("LogTestService2") > 0 ? true : false); + assertTrue(outputString.indexOf("counter_port_type") > 0 ? true : false); return results; } Modified: webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlTokenTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlTokenTest.java?rev=1043958&r1=1043957&r2=1043958&view=diff ============================================================================== --- webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlTokenTest.java (original) +++ webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SamlTokenTest.java Thu Dec 9 13:10:11 2010 @@ -44,17 +44,6 @@ import java.util.List; */ public class SamlTokenTest extends org.junit.Assert { private static final Log LOG = LogFactory.getLog(SamlTokenTest.class); - private static final String SOAPMSG = - "<?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\">" - + "<SOAP-ENV:Body>" - + "<ns1:testMethod xmlns:ns1=\"uri:LogTestService2\"></ns1:testMethod>" - + "</SOAP-ENV:Body>" - + "</SOAP-ENV:Envelope>"; - private WSSecurityEngine secEngine = new WSSecurityEngine(); /** @@ -68,7 +57,7 @@ public class SamlTokenTest extends org.j WSSecSAMLToken wsSign = new WSSecSAMLToken(); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); LOG.info("Before SAMLUnsignedSenderVouches...."); @@ -103,7 +92,7 @@ public class SamlTokenTest extends org.j secEngine.processSecurityHeader(doc, null, null, null); String outputString = org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc); - assertTrue(outputString.indexOf("LogTestService2") > 0 ? true : false); + assertTrue(outputString.indexOf("counter_port_type") > 0 ? true : false); return results; } Modified: webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SignedSamlTokenTest.java URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SignedSamlTokenTest.java?rev=1043958&r1=1043957&r2=1043958&view=diff ============================================================================== --- webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SignedSamlTokenTest.java (original) +++ webservices/wss4j/trunk/src/test/java/org/apache/ws/security/saml/SignedSamlTokenTest.java Thu Dec 9 13:10:11 2010 @@ -51,17 +51,6 @@ import java.util.List; */ public class SignedSamlTokenTest extends org.junit.Assert { private static final Log LOG = LogFactory.getLog(SignedSamlTokenTest.class); - private static final String SOAPMSG = - "<?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\">" - + "<SOAP-ENV:Body>" - + "<ns1:testMethod xmlns:ns1=\"uri:LogTestService2\"></ns1:testMethod>" - + "</SOAP-ENV:Body>" - + "</SOAP-ENV:Envelope>"; - private WSSecurityEngine secEngine = new WSSecurityEngine(); private CallbackHandler callbackHandler = new KeystoreCallbackHandler(); private Crypto crypto = CryptoFactory.getInstance("crypto.properties"); @@ -83,7 +72,7 @@ public class SignedSamlTokenTest extends LOG.info("Before SAMLSignedSenderVouches...."); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); @@ -126,7 +115,7 @@ public class SignedSamlTokenTest extends LOG.info("Before SAMLSignedSenderVouches...."); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); @@ -171,7 +160,7 @@ public class SignedSamlTokenTest extends LOG.info("Before SAMLSignedSenderVouches...."); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); @@ -213,7 +202,7 @@ public class SignedSamlTokenTest extends WSSecSignatureSAML wsSign = new WSSecSignatureSAML(); wsSign.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE); - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); @@ -258,7 +247,7 @@ public class SignedSamlTokenTest extends */ @org.junit.Test public void testSAMLSignedKeyHolder() throws Exception { - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); SAMLIssuer saml = SAMLIssuerFactory.getInstance("saml4.properties"); // Provide info to SAML issuer that it can construct a Holder-of-key @@ -308,7 +297,7 @@ public class SignedSamlTokenTest extends */ @org.junit.Test public void testSAMLSignedKeyHolderSendKeyValue() throws Exception { - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); SAMLIssuer saml = SAMLIssuerFactory.getInstance("saml4sendKeyValue.properties"); // Provide info to SAML issuer that it can construct a Holder-of-key @@ -359,7 +348,7 @@ public class SignedSamlTokenTest extends */ @org.junit.Test public void testSAMLSignedKeyHolderKeyIdentifier() throws Exception { - Document doc = SOAPUtil.toSOAPPart(SOAPMSG); + Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); SAMLIssuer saml = SAMLIssuerFactory.getInstance("saml4.properties"); // Provide info to SAML issuer that it can construct a Holder-of-key @@ -411,7 +400,7 @@ public class SignedSamlTokenTest extends secEngine.processSecurityHeader(doc, null, callbackHandler, crypto); String outputString = org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc); - assertTrue(outputString.indexOf("LogTestService2") > 0 ? true : false); + assertTrue(outputString.indexOf("counter_port_type") > 0 ? true : false); return results; }
