geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [10/26] incubator-geode git commit: GEODE-1571: fix precheckin failures
Date Thu, 30 Jun 2016 19:23:15 GMT
GEODE-1571: fix precheckin failures


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

Branch: refs/heads/feature/GEODE-1571
Commit: beb50ad8e3a54761ccbeafb12f6dcda62629af16
Parents: 07d0817
Author: Jinmei Liao <jiliao@pivotal.io>
Authored: Tue Jun 28 11:55:02 2016 -0700
Committer: Jinmei Liao <jiliao@pivotal.io>
Committed: Tue Jun 28 12:14:08 2016 -0700

----------------------------------------------------------------------
 ...tedClientContainsKeyAuthDistributedTest.java | 33 +++++---------------
 .../gemfire/security/SecurityTestUtils.java     | 14 ++-------
 2 files changed, 10 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/beb50ad8/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientContainsKeyAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientContainsKeyAuthDistributedTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientContainsKeyAuthDistributedTest.java
index a02b49c..558c427 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientContainsKeyAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientContainsKeyAuthDistributedTest.java
@@ -18,51 +18,34 @@ package com.gemstone.gemfire.security;
 
 import static org.junit.Assert.*;
 
-import com.gemstone.gemfire.cache.Cache;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
 @Category(DistributedTest.class)
 public class IntegratedClientContainsKeyAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest
{
 
   @Test
   public void testContainsKey() throws InterruptedException {
-//    AsyncInvocation ai1 = client1.invokeAsync("containsKey with permission", () -> {
-//      ClientCache cache = new ClientCacheFactory(createClientProperties("dataReader", "1234567"))
-//          .setPoolSubscriptionEnabled(true)
-//          .addPoolServer("localhost", serverPort)
-//          .create();
-//
     AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      Cache cache = SecurityTestUtils.createCacheClient("key1User", "1234567", serverPort,
SecurityTestUtils.NO_EXCEPTION);
-      final Region region = cache.getRegion(SecurityTestUtils.REGION_NAME);
+      ClientCache cache = createClientCache("key1User", "1234567", serverPort);
+      final Region region = cache.getRegion(REGION_NAME);
       assertTrue(region.containsKeyOnServer("key1"));
       assertNotAuthorized(() -> region.containsKeyOnServer("key3"), "DATA:READ:AuthRegion:key3");
     });
 
     AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      Cache cache = SecurityTestUtils.createCacheClient("authRegionReader", "1234567", serverPort,
SecurityTestUtils.NO_EXCEPTION);
-      final Region region = cache.getRegion(SecurityTestUtils.REGION_NAME);
+      ClientCache cache = createClientCache("authRegionReader", "1234567", serverPort);
+      final Region region = cache.getRegion(REGION_NAME);
       region.containsKeyOnServer("key3");
       assertTrue(region.containsKeyOnServer("key1"));
 
     });
 
-//    AsyncInvocation ai2 = client2.invokeAsync("containsKey without permission", () ->
{
-//      ClientCache cache = new ClientCacheFactory(createClientProperties("authRegionReader",
"1234567"))
-//        .setPoolSubscriptionEnabled(true)
-//        .addPoolServer("localhost", serverPort)
-//        .create();
-//
-//      Region region = cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-//      assertNotAuthorized(() -> region.containsKeyOnServer("key3"), "DATA:READ");
-
-//    });
-
     ai1.join();
     ai2.join();
     ai1.checkException();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/beb50ad8/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
b/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
index aeffe7f..5ff0344 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
@@ -43,6 +43,7 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.Callable;
+
 import javax.net.ServerSocketFactory;
 import javax.net.SocketFactory;
 import javax.net.ssl.KeyManager;
@@ -83,7 +84,6 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.pdx.PdxReader;
 import com.gemstone.gemfire.pdx.PdxSerializable;
 import com.gemstone.gemfire.pdx.PdxWriter;
-import com.gemstone.gemfire.security.templates.UserPasswordAuthInit;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
 import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
 
@@ -308,15 +308,6 @@ public final class SecurityTestUtils {
     return server1.getPort();
   }
 
-  protected static Cache createCacheClient(String userName, String password, int serverPort,
int expectedResult){
-    Properties authProps = new Properties();
-    authProps.setProperty(UserPasswordAuthInit.USER_NAME, userName);
-    authProps.setProperty(UserPasswordAuthInit.PASSWORD, password);
-    int[] ports = new int[1];
-    ports[0] = serverPort;
-    return createCacheClient(UserPasswordAuthInit.class.getName()+".create", authProps, null,
ports, 0, false, false, true, expectedResult);
-  }
-
   // 1
   protected static void createCacheClient(final String authInitModule,
                                           final Properties authProps,
@@ -366,7 +357,7 @@ public final class SecurityTestUtils {
   }
 
   // 5
-  protected static Cache createCacheClient(final String authInitModule,
+  protected static void createCacheClient(final String authInitModule,
                                           Properties authProps,
                                           final Properties javaProps,
                                           int[] ports,
@@ -480,7 +471,6 @@ public final class SecurityTestUtils {
     catch (Exception ex) {
       fail("Got unexpected exception when starting client", ex);
     }
-    return cache;
   }
 
   protected static void createCacheClientForMultiUserMode(final int numOfUsers,


Mime
View raw message