You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by gi...@apache.org on 2013/04/01 20:28:40 UTC
svn commit: r1463243 [2/3] - in /webservices/wss4j/trunk:
ws-security-common/src/main/java/org/apache/wss4j/common/principal/
ws-security-common/src/main/java/org/apache/wss4j/common/spnego/
ws-security-common/src/main/java/org/apache/wss4j/common/util...
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SignatureSTRParser.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SignatureSTRParser.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SignatureSTRParser.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SignatureSTRParser.java Mon Apr 1 18:28:38 2013
@@ -221,9 +221,7 @@ public class SignatureSTRParser implemen
} else {
throw new WSSecurityException(
WSSecurityException.ErrorCode.INVALID_SECURITY,
- "unsupportedKeyInfo",
- new Object[]{strElement.toString()}
- );
+ "unsupportedKeyInfo", strElement.toString());
}
if (certs != null && certs.length > 0 && principal == null) {
@@ -306,7 +304,6 @@ public class SignatureSTRParser implemen
* Get the Secret Key from a CallbackHandler
* @param id The id of the element
* @param type The type of the element (can be null)
- * @param cb The CallbackHandler object
* @return A Secret Key
* @throws WSSecurityException
*/
@@ -330,9 +327,7 @@ public class SignatureSTRParser implemen
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE,
"noPassword",
- e,
- new Object[] {id}
- );
+ e, id);
}
return null;
@@ -465,7 +460,7 @@ public class SignatureSTRParser implemen
RequestData data,
Map<String, Object> parameters
) throws WSSecurityException {
- int action = ((Integer)result.get(WSSecurityEngineResult.TAG_ACTION)).intValue();
+ int action = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
if (WSConstants.UT_NOPASSWORD == action || WSConstants.UT == action) {
STRParserUtil.checkUsernameTokenBSPCompliance(secRef, data.getBSPEnforcer());
@@ -476,7 +471,7 @@ public class SignatureSTRParser implemen
if (usernameToken.isDerivedKey()) {
secretKey = (byte[])result.get(WSSecurityEngineResult.TAG_SECRET);
} else {
- int keyLength = ((Integer)parameters.get(SECRET_KEY_LENGTH)).intValue();
+ int keyLength = (Integer) parameters.get(SECRET_KEY_LENGTH);
secretKey = usernameToken.getSecretKey(keyLength);
}
principal = usernameToken.createPrincipal();
@@ -492,7 +487,7 @@ public class SignatureSTRParser implemen
secretKey = (byte[])result.get(WSSecurityEngineResult.TAG_SECRET);
Boolean validatedToken =
(Boolean)result.get(WSSecurityEngineResult.TAG_VALIDATED_TOKEN);
- if (validatedToken.booleanValue()) {
+ if (validatedToken) {
trustedCredential = true;
}
} else if (WSConstants.ENCR == action) {
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/STRTransform.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/STRTransform.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/STRTransform.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/STRTransform.java Mon Apr 1 18:28:38 2013
@@ -69,8 +69,6 @@ public class STRTransform extends Transf
private static org.slf4j.Logger log =
org.slf4j.LoggerFactory.getLogger(STRTransform.class);
- private static boolean doDebug = false;
-
public final AlgorithmParameterSpec getParameterSpec() {
return params;
}
@@ -131,8 +129,8 @@ public class STRTransform extends Transf
private Data transformIt(Data data, XMLCryptoContext xc, OutputStream os)
throws TransformException {
- doDebug = log.isDebugEnabled();
- //
+
+ //
// First step: Get the required c14n argument and get the specified
// Canonicalizer
//
@@ -192,7 +190,7 @@ public class STRTransform extends Transf
if (wsDocInfoObject instanceof WSDocInfo) {
wsDocInfo = (WSDocInfo)wsDocInfoObject;
}
- if (wsDocInfo == null && doDebug) {
+ if (wsDocInfo == null) {
log.debug("STRTransform: no WSDocInfo found");
}
@@ -220,7 +218,7 @@ public class STRTransform extends Transf
// C14n with specified algorithm. According to WSS Specification.
//
buf = canon.canonicalizeSubtree(dereferencedToken, "#default", true);
- if (doDebug) {
+ if (log.isDebugEnabled()) {
log.debug("after c14n: " + new String(buf, "UTF-8"));
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/STRTransformProvider.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/STRTransformProvider.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/STRTransformProvider.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/STRTransformProvider.java Mon Apr 1 18:28:38 2013
@@ -34,9 +34,9 @@ public class STRTransformProvider extend
public STRTransformProvider() {
super("STRTransform", 1.6, "Security Token Reference Transform Provider");
put(
- (String)"TransformService." + STRTransform.TRANSFORM_URI,
+ "TransformService." + STRTransform.TRANSFORM_URI,
"org.apache.wss4j.dom.transform.STRTransform"
);
- put((String)"TransformService." + STRTransform.TRANSFORM_URI + " MechanismType", "DOM");
+ put("TransformService." + STRTransform.TRANSFORM_URI + " MechanismType", "DOM");
}
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/StringUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/StringUtil.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/StringUtil.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/StringUtil.java Mon Apr 1 18:28:38 2013
@@ -114,6 +114,6 @@ public final class StringUtil {
if (match) {
list.add(str.substring(start, i));
}
- return (String[]) list.toArray(new String[list.size()]);
+ return list.toArray(new String[list.size()]);
}
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java Mon Apr 1 18:28:38 2013
@@ -831,7 +831,7 @@ public final class WSSecurityUtil {
} else {
keySpec = new SecretKeySpec(rawKey, keyAlgorithm);
}
- return (SecretKey)keySpec;
+ return keySpec;
}
@@ -847,8 +847,7 @@ public final class WSSecurityUtil {
} catch (NoSuchPaddingException ex) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, "unsupportedKeyTransp",
- ex, new Object[] { "No such padding: " + cipherAlgo }
- );
+ ex, "No such padding: " + cipherAlgo);
} catch (NoSuchAlgorithmException ex) {
// Check to see if an RSA OAEP MGF-1 with SHA-1 algorithm was requested
// Some JDKs don't support RSA/ECB/OAEPPadding
@@ -858,14 +857,12 @@ public final class WSSecurityUtil {
} catch (Exception e) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, "unsupportedKeyTransp",
- e, new Object[] { "No such algorithm: " + cipherAlgo }
- );
+ e, "No such algorithm: " + cipherAlgo);
}
} else {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, "unsupportedKeyTransp",
- ex, new Object[] { "No such algorithm: " + cipherAlgo }
- );
+ ex, "No such algorithm: " + cipherAlgo);
}
}
}
@@ -889,8 +886,8 @@ public final class WSSecurityUtil {
//
// Check the result of every action whether it matches the given action
//
- int resultAction =
- ((java.lang.Integer)result.get(WSSecurityEngineResult.TAG_ACTION)).intValue();
+ int resultAction =
+ (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
if (resultAction == action) {
returnResult = result;
}
@@ -934,8 +931,8 @@ public final class WSSecurityUtil {
//
// Check the result of every action whether it matches the given action
//
- int resultAction =
- ((java.lang.Integer)result.get(WSSecurityEngineResult.TAG_ACTION)).intValue();
+ int resultAction =
+ (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
if (actions.contains(resultAction)) {
if (actionResultList.isEmpty()) {
actionResultList = new ArrayList<WSSecurityEngineResult>();
@@ -962,31 +959,31 @@ public final class WSSecurityUtil {
return doAction;
} else if (single[i].equals(WSHandlerConstants.USERNAME_TOKEN)) {
doAction |= WSConstants.UT;
- actions.add(Integer.valueOf(WSConstants.UT));
+ actions.add(WSConstants.UT);
} else if (single[i].equals(WSHandlerConstants.USERNAME_TOKEN_NO_PASSWORD)) {
doAction |= WSConstants.UT_NOPASSWORD;
- actions.add(Integer.valueOf(WSConstants.UT_NOPASSWORD));
+ actions.add(WSConstants.UT_NOPASSWORD);
} else if (single[i].equals(WSHandlerConstants.SIGNATURE)) {
doAction |= WSConstants.SIGN;
- actions.add(Integer.valueOf(WSConstants.SIGN));
+ actions.add(WSConstants.SIGN);
} else if (single[i].equals(WSHandlerConstants.ENCRYPT)) {
doAction |= WSConstants.ENCR;
- actions.add(Integer.valueOf(WSConstants.ENCR));
+ actions.add(WSConstants.ENCR);
} else if (single[i].equals(WSHandlerConstants.SAML_TOKEN_UNSIGNED)) {
doAction |= WSConstants.ST_UNSIGNED;
- actions.add(Integer.valueOf(WSConstants.ST_UNSIGNED));
+ actions.add(WSConstants.ST_UNSIGNED);
} else if (single[i].equals(WSHandlerConstants.SAML_TOKEN_SIGNED)) {
doAction |= WSConstants.ST_SIGNED;
- actions.add(Integer.valueOf(WSConstants.ST_SIGNED));
+ actions.add(WSConstants.ST_SIGNED);
} else if (single[i].equals(WSHandlerConstants.TIMESTAMP)) {
doAction |= WSConstants.TS;
- actions.add(Integer.valueOf(WSConstants.TS));
+ actions.add(WSConstants.TS);
} else if (single[i].equals(WSHandlerConstants.SIGN_WITH_UT_KEY)) {
doAction |= WSConstants.UT_SIGN;
- actions.add(Integer.valueOf(WSConstants.UT_SIGN));
+ actions.add(WSConstants.UT_SIGN);
} else if (single[i].equals(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION)) {
doAction |= WSConstants.SC;
- actions.add(Integer.valueOf(WSConstants.SC));
+ actions.add(WSConstants.SC);
} else {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
"Unknown action defined: " + single[i]
@@ -1022,28 +1019,28 @@ public final class WSSecurityUtil {
return doAction;
} else if (single[i].equals(WSHandlerConstants.USERNAME_TOKEN)) {
doAction |= WSConstants.UT;
- actions.add(Integer.valueOf(WSConstants.UT));
+ actions.add(WSConstants.UT);
} else if (single[i].equals(WSHandlerConstants.SIGNATURE)) {
doAction |= WSConstants.SIGN;
- actions.add(Integer.valueOf(WSConstants.SIGN));
+ actions.add(WSConstants.SIGN);
} else if (single[i].equals(WSHandlerConstants.ENCRYPT)) {
doAction |= WSConstants.ENCR;
- actions.add(Integer.valueOf(WSConstants.ENCR));
+ actions.add(WSConstants.ENCR);
} else if (single[i].equals(WSHandlerConstants.SAML_TOKEN_UNSIGNED)) {
doAction |= WSConstants.ST_UNSIGNED;
- actions.add(Integer.valueOf(WSConstants.ST_UNSIGNED));
+ actions.add(WSConstants.ST_UNSIGNED);
} else if (single[i].equals(WSHandlerConstants.SAML_TOKEN_SIGNED)) {
doAction |= WSConstants.ST_SIGNED;
- actions.add(Integer.valueOf(WSConstants.ST_SIGNED));
+ actions.add(WSConstants.ST_SIGNED);
} else if (single[i].equals(WSHandlerConstants.TIMESTAMP)) {
doAction |= WSConstants.TS;
- actions.add(Integer.valueOf(WSConstants.TS));
+ actions.add(WSConstants.TS);
} else if (single[i].equals(WSHandlerConstants.SIGN_WITH_UT_KEY)) {
doAction |= WSConstants.UT_SIGN;
- actions.add(Integer.valueOf(WSConstants.UT_SIGN));
+ actions.add(WSConstants.UT_SIGN);
} else if (single[i].equals(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION)) {
doAction |= WSConstants.SC;
- actions.add(Integer.valueOf(WSConstants.SC));
+ actions.add(WSConstants.SC);
} else {
try {
int parsedAction = Integer.parseInt(single[i]);
@@ -1052,7 +1049,7 @@ public final class WSSecurityUtil {
"Unknown action defined: " + single[i]
);
}
- actions.add(Integer.valueOf(parsedAction));
+ actions.add(parsedAction);
} catch (NumberFormatException ex) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
"Unknown action defined: " + single[i]
@@ -1164,8 +1161,8 @@ public final class WSSecurityUtil {
for (Iterator<WSSecurityEngineResult> iter = results.iterator();
iter.hasNext() && !found;) {
WSSecurityEngineResult result = iter.next();
- int resultAction =
- ((java.lang.Integer)result.get(WSSecurityEngineResult.TAG_ACTION)).intValue();
+ int resultAction =
+ (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
if (resultAction != action) {
continue;
}
@@ -1184,8 +1181,7 @@ public final class WSSecurityUtil {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILED_CHECK,
"requiredElementNotProtected",
- new Object[] {requiredPart}
- );
+ requiredPart);
}
}
log.debug("All required elements are protected");
@@ -1205,8 +1201,8 @@ public final class WSSecurityUtil {
WSSecurityEngineResult resultItem,
String[] requiredIDs
) throws WSSecurityException {
- int resultAction =
- ((java.lang.Integer)resultItem.get(WSSecurityEngineResult.TAG_ACTION)).intValue();
+ int resultAction =
+ (Integer) resultItem.get(WSSecurityEngineResult.TAG_ACTION);
if (resultAction != WSConstants.SIGN) {
throw new IllegalArgumentException("Not a SIGN result");
}
@@ -1223,7 +1219,7 @@ public final class WSSecurityUtil {
for (int i = 0; i < requiredIDs.length; i++) {
boolean found = false;
for (int j = 0; j < signedElemsRefList.size(); j++) {
- WSDataRef dataRef = (WSDataRef)signedElemsRefList.get(j);
+ WSDataRef dataRef = signedElemsRefList.get(j);
String wsuId = dataRef.getWsuId();
if (wsuId.charAt(0) == '#') {
wsuId = wsuId.substring(1);
@@ -1236,8 +1232,7 @@ public final class WSSecurityUtil {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILED_CHECK,
"requiredElementNotSigned",
- new Object[] {requiredIDs[i]}
- );
+ requiredIDs[i]);
}
log.debug("Element with ID " + requiredIDs[i] + " was correctly signed");
}
@@ -1377,7 +1372,7 @@ public final class WSSecurityUtil {
if (WSConstants.SIG_LN.equals(cur.getLocalName())
&& WSConstants.SIG_NS.equals(cur.getNamespaceURI())) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_CHECK,
- "requiredElementNotSigned", new Object[] {elem});
+ "requiredElementNotSigned", elem);
} else if (isLinkedBySignatureRefs((Element)cur, signatureRefIDs)) {
return;
}
@@ -1386,7 +1381,7 @@ public final class WSSecurityUtil {
}
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILED_CHECK, "requiredElementNotSigned", new Object[] {elem});
+ WSSecurityException.ErrorCode.FAILED_CHECK, "requiredElementNotSigned", elem);
}
private static boolean isLinkedBySignatureRefs(Element elem, Set<String> allIDs) {
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/KerberosTokenValidator.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/KerberosTokenValidator.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/KerberosTokenValidator.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/KerberosTokenValidator.java Mon Apr 1 18:28:38 2013
@@ -162,8 +162,7 @@ public class KerberosTokenValidator impl
WSSecurityException.ErrorCode.FAILURE,
"kerberosLoginError",
ex,
- new Object[] {ex.getMessage()}
- );
+ ex.getMessage());
}
if (log.isDebugEnabled()) {
log.debug("Successfully authenticated to the TGT");
@@ -179,9 +178,8 @@ public class KerberosTokenValidator impl
if (principals.isEmpty()) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE,
- "kerberosLoginError",
- new Object[] {"No Client principals found after login"}
- );
+ "kerberosLoginError",
+ "No Client principals found after login");
}
service = principals.iterator().next().getName();
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/SignatureTrustValidator.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/SignatureTrustValidator.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/SignatureTrustValidator.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/SignatureTrustValidator.java Mon Apr 1 18:28:38 2013
@@ -190,9 +190,7 @@ public class SignatureTrustValidator imp
//
X509Certificate[] x509certs = new X509Certificate[foundCerts.length + 1];
x509certs[0] = cert;
- for (int j = 0; j < foundCerts.length; j++) {
- x509certs[j + 1] = (X509Certificate)foundCerts[j];
- }
+ System.arraycopy(foundCerts, 0, x509certs, 1, foundCerts.length);
//
// Use the validation method from the crypto to check whether the subjects'
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/TimestampValidator.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/TimestampValidator.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/TimestampValidator.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/TimestampValidator.java Mon Apr 1 18:28:38 2013
@@ -62,8 +62,7 @@ public class TimestampValidator implemen
throw new WSSecurityException(
WSSecurityException.ErrorCode.MESSAGE_EXPIRED,
"invalidTimestamp",
- new Object[] {"The security semantics of the message have expired"}
- );
+ "The security semantics of the message have expired");
}
return credential;
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SecretKeyCallbackHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SecretKeyCallbackHandler.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SecretKeyCallbackHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SecretKeyCallbackHandler.java Mon Apr 1 18:28:38 2013
@@ -46,7 +46,7 @@ public class SecretKeyCallbackHandler im
WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
if ((pc.getUsage() == WSPasswordCallback.Usage.SECRET_KEY)
|| (pc.getUsage() == WSPasswordCallback.Usage.SECURITY_CONTEXT_TOKEN)) {
- byte[] secret = (byte[]) this.secrets.get(pc.getIdentifier());
+ byte[] secret = this.secrets.get(pc.getIdentifier());
if (secret == null) {
secret = outboundSecret;
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CryptoTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CryptoTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CryptoTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CryptoTest.java Mon Apr 1 18:28:38 2013
@@ -137,7 +137,7 @@ public class CryptoTest extends org.juni
private static class NullPropertiesCrypto extends Merlin {
public NullPropertiesCrypto()
throws Exception {
- super((java.util.Properties) null);
+ super(null);
}
}
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/CallbackRefTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/CallbackRefTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/CallbackRefTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/CallbackRefTest.java Mon Apr 1 18:28:38 2013
@@ -60,7 +60,7 @@ public class CallbackRefTest extends org
reqData.setMsgContext(messageContext);
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.UT));
+ actions.add(WSConstants.UT);
Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
@@ -76,8 +76,8 @@ public class CallbackRefTest extends org
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("alice") != -1);
- assertTrue(outputString.indexOf("securityPassword") != -1);
+ assertTrue(outputString.contains("alice"));
+ assertTrue(outputString.contains("securityPassword"));
}
/**
@@ -96,7 +96,7 @@ public class CallbackRefTest extends org
reqData.setMsgContext(new java.util.TreeMap<String, String>());
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.UT));
+ actions.add(WSConstants.UT);
Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.setOption(WSHandlerConstants.PW_CALLBACK_REF, callbackHandler);
@@ -113,8 +113,8 @@ public class CallbackRefTest extends org
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("alice") != -1);
- assertTrue(outputString.indexOf("securityPassword") != -1);
+ assertTrue(outputString.contains("alice"));
+ assertTrue(outputString.contains("securityPassword"));
}
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/CustomActionProcessorTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/CustomActionProcessorTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/CustomActionProcessorTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/CustomActionProcessorTest.java Mon Apr 1 18:28:38 2013
@@ -163,7 +163,7 @@ public class CustomActionProcessorTest e
reqData.setWssConfig(cfg);
final List<Integer> actions = new ArrayList<Integer>();
- actions.add(Integer.valueOf(action));
+ actions.add(action);
final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
reqData.setMsgContext("bread");
@@ -193,7 +193,7 @@ public class CustomActionProcessorTest e
reqData.setWssConfig(cfg);
final List<Integer> actions = new ArrayList<Integer>();
- actions.add(Integer.valueOf(action));
+ actions.add(action);
final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
reqData.setMsgContext("bread");
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/ResultsOrderTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/ResultsOrderTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/ResultsOrderTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/ResultsOrderTest.java Mon Apr 1 18:28:38 2013
@@ -53,9 +53,9 @@ public class ResultsOrderTest extends or
);
java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.UT));
- actions.add(Integer.valueOf(WSConstants.TS));
- actions.add(Integer.valueOf(WSConstants.SIGN));
+ actions.add(WSConstants.UT);
+ actions.add(WSConstants.TS);
+ actions.add(WSConstants.SIGN);
assertTrue (handler.checkResults(results, actions));
assertTrue (handler.checkResultsAnyOrder(results, actions));
@@ -83,9 +83,9 @@ public class ResultsOrderTest extends or
);
java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.UT));
- actions.add(Integer.valueOf(WSConstants.TS));
- actions.add(Integer.valueOf(WSConstants.SIGN));
+ actions.add(WSConstants.UT);
+ actions.add(WSConstants.TS);
+ actions.add(WSConstants.SIGN);
assertFalse (handler.checkResults(results, actions));
assertTrue (handler.checkResultsAnyOrder(results, actions));
@@ -115,9 +115,9 @@ public class ResultsOrderTest extends or
);
java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.UT));
- actions.add(Integer.valueOf(WSConstants.TS));
- actions.add(Integer.valueOf(WSConstants.SIGN));
+ actions.add(WSConstants.UT);
+ actions.add(WSConstants.TS);
+ actions.add(WSConstants.SIGN);
assertFalse (handler.checkResults(results, actions));
assertTrue (handler.checkResultsAnyOrder(results, actions));
@@ -147,9 +147,9 @@ public class ResultsOrderTest extends or
);
java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.SIGN));
- actions.add(Integer.valueOf(WSConstants.UT));
- actions.add(Integer.valueOf(WSConstants.TS));
+ actions.add(WSConstants.SIGN);
+ actions.add(WSConstants.UT);
+ actions.add(WSConstants.TS);
assertFalse (handler.checkResults(results, actions));
assertTrue (handler.checkResultsAnyOrder(results, actions));
@@ -175,9 +175,9 @@ public class ResultsOrderTest extends or
);
java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.TS));
- actions.add(Integer.valueOf(WSConstants.UT));
- actions.add(Integer.valueOf(WSConstants.SIGN));
+ actions.add(WSConstants.TS);
+ actions.add(WSConstants.UT);
+ actions.add(WSConstants.SIGN);
assertFalse (handler.checkResults(results, actions));
assertFalse (handler.checkResultsAnyOrder(results, actions));
@@ -206,8 +206,8 @@ public class ResultsOrderTest extends or
);
java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.TS));
- actions.add(Integer.valueOf(WSConstants.UT));
+ actions.add(WSConstants.TS);
+ actions.add(WSConstants.UT);
assertFalse (handler.checkResults(results, actions));
assertFalse (handler.checkResultsAnyOrder(results, actions));
@@ -224,7 +224,7 @@ public class ResultsOrderTest extends or
new java.util.ArrayList<WSSecurityEngineResult>();
java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.TS));
+ actions.add(WSConstants.TS);
assertFalse (handler.checkResults(results, actions));
assertFalse (handler.checkResultsAnyOrder(results, actions));
@@ -269,9 +269,9 @@ public class ResultsOrderTest extends or
);
java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.ENCR));
- actions.add(Integer.valueOf(WSConstants.UT));
- actions.add(Integer.valueOf(WSConstants.UT));
+ actions.add(WSConstants.ENCR);
+ actions.add(WSConstants.UT);
+ actions.add(WSConstants.UT);
assertFalse (handler.checkResults(results, actions));
assertFalse (handler.checkResultsAnyOrder(results, actions));
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/SignatureConfirmationTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/SignatureConfirmationTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/SignatureConfirmationTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/SignatureConfirmationTest.java Mon Apr 1 18:28:38 2013
@@ -73,7 +73,7 @@ public class SignatureConfirmationTest e
reqData.setUsername("16c73ab6-b892-458f-abf5-2f875f74882e");
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.SIGN));
+ actions.add(WSConstants.SIGN);
final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
@@ -90,7 +90,7 @@ public class SignatureConfirmationTest e
List<byte[]> savedSignatures =
(List<byte[]>)msgContext.get(WSHandlerConstants.SEND_SIGV);
assertTrue(savedSignatures != null && savedSignatures.size() == 1);
- byte[] signatureValue = (byte[])savedSignatures.get(0);
+ byte[] signatureValue = savedSignatures.get(0);
assertTrue(signatureValue != null && signatureValue.length > 0);
}
@@ -112,7 +112,7 @@ public class SignatureConfirmationTest e
reqData.setUsername("16c73ab6-b892-458f-abf5-2f875f74882e");
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.SIGN));
+ actions.add(WSConstants.SIGN);
final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
@@ -149,7 +149,7 @@ public class SignatureConfirmationTest e
reqData.setUsername("16c73ab6-b892-458f-abf5-2f875f74882e");
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.SIGN));
+ actions.add(WSConstants.SIGN);
Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
@@ -166,7 +166,7 @@ public class SignatureConfirmationTest e
List<byte[]> savedSignatures =
(List<byte[]>)msgContext.get(WSHandlerConstants.SEND_SIGV);
assertTrue(savedSignatures != null && savedSignatures.size() == 1);
- byte[] signatureValue = (byte[])savedSignatures.get(0);
+ byte[] signatureValue = savedSignatures.get(0);
assertTrue(signatureValue != null && signatureValue.length > 0);
//
@@ -189,8 +189,8 @@ public class SignatureConfirmationTest e
LOG.debug("Signature Confirmation response....");
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("SignatureConfirmation") != -1);
- assertTrue(outputString.indexOf(Base64.encode(signatureValue)) != -1);
+ assertTrue(outputString.contains("SignatureConfirmation"));
+ assertTrue(outputString.contains(Base64.encode(signatureValue)));
}
@@ -210,7 +210,7 @@ public class SignatureConfirmationTest e
reqData.setUsername("16c73ab6-b892-458f-abf5-2f875f74882e");
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.SIGN));
+ actions.add(WSConstants.SIGN);
Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/SignatureUTAliasTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/SignatureUTAliasTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/SignatureUTAliasTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/SignatureUTAliasTest.java Mon Apr 1 18:28:38 2013
@@ -75,8 +75,8 @@ public class SignatureUTAliasTest extend
reqData.setMsgContext(messageContext);
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.UT));
- actions.add(Integer.valueOf(WSConstants.SIGN));
+ actions.add(WSConstants.UT);
+ actions.add(WSConstants.SIGN);
final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/WSHandlerGetPasswordTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/WSHandlerGetPasswordTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/WSHandlerGetPasswordTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/WSHandlerGetPasswordTest.java Mon Apr 1 18:28:38 2013
@@ -82,7 +82,7 @@ public class WSHandlerGetPasswordTest ex
reqData.setMsgContext(messageContext);
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.UT));
+ actions.add(WSConstants.UT);
Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
@@ -98,8 +98,8 @@ public class WSHandlerGetPasswordTest ex
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("alice") != -1);
- assertTrue(outputString.indexOf("securityPassword") != -1);
+ assertTrue(outputString.contains("alice"));
+ assertTrue(outputString.contains("securityPassword"));
}
/**
@@ -123,7 +123,7 @@ public class WSHandlerGetPasswordTest ex
reqData.setMsgContext(messageContext);
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.UT));
+ actions.add(WSConstants.UT);
Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
@@ -139,8 +139,8 @@ public class WSHandlerGetPasswordTest ex
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("alice") != -1);
- assertTrue(outputString.indexOf("securityPassword") != -1);
+ assertTrue(outputString.contains("alice"));
+ assertTrue(outputString.contains("securityPassword"));
}
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/CertErrorTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/CertErrorTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/CertErrorTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/CertErrorTest.java Mon Apr 1 18:28:38 2013
@@ -51,7 +51,7 @@ public class CertErrorTest extends org.j
fail("Expected failure on a bad username");
} catch (WSSecurityException ex) {
String expectedError = "No certificates for user bob were found for signature";
- assertTrue(ex.getMessage().indexOf(expectedError) != -1);
+ assertTrue(ex.getMessage().contains(expectedError));
}
}
@@ -70,7 +70,7 @@ public class CertErrorTest extends org.j
fail("Expected failure on a bad username");
} catch (WSSecurityException ex) {
String expectedError = "No certificates for user alice were found for encryption";
- assertTrue(ex.getMessage().indexOf(expectedError) != -1);
+ assertTrue(ex.getMessage().contains(expectedError));
}
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionCRLTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionCRLTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionCRLTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionCRLTest.java Mon Apr 1 18:28:38 2013
@@ -84,7 +84,7 @@ public class EncryptionCRLTest extends o
reqData.setUsername("wss40rev");
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.ENCR));
+ actions.add(WSConstants.ENCR);
final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
@@ -125,7 +125,7 @@ public class EncryptionCRLTest extends o
reqData.setUsername("wss40rev");
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.ENCR));
+ actions.add(WSConstants.ENCR);
final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.setOption(WSHandlerConstants.ENABLE_REVOCATION, "true");
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionGCMTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionGCMTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionGCMTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionGCMTest.java Mon Apr 1 18:28:38 2013
@@ -95,7 +95,7 @@ public class EncryptionGCMTest extends o
LOG.debug("Encrypted message:");
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("counter_port_type") == -1 ? true : false);
+ assertFalse(outputString.contains("counter_port_type"));
verify(encryptedDoc, keystoreCallbackHandler, SOAP_BODY);
}
@@ -124,7 +124,7 @@ public class EncryptionGCMTest extends o
LOG.debug("Encrypted message:");
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("counter_port_type") == -1 ? true : false);
+ assertFalse(outputString.contains("counter_port_type"));
verify(encryptedDoc, keystoreCallbackHandler, SOAP_BODY);
}
@@ -161,7 +161,7 @@ public class EncryptionGCMTest extends o
assertTrue(outputString.indexOf("http://www.w3.org/2001/04/xmlenc#sha256") > 0);
assertTrue(outputString.indexOf("http://www.w3.org/2009/xmlenc11#aes192-gcm") > 0);
assertTrue(outputString.indexOf("http://www.w3.org/2009/xmlenc11#mgf1sha256") > 0);
- assertTrue(outputString.indexOf("counter_port_type") == -1 ? true : false);
+ assertFalse(outputString.contains("counter_port_type"));
verify(encryptedDoc, keystoreCallbackHandler, SOAP_BODY);
}
@@ -202,7 +202,7 @@ public class EncryptionGCMTest extends o
final WSSecurityEngineResult result = ipos.next();
final Integer action = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
assertNotNull(action);
- if ((action.intValue() & WSConstants.ENCR) != 0) {
+ if ((action & WSConstants.ENCR) != 0) {
final java.util.List<WSDataRef> refs =
(java.util.List<WSDataRef>) result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
assertNotNull(refs);
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionPartsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionPartsTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionPartsTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionPartsTest.java Mon Apr 1 18:28:38 2013
@@ -140,7 +140,7 @@ public class EncryptionPartsTest extends
assertEquals(WSConstants.KEYTRANSPORT_RSAOEP,
actionResult.get(WSSecurityEngineResult.TAG_ENCRYPTED_KEY_TRANSPORT_METHOD));
- WSDataRef wsDataRef = (WSDataRef)refs.get(0);
+ WSDataRef wsDataRef = refs.get(0);
String xpath = wsDataRef.getXpath();
assertEquals("/soapenv:Envelope/soapenv:Header/foo:foobar", xpath);
assertEquals(WSConstants.AES_128, wsDataRef.getAlgorithm());
@@ -177,8 +177,8 @@ public class EncryptionPartsTest extends
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("wsse11:EncryptedHeader") != -1);
- assertTrue(outputString.indexOf("foo:foobar") == -1);
+ assertTrue(outputString.contains("wsse11:EncryptedHeader"));
+ assertFalse(outputString.contains("foo:foobar"));
List<WSSecurityEngineResult> results = verify(encryptedDoc);
@@ -192,7 +192,7 @@ public class EncryptionPartsTest extends
assertEquals(WSConstants.KEYTRANSPORT_RSAOEP,
actionResult.get(WSSecurityEngineResult.TAG_ENCRYPTED_KEY_TRANSPORT_METHOD));
- WSDataRef wsDataRef = (WSDataRef)refs.get(0);
+ WSDataRef wsDataRef = refs.get(0);
String xpath = wsDataRef.getXpath();
assertEquals("/soapenv:Envelope/soapenv:Header/foo:foobar", xpath);
}
@@ -410,7 +410,7 @@ public class EncryptionPartsTest extends
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
- assertTrue(!outputString.contains("testMethod"));
+ assertFalse(outputString.contains("testMethod"));
verify(encryptedDoc);
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionTest.java Mon Apr 1 18:28:38 2013
@@ -116,7 +116,7 @@ public class EncryptionTest extends org.
LOG.debug("Encrypted message, RSA-15 keytransport, 3DES:");
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("counter_port_type") == -1 ? true : false);
+ assertFalse(outputString.contains("counter_port_type"));
verify(encryptedDoc, keystoreCallbackHandler, SOAP_BODY);
/*
@@ -147,7 +147,7 @@ public class EncryptionTest extends org.
LOG.debug("Encrypted message, RSA-15 keytransport, AES 128:");
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("counter_port_type") == -1 ? true : false);
+ assertFalse(outputString.contains("counter_port_type"));
List<WSSecurityEngineResult> results = verify(
encryptedDoc,
keystoreCallbackHandler,
@@ -193,7 +193,7 @@ public class EncryptionTest extends org.
LOG.debug("Encrypted message, RSA-OAEP keytransport, 3DES:");
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("counter_port_type") == -1 ? true : false);
+ assertFalse(outputString.contains("counter_port_type"));
WSSecurityEngine newEngine = new WSSecurityEngine();
@@ -286,7 +286,7 @@ public class EncryptionTest extends org.
LOG.debug("Encrypted message with THUMBPRINT_IDENTIFIER:");
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("#ThumbprintSHA1") != -1);
+ assertTrue(outputString.contains("#ThumbprintSHA1"));
LOG.info("After Encrypting ThumbprintSHA1....");
List<WSSecurityEngineResult> results = verify(encryptedDoc, encCrypto, keystoreCallbackHandler);
@@ -326,7 +326,7 @@ public class EncryptionTest extends org.
LOG.debug("Encrypted message with ENCRYPTED_KEY_SHA1_IDENTIFIER:");
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("#EncryptedKeySHA1") != -1);
+ assertTrue(outputString.contains("#EncryptedKeySHA1"));
LOG.info("After Encrypting EncryptedKeySHA1....");
verify(encryptedDoc, encCrypto, keystoreCallbackHandler);
@@ -361,10 +361,10 @@ public class EncryptionTest extends org.
LOG.debug("Encrypted message with ENCRYPTED_KEY_SHA1_IDENTIFIER:");
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("#EncryptedKeySHA1") != -1);
+ assertTrue(outputString.contains("#EncryptedKeySHA1"));
LOG.info("After Encrypting EncryptedKeySHA1....");
- verify(encryptedDoc, (Crypto)null, secretKeyCallbackHandler);
+ verify(encryptedDoc, null, secretKeyCallbackHandler);
}
/**
@@ -396,7 +396,7 @@ public class EncryptionTest extends org.
LOG.debug("Encrypted message with ENCRYPTED_KEY_SHA1_IDENTIFIER:");
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("#EncryptedKeySHA1") != -1);
+ assertTrue(outputString.contains("#EncryptedKeySHA1"));
LOG.info("After Encrypting EncryptedKeySHA1....");
verify(encryptedDoc, crypto, secretKeyCallbackHandler);
@@ -424,7 +424,7 @@ public class EncryptionTest extends org.
reqData.setUsername("");
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.ENCR));
+ actions.add(WSConstants.ENCR);
final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
@@ -441,7 +441,7 @@ public class EncryptionTest extends org.
LOG.debug(outputString);
}
- verify(doc, (Crypto)null, secretKeyCallbackHandler);
+ verify(doc, null, secretKeyCallbackHandler);
}
/**
@@ -508,14 +508,12 @@ public class EncryptionTest extends org.
LOG.debug("Encrypted message, RSA-15 keytransport, 3DES:");
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("counter_port_type") == -1 ? true
- : false);
+ assertFalse(outputString.contains("counter_port_type"));
List<WSSecurityEngineResult> results = verify(encryptedDoc, crypto, keystoreCallbackHandler);
outputString =
XMLUtils.PrettyDocumentToString(encryptedDoc);
- assertTrue(outputString.indexOf("counter_port_type") > 0 ? true
- : false);
+ assertTrue(outputString.contains("counter_port_type"));
WSSecurityEngineResult actionResult =
WSSecurityUtil.fetchActionResult(results, WSConstants.ENCR);
@@ -656,7 +654,7 @@ public class EncryptionTest extends org.
LOG.debug("Encrypted message, RSA-OAEP keytransport, 3DES:");
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("counter_port_type") == -1 ? true : false);
+ assertTrue(!outputString.contains("counter_port_type") ? true : false);
WSSecurityEngine newEngine = new WSSecurityEngine();
List<WSSecurityEngineResult> results =
@@ -719,7 +717,7 @@ public class EncryptionTest extends org.
final WSSecurityEngineResult result = ipos.next();
final Integer action = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
assertNotNull(action);
- if ((action.intValue() & WSConstants.ENCR) != 0) {
+ if ((action & WSConstants.ENCR) != 0) {
final java.util.List<WSDataRef> refs =
(java.util.List<WSDataRef>) result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
assertNotNull(refs);
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/PasswordTypeTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/PasswordTypeTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/PasswordTypeTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/PasswordTypeTest.java Mon Apr 1 18:28:38 2013
@@ -158,7 +158,7 @@ public class PasswordTypeTest extends or
reqData.setMsgContext(config);
java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.UT));
+ actions.add(WSConstants.UT);
handler.send(WSConstants.UT, doc, reqData, actions, true);
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCertTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCertTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCertTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCertTest.java Mon Apr 1 18:28:38 2013
@@ -110,7 +110,7 @@ public class SignatureCertTest extends o
assertTrue (cert != null);
}
- // TODO disabling this test as the certs are expired
+ //disabling this test as the certs are expired
@org.junit.Test
@org.junit.Ignore
public void testBSTCertChain() throws Exception {
@@ -275,7 +275,7 @@ public class SignatureCertTest extends o
reqData.setMsgContext(config);
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(action));
+ actions.add(action);
final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureEncryptionTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureEncryptionTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureEncryptionTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureEncryptionTest.java Mon Apr 1 18:28:38 2013
@@ -208,11 +208,11 @@ public class SignatureEncryptionTest ext
assertEquals(1, sigDataRefs.size());
assertEquals(1, encDataRefs.size());
- assertNull(((WSDataRef) sigDataRefs.get(0))
+ assertNull(sigDataRefs.get(0)
.getProtectedElement().getAttributeNodeNS(WSConstants.WSU_NS, "Id"));
- assertTrue(((WSDataRef) sigDataRefs.get(0)).getWsuId().contains(
- ((WSDataRef) encDataRefs.get(0)).getWsuId()));
+ assertTrue(sigDataRefs.get(0).getWsuId().contains(
+ encDataRefs.get(0).getWsuId()));
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureKeyValueTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureKeyValueTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureKeyValueTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureKeyValueTest.java Mon Apr 1 18:28:38 2013
@@ -70,7 +70,7 @@ public class SignatureKeyValueTest exten
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("RSAKeyValue") != -1);
+ assertTrue(outputString.contains("RSAKeyValue"));
WSSecurityEngine secEngine = new WSSecurityEngine();
RequestData data = new RequestData();
@@ -113,7 +113,7 @@ public class SignatureKeyValueTest exten
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("RSAKeyValue") != -1);
+ assertTrue(outputString.contains("RSAKeyValue"));
try {
WSSecurityEngine secEngine = new WSSecurityEngine();
@@ -147,7 +147,7 @@ public class SignatureKeyValueTest exten
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
- assertTrue(outputString.indexOf("DSAKeyValue") != -1);
+ assertTrue(outputString.contains("DSAKeyValue"));
WSSecurityEngine secEngine = new WSSecurityEngine();
RequestData data = new RequestData();
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignaturePartsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignaturePartsTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignaturePartsTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignaturePartsTest.java Mon Apr 1 18:28:38 2013
@@ -143,7 +143,7 @@ public class SignaturePartsTest extends
final List<WSDataRef> refs =
(List<WSDataRef>) actionResult.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
- WSDataRef wsDataRef = (WSDataRef)refs.get(0);
+ WSDataRef wsDataRef = refs.get(0);
String xpath = wsDataRef.getXpath();
assertEquals("/soapenv:Envelope/soapenv:Header/foo:foobar", xpath);
assertEquals(WSConstants.RSA_SHA1, wsDataRef.getAlgorithm());
@@ -239,7 +239,7 @@ public class SignaturePartsTest extends
final List<WSDataRef> refs =
(List<WSDataRef>) signActionResult.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
- WSDataRef wsDataRef = (WSDataRef)refs.get(0);
+ WSDataRef wsDataRef = refs.get(0);
String xpath = wsDataRef.getXpath();
assertEquals("/soapenv:Envelope/soapenv:Header/wsse:Security/saml1:Assertion", xpath);
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureTest.java Mon Apr 1 18:28:38 2013
@@ -491,7 +491,7 @@ public class SignatureTest extends org.j
reqData.setMsgContext(config);
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(action));
+ actions.add(action);
final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
@@ -508,10 +508,10 @@ public class SignatureTest extends org.j
LOG.debug(outputString);
}
assertTrue(
- outputString.indexOf("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256") != -1
+ outputString.contains("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256")
);
assertTrue(
- outputString.indexOf("http://www.w3.org/2001/04/xmlenc#sha256") != -1
+ outputString.contains("http://www.w3.org/2001/04/xmlenc#sha256")
);
verify(doc);
@@ -701,8 +701,8 @@ public class SignatureTest extends org.j
reqData.setMsgContext(config);
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.SIGN));
- actions.add(Integer.valueOf(WSConstants.TS));
+ actions.add(WSConstants.SIGN);
+ actions.add(WSConstants.TS);
final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
@@ -742,9 +742,9 @@ public class SignatureTest extends org.j
reqData.setMsgContext(config);
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.SIGN));
- actions.add(Integer.valueOf(WSConstants.ENCR));
- actions.add(Integer.valueOf(WSConstants.TS));
+ actions.add(WSConstants.SIGN);
+ actions.add(WSConstants.ENCR);
+ actions.add(WSConstants.TS);
final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
@@ -781,9 +781,9 @@ public class SignatureTest extends org.j
reqData.setMsgContext(config);
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.ENCR));
- actions.add(Integer.valueOf(WSConstants.SIGN));
- actions.add(Integer.valueOf(WSConstants.TS));
+ actions.add(WSConstants.ENCR);
+ actions.add(WSConstants.SIGN);
+ actions.add(WSConstants.TS);
final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SymmetricSignatureTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SymmetricSignatureTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SymmetricSignatureTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SymmetricSignatureTest.java Mon Apr 1 18:28:38 2013
@@ -214,7 +214,7 @@ public class SymmetricSignatureTest exte
reqData.setUsername("");
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.SIGN));
+ actions.add(WSConstants.SIGN);
final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
handler.send(
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/TestMessageTransformer.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/TestMessageTransformer.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/TestMessageTransformer.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/TestMessageTransformer.java Mon Apr 1 18:28:38 2013
@@ -260,7 +260,7 @@ public class TestMessageTransformer exte
Element childElement = null;
Iterator<Element> it = getChildElements(node, nodeName, recursive).iterator();
if (it.hasNext()) {
- childElement = (Element)it.next();
+ childElement = it.next();
}
return childElement;
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTDerivedKeyTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTDerivedKeyTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTDerivedKeyTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTDerivedKeyTest.java Mon Apr 1 18:28:38 2013
@@ -90,10 +90,10 @@ public class UTDerivedKeyTest extends or
String outputString =
XMLUtils.PrettyDocumentToString(doc);
- assertTrue(outputString.indexOf("wsse:Username") != -1);
- assertTrue(outputString.indexOf("wsse:Password") == -1);
- assertTrue(outputString.indexOf("wsse11:Salt") != -1);
- assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
+ assertTrue(outputString.contains("wsse:Username"));
+ assertFalse(outputString.contains("wsse:Password"));
+ assertTrue(outputString.contains("wsse11:Salt"));
+ assertTrue(outputString.contains("wsse11:Iteration"));
byte[] derivedKey = UsernameToken.generateDerivedKey("security", salt, 500);
assertTrue(derivedKey.length == 20);
@@ -151,11 +151,11 @@ public class UTDerivedKeyTest extends or
String outputString =
XMLUtils.PrettyDocumentToString(encryptedDoc);
- assertTrue(outputString.indexOf("wsse:Username") != -1);
- assertTrue(outputString.indexOf("wsse:Password") == -1);
- assertTrue(outputString.indexOf("wsse11:Salt") != -1);
- assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
- assertTrue(outputString.indexOf("testMethod") == -1);
+ assertTrue(outputString.contains("wsse:Username"));
+ assertFalse(outputString.contains("wsse:Password"));
+ assertTrue(outputString.contains("wsse11:Salt"));
+ assertTrue(outputString.contains("wsse11:Iteration"));
+ assertFalse(outputString.contains("testMethod"));
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
@@ -202,11 +202,11 @@ public class UTDerivedKeyTest extends or
String outputString =
XMLUtils.PrettyDocumentToString(encryptedDoc);
- assertTrue(outputString.indexOf("wsse:Username") != -1);
- assertTrue(outputString.indexOf("wsse:Password") == -1);
- assertTrue(outputString.indexOf("wsse11:Salt") != -1);
- assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
- assertTrue(outputString.indexOf("testMethod") == -1);
+ assertTrue(outputString.contains("wsse:Username"));
+ assertFalse(outputString.contains("wsse:Password"));
+ assertTrue(outputString.contains("wsse11:Salt"));
+ assertTrue(outputString.contains("wsse11:Iteration"));
+ assertFalse(outputString.contains("testMethod"));
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
@@ -254,11 +254,11 @@ public class UTDerivedKeyTest extends or
String outputString =
XMLUtils.PrettyDocumentToString(encryptedDoc);
- assertTrue(outputString.indexOf("wsse:Username") != -1);
- assertTrue(outputString.indexOf("wsse:Password") == -1);
- assertTrue(outputString.indexOf("wsse11:Salt") != -1);
- assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
- assertTrue(outputString.indexOf("testMethod") == -1);
+ assertTrue(outputString.contains("wsse:Username"));
+ assertFalse(outputString.contains("wsse:Password"));
+ assertTrue(outputString.contains("wsse11:Salt"));
+ assertTrue(outputString.contains("wsse11:Iteration"));
+ assertFalse(outputString.contains("testMethod"));
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
@@ -305,11 +305,11 @@ public class UTDerivedKeyTest extends or
String outputString =
XMLUtils.PrettyDocumentToString(encryptedDoc);
- assertTrue(outputString.indexOf("wsse:Username") != -1);
- assertTrue(outputString.indexOf("wsse:Password") == -1);
- assertTrue(outputString.indexOf("wsse11:Salt") != -1);
- assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
- assertTrue(outputString.indexOf("testMethod") == -1);
+ assertTrue(outputString.contains("wsse:Username"));
+ assertFalse(outputString.contains("wsse:Password"));
+ assertTrue(outputString.contains("wsse11:Salt"));
+ assertTrue(outputString.contains("wsse11:Iteration"));
+ assertFalse(outputString.contains("testMethod"));
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
@@ -355,10 +355,10 @@ public class UTDerivedKeyTest extends or
String outputString =
XMLUtils.PrettyDocumentToString(signedDoc);
- assertTrue(outputString.indexOf("wsse:Username") != -1);
- assertTrue(outputString.indexOf("wsse:Password") == -1);
- assertTrue(outputString.indexOf("wsse11:Salt") != -1);
- assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
+ assertTrue(outputString.contains("wsse:Username"));
+ assertFalse(outputString.contains("wsse:Password"));
+ assertTrue(outputString.contains("wsse11:Salt"));
+ assertTrue(outputString.contains("wsse11:Iteration"));
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
@@ -369,7 +369,7 @@ public class UTDerivedKeyTest extends or
java.security.Principal principal =
(java.security.Principal) actionResult.get(WSSecurityEngineResult.TAG_PRINCIPAL);
// System.out.println(principal.getName());
- assertTrue(principal.getName().indexOf("DK") != -1);
+ assertTrue(principal.getName().contains("DK"));
}
/**
@@ -405,10 +405,10 @@ public class UTDerivedKeyTest extends or
String outputString =
XMLUtils.PrettyDocumentToString(signedDoc);
- assertTrue(outputString.indexOf("wsse:Username") != -1);
- assertTrue(outputString.indexOf("wsse:Password") == -1);
- assertTrue(outputString.indexOf("wsse11:Salt") != -1);
- assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
+ assertTrue(outputString.contains("wsse:Username"));
+ assertFalse(outputString.contains("wsse:Password"));
+ assertTrue(outputString.contains("wsse11:Salt"));
+ assertTrue(outputString.contains("wsse11:Iteration"));
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
@@ -424,7 +424,7 @@ public class UTDerivedKeyTest extends or
java.security.Principal principal =
(java.security.Principal) actionResult.get(WSSecurityEngineResult.TAG_PRINCIPAL);
// System.out.println(principal.getName());
- assertTrue(principal.getName().indexOf("DK") != -1);
+ assertTrue(principal.getName().contains("DK"));
}
/**
@@ -560,10 +560,10 @@ public class UTDerivedKeyTest extends or
String outputString =
XMLUtils.PrettyDocumentToString(doc);
- assertTrue(outputString.indexOf("wsse:Username") != -1);
- assertTrue(outputString.indexOf("wsse:Password") == -1);
- assertTrue(outputString.indexOf("wsse11:Salt") == -1);
- assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
+ assertTrue(outputString.contains("wsse:Username"));
+ assertFalse(outputString.contains("wsse:Password"));
+ assertFalse(outputString.contains("wsse11:Salt"));
+ assertTrue(outputString.contains("wsse11:Iteration"));
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
@@ -609,10 +609,10 @@ public class UTDerivedKeyTest extends or
String outputString =
XMLUtils.PrettyDocumentToString(doc);
- assertTrue(outputString.indexOf("wsse:Username") != -1);
- assertTrue(outputString.indexOf("wsse:Password") == -1);
- assertTrue(outputString.indexOf("wsse11:Salt") != -1);
- assertTrue(outputString.indexOf("wsse11:Iteration") == -1);
+ assertTrue(outputString.contains("wsse:Username"));
+ assertFalse(outputString.contains("wsse:Password"));
+ assertTrue(outputString.contains("wsse11:Salt"));
+ assertFalse(outputString.contains("wsse11:Iteration"));
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
@@ -659,10 +659,10 @@ public class UTDerivedKeyTest extends or
String outputString =
XMLUtils.PrettyDocumentToString(doc);
- assertTrue(outputString.indexOf("wsse:Username") != -1);
- assertTrue(outputString.indexOf("wsse:Password") == -1);
- assertTrue(outputString.indexOf("wsse11:Salt") != -1);
- assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
+ assertTrue(outputString.contains("wsse:Username"));
+ assertFalse(outputString.contains("wsse:Password"));
+ assertTrue(outputString.contains("wsse11:Salt"));
+ assertTrue(outputString.contains("wsse11:Iteration"));
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
@@ -719,11 +719,11 @@ public class UTDerivedKeyTest extends or
String outputString =
XMLUtils.PrettyDocumentToString(encryptedDoc);
- assertTrue(outputString.indexOf("wsse:Username") != -1);
- assertTrue(outputString.indexOf("wsse:Password") == -1);
- assertTrue(outputString.indexOf("wsse11:Salt") != -1);
- assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
- assertTrue(outputString.indexOf("testMethod") == -1);
+ assertTrue(outputString.contains("wsse:Username"));
+ assertFalse(outputString.contains("wsse:Password"));
+ assertTrue(outputString.contains("wsse11:Salt"));
+ assertTrue(outputString.contains("wsse11:Iteration"));
+ assertFalse(outputString.contains("testMethod"));
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
@@ -786,11 +786,11 @@ public class UTDerivedKeyTest extends or
String outputString =
XMLUtils.PrettyDocumentToString(encryptedDoc);
- assertTrue(outputString.indexOf("wsse:Username") != -1);
- assertTrue(outputString.indexOf("wsse:Password") == -1);
- assertTrue(outputString.indexOf("wsse11:Salt") != -1);
- assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
- assertTrue(outputString.indexOf("testMethod") == -1);
+ assertTrue(outputString.contains("wsse:Username"));
+ assertFalse(outputString.contains("wsse:Password"));
+ assertTrue(outputString.contains("wsse11:Salt"));
+ assertTrue(outputString.contains("wsse11:Iteration"));
+ assertFalse(outputString.contains("testMethod"));
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTSignatureTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTSignatureTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTSignatureTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTSignatureTest.java Mon Apr 1 18:28:38 2013
@@ -83,10 +83,10 @@ public class UTSignatureTest extends org
String outputString =
XMLUtils.PrettyDocumentToString(signedDoc);
- assertTrue(outputString.indexOf("wsse:Username") != -1);
- assertTrue(outputString.indexOf("wsse:Password") == -1);
- assertTrue(outputString.indexOf("wsse11:Salt") != -1);
- assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
+ assertTrue(outputString.contains("wsse:Username"));
+ assertFalse(outputString.contains("wsse:Password"));
+ assertTrue(outputString.contains("wsse11:Salt"));
+ assertTrue(outputString.contains("wsse11:Iteration"));
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
@@ -96,7 +96,7 @@ public class UTSignatureTest extends org
WSSecurityUtil.fetchActionResult(results, WSConstants.UT_SIGN);
java.security.Principal principal =
(java.security.Principal) actionResult.get(WSSecurityEngineResult.TAG_PRINCIPAL);
- assertTrue(principal.getName().indexOf("bob") != -1);
+ assertTrue(principal.getName().contains("bob"));
try {
verify(signedDoc, false);
@@ -163,7 +163,7 @@ public class UTSignatureTest extends org
reqData.setUsername("bob");
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.UT_SIGN));
+ actions.add(WSConstants.UT_SIGN);
Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
@@ -177,10 +177,10 @@ public class UTSignatureTest extends org
String outputString =
XMLUtils.PrettyDocumentToString(doc);
- assertTrue(outputString.indexOf("wsse:Username") != -1);
- assertTrue(outputString.indexOf("wsse:Password") == -1);
- assertTrue(outputString.indexOf("wsse11:Salt") != -1);
- assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
+ assertTrue(outputString.contains("wsse:Username"));
+ assertFalse(outputString.contains("wsse:Password"));
+ assertTrue(outputString.contains("wsse11:Salt"));
+ assertTrue(outputString.contains("wsse11:Iteration"));
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
@@ -190,7 +190,7 @@ public class UTSignatureTest extends org
WSSecurityUtil.fetchActionResult(results, WSConstants.UT_SIGN);
java.security.Principal principal =
(java.security.Principal) actionResult.get(WSSecurityEngineResult.TAG_PRINCIPAL);
- assertTrue(principal.getName().indexOf("bob") != -1);
+ assertTrue(principal.getName().contains("bob"));
}
/**
@@ -210,7 +210,7 @@ public class UTSignatureTest extends org
reqData.setUsername("bob");
final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.UT_SIGN));
+ actions.add(WSConstants.UT_SIGN);
Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
CustomHandler handler = new CustomHandler();
@@ -224,11 +224,11 @@ public class UTSignatureTest extends org
String outputString =
XMLUtils.PrettyDocumentToString(doc);
- assertTrue(outputString.indexOf("wsse:Username") != -1);
- assertTrue(outputString.indexOf("wsse:Password") == -1);
- assertTrue(outputString.indexOf("wsse11:Salt") != -1);
- assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
- assertTrue(outputString.indexOf("1234") != -1);
+ assertTrue(outputString.contains("wsse:Username"));
+ assertFalse(outputString.contains("wsse:Password"));
+ assertTrue(outputString.contains("wsse11:Salt"));
+ assertTrue(outputString.contains("wsse11:Iteration"));
+ assertTrue(outputString.contains("1234"));
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
@@ -238,13 +238,13 @@ public class UTSignatureTest extends org
WSSecurityUtil.fetchActionResult(results, WSConstants.UT_SIGN);
java.security.Principal principal =
(java.security.Principal) actionResult.get(WSSecurityEngineResult.TAG_PRINCIPAL);
- assertTrue(principal.getName().indexOf("bob") != -1);
+ assertTrue(principal.getName().contains("bob"));
}
/**
* Verifies the soap envelope.
*
- * @param env soap envelope
+ * @param doc soap envelope
* @throws java.lang.Exception Thrown when there is a problem in verification
*/
private List<WSSecurityEngineResult> verify(Document doc) throws Exception {
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTWseSignatureTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTWseSignatureTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTWseSignatureTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTWseSignatureTest.java Mon Apr 1 18:28:38 2013
@@ -160,7 +160,7 @@ public class UTWseSignatureTest extends
reqData.setMsgContext(config);
java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.UT_SIGN));
+ actions.add(WSConstants.UT_SIGN);
handler.send(WSConstants.UT_SIGN, doc, reqData, actions, true);
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UsernameTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UsernameTokenTest.java?rev=1463243&r1=1463242&r2=1463243&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UsernameTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UsernameTokenTest.java Mon Apr 1 18:28:38 2013
@@ -213,7 +213,7 @@ public class UsernameTokenTest extends o
fail("Failure expected on a bad username");
} catch (WSSecurityException ex) {
String message = ex.getMessage();
- assertTrue(message.indexOf("badusername") == -1);
+ assertFalse(message.contains("badusername"));
assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_AUTHENTICATION);
// expected
}
@@ -775,7 +775,7 @@ public class UsernameTokenTest extends o
Document signedDoc = builder.build(doc, secHeader);
String outputString =
XMLUtils.PrettyDocumentToString(signedDoc);
- assertTrue(outputString.indexOf("EncodingType") != -1);
+ assertTrue(outputString.contains("EncodingType"));
}
/**
@@ -794,7 +794,7 @@ public class UsernameTokenTest extends o
reqData.setMsgContext(config);
java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.UT));
+ actions.add(WSConstants.UT);
handler.send(WSConstants.UT, doc, reqData, actions, true);
@@ -821,7 +821,7 @@ public class UsernameTokenTest extends o
reqData.setMsgContext(config);
java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.UT));
+ actions.add(WSConstants.UT);
handler.send(WSConstants.UT, doc, reqData, actions, true);
@@ -849,7 +849,7 @@ public class UsernameTokenTest extends o
reqData.setMsgContext(config);
java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
- actions.add(Integer.valueOf(WSConstants.UT));
+ actions.add(WSConstants.UT);
handler.send(WSConstants.UT, doc, reqData, actions, true);