cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject git commit: Minor test change
Date Fri, 24 Oct 2014 11:14:30 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 35f28c58d -> 1b3c22e92


Minor test change


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1b3c22e9
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1b3c22e9
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1b3c22e9

Branch: refs/heads/3.0.x-fixes
Commit: 1b3c22e922177f312a6f659b4e7dc3d0706626de
Parents: 35f28c5
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Fri Oct 24 12:11:07 2014 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Fri Oct 24 12:14:22 2014 +0100

----------------------------------------------------------------------
 .../cxf/systest/ws/common/SecurityTestUtil.java | 38 +++++++++++---------
 1 file changed, 22 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/1b3c22e9/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/SecurityTestUtil.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/SecurityTestUtil.java
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/SecurityTestUtil.java
index 25f61f0..d0b8bc0 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/SecurityTestUtil.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/SecurityTestUtil.java
@@ -33,6 +33,27 @@ import org.example.contract.doubleit.DoubleItPortType;
  */
 public final class SecurityTestUtil {
     
+    private static final boolean UNRESTRICTED_POLICIES_INSTALLED;
+    static {
+        boolean ok = false;
+        try {
+            byte[] data = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
+
+            SecretKey key192 = new SecretKeySpec(
+                new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+                            0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+                            0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17},
+                            "AES");
+            Cipher c = Cipher.getInstance("AES");
+            c.init(Cipher.ENCRYPT_MODE, key192);
+            c.doFinal(data);
+            ok = true;
+        } catch (Exception e) {
+            //
+        }
+        UNRESTRICTED_POLICIES_INSTALLED = ok;
+    }
+    
     private SecurityTestUtil() {
         // complete
     }
@@ -55,22 +76,7 @@ public final class SecurityTestUtil {
     }
     
     public static boolean checkUnrestrictedPoliciesInstalled() {
-        try {
-            byte[] data = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
-
-            SecretKey key192 = new SecretKeySpec(
-                new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-                            0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-                            0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17},
-                            "AES");
-            Cipher c = Cipher.getInstance("AES");
-            c.init(Cipher.ENCRYPT_MODE, key192);
-            c.doFinal(data);
-            return true;
-        } catch (Exception e) {
-            //
-        }
-        return false;
+        return UNRESTRICTED_POLICIES_INSTALLED;
     }
     
     public static void enableStreaming(DoubleItPortType port) {


Mime
View raw message