You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2019/01/03 11:48:58 UTC
svn commit: r1850227 [4/11] - in /webservices/wss4j/trunk: build-tools/
integration/src/test/java/org/apache/wss4j/integration/test/kerberos/
performance/src/test/java/org/apache/wss4j/performance/
policy/src/test/java/org/apache/wss4j/policy/tests/ ws...
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/EncryptedPartsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/EncryptedPartsTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/EncryptedPartsTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/EncryptedPartsTest.java Thu Jan 3 11:48:56 2019
@@ -31,9 +31,12 @@ import org.apache.wss4j.stax.ext.WSSCons
import org.apache.wss4j.stax.securityEvent.EncryptedPartSecurityEvent;
import org.apache.wss4j.stax.securityEvent.OperationSecurityEvent;
import org.apache.xml.security.stax.ext.XMLSecurityConstants;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class EncryptedPartsTest extends AbstractPolicyTestBase {
@Test
@@ -97,12 +100,12 @@ public class EncryptedPartsTest extends
encryptedPartSecurityEvent.setElementPath(headerPath);
try {
policyEnforcer.registerSecurityEvent(encryptedPartSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Element /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://example.org}a must be encrypted");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -152,10 +155,10 @@ public class EncryptedPartsTest extends
try {
policyEnforcer.registerSecurityEvent(encryptedPartSecurityEvent);
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"SOAP-Body must be encrypted");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -220,12 +223,12 @@ public class EncryptedPartsTest extends
encryptedPartSecurityEvent.setElementPath(headerPath);
try {
policyEnforcer.registerSecurityEvent(encryptedPartSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Element /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://example.org}a must be encrypted");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/HttpsTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/HttpsTokenTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/HttpsTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/HttpsTokenTest.java Thu Jan 3 11:48:56 2019
@@ -27,9 +27,12 @@ import org.apache.wss4j.stax.impl.securi
import org.apache.wss4j.stax.securityEvent.HttpsTokenSecurityEvent;
import org.apache.wss4j.stax.securityEvent.OperationSecurityEvent;
import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class HttpsTokenTest extends AbstractPolicyTestBase {
@Test
@@ -107,12 +110,12 @@ public class HttpsTokenTest extends Abst
operationSecurityEvent.setOperation(new QName("definitions"));
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Policy enforces HttpClientCertificateAuthentication but we got HttpBasicAuthentication");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/IssuedTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/IssuedTokenTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/IssuedTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/IssuedTokenTest.java Thu Jan 3 11:48:56 2019
@@ -45,9 +45,12 @@ import org.apache.wss4j.stax.securityTok
import org.apache.xml.security.stax.ext.XMLSecurityConstants;
import org.apache.xml.security.stax.securityEvent.ContentEncryptedElementSecurityEvent;
import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class IssuedTokenTest extends AbstractPolicyTestBase {
private static final String samlPolicyString =
@@ -221,10 +224,10 @@ public class IssuedTokenTest extends Abs
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(), "IssuerName in Policy (http://recipientTokenIssuer.com) didn't match with the one in the IssuedToken (http://initiatorTokenIssuer.com)");
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(), "IssuerName in Policy (http://recipientTokenIssuer.com) didn't match with the one in the IssuedToken (http://initiatorTokenIssuer.com)");
}
}
@@ -293,10 +296,10 @@ public class IssuedTokenTest extends Abs
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(), "Policy enforces SAML V2.0 token but got 1.1");
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(), "Policy enforces SAML V2.0 token but got 1.1");
}
}
@@ -365,10 +368,10 @@ public class IssuedTokenTest extends Abs
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(), "Policy enforces SAML token with a symmetric key");
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(), "Policy enforces SAML token with a symmetric key");
}
}
@@ -434,10 +437,10 @@ public class IssuedTokenTest extends Abs
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(), "Attribute http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname not found in the SAMLAssertion");
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(), "Attribute http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname not found in the SAMLAssertion");
}
}
@@ -567,11 +570,11 @@ public class IssuedTokenTest extends Abs
operationSecurityEvent.setOperation(new QName("definitions"));
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Policy enforces Kerberos token of type http://docs.oasisopen.org/wss/oasiswss-kerberos-tokenprofile-1.1#Kerberosv5APREQSHA1 but got http://docs.oasisopen.org/wss/oasiswss-kerberos-tokenprofile-1.1#GSS_Kerberosv5_AP_REQ");
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/KerberosTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/KerberosTokenTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/KerberosTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/KerberosTokenTest.java Thu Jan 3 11:48:56 2019
@@ -35,9 +35,11 @@ import org.apache.xml.security.stax.ext.
import org.apache.xml.security.stax.impl.util.IDGenerator;
import org.apache.xml.security.stax.securityEvent.ContentEncryptedElementSecurityEvent;
import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
public class KerberosTokenTest extends AbstractPolicyTestBase {
@Test
@@ -192,9 +194,9 @@ public class KerberosTokenTest extends A
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertEquals(e.getMessage(), "Policy enforces WssKerberosV5ApReqToken11");
+ assertEquals(e.getMessage(), "Policy enforces WssKerberosV5ApReqToken11");
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/KeyValueTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/KeyValueTokenTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/KeyValueTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/KeyValueTokenTest.java Thu Jan 3 11:48:56 2019
@@ -36,9 +36,12 @@ import org.apache.wss4j.stax.securityTok
import org.apache.xml.security.stax.ext.XMLSecurityConstants;
import org.apache.xml.security.stax.securityEvent.ContentEncryptedElementSecurityEvent;
import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class KeyValueTokenTest extends AbstractPolicyTestBase {
@Test
@@ -172,12 +175,12 @@ public class KeyValueTokenTest extends A
operationSecurityEvent.setOperation(new QName("definitions"));
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Policy enforces that a RsaKeyValue must be present in the KeyValueToken but we got a ECKeyValueSecurityTokenImpl");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/LayoutTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/LayoutTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/LayoutTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/LayoutTest.java Thu Jan 3 11:48:56 2019
@@ -127,10 +127,10 @@ public class LayoutTest extends Abstract
operationSecurityEvent.setOperation(new QName("definitions"));
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(), "\n" +
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(), "\n" +
"Policy enforces LaxTsFirst but X509Token occured first");
}
}*/
@@ -180,10 +180,10 @@ public class LayoutTest extends Abstract
operationSecurityEvent.setOperation(new QName("definitions"));
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(), "\n" +
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(), "\n" +
"Policy enforces LaxTsLast but X509Token occured last");
}
}*/
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/ProtectionOrderTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/ProtectionOrderTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/ProtectionOrderTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/ProtectionOrderTest.java Thu Jan 3 11:48:56 2019
@@ -34,9 +34,12 @@ import org.apache.xml.security.stax.ext.
import org.apache.xml.security.stax.securityEvent.ContentEncryptedElementSecurityEvent;
import org.apache.xml.security.stax.securityEvent.EncryptedElementSecurityEvent;
import org.apache.xml.security.stax.securityEvent.SignedElementSecurityEvent;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class ProtectionOrderTest extends AbstractPolicyTestBase {
@Test
@@ -135,12 +138,12 @@ public class ProtectionOrderTest extends
signedPartSecurityEvent.setElementPath(WSSConstants.SOAP_11_BODY_PATH);
try {
policyEnforcer.registerSecurityEvent(signedPartSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Policy enforces SignBeforeEncrypting but the /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Body was encrypted and then signed");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -243,12 +246,12 @@ public class ProtectionOrderTest extends
encryptedPartSecurityEvent.setElementPath(WSSConstants.SOAP_11_BODY_PATH);
try {
policyEnforcer.registerSecurityEvent(encryptedPartSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Policy enforces EncryptBeforeSigning but the /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Body was signed and then encrypted");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/RequiredElementsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/RequiredElementsTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/RequiredElementsTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/RequiredElementsTest.java Thu Jan 3 11:48:56 2019
@@ -28,9 +28,11 @@ import org.apache.wss4j.policy.stax.enfo
import org.apache.wss4j.stax.ext.WSSConstants;
import org.apache.wss4j.stax.securityEvent.OperationSecurityEvent;
import org.apache.wss4j.stax.securityEvent.RequiredElementSecurityEvent;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
public class RequiredElementsTest extends AbstractPolicyTestBase {
@Test
@@ -77,9 +79,9 @@ public class RequiredElementsTest extend
policyEnforcer.registerSecurityEvent(requiredElementSecurityEvent);
try {
policyEnforcer.doFinal();
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSPolicyException e) {
- Assert.assertEquals(e.getMessage(), "Element /{http://example.org}a must be present");
+ assertEquals(e.getMessage(), "Element /{http://example.org}a must be present");
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/RequiredPartsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/RequiredPartsTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/RequiredPartsTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/RequiredPartsTest.java Thu Jan 3 11:48:56 2019
@@ -28,9 +28,11 @@ import org.apache.wss4j.policy.stax.enfo
import org.apache.wss4j.stax.ext.WSSConstants;
import org.apache.wss4j.stax.securityEvent.OperationSecurityEvent;
import org.apache.wss4j.stax.securityEvent.RequiredPartSecurityEvent;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
public class RequiredPartsTest extends AbstractPolicyTestBase {
@Test
@@ -83,9 +85,9 @@ public class RequiredPartsTest extends A
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertEquals(e.getMessage(), "Element {http://example.org}a must be present");
+ assertEquals(e.getMessage(), "Element {http://example.org}a must be present");
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SamlTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SamlTokenTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SamlTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SamlTokenTest.java Thu Jan 3 11:48:56 2019
@@ -39,9 +39,12 @@ import org.apache.wss4j.stax.securityTok
import org.apache.xml.security.stax.ext.XMLSecurityConstants;
import org.apache.xml.security.stax.securityEvent.ContentEncryptedElementSecurityEvent;
import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class SamlTokenTest extends AbstractPolicyTestBase {
@Test
@@ -209,12 +212,12 @@ public class SamlTokenTest extends Abstr
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"IssuerName in Policy (xs:anyURI) didn't match with the one in the SamlToken (xs:otherURI)");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SecureConversationTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SecureConversationTokenTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SecureConversationTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SecureConversationTokenTest.java Thu Jan 3 11:48:56 2019
@@ -35,9 +35,12 @@ import org.apache.wss4j.stax.securityTok
import org.apache.xml.security.stax.ext.XMLSecurityConstants;
import org.apache.xml.security.stax.securityEvent.ContentEncryptedElementSecurityEvent;
import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class SecureConversationTokenTest extends AbstractPolicyTestBase {
@Test
@@ -181,12 +184,12 @@ public class SecureConversationTokenTest
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"IssuerName in Policy (xs:anyURI) didn't match with the one in the SecurityContextToken (sss)");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SecurityContextTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SecurityContextTokenTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SecurityContextTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SecurityContextTokenTest.java Thu Jan 3 11:48:56 2019
@@ -36,9 +36,12 @@ import org.apache.wss4j.stax.securityTok
import org.apache.xml.security.stax.ext.XMLSecurityConstants;
import org.apache.xml.security.stax.securityEvent.ContentEncryptedElementSecurityEvent;
import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class SecurityContextTokenTest extends AbstractPolicyTestBase {
@Test
@@ -184,12 +187,12 @@ public class SecurityContextTokenTest ex
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"IssuerName in Policy (xs:anyURI) didn't match with the one in the SecurityContextToken (sss)");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SignedElementsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SignedElementsTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SignedElementsTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SignedElementsTest.java Thu Jan 3 11:48:56 2019
@@ -31,9 +31,12 @@ import org.apache.wss4j.stax.ext.WSSCons
import org.apache.wss4j.stax.securityEvent.OperationSecurityEvent;
import org.apache.xml.security.stax.ext.XMLSecurityConstants;
import org.apache.xml.security.stax.securityEvent.SignedElementSecurityEvent;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class SignedElementsTest extends AbstractPolicyTestBase {
@Test
@@ -92,12 +95,12 @@ public class SignedElementsTest extends
signedElementSecurityEvent.setElementPath(headerPath);
try {
policyEnforcer.registerSecurityEvent(signedElementSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Element /{http://example.org}a must be signed");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SignedPartsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SignedPartsTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SignedPartsTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SignedPartsTest.java Thu Jan 3 11:48:56 2019
@@ -31,9 +31,12 @@ import org.apache.wss4j.stax.ext.WSSCons
import org.apache.wss4j.stax.securityEvent.OperationSecurityEvent;
import org.apache.wss4j.stax.securityEvent.SignedPartSecurityEvent;
import org.apache.xml.security.stax.ext.XMLSecurityConstants;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class SignedPartsTest extends AbstractPolicyTestBase {
@Test
@@ -103,12 +106,12 @@ public class SignedPartsTest extends Abs
signedPartSecurityEvent.setElementPath(headerPath);
try {
policyEnforcer.registerSecurityEvent(signedPartSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Element /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://example.org}a must be signed");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -158,10 +161,10 @@ public class SignedPartsTest extends Abs
try {
policyEnforcer.registerSecurityEvent(signedPartSecurityEvent);
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Element /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Body must be signed");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -232,12 +235,12 @@ public class SignedPartsTest extends Abs
signedPartSecurityEvent.setElementPath(headerPath);
try {
policyEnforcer.registerSecurityEvent(signedPartSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Element /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://example.org}a must be signed");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SupportingTokensTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SupportingTokensTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SupportingTokensTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SupportingTokensTest.java Thu Jan 3 11:48:56 2019
@@ -48,9 +48,12 @@ import org.apache.wss4j.stax.securityEve
import org.apache.wss4j.stax.securityEvent.X509TokenSecurityEvent;
import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
import org.apache.xml.security.stax.impl.util.IDGenerator;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class SupportingTokensTest extends AbstractPolicyTestBase {
@Test
@@ -108,11 +111,11 @@ public class SupportingTokensTest extend
operationSecurityEvent.setOperation(new QName("definitions"));
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertEquals(e.getMessage(),
+ assertEquals(e.getMessage(),
"X509Certificate Version 3 mismatch; Policy enforces WssX509V3Token11");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -186,9 +189,9 @@ public class SupportingTokensTest extend
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof WSSPolicyException);
+ assertTrue(e.getCause() instanceof WSSPolicyException);
}
}
@@ -350,9 +353,9 @@ public class SupportingTokensTest extend
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof WSSPolicyException);
+ assertTrue(e.getCause() instanceof WSSPolicyException);
}
}
@@ -514,9 +517,9 @@ public class SupportingTokensTest extend
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof WSSPolicyException);
+ assertTrue(e.getCause() instanceof WSSPolicyException);
}
}
@@ -660,9 +663,9 @@ public class SupportingTokensTest extend
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof WSSPolicyException);
+ assertTrue(e.getCause() instanceof WSSPolicyException);
}
}
@@ -804,9 +807,9 @@ public class SupportingTokensTest extend
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof WSSPolicyException);
+ assertTrue(e.getCause() instanceof WSSPolicyException);
}
}
@@ -948,9 +951,9 @@ public class SupportingTokensTest extend
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof WSSPolicyException);
+ assertTrue(e.getCause() instanceof WSSPolicyException);
}
}
@@ -1092,9 +1095,9 @@ public class SupportingTokensTest extend
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof WSSPolicyException);
+ assertTrue(e.getCause() instanceof WSSPolicyException);
}
}
@@ -1258,9 +1261,9 @@ public class SupportingTokensTest extend
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof WSSPolicyException);
+ assertTrue(e.getCause() instanceof WSSPolicyException);
}
}
@@ -1428,9 +1431,9 @@ public class SupportingTokensTest extend
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof WSSPolicyException);
+ assertTrue(e.getCause() instanceof WSSPolicyException);
}
}
@@ -1568,9 +1571,9 @@ public class SupportingTokensTest extend
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof WSSPolicyException);
+ assertTrue(e.getCause() instanceof WSSPolicyException);
}
}
@@ -1641,4 +1644,4 @@ public class SupportingTokensTest extend
policyEnforcer.doFinal();
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SymmetricBindingTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SymmetricBindingTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SymmetricBindingTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SymmetricBindingTest.java Thu Jan 3 11:48:56 2019
@@ -38,9 +38,12 @@ import org.apache.wss4j.stax.securityTok
import org.apache.xml.security.stax.ext.XMLSecurityConstants;
import org.apache.xml.security.stax.ext.stax.XMLSecEventFactory;
import org.apache.xml.security.stax.securityEvent.EncryptedElementSecurityEvent;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class SymmetricBindingTest extends AbstractPolicyTestBase {
@Test
@@ -152,12 +155,12 @@ public class SymmetricBindingTest extend
operationSecurityEvent.setOperation(new QName("definitions"));
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Timestamp must not be present");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -198,12 +201,12 @@ public class SymmetricBindingTest extend
operationSecurityEvent.setOperation(new QName("definitions"));
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Policy enforces EncryptBeforeSigning but the /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Body was signed and then encrypted");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -256,11 +259,11 @@ public class SymmetricBindingTest extend
operationSecurityEvent.setOperation(new QName("definitions"));
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertEquals(e.getCause().getMessage(),
+ assertEquals(e.getCause().getMessage(),
"Element /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security/{http://www.w3.org/2000/09/xmldsig#}Signature must be encrypted");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -328,13 +331,13 @@ public class SymmetricBindingTest extend
signedPartSecurityEvent.setElementPath(elementPath);
try {
policyEnforcer.registerSecurityEvent(signedPartSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"OnlySignEntireHeadersAndBody not fulfilled, offending element: " +
"/{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Body/{http://www.example.com}bodyChildElement");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TokenProtectionTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TokenProtectionTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TokenProtectionTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TokenProtectionTest.java Thu Jan 3 11:48:56 2019
@@ -41,9 +41,12 @@ import org.apache.xml.security.stax.secu
import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
import org.apache.xml.security.stax.securityToken.SecurityToken;
import org.apache.xml.security.stax.securityToken.SecurityTokenConstants;
-import org.junit.Assert;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class TokenProtectionTest extends AbstractPolicyTestBase {
private static List<WSSecurityTokenConstants.TokenUsage> tokenUsages = new ArrayList<>();
@@ -214,10 +217,10 @@ public class TokenProtectionTest extends
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Token /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}BinarySecurityToken must not be signed by its signature.");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -258,12 +261,12 @@ public class TokenProtectionTest extends
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Token /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}BinarySecurityToken must be signed by its signature.");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -304,12 +307,12 @@ public class TokenProtectionTest extends
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Token /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}BinarySecurityToken must be signed by its signature.");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -351,12 +354,12 @@ public class TokenProtectionTest extends
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Token /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}BinarySecurityToken must be signed by its signature.");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -429,10 +432,10 @@ public class TokenProtectionTest extends
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Token /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}BinarySecurityToken must sign the main signature.");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -491,10 +494,10 @@ public class TokenProtectionTest extends
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Main signature must sign the Signed*Supporting-Tokens.");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -631,10 +634,10 @@ public class TokenProtectionTest extends
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Token /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security/{http://www.w3.org/2001/04/xmlenc#}EncryptedKey must be signed by its signature.");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -708,4 +711,4 @@ public class TokenProtectionTest extends
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
policyEnforcer.doFinal();
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TransportBindingIntegrationTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TransportBindingIntegrationTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TransportBindingIntegrationTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TransportBindingIntegrationTest.java Thu Jan 3 11:48:56 2019
@@ -47,10 +47,13 @@ import org.apache.wss4j.stax.test.Callba
import org.apache.xml.security.stax.config.Init;
import org.apache.xml.security.stax.ext.SecurePart;
import org.apache.xml.security.stax.securityEvent.SecurityEvent;
-import org.junit.Assert;
import org.junit.Test;
import org.w3c.dom.Document;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class TransportBindingIntegrationTest extends AbstractPolicyTestBase {
@Test
@@ -256,12 +259,12 @@ public class TransportBindingIntegration
}
}
));
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (XMLStreamException e) {
- Assert.assertTrue(e.getCause() instanceof WSSecurityException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof WSSecurityException);
+ assertEquals(e.getCause().getMessage(),
"Element /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security/{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp must be present");
- Assert.assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -493,12 +496,12 @@ public class TransportBindingIntegration
}
}
));
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (XMLStreamException e) {
- Assert.assertTrue(e.getCause() instanceof WSSecurityException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof WSSecurityException);
+ assertEquals(e.getCause().getMessage(),
"Assertion {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}UsernameToken not satisfied");
- Assert.assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -594,12 +597,12 @@ public class TransportBindingIntegration
}
}
));
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (XMLStreamException e) {
- Assert.assertTrue(e.getCause() instanceof WSSecurityException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof WSSecurityException);
+ assertEquals(e.getCause().getMessage(),
"Assertion {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}UsernameToken not satisfied");
- Assert.assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -1077,12 +1080,12 @@ public class TransportBindingIntegration
}
}
));
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (XMLStreamException e) {
- Assert.assertTrue(e.getCause() instanceof WSSecurityException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof WSSecurityException);
+ assertEquals(e.getCause().getMessage(),
"IssuerName in Policy (CN=transmitter,OU=swssf,C=CH) didn't match with the one in the HttpsToken (CN=example,OU=swssf,C=CH)");
- Assert.assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -1195,12 +1198,12 @@ public class TransportBindingIntegration
}
}
));
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (XMLStreamException e) {
- Assert.assertTrue(e.getCause() instanceof WSSecurityException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof WSSecurityException);
+ assertEquals(e.getCause().getMessage(),
"Asymmetric algorithm http://www.w3.org/2001/04/xmldsig-more#rsa-sha512 does not meet policy");
- Assert.assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -1315,12 +1318,12 @@ public class TransportBindingIntegration
}
}
));
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (XMLStreamException e) {
- Assert.assertTrue(e.getCause() instanceof WSSecurityException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof WSSecurityException);
+ assertEquals(e.getCause().getMessage(),
"C14N algorithm http://www.w3.org/2006/12/xml-c14n11 does not meet policy");
- Assert.assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -1435,12 +1438,12 @@ public class TransportBindingIntegration
}
}
));
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (XMLStreamException e) {
- Assert.assertTrue(e.getCause() instanceof WSSecurityException);
- //Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof WSSecurityException);
+ //assertEquals(e.getCause().getMessage(),
// "Digest algorithm http://www.w3.org/2001/04/xmldsig-more#md5 does not meet policy");
- // Assert.assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ // assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
} finally {
switchAllowMD5Algorithm(false);
}
@@ -1554,13 +1557,13 @@ public class TransportBindingIntegration
}
}
));
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (XMLStreamException e) {
- Assert.assertTrue(e.getCause() instanceof WSSecurityException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof WSSecurityException);
+ assertEquals(e.getCause().getMessage(),
"Encryption algorithm http://www.w3.org/2001/04/xmlenc#tripledes-cbc does not meet policy\n" +
"Symmetric encryption algorithm key length 192 does not meet policy");
- Assert.assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(((WSSecurityException) e.getCause()).getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -1668,12 +1671,12 @@ public class TransportBindingIntegration
}
}
));
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (XMLStreamException e) {
- Assert.assertTrue(e.getCause() instanceof WSSecurityException);
- Assert.assertEquals(e.getCause().getMessage(), "An error was discovered processing the <wsse:Security> header; nested exception is: \n" +
+ assertTrue(e.getCause() instanceof WSSecurityException);
+ assertEquals(e.getCause().getMessage(), "An error was discovered processing the <wsse:Security> header; nested exception is: \n" +
"\torg.apache.wss4j.policy.stax.PolicyViolationException: \n" +
"Policy enforces LaxTsFirst but X509Token occured first");
}
}*/
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TransportBindingTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TransportBindingTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TransportBindingTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TransportBindingTest.java Thu Jan 3 11:48:56 2019
@@ -27,7 +27,6 @@ import org.apache.wss4j.stax.impl.securi
import org.apache.wss4j.stax.securityEvent.*;
import org.apache.xml.security.stax.ext.XMLSecurityConstants;
import org.apache.xml.security.stax.securityEvent.EncryptedElementSecurityEvent;
-import org.junit.Assert;
import org.junit.Test;
import javax.xml.namespace.QName;
@@ -36,6 +35,10 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class TransportBindingTest extends AbstractPolicyTestBase {
@Test
@@ -124,12 +127,12 @@ public class TransportBindingTest extend
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"Timestamp must not be present");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -238,4 +241,4 @@ public class TransportBindingTest extend
policyEnforcer.doFinal();
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/UsernameTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/UsernameTokenTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/UsernameTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/UsernameTokenTest.java Thu Jan 3 11:48:56 2019
@@ -32,7 +32,6 @@ import org.apache.xml.security.stax.ext.
import org.apache.xml.security.stax.impl.util.IDGenerator;
import org.apache.xml.security.stax.securityEvent.ContentEncryptedElementSecurityEvent;
import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
-import org.junit.Assert;
import org.junit.Test;
import javax.xml.namespace.QName;
@@ -42,6 +41,10 @@ import java.time.ZonedDateTime;
import java.util.LinkedList;
import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class UsernameTokenTest extends AbstractPolicyTestBase {
@Test
@@ -202,12 +205,12 @@ public class UsernameTokenTest extends A
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertTrue(e.getCause() instanceof PolicyViolationException);
- Assert.assertEquals(e.getCause().getMessage(),
+ assertTrue(e.getCause() instanceof PolicyViolationException);
+ assertEquals(e.getCause().getMessage(),
"UsernameToken does not contain a hashed password");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/VulnerabliltyVectorsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/VulnerabliltyVectorsTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/VulnerabliltyVectorsTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/VulnerabliltyVectorsTest.java Thu Jan 3 11:48:56 2019
@@ -41,11 +41,15 @@ import org.apache.wss4j.stax.ext.WSSSecu
import org.apache.wss4j.stax.test.AbstractTestBase;
import org.apache.wss4j.stax.test.CallbackHandlerImpl;
import org.apache.xml.security.stax.ext.SecurePart;
-import org.junit.Assert;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class VulnerabliltyVectorsTest extends AbstractTestBase {
/**
@@ -87,15 +91,15 @@ public class VulnerabliltyVectorsTest ex
try {
doInboundSecurity(inSecurityProperties, new ByteArrayInputStream(baos.toByteArray()), policyEnforcer);
- Assert.fail("Expected XMLStreamException");
+ fail("Expected XMLStreamException");
} catch (XMLStreamException e) {
Throwable throwable = e.getCause();
- Assert.assertNotNull(throwable);
- Assert.assertTrue(throwable instanceof WSSecurityException);
- Assert.assertEquals(throwable.getMessage(),
+ assertNotNull(throwable);
+ assertTrue(throwable instanceof WSSecurityException);
+ assertEquals(throwable.getMessage(),
"SOAPAction (emptyPolicyOperation) does not match with the current Operation: " +
"{http://schemas.xmlsoap.org/wsdl/}definitions");
- Assert.assertEquals(((WSSecurityException) throwable).getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(((WSSecurityException) throwable).getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
@@ -139,14 +143,14 @@ public class VulnerabliltyVectorsTest ex
try {
doInboundSecurity(inSecurityProperties, xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), policyEnforcer);
- Assert.fail("Expected XMLStreamException");
+ fail("Expected XMLStreamException");
} catch (XMLStreamException e) {
Throwable throwable = e.getCause();
- Assert.assertNotNull(throwable);
- Assert.assertTrue(throwable instanceof WSSecurityException);
- Assert.assertEquals(throwable.getMessage(),
+ assertNotNull(throwable);
+ assertTrue(throwable instanceof WSSecurityException);
+ assertEquals(throwable.getMessage(),
"Element /{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Body must be signed");
- Assert.assertEquals(((WSSecurityException) throwable).getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(((WSSecurityException) throwable).getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/WSP13SpecTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/WSP13SpecTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/WSP13SpecTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/WSP13SpecTest.java Thu Jan 3 11:48:56 2019
@@ -25,12 +25,15 @@ import org.apache.xml.security.stax.secu
import org.apache.xml.security.stax.securityEvent.SecurityEventConstants;
import org.apache.wss4j.stax.securityEvent.WSSecurityEventConstants;
import org.apache.wss4j.stax.test.InboundWSSecurityContextImplTest;
-import org.junit.Assert;
import org.junit.Test;
import java.nio.charset.StandardCharsets;
import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
public class WSP13SpecTest extends AbstractPolicyTestBase {
private InboundWSSecurityContextImplTest inboundWSSecurityContextImplTest = new InboundWSSecurityContextImplTest();
@@ -214,7 +217,7 @@ public class WSP13SpecTest extends Abstr
for (int j = 0; j < securityEventList.size(); j++) {
System.out.println(j + " " + securityEventList.get(j));
}
- Assert.fail("Event at index " + eventIndex + " is not of type " + ignoreEvent);
+ fail("Event at index " + eventIndex + " is not of type " + ignoreEvent);
}
if (ignoreEvent == null || i != eventIndex) {
policyEnforcer.registerSecurityEvent(securityEvent);
@@ -223,21 +226,21 @@ public class WSP13SpecTest extends Abstr
policyEnforcer.doFinal();
if (ignoreEvent != null) {
- Assert.fail("Expected WSSPolicyException");
+ fail("Expected WSSPolicyException");
}
} catch (WSSPolicyException e) {
//Exception for policyEnforcer.doFinal();
if (ignoreEvent == null) {
- Assert.fail("Unexpected WSSPolicyException: " + e.getMessage());
+ fail("Unexpected WSSPolicyException: " + e.getMessage());
}
- Assert.assertEquals(e.getMessage(), expectedErrorMessage);
+ assertEquals(e.getMessage(), expectedErrorMessage);
} catch (WSSecurityException e) {
//Exception for policyEnforcer.registerSecurityEvent(securityEvent);
if (ignoreEvent == null) {
- Assert.fail("Unexpected WSSPolicyException: " + e.getMessage());
+ fail("Unexpected WSSPolicyException: " + e.getMessage());
}
- Assert.assertTrue(e.getCause() instanceof WSSPolicyException);
- Assert.assertEquals(e.getCause().getMessage(), expectedErrorMessage);
+ assertTrue(e.getCause() instanceof WSSPolicyException);
+ assertEquals(e.getCause().getMessage(), expectedErrorMessage);
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/X509TokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/X509TokenTest.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/X509TokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/X509TokenTest.java Thu Jan 3 11:48:56 2019
@@ -29,7 +29,6 @@ import org.apache.wss4j.stax.securityEve
import org.apache.xml.security.stax.ext.XMLSecurityConstants;
import org.apache.xml.security.stax.securityEvent.ContentEncryptedElementSecurityEvent;
import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
-import org.junit.Assert;
import org.junit.Test;
import javax.xml.namespace.QName;
@@ -37,6 +36,9 @@ import javax.xml.namespace.QName;
import java.util.LinkedList;
import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
public class X509TokenTest extends AbstractPolicyTestBase {
@Test
@@ -177,11 +179,11 @@ public class X509TokenTest extends Abstr
try {
policyEnforcer.registerSecurityEvent(operationSecurityEvent);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (WSSecurityException e) {
- Assert.assertEquals(e.getMessage(),
+ assertEquals(e.getMessage(),
"X509Certificate Version 3 mismatch; Policy enforces WssX509V3Token11");
- Assert.assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
+ assertEquals(e.getFaultCode(), WSSecurityException.INVALID_SECURITY);
}
}
-}
+}
\ No newline at end of file
Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java?rev=1850227&r1=1850226&r2=1850227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java Thu Jan 3 11:48:56 2019
@@ -85,11 +85,14 @@ import org.apache.xml.security.stax.secu
import org.apache.xml.security.stax.securityEvent.SecurityEventConstants;
import org.apache.xml.security.stax.securityEvent.SecurityEventListener;
import org.junit.AfterClass;
-import org.junit.Assert;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-public abstract class AbstractTestBase extends Assert {
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+public abstract class AbstractTestBase {
//javax.xml.transform.Transformer transformer = TransformerFactory.newInstance().newTransformer();
//transformer.transform(new StreamSource(new ByteArrayInputStream(baos.toByteArray())), new StreamResult(System.out));
@@ -664,15 +667,15 @@ public abstract class AbstractTestBase e
@Override
public void registerSecurityEvent(SecurityEvent securityEvent) throws WSSecurityException {
- Assert.assertNotNull(securityEvent.getCorrelationID());
- Assert.assertNotEquals("", securityEvent.getCorrelationID());
+ assertNotNull(securityEvent.getCorrelationID());
+ assertNotEquals("", securityEvent.getCorrelationID());
receivedSecurityEvents.add(securityEvent);
}
public void compare() {
if (expectedEvents.length != receivedSecurityEvents.size()) {
printEvents();
- Assert.fail("event count mismatch");
+ fail("event count mismatch");
}
boolean asserted = true;
for (int i = 0; i < expectedEvents.length; i++) {
@@ -683,7 +686,7 @@ public abstract class AbstractTestBase e
}
if (!asserted) {
printEvents();
- Assert.fail("event mismatch");
+ fail("event mismatch");
}
}
@@ -801,4 +804,4 @@ public abstract class AbstractTestBase e
}
return 0.0d;
}
-}
+}
\ No newline at end of file