You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2015/03/14 00:14:53 UTC

cxf git commit: Disable test when unlimited security policies are not installed

Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes f5b751cc4 -> abe4cba67


Disable test when unlimited security policies are not installed


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

Branch: refs/heads/3.0.x-fixes
Commit: abe4cba67337556651787d3e14f3ecf472cd7f80
Parents: f5b751c
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Mar 13 23:14:10 2015 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Mar 13 23:14:10 2015 +0000

----------------------------------------------------------------------
 .../https/ciphersuites/CipherSuitesTest.java    | 28 ++++++++++++++++++++
 1 file changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/abe4cba6/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
----------------------------------------------------------------------
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java b/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
index 3a93002..a0cad91 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
@@ -21,6 +21,9 @@ package org.apache.cxf.systest.https.ciphersuites;
 
 import java.net.URL;
 
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
 import javax.xml.ws.BindingProvider;
 
 import org.apache.cxf.Bus;
@@ -40,6 +43,27 @@ public class CipherSuitesTest extends AbstractBusClientServerTestBase {
     static final String PORT3 = allocatePort(CipherSuitesServer.class, 3);
     static final String PORT4 = allocatePort(CipherSuitesServer.class, 4);
     
+    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;
+    }
+    
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue(
@@ -109,6 +133,10 @@ public class CipherSuitesTest extends AbstractBusClientServerTestBase {
     // Both client + server include a specific AES CipherSuite (not via a filter)
     @org.junit.Test
     public void testAESIncludedExplicitly() throws Exception {
+        
+        if (!UNRESTRICTED_POLICIES_INSTALLED) {
+            return;
+        }
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = CipherSuitesTest.class.getResource("ciphersuites-explicit-client.xml");