geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tush...@apache.org
Subject [79/79] incubator-geode git commit: Incorprating kirk's review comments : https://reviews.apache.org/r/39585/
Date Tue, 03 Nov 2015 11:26:41 GMT
Incorprating kirk's review comments : https://reviews.apache.org/r/39585/


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

Branch: refs/heads/feature/GEODE-17
Commit: 9fdc8bcd58e1492a933c530cf8417b0da08cbc91
Parents: 87c83da
Author: tushark <tushark@apache.org>
Authored: Tue Nov 3 15:06:19 2015 +0530
Committer: tushark <tushark@apache.org>
Committed: Tue Nov 3 16:54:35 2015 +0530

----------------------------------------------------------------------
 .../internal/security/CommandTestBase.java      |   7 +-
 .../security/IntegratedSecDUnitTest.java        | 105 +++++++++++++------
 .../security/MBeanSecurityJUnitTest.java        |  37 +++----
 .../internal/security/TestAccessControl.java    |  28 ++---
 .../internal/security/TestAuthenticator.java    |   8 +-
 5 files changed, 111 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9fdc8bcd/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/CommandTestBase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/CommandTestBase.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/CommandTestBase.java
index a95e605..9fb9d94 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/CommandTestBase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/CommandTestBase.java
@@ -160,9 +160,6 @@ public class CommandTestBase extends CacheTestCase {
     Host.getHost(0).getVM(0).invoke(new SerializableRunnable() {
       public void run() {
         verifyManagementServiceStopped();
-        //if (Boolean.getBoolean(USE_HTTP_SYSTEM_PROPERTY)) {
-        //  System.gc();
-        //}
       }
     });
   }
@@ -291,10 +288,12 @@ public class CommandTestBase extends CacheTestCase {
       Gfsh.SUPPORT_MUTLIPLESHELL = true;
       String shellId = getClass().getSimpleName()+"_"+getName();
       HeadlessGfsh shell = new HeadlessGfsh(shellId, 300);
+      
       //Various command use ThreadLocal instance. following call makes
       //HeadlessGfsh available to all the commands
       shell.setThreadLocalInstance();
-      //Added to avoid trimming of the columns
+      
+      //Added to avoid trimming of the columns. Not needed for non-interactive shell
       //shell.setEnvProperty(Gfsh.ENV_APP_RESULT_VIEWER, "non-basic");
       //shell.start();
       info("Started headless shell: " + shell);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9fdc8bcd/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/IntegratedSecDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/IntegratedSecDUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/IntegratedSecDUnitTest.java
index 8258e49..8e63524 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/IntegratedSecDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/IntegratedSecDUnitTest.java
@@ -1,6 +1,6 @@
 package com.gemstone.gemfire.management.internal.security;
 
-import hydra.Log;
+//import hydra.Log;
 
 import java.io.IOException;
 import java.net.MalformedURLException;
@@ -17,6 +17,8 @@ import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
 import javax.management.remote.JMXServiceURL;
 
+import org.apache.logging.log4j.Logger;
+
 import com.gemstone.gemfire.LogWriter;
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
@@ -34,6 +36,10 @@ import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.management.DistributedRegionMXBean;
+import com.gemstone.gemfire.management.ManagementService;
+import com.gemstone.gemfire.management.ManagerMXBean;
 import com.gemstone.gemfire.management.internal.MBeanJMXAdapter;
 import com.gemstone.gemfire.management.internal.cli.domain.DataCommandRequest;
 import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
@@ -45,6 +51,7 @@ import com.gemstone.gemfire.management.internal.security.ResourceOperationContex
 import com.gemstone.gemfire.security.AuthInitialize;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 
+import dunit.DistributedTestCase;
 import dunit.Host;
 import dunit.SerializableRunnable;
 import dunit.VM;
@@ -54,6 +61,8 @@ import dunit.VM;
  * 
  */
 public class IntegratedSecDUnitTest extends CommandTestBase {
+  
+  private static Logger logger = LogService.getLogger();
 
   public static class AuthInitializer implements AuthInitialize {
 
@@ -118,7 +127,7 @@ public class IntegratedSecDUnitTest extends CommandTestBase {
 
   @SuppressWarnings("rawtypes")
   public void setUpServerVM(Properties gemFireProps) throws Exception {
-    Log.getLogWriter().info("Creating server vm cache with props =" + gemFireProps);
+    logger.info("Creating server vm cache with props =" + gemFireProps);
     gemFireProps.setProperty(DistributionConfig.NAME_NAME, testName + "Server");
     createCache(gemFireProps);
     RegionFactory factory = cache.createRegionFactory(RegionShortcut.REPLICATE);
@@ -126,16 +135,14 @@ public class IntegratedSecDUnitTest extends CommandTestBase {
     assertNotNull(r);
     r.put("serverkey", "servervalue");
     assertEquals(1,r.size());
-    Log.getLogWriter().info("Created serverRegion with 1 key=serverKey");
+    logger.info("Created serverRegion with 1 key=serverKey");
   }
 
   public void setUpClientVM(Properties gemFireProps, String host, int port, String user,
String password) {
     gemFireProps.setProperty(DistributionConfig.NAME_NAME, testName + "Client");
-    //gemFireProps.setProperty("security-username", user);
-    //gemFireProps.setProperty("security-password", password);
     gemFireProps.setProperty("security-client-auth-init",
         "com.gemstone.gemfire.management.internal.security.IntegratedSecDUnitTest$AuthInitializer.create");
-    Log.getLogWriter().info("Creating client cache with props =" + gemFireProps);
+    logger.info("Creating client cache with props =" + gemFireProps);
     ClientCacheFactory clientCacheFactory = new ClientCacheFactory(gemFireProps);
     clientCacheFactory.addPoolServer(host, port);
     clientCacheFactory.setPoolMultiuserAuthentication(true);
@@ -215,6 +222,7 @@ public class IntegratedSecDUnitTest extends CommandTestBase {
     final Host host = Host.getHost(0);
     VM serverVM = host.getVM(1);
     VM clientVM = host.getVM(2);
+    VM managerVM = host.getVM(0);
     serverVM.invoke(IntegratedSecDUnitTest.class, "setUpServerVMTask", new Object[] { props
});
     serverVM.invoke(IntegratedSecDUnitTest.class, "createServerTask");
 
@@ -222,16 +230,44 @@ public class IntegratedSecDUnitTest extends CommandTestBase {
     String hostName = (String) array[0];
     int port = (Integer) array[1];
     Object params[] = new Object[] { props, hostName, port, "tushark", "password123" };
-    Log.getLogWriter().info("Starting client with server endpoint " + hostName + ":" + port);
+    logger.info("Starting client with server endpoint " + hostName + ":" + port);
     clientVM.invoke(IntegratedSecDUnitTest.class, "setUpClientVMTask", params);
     
-    Log.getLogWriter().info("Sleeping for 5 seconds to get all mbeans registered on manager");
-    try {
-      Thread.sleep(5000);
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-    }
-    
+    SerializableRunnable checkRegionMBeans = new SerializableRunnable() {
+      @Override
+      public void run() {
+        Cache cache = getCache();
+        final ManagementService service = ManagementService.getManagementService(cache);
+
+        final WaitCriterion waitForMaangerMBean = new WaitCriterion() {
+          @Override
+          public boolean done() {
+            ManagerMXBean bean1 = service.getManagerMXBean();
+            DistributedRegionMXBean bean2 = service.getDistributedRegionMXBean("/serverRegion");
+            if (bean1 == null) {
+              logger.info("Still probing for ManagerMBean");
+              return false;
+            } else {
+              logger.info("Still probing for DistributedRegionMXBean=" + bean2);
+              return (bean2 != null);
+            }
+          }
+
+          @Override
+          public String description() {
+            return "Probing for DistributedRegionMXBean for serverRegion";
+          }
+        };
+
+        DistributedTestCase.waitForCriterion(waitForMaangerMBean, 30000, 2000, true);
+
+        assertNotNull(service.getMemberMXBean());
+        assertNotNull(service.getManagerMXBean());
+        DistributedRegionMXBean bean = service.getDistributedRegionMXBean("/serverRegion");
+        assertNotNull(bean);
+      }
+    };
+    managerVM.invoke(checkRegionMBeans);        
   }
 
   @SuppressWarnings("serial")
@@ -361,14 +397,14 @@ public class IntegratedSecDUnitTest extends CommandTestBase {
       Region region = regionService.getRegion(regionPath);
       assertNotNull(region);
       Object oldValue = region.put(key, value);
-      Log.getLogWriter().info("doPutUsingClientCache : Put key=" + key + " for user="+ user+"
newValue="+ value + " oldValue="+ oldValue + " expectSuccess="+expectSuccess);
+      logger.info("doPutUsingClientCache : Put key=" + key + " for user="+ user+" newValue="+
value + " oldValue="+ oldValue + " expectSuccess="+expectSuccess);
       if (!expectSuccess)
         fail("Region Put was expected to fail");
     } catch (Exception e) {
       if (!expectSuccess) {
-        Log.getLogWriter().info("expectSuccess=false => " + e.getMessage());
+        logger.info("expectSuccess=false => " + e.getMessage());
       } else {
-        Log.getLogWriter().error("Unexpected error", e);
+        logger.error("Unexpected error", e);
         fail("Unknown reason " + e.getMessage());
       }
     }
@@ -379,13 +415,13 @@ public class IntegratedSecDUnitTest extends CommandTestBase {
     String command = "put --region=" + regionPath + " --key=" + key + " --value=" + value;
     changeGfshUser(user, password);
     CommandResult result = executeCommand(command);
-    Log.getLogWriter().info("CommandResult " + result);
+    logger.info("CommandResult " + result);
     if (expectSuccess) {
       validateGfshResult(result, expectSuccess);
       printCommandOutput(result);
     }
     else {
-      Log.getLogWriter().info("Error line :" + this.commandError);
+      logger.info("Error line :" + this.commandError);
       assertTrue(this.commandError.contains("Access Denied"));
       this.commandError = null;
       // validateGfshResultError(result);
@@ -395,7 +431,7 @@ public class IntegratedSecDUnitTest extends CommandTestBase {
   private static void validateGfshResultError(CommandResult result) {
     if (result.getType().equals(ResultData.TYPE_ERROR)) {
       ErrorResultData data = (ErrorResultData) result.getResultData();
-      Log.getLogWriter().info("Error resultData : " + data.toString());
+      logger.info("Error resultData : " + data.toString());
     } else
       fail("Unexpected result type " + result.getType());
   }
@@ -420,15 +456,15 @@ public class IntegratedSecDUnitTest extends CommandTestBase {
       Region region = regionService.getRegion(regionPath);
       assertNotNull(region);
       Object value = region.get(key);
-      Log.getLogWriter().info("doGetUsingClientCache : Get key=" + key + " for user="+ user+"
value="+ value + " expectSuccess="+expectSuccess);
+      logger.info("doGetUsingClientCache : Get key=" + key + " for user="+ user+" value="+
value + " expectSuccess="+expectSuccess);
       assertNotNull(value);
       if (!expectSuccess)
         fail("Region Get was expected to fail");
     } catch (Exception e) {
       if (!expectSuccess) {
-        Log.getLogWriter().info("expectSuccess=true => " + e.getMessage());
+        logger.info("expectSuccess=true => " + e.getMessage());
       } else {
-        Log.getLogWriter().error("Unexpected error", e);
+        logger.error("Unexpected error", e);
         fail("Unknown reason " + e.getMessage());
       }
     }
@@ -444,7 +480,7 @@ public class IntegratedSecDUnitTest extends CommandTestBase {
       validateGfshResult(result, expectSuccess);      
     }
     else {
-      Log.getLogWriter().info("Error line :" + this.commandError);
+      logger.info("Error line :" + this.commandError);
       assertTrue(this.commandError.contains("Access Denied"));
       this.commandError = null;
     }
@@ -468,7 +504,7 @@ public class IntegratedSecDUnitTest extends CommandTestBase {
       //assertFalse(result.getType().equals(ResultData.TYPE_ERROR));
     }
     else {
-      Log.getLogWriter().info("Error line :" + this.commandError);
+      logger.info("Error line :" + this.commandError);
       assertTrue(this.commandError.contains("Access Denied"));
       this.commandError = null;
     }
@@ -476,14 +512,14 @@ public class IntegratedSecDUnitTest extends CommandTestBase {
   
   private static void printCommandOutput(CommandResult cmdResult) {
     assertNotNull(cmdResult);
-    Log.getLogWriter().info("Command Output : ");
+    logger.info("Command Output : ");
     StringBuilder sb = new StringBuilder();
     cmdResult.resetToFirstLine();
     while (cmdResult.hasNextLine()) {
       sb.append(cmdResult.nextLine()).append(DataCommandRequest.NEW_LINE);
     }
-    Log.getLogWriter().info(sb.toString());
-    Log.getLogWriter().info("");      
+    logger.info(sb.toString());
+    logger.info("");      
   }
   
   private void doShowLogUsingJMX(boolean expectSuccess, String user, String password) {
@@ -495,21 +531,21 @@ public class IntegratedSecDUnitTest extends CommandTestBase {
       ObjectName memberON = (ObjectName)mbeanServer.invoke(MBeanJMXAdapter.getDistributedSystemName(),
"fetchMemberObjectName", 
           new Object[]{"Manager"}, new String[]{String.class.getCanonicalName()});      
       String logs = (String) mbeanServer.invoke(memberON, "showLog", new Object[]{60}, new
String[]{int.class.toString()});
-      Log.getLogWriter().info("JMX Output :" + logs);
+      logger.info("JMX Output :" + logs);
       connector.close();
       if(!expectSuccess)
         fail("Expected Access Denied...");      
     } catch (InstanceNotFoundException e) {
-      Log.getLogWriter().error("Unexpected Error", e);
+      logger.error("Unexpected Error", e);
       fail("Unexpected Error " + e.getMessage());
     } catch (MBeanException e) {
-      Log.getLogWriter().error("Unexpected Error", e);
+      logger.error("Unexpected Error", e);
       fail("Unexpected Error " + e.getMessage());
     } catch (ReflectionException e) {
-      Log.getLogWriter().error("Unexpected Error", e);
+      logger.error("Unexpected Error", e);
       fail("Unexpected Error " + e.getMessage());
     } catch (IOException e) {
-      Log.getLogWriter().error("Unexpected Error", e);
+      logger.error("Unexpected Error", e);
       fail("Unexpected Error " + e.getMessage());
     } catch (SecurityException e) {
       if(expectSuccess){
@@ -635,7 +671,8 @@ public class IntegratedSecDUnitTest extends CommandTestBase {
     doCommandUsingGfsh("show metrics", true, "custom", "password123");
     doCommandUsingGfsh("show dead-locks --file=deadlocks_custom_3.txt", true, "custom", "password123");
   
     
-    /* Commented due to error with gradle :  TailLogRequest/Response processed in application
vm with shared logging
+    /* Commented due to error with gradle but was working with ant build earlier 
+    Error string is :  TailLogRequest/Response processed in application vm with shared logging
     //check jmx and gfsh
     doCommandUsingGfsh("show log --member=Manager", true, "monitor", "password123");
     doCommandUsingGfsh("show log --member=Manager", false, "dataWrite", "password123");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9fdc8bcd/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanSecurityJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanSecurityJUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanSecurityJUnitTest.java
index d8915a7..ed6a5e8 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanSecurityJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanSecurityJUnitTest.java
@@ -1,6 +1,6 @@
 package com.gemstone.gemfire.management.internal.security;
 
-import hydra.Log;
+
 
 import java.io.File;
 import java.io.IOException;
@@ -27,6 +27,7 @@ import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
 import javax.management.remote.JMXServiceURL;
 
+import org.apache.logging.log4j.Logger;
 import org.junit.experimental.categories.Category;
 
 import junit.framework.TestCase;
@@ -41,6 +42,7 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.management.AsyncEventQueueMXBean;
 import com.gemstone.gemfire.management.CacheServerMXBean;
 import com.gemstone.gemfire.management.DiskStoreMXBean;
@@ -58,7 +60,7 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 /**
  * Test all mbean operations by granting and revoking the access levels required
- * for performing that operation
+ * for performing that operation. Does not test wan mbeans 
  * 
  * @author tushark
  * 
@@ -66,6 +68,7 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
 @Category(UnitTest.class)
 public class MBeanSecurityJUnitTest extends TestCase {
 
+  private static Logger logger = LogService.getLogger();
   private static final String USER = "custom";
   private static final String PASSWORD = "password123";
   private JMXConnector connector = null;
@@ -86,8 +89,7 @@ public class MBeanSecurityJUnitTest extends TestCase {
   }
 
   public void testGemfireMBeans() throws IOException, InstanceNotFoundException, MBeanException,
ReflectionException,
-      AttributeNotFoundException, InvalidAttributeValueException, MalformedObjectNameException
{
-    Log.createLogWriter("testGemfireMBeans", "info");
+      AttributeNotFoundException, InvalidAttributeValueException, MalformedObjectNameException
{    
     GemFireCacheImpl cache = null;
     DistributedSystem ds = null;
     Properties pr = new Properties();
@@ -149,14 +151,9 @@ public class MBeanSecurityJUnitTest extends TestCase {
 
     doTestDiskStoreMXBean(port);
     doTestCacheServerMXBean(port, cacheServerPort);
-    //TODO : needs WAN
-    // doTestGatewayReceiverMXBean(port);
-    // doTestGatewaySenderMXBean(port);
     doTestLockServiceMXBean(port);
     doTestManagerMXBean(port);
-    doTestRegionMXBean(port);
-    //TODO : Needs Locator in DS
-    doTestLocatorMXBean(port);
+    doTestRegionMXBean(port);    
     doTestDistributedLockServiceMXBean(port);
     doTestDistributedRegionMXBean(port);
     doTestAsyncEventQueueMXBean(port);
@@ -225,9 +222,10 @@ public class MBeanSecurityJUnitTest extends TestCase {
 
   }
 
-  private void doTestLocatorMXBean(int port) {
+  /* Has issues while starting locator hence commented out
+   private void doTestLocatorMXBean(int port) {
 
-    /*MBeanServerConnection conn = connector.getMBeanServerConnection();
+    MBeanServerConnection conn = connector.getMBeanServerConnection();
     ObjectName regionON = (ObjectName) conn.invoke(MBeanJMXAdapter.getDistributedSystemName(),
"fetchRegionObjectName",
         new Object[] { "testGemfireMBeans", "/region1" },
         new String[] { String.class.getCanonicalName(), String.class.getCanonicalName() });
@@ -246,9 +244,9 @@ public class MBeanSecurityJUnitTest extends TestCase {
         
       checkMethod(port, LocatorMXBean.class, locatorON, "listManagers", null,
         ResourceOperationCode.LIST_DS);                            
-        */
+        
     
-  }
+  }*/
 
   private void doTestRegionMXBean(int port) throws IOException, InstanceNotFoundException,
MBeanException,
       ReflectionException {
@@ -329,9 +327,6 @@ public class MBeanSecurityJUnitTest extends TestCase {
         "MaxConnections", "Running" });
     
     checkMethod(port, CacheServerMXBean.class, cacheServerON, "showAllClientStats", null,
ResourceOperationCode.LIST_DS);
-
-    /*checkMethod(port, CacheServerMXBean.class, cacheServerON, "showClientQueueDetails",
null,
-        ResourceOperationCode.LIST_DS);*/
     
     checkMethod(port, CacheServerMXBean.class, cacheServerON, "removeIndex", new Object[]{"indexName"},
         ResourceOperationCode.DESTROY_INDEX);
@@ -434,13 +429,13 @@ public class MBeanSecurityJUnitTest extends TestCase {
       }
       testObject(proxy, methodName, args, true);
       TestAccessControl.grantResourceOp(USER, opCode);
-      Log.getLogWriter().info("Grant opCode " + opCode);
+      logger.info("Grant opCode " + opCode);
       testObject(proxy, methodName, args, false);
       boolean removed = TestAccessControl.revokeResourceOp(USER, opCode);
       if (!removed)
         fail("Fail to removed opCode " + opCode);
       else
-        Log.getLogWriter().info("Revoke opCode " + opCode);
+        logger.info("Revoke opCode " + opCode);
 
     }
   }
@@ -519,11 +514,11 @@ public class MBeanSecurityJUnitTest extends TestCase {
       }
     }
     try {
-      Log.getLogWriter().info("Invoking method " + methodName);
+      logger.info("Invoking method " + methodName);
       mt.invoke(proxy, args);
       if (securityExceptionExpected)
         fail("Expected call to method " + methodName + " was expected to fail with security
exception");
-      Log.getLogWriter().info("Successfully Invoked method " + methodName);
+      logger.info("Successfully Invoked method " + methodName);
     } catch (IllegalAccessException e) {
       error("UnExpected error ", e);
       fail(e.getMessage());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9fdc8bcd/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestAccessControl.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestAccessControl.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestAccessControl.java
index e777b0c..5c9971c 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestAccessControl.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestAccessControl.java
@@ -1,6 +1,6 @@
 package com.gemstone.gemfire.management.internal.security;
 
-import hydra.Log;
+
 
 import java.security.Principal;
 import java.util.HashMap;
@@ -9,16 +9,20 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.logging.log4j.Logger;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.operations.OperationContext;
 import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
 import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.management.internal.security.ResourceOperationContext.ResourceOperationCode;
 import com.gemstone.gemfire.security.AccessControl;
 import com.gemstone.gemfire.security.NotAuthorizedException;
 
 public class TestAccessControl implements AccessControl {
   
+  private static Logger logger = LogService.getLogger();
   private Principal principal=null;
   
   public static Map<String,Set<ResourceOperationCode>> resourceOpCodeMap = new
HashMap<String,Set<ResourceOperationCode>>();
@@ -52,7 +56,7 @@ public class TestAccessControl implements AccessControl {
     boolean removed = list.remove(code);
 
     if (!removed) {
-      Log.getLogWriter().warning("Code " + code + " was not found for REVOKE access");
+      logger.warn("Code " + code + " was not found for REVOKE access");
     }
     return removed;
   }
@@ -61,7 +65,7 @@ public class TestAccessControl implements AccessControl {
     Set<ResourceOperationCode> list = resourceOpCodeMap.get(user);
     boolean removed = list.remove(code);
     if (!removed) {
-      Log.getLogWriter().warning("Code " + code + " was not found for REVOKE access");
+      logger.warn("Code " + code + " was not found for REVOKE access");
     }
     return removed;
   }
@@ -82,17 +86,17 @@ public class TestAccessControl implements AccessControl {
 
   @Override
   public boolean authorizeOperation(String regionName, OperationContext context) {    
-    Log.getLogWriter().info("Context Received " + context);
-    Log.getLogWriter().info("Principal " + principal.getName());    
+    logger.info("Context Received " + context);
+    logger.info("Principal " + principal.getName());    
     boolean flag = false;
     if (!context.getOperationCode().equals(OperationCode.RESOURCE)) {
       if (opCodeMap.containsKey(principal.getName())) {
         Set<OperationCode> codes = opCodeMap.get(principal.getName());
         for (OperationCode code : codes) {
-          Log.getLogWriter().info("Checking OpCode=" + code);
+          logger.info("Checking OpCode=" + code);
           flag = code.equals(context.getOperationCode());
           if (flag) {
-            Log.getLogWriter().info("For Principal " + principal.getName() + " Found Granted
CacheOp=" + code);
+            logger.info("For Principal " + principal.getName() + " Found Granted CacheOp="
+ code);
             break;
           }
         }
@@ -107,21 +111,21 @@ public class TestAccessControl implements AccessControl {
         ResourceOperationContext ctx = (ResourceOperationContext) context;
         flag = false;
         for (ResourceOperationCode code : codes) {
-          Log.getLogWriter().info("Checking ResourceOpCode=" + code);
+          logger.info("Checking ResourceOpCode=" + code);
           flag = code.allowedOp(ctx.getResourceOperationCode());
           if (flag) {
-            Log.getLogWriter().info("For Principal " + principal.getName() + " Found Granted
ResourceOp=" + code);
+            logger.info("For Principal " + principal.getName() + " Found Granted ResourceOp="
+ code);
             return true;
           }
         }
-        Log.getLogWriter().info("For Principal " + principal.getName() + " authorizeOperation
failed");
+        logger.info("For Principal " + principal.getName() + " authorizeOperation failed");
         return false;
       } else {
-        Log.getLogWriter().info("For Principal " + principal.getName() + " authorizeOperation
failed");
+        logger.info("For Principal " + principal.getName() + " authorizeOperation failed");
         return false;
       }
     }
-    Log.getLogWriter().info("For Principal " + principal.getName() + " authorizeOperation
failed");
+    logger.info("For Principal " + principal.getName() + " authorizeOperation failed");
     return false;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9fdc8bcd/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestAuthenticator.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestAuthenticator.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestAuthenticator.java
index 0eae45f..ca450c3 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestAuthenticator.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestAuthenticator.java
@@ -1,20 +1,22 @@
 package com.gemstone.gemfire.management.internal.security;
 
-import hydra.Log;
-
 import java.security.Principal;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.logging.log4j.Logger;
+
 import com.gemstone.gemfire.LogWriter;
 import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.management.internal.security.ResourceOperationJUnit.TestUsernamePrincipal;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.Authenticator;
 
 public class TestAuthenticator implements Authenticator {
   
+  private static Logger logger = LogService.getLogger();
   public static Map<String,String> userRepo = new HashMap<String,String>();
   
   public static void addUser(String user, String password) {
@@ -41,7 +43,7 @@ public class TestAuthenticator implements Authenticator {
     String user = props.getProperty(ResourceConstants.USER_NAME);
     String pwd = props.getProperty(ResourceConstants.PASSWORD);
     if (user != null && userRepo.containsKey(user) && pwd != null &&
pwd.equals(userRepo.get(user))) {
-      Log.getLogWriter().info("Authentication successful!! for " + user);
+      logger.info("Authentication successful!! for " + user);
       return new TestUsernamePrincipal(user);
     } else
       throw new AuthenticationFailedException("Wrong username/password");


Mime
View raw message