cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject git commit: [CXF-5869] test using AES/CTR
Date Thu, 10 Jul 2014 16:04:31 GMT
Repository: cxf
Updated Branches:
  refs/heads/master f584187d0 -> e8a038340


[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/e8a03834
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e8a03834
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e8a03834

Branch: refs/heads/master
Commit: e8a038340ec349de5c6c8732e1bf82dcdab05f27
Parents: f584187
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:04:20 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/e8a03834/core/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java b/core/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java
index 47e837f..56e35c1 100755
--- a/core/src/test/java/org/apache/cxf/io/CachedStreamTestBase.java
+++ b/core/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