cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [2/2] git commit: [CXF-5869] test using AES/CTR
Date Thu, 10 Jul 2014 16:58:12 GMT
[CXF-5869] test using AES/CTR


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

Branch: refs/heads/2.7.x-fixes
Commit: c651e2671edeace288e555316d136a7113f0127e
Parents: 141e88e
Author: Akitoshi Yoshida <ay@apache.org>
Authored: Thu Jul 10 18:04:20 2014 +0200
Committer: Akitoshi Yoshida <ay@apache.org>
Committed: Thu Jul 10 18:57:21 2014 +0200

----------------------------------------------------------------------
 .../org/apache/cxf/io/CachedStreamTestBase.java | 27 +++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c651e267/api/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java b/api/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java
index ddd5fed..b88ba14 100755
--- a/api/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java
+++ b/api/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java
@@ -34,6 +34,9 @@ import org.junit.Assert;
 import org.junit.Test;
 
 public abstract class CachedStreamTestBase extends Assert {
+    // use two typical ciphers for testing
+    private static final String[] CIPHER_LIST = {"RC4", "AES/CTR/NoPadding"};
+
     protected abstract void reloadDefaultProperties();
     protected abstract Object createCache();
     protected abstract Object createCache(long threshold);
@@ -88,7 +91,13 @@ public abstract class CachedStreamTestBase extends Assert {
     @Test
     public void testEncryptAndDecryptWithDeleteOnClose() throws IOException {
         // need a 8-bit cipher so that all bytes are flushed when the stream is flushed.
-        Object cache = createCache(4, "RC4");
+        for (String cipher: CIPHER_LIST) {
+            verifyEncryptAndDecryptWithDeleteOnClose(cipher);
+        }
+    }
+    
+    private void verifyEncryptAndDecryptWithDeleteOnClose(String cipher) throws IOException
{
+        Object cache = createCache(4, cipher);
         final String text = "Hello Secret World!";
         File tmpfile = getTmpFile(text, cache);
         assertNotNull(tmpfile);
@@ -111,8 +120,14 @@ public abstract class CachedStreamTestBase extends Assert {
 
     @Test
     public void testEncryptAndDecryptWithDeleteOnInClose() throws IOException {
+        for (String cipher: CIPHER_LIST) {
+            verifyEncryptAndDecryptWithDeleteOnInClose(cipher);
+        }
+    }
+
+    private void verifyEncryptAndDecryptWithDeleteOnInClose(String cipher) throws IOException
{
         // need a 8-bit cipher so that all bytes are flushed when the stream is flushed.
-        Object cache = createCache(4, "RC4");
+        Object cache = createCache(4, cipher);
         final String text = "Hello Secret World!";
         File tmpfile = getTmpFile(text, cache);
         assertNotNull(tmpfile);
@@ -133,8 +148,14 @@ public abstract class CachedStreamTestBase extends Assert {
 
     @Test
     public void testEncryptAndDecryptPartially() throws IOException {
+        for (String cipher: CIPHER_LIST) {
+            verifyEncryptAndDecryptPartially(cipher);
+        }
+    }
+
+    private void verifyEncryptAndDecryptPartially(String cipher) throws IOException {
         // need a 8-bit cipher so that all bytes are flushed when the stream is flushed.
-        Object cache = createCache(4, "RC4");
+        Object cache = createCache(4, cipher);
         final String text = "Hello Secret World!";
         File tmpfile = getTmpFile(text, cache);
         assertNotNull(tmpfile);


Mime
View raw message