geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [28/50] [abbrv] incubator-geode git commit: Added test to make sure separate clients have distinct auth state in AuthJUnitTest
Date Mon, 27 Jul 2015 23:19:51 GMT
Added test to make sure separate clients have distinct auth state in AuthJUnitTest


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/049771f6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/049771f6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/049771f6

Branch: refs/heads/feature/GEODE-77
Commit: 049771f6ef6b61360082b4d3581a46007397d959
Parents: 580d950
Author: Vito Gavrilov <vgavrilov@pivotal.io>
Authored: Tue Jul 21 14:31:22 2015 -0700
Committer: Vito Gavrilov <vgavrilov@pivotal.io>
Committed: Tue Jul 21 14:32:13 2015 -0700

----------------------------------------------------------------------
 .../gemstone/gemfire/redis/AuthJUnitTest.java   | 28 ++++++++++++++++++++
 1 file changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/049771f6/gemfire-core/src/test/java/com/gemstone/gemfire/redis/AuthJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/redis/AuthJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/redis/AuthJUnitTest.java
index ece74bb..4b2ba0b 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/redis/AuthJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/redis/AuthJUnitTest.java
@@ -113,4 +113,32 @@ public class AuthJUnitTest {
     jedis.set("foo", "bar"); // No exception
   }
 
+  @Test
+  public void testSeparateClientRequests() {
+    setupCacheWithPassword();
+    Jedis authorizedJedis = null;
+    Jedis nonAuthorizedJedis = null;
+    try {
+      authorizedJedis =  new Jedis("localhost", port, 100000);
+      nonAuthorizedJedis = new Jedis("localhost", port, 100000);
+      String res = authorizedJedis.auth(PASSWORD);
+      assertEquals(res, "OK");
+      authorizedJedis.set("foo", "bar"); // No exception for authorized client
+
+      authorizedJedis.auth(PASSWORD);
+      Exception ex = null;
+      try {                        
+        nonAuthorizedJedis.set("foo", "bar");
+      } catch (JedisDataException e) {
+        ex = e;
+      }
+      assertNotNull(ex);
+    } finally {
+      if (authorizedJedis != null)
+        authorizedJedis.close();
+      if (nonAuthorizedJedis != null)
+        nonAuthorizedJedis.close();
+    }
+  }
+
 }
\ No newline at end of file


Mime
View raw message