geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ash...@apache.org
Subject [03/15] incubator-geode git commit: GEODE-429: Remove hdfsStore gfsh commands
Date Wed, 21 Oct 2015 15:58:50 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/HDFSStoreCommandsController.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/HDFSStoreCommandsController.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/HDFSStoreCommandsController.java
deleted file mode 100644
index c182edd..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/HDFSStoreCommandsController.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*=========================================================================
- * Copyright (c) 2010-2014 Pivotal Software, Inc. All Rights Reserved.
- * This product is protected by U.S. and international copyright
- * and intellectual property laws. Pivotal products are covered by
- * one or more patents listed at http://www.pivotal.io/patents.
- *=========================================================================
- */
-package com.gemstone.gemfire.management.internal.web.controllers;
-
-import org.springframework.shell.core.annotation.CliOption;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import com.gemstone.gemfire.internal.lang.StringUtils;
-import com.gemstone.gemfire.management.cli.CliMetaData;
-import com.gemstone.gemfire.management.cli.ConverterHint;
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
-
-/**
- * The HDFSStoreCommandsController class implements GemFire Management REST API web service endpoints for the
- * Gfsh Hdfs Store Commands.
- * <p/>
- * @author Namrata Thanvi
- * @see com.gemstone.gemfire.management.internal.cli.commands.HDFSStoreCommands
- * @see com.gemstone.gemfire.management.internal.web.controllers.AbstractCommandsController
- * @see org.springframework.stereotype.Controller
- * @see org.springframework.web.bind.annotation.PathVariable
- * @see org.springframework.web.bind.annotation.RequestMapping
- * @see org.springframework.web.bind.annotation.RequestMethod
- * @see org.springframework.web.bind.annotation.RequestParam
- * @see org.springframework.web.bind.annotation.ResponseBody
- * @since 9.0
- */
-@Controller("hdfsStoreController")
-@RequestMapping(AbstractCommandsController.REST_API_VERSION)
-@SuppressWarnings("unused")
-public class HDFSStoreCommandsController extends AbstractCommandsController {
-  @RequestMapping(method = RequestMethod.GET, value = "/hdfsstores")
-  @ResponseBody
-  public String listHDFSStores() {
-    String my= processCommand(CliStrings.LIST_HDFS_STORE);
-    return my;
-  }
-  
-  @RequestMapping(method = RequestMethod.POST, value = "/hdfsstores")
-  @ResponseBody
-  public String createHdfsStore(
-		  @RequestParam(CliStrings.CREATE_HDFS_STORE__NAME) final String storeName,		  
-		  @RequestParam(value = CliStrings.CREATE_HDFS_STORE__NAMENODE, required=false) final String  namenode,
-		  @RequestParam(value = CliStrings.CREATE_HDFS_STORE__HOMEDIR, required=false) final String  homedir,
-		  @RequestParam(value = CliStrings.CREATE_HDFS_STORE__BATCHSIZE,required=false) final Integer batchSize,                    
-		  @RequestParam(value = CliStrings.CREATE_HDFS_STORE__BATCHINTERVAL, required=false) final Integer batchInterval,          
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__READCACHESIZE, required=false) final Float readCachesize,
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__DISPATCHERTHREADS, required=false) final Integer dispatcherThreads,
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__MAXMEMORY, required=false) final Integer maxMemory,
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__BUFFERPERSISTENT, required=false) final Boolean persistence,
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__SYNCDISKWRITE, required=false) final Boolean  synchronousDiskWrite,                    
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__DISKSTORENAME, required=false) final String diskStoreName,
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__MINORCOMPACT, required=false) final Boolean minorCompaction,
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__MINORCOMPACTIONTHREADS, required=false) final Integer minorCompactionThreads,
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__MAJORCOMPACT, required=false) final Boolean majorCompact,
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__MAJORCOMPACTINTERVAL, required=false) final Integer majorCompactionInterval,
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__MAJORCOMPACTIONTHREADS, required=false) final Integer majorCompactionThreads,
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__PURGEINTERVAL, required=false) final Integer purgeInterval,
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__WRITEONLYFILESIZE, required=false) final Integer writeOnlyFileSize,
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__FILEROLLOVERINTERVAL, required=false) final Integer fileRolloverInterval,
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__CLIENTCONFIGFILE, required=false) final String clientConfigFile,
-          @RequestParam(value = CliStrings.CREATE_HDFS_STORE__GROUP, required = false) final String[] groups)
-  {
-		CommandStringBuilder command = new CommandStringBuilder(CliStrings.CREATE_HDFS_STORE);
-
-		command.addOption(CliStrings.CREATE_HDFS_STORE__NAME, storeName);
-		
-		if (hasValue(namenode))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__NAMENODE, namenode);
-		
-		if (hasValue(homedir))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__HOMEDIR, homedir);
-		
-		if (hasValue(batchSize))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__BATCHSIZE, String.valueOf(batchSize));
-		
-		if (hasValue(batchInterval))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__BATCHINTERVAL, String.valueOf(batchInterval));
-		
-		if (hasValue(readCachesize))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__READCACHESIZE, String.valueOf(readCachesize));
-		
-		if (hasValue(dispatcherThreads))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__DISPATCHERTHREADS, String.valueOf(dispatcherThreads));
-		
-		if (hasValue(maxMemory))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__MAXMEMORY,String.valueOf(maxMemory));
-		
-		if (hasValue(persistence))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__BUFFERPERSISTENT,String.valueOf(Boolean.TRUE.equals(persistence)));
-		
-		if (hasValue(synchronousDiskWrite))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__SYNCDISKWRITE,String.valueOf(Boolean.TRUE.equals(synchronousDiskWrite)));
-		
-		if (hasValue(diskStoreName))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__DISKSTORENAME,String.valueOf(diskStoreName));
-		
-		if (hasValue(minorCompaction))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__MINORCOMPACT,String.valueOf(Boolean.TRUE.equals(minorCompaction)));
-		
-		if (hasValue(minorCompactionThreads))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__MINORCOMPACTIONTHREADS,String.valueOf(minorCompactionThreads));
-		
-		if (hasValue(majorCompact))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__MAJORCOMPACT,String.valueOf(Boolean.TRUE.equals(majorCompact)));
-		
-		if (hasValue(majorCompactionInterval))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__MAJORCOMPACTINTERVAL,String.valueOf(majorCompactionInterval));
-		
-		if (hasValue(majorCompactionThreads))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__MAJORCOMPACTIONTHREADS,String.valueOf(majorCompactionThreads));
-		
-		if (hasValue(purgeInterval))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__PURGEINTERVAL,String.valueOf(purgeInterval));
-		
-		if (hasValue(writeOnlyFileSize))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__WRITEONLYFILESIZE,String.valueOf(writeOnlyFileSize));
-		
-		if (hasValue(fileRolloverInterval))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__FILEROLLOVERINTERVAL,String.valueOf(fileRolloverInterval));
-		
-		if (hasValue(clientConfigFile))
-			command.addOption(CliStrings.CREATE_HDFS_STORE__CLIENTCONFIGFILE,String.valueOf(clientConfigFile));		
-
-		if (hasValue(groups)) {
-			command.addOption(CliStrings.CREATE_HDFS_STORE__GROUP,StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
-		}
-
-		return processCommand(command.toString());
-  }  
-  
-  @RequestMapping(method = RequestMethod.GET, value = "/hdfsstores/{name}")
-  @ResponseBody
-  public String describeHDFSStore(
-		  @PathVariable("name") final String hdfsStoreName,
-          @RequestParam(CliStrings.DESCRIBE_HDFS_STORE__MEMBER) final String memberNameId)
-  {	  
-    CommandStringBuilder command = new CommandStringBuilder(CliStrings.DESCRIBE_HDFS_STORE);
-    command.addOption(CliStrings.DESCRIBE_HDFS_STORE__NAME, decode(hdfsStoreName));
-    command.addOption(CliStrings.DESCRIBE_HDFS_STORE__MEMBER, memberNameId);    
-    return processCommand(command.toString());
-  }  
-  
-  @RequestMapping(method = RequestMethod.PUT, value = "/hdfsstores/{name}")
-  @ResponseBody
-  public String alterHdfsStore(
-		  @PathVariable("name") final String hdfsStoreName,	  								
-		  @RequestParam(value = CliStrings.ALTER_HDFS_STORE__BATCHSIZE, required=false) final Integer batchSize,                                    				                                
-		  @RequestParam(value = CliStrings.ALTER_HDFS_STORE__BATCHINTERVAL, required=false) final Integer batchInterval,
-          @RequestParam(value = CliStrings.ALTER_HDFS_STORE__MINORCOMPACT, required=false) final Boolean minorCompaction,
-          @RequestParam(value = CliStrings.ALTER_HDFS_STORE__MINORCOMPACTIONTHREADS, required=false) final Integer minorCompactionThreads,
-          @RequestParam(value = CliStrings.ALTER_HDFS_STORE__MAJORCOMPACT, required=false) final Boolean majorCompact,
-          @RequestParam(value = CliStrings.ALTER_HDFS_STORE__MAJORCOMPACTINTERVAL, required=false) final Integer majorCompactionInterval,
-          @RequestParam(value = CliStrings.ALTER_HDFS_STORE__MAJORCOMPACTIONTHREADS, required=false) final Integer majorCompactionThreads,
-          @RequestParam(value = CliStrings.ALTER_HDFS_STORE__PURGEINTERVAL, required=false) final Integer purgeInterval,
-          @RequestParam(value = CliStrings.ALTER_HDFS_STORE__WRITEONLYFILESIZE, required=false) final Integer writeOnlyFileSize,
-          @RequestParam(value = CliStrings.ALTER_HDFS_STORE__FILEROLLOVERINTERVAL, required=false) final Integer fileRolloverInterval,
-          @RequestParam(value = CliStrings.ALTER_HDFS_STORE__GROUP, required = false) final String[] groups)
-  {
-	  CommandStringBuilder command = new CommandStringBuilder(CliStrings.ALTER_HDFS_STORE);
-
-		command.addOption(CliStrings.ALTER_HDFS_STORE__NAME, hdfsStoreName);
-		
-		
-		if (hasValue(batchSize))
-			command.addOption(CliStrings.ALTER_HDFS_STORE__BATCHSIZE, String.valueOf(batchSize));
-		
-		if (hasValue(batchInterval))
-			command.addOption(CliStrings.ALTER_HDFS_STORE__BATCHINTERVAL, String.valueOf(batchInterval));	
-		
-		if (hasValue(minorCompaction))
-			command.addOption(CliStrings.ALTER_HDFS_STORE__MINORCOMPACT,String.valueOf(Boolean.TRUE.equals(minorCompaction)));
-		
-		if (hasValue(minorCompactionThreads))
-			command.addOption(CliStrings.ALTER_HDFS_STORE__MINORCOMPACTIONTHREADS,String.valueOf(minorCompactionThreads));
-		
-		if (hasValue(majorCompact))
-			command.addOption(CliStrings.ALTER_HDFS_STORE__MAJORCOMPACT,String.valueOf(Boolean.TRUE.equals(majorCompact)));
-		
-		if (hasValue(majorCompactionInterval))
-			command.addOption(CliStrings.ALTER_HDFS_STORE__MAJORCOMPACTINTERVAL,String.valueOf(majorCompactionInterval));
-		
-		if (hasValue(majorCompactionThreads))
-			command.addOption(CliStrings.ALTER_HDFS_STORE__MAJORCOMPACTIONTHREADS,String.valueOf(majorCompactionThreads));
-		
-		if (hasValue(purgeInterval))
-			command.addOption(CliStrings.ALTER_HDFS_STORE__PURGEINTERVAL,String.valueOf(purgeInterval));
-		
-		if (hasValue(writeOnlyFileSize))
-			command.addOption(CliStrings.ALTER_HDFS_STORE__WRITEONLYFILESIZE,String.valueOf(writeOnlyFileSize));
-		
-		if (hasValue(fileRolloverInterval))
-			command.addOption(CliStrings.ALTER_HDFS_STORE__FILEROLLOVERINTERVAL,String.valueOf(fileRolloverInterval));
-		
-		if (hasValue(groups)) {
-			command.addOption(CliStrings.ALTER_HDFS_STORE__GROUP,StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
-		}
-
-		return processCommand(command.toString());
-  }
-  
-  @RequestMapping(method = RequestMethod.DELETE, value = "/hdfsstores/{name}")
-  @ResponseBody
-  public String destroyHDFSStore(
-		  @PathVariable("name") final String hdfsStoreName,
-          @RequestParam(value = CliStrings.DESTROY_HDFS_STORE__GROUP, required = false) final String[] groups)
-  {
-    CommandStringBuilder command = new CommandStringBuilder(CliStrings.DESTROY_HDFS_STORE);
-    command.addOption(CliStrings.DESTROY_HDFS_STORE__NAME, decode(hdfsStoreName));
-
-    if (hasValue(groups)) {
-      command.addOption(CliStrings.DESTROY_HDFS_STORE__GROUP, StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
-    }
-    return processCommand(command.toString());
-    
-  }  
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/ShellCommandsController.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/ShellCommandsController.java b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/ShellCommandsController.java
index ef4c49f..46ed1a6 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/ShellCommandsController.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/ShellCommandsController.java
@@ -9,21 +9,12 @@ package com.gemstone.gemfire.management.internal.web.controllers;
 
 import java.io.IOException;
 import java.util.Set;
+
 import javax.management.AttributeNotFoundException;
 import javax.management.InstanceNotFoundException;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
-import com.gemstone.gemfire.internal.GemFireVersion;
-import com.gemstone.gemfire.internal.lang.ObjectUtils;
-import com.gemstone.gemfire.internal.lang.StringUtils;
-import com.gemstone.gemfire.internal.util.IOUtils;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.web.domain.Link;
-import com.gemstone.gemfire.management.internal.web.domain.LinkIndex;
-import com.gemstone.gemfire.management.internal.web.domain.QueryParameterSource;
-import com.gemstone.gemfire.management.internal.web.http.HttpMethod;
-
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
@@ -34,6 +25,16 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 
+import com.gemstone.gemfire.internal.GemFireVersion;
+import com.gemstone.gemfire.internal.lang.ObjectUtils;
+import com.gemstone.gemfire.internal.lang.StringUtils;
+import com.gemstone.gemfire.internal.util.IOUtils;
+import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
+import com.gemstone.gemfire.management.internal.web.domain.Link;
+import com.gemstone.gemfire.management.internal.web.domain.LinkIndex;
+import com.gemstone.gemfire.management.internal.web.domain.QueryParameterSource;
+import com.gemstone.gemfire.management.internal.web.http.HttpMethod;
+
 /**
  * The ShellCommandsController class implements GemFire REST API calls for Gfsh Shell Commands.
  * 
@@ -249,12 +250,7 @@ public class ShellCommandsController extends AbstractCommandsController {
       .add(new Link(CliStrings.STATUS_GATEWAYSENDER, toUri("/gateways/senders/{id}")))
       .add(new Link(CliStrings.STOP_GATEWAYRECEIVER, toUri("/gateways/receivers?op=stop"), HttpMethod.POST))
       .add(new Link(CliStrings.STOP_GATEWAYSENDER, toUri("/gateways/senders/{id}?op=stop"), HttpMethod.POST))
-       // HDFS Store Commands
-       .add(new Link(CliStrings.LIST_HDFS_STORE, toUri("/hdfsstores"), HttpMethod.GET))
-       .add(new Link(CliStrings.DESCRIBE_HDFS_STORE, toUri("/hdfsstores/{name}"), HttpMethod.GET))
-       .add(new Link(CliStrings.CREATE_HDFS_STORE, toUri("/hdfsstores"), HttpMethod.POST))
-       .add(new Link(CliStrings.DESTROY_HDFS_STORE, toUri("/hdfsstores/{name}"), HttpMethod.DELETE))
-       .add(new Link(CliStrings.ALTER_HDFS_STORE,   toUri("/hdfsstores/{name}"), HttpMethod.PUT));
+      ;
   }
 
   @RequestMapping(method = { RequestMethod.GET, RequestMethod.HEAD }, value = "/ping")

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HDFSStoreCommandsJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HDFSStoreCommandsJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HDFSStoreCommandsJUnitTest.java
deleted file mode 100644
index af47138..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HDFSStoreCommandsJUnitTest.java
+++ /dev/null
@@ -1,838 +0,0 @@
-/*
- * =========================================================================
- *  Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
- *  This product is protected by U.S. and international copyright
- *  and intellectual property laws. Pivotal products are covered by
- *  more patents listed at http://www.pivotal.io/patents.
- * ========================================================================
- */
-
-package com.gemstone.gemfire.management.internal.cli.commands;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.lib.legacy.ClassImposteriser;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.execute.Execution;
-import com.gemstone.gemfire.cache.execute.FunctionInvocationTargetException;
-import com.gemstone.gemfire.cache.execute.ResultCollector;
-import com.gemstone.gemfire.cache.hdfs.HDFSStore;
-import com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreConfigHolder;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.internal.cache.execute.AbstractExecution;
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.cli.Result.Status;
-import com.gemstone.gemfire.management.internal.cli.functions.AlterHDFSStoreFunction;
-import com.gemstone.gemfire.management.internal.cli.functions.CliFunctionResult;
-import com.gemstone.gemfire.management.internal.cli.functions.CreateHDFSStoreFunction;
-import com.gemstone.gemfire.management.internal.cli.functions.DescribeHDFSStoreFunction;
-import com.gemstone.gemfire.management.internal.cli.functions.DestroyHDFSStoreFunction;
-import com.gemstone.gemfire.management.internal.cli.functions.ListHDFSStoresFunction;
-import com.gemstone.gemfire.management.internal.cli.functions.ListHDFSStoresFunction.HdfsStoreDetails;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.json.GfJsonObject;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.result.InfoResultData;
-import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
-import com.gemstone.gemfire.management.internal.cli.util.HDFSStoreNotFoundException;
-import com.gemstone.gemfire.management.internal.cli.util.MemberNotFoundException;
-import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity;
-import com.gemstone.gemfire.test.junit.categories.HoplogTest;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-/**
- * The HDFSStoreCommandsJUnitTest class is a test suite of test cases testing
- * the contract and functionality of the HDFSStoreCommands class implementing
- * commands in the GemFire shell (gfsh) that access and modify hdfs stores in
- * GemFire. </p>
- * 
- * @author Namrata Thanvi
- * @see com.gemstone.gemfire.management.internal.cli.commands.HDFSStoreCommands
- * @see com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreConfigHolder
- * @see com.gemstone.gemfire.management.internal.cli.functions.DescribeHDFSStoreFunction
- * @see org.jmock.Expectations
- * @see org.jmock.Mockery
- * @see org.jmock.lib.legacy.ClassImposteriser
- * @see org.junit.Assert
- * @see org.junit.Test
- */
-@Category({IntegrationTest.class, HoplogTest.class})
-public class HDFSStoreCommandsJUnitTest {
-
-  private Mockery mockContext;
-
-  @Before
-  public void setUp() {
-    mockContext = new Mockery() {
-      {
-        setImposteriser(ClassImposteriser.INSTANCE);
-      }
-    };
-  }
-
-  @After
-  public void tearDown() {
-    mockContext.assertIsSatisfied();
-    mockContext = null;
-  }
-
-  @Test
-  public void testGetHDFSStoreDescription() {
-    final String hdfsStoreName = "mockHdfsStore";
-    final String memberId = "mockMember";
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final Execution mockFunctionExecutor = mockContext.mock(Execution.class, "Function Executor");
-    final ResultCollector mockResultCollector = mockContext.mock(ResultCollector.class, "ResultCollector");
-
-    final HDFSStoreConfigHolder expectedHdfsStoreConfigHolder = createMockHDFSStoreConfigHolder(mockContext, "hdfsStoreName",
-        "hdfs://localhost:9000", "testDir", 1024, 20, .25f, null, 40, 40, null, false, 0, 2048, true, true, true, 40,
-        40, 40, 800);
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockMember).getName();
-        will(returnValue(null));
-        oneOf(mockMember).getId();
-        will(returnValue(memberId));
-        oneOf(mockFunctionExecutor).withArgs(with(equal(hdfsStoreName)));
-        will(returnValue(mockFunctionExecutor));
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(DescribeHDFSStoreFunction.class)));
-        will(returnValue(mockResultCollector));
-        oneOf(mockResultCollector).getResult();
-        will(returnValue(Arrays.asList(expectedHdfsStoreConfigHolder)));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockMember, mockFunctionExecutor);
-
-    final HDFSStoreConfigHolder actualHdfsStoreConfigHolder = commands.getHDFSStoreDescription(memberId, hdfsStoreName);
-
-    assertNotNull(actualHdfsStoreConfigHolder);
-    assertEquals(expectedHdfsStoreConfigHolder, actualHdfsStoreConfigHolder);
-  }
-
-  @Test(expected = MemberNotFoundException.class)
-  public void testGetHDFSStoreDescriptionThrowsMemberNotFoundException() {
-    final String hdfsStoreName = "mockHdfsStore";
-    final String memberId = "mockMember";
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockMember).getName();
-        will(returnValue(null));
-        oneOf(mockMember).getId();
-        will(returnValue("testMember"));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockMember, null);
-
-    try {
-      commands.getHDFSStoreDescription(memberId, hdfsStoreName);
-    } catch (MemberNotFoundException expected) {
-      assertEquals(CliStrings.format(CliStrings.MEMBER_NOT_FOUND_ERROR_MESSAGE, memberId), expected.getMessage());
-      throw expected;
-    }
-  }
-
-  @Test(expected = HDFSStoreNotFoundException.class)
-  public void testGetHDFSStoreDescriptionThrowsResourceNotFoundException() {
-    final String hdfsStoreName = "mockHdfsStore";
-    final String memberId = "mockMember";
-
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final Execution mockFunctionExecutor = mockContext.mock(Execution.class, "Function Executor");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockMember).getName();
-        will(returnValue(null));
-        oneOf(mockMember).getId();
-        will(returnValue(memberId));
-        oneOf(mockFunctionExecutor).withArgs(with(equal(hdfsStoreName)));
-        will(returnValue(mockFunctionExecutor));
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(DescribeHDFSStoreFunction.class)));
-        will(throwException(new HDFSStoreNotFoundException("expected")));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockMember, mockFunctionExecutor);
-
-    try {
-      commands.getHDFSStoreDescription(memberId, hdfsStoreName);
-    } catch (HDFSStoreNotFoundException expected) {
-      assertEquals("expected", expected.getMessage());
-      throw expected;
-    }
-  }
-
-  @Test(expected = RuntimeException.class)
-  public void testGetHDFSStoreDescriptionThrowsRuntimeException() {
-    final String hdfsStoreName = "mockHdfsStore";
-    final String memberId = "mockMember";
-
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-
-    final Execution mockFunctionExecutor = mockContext.mock(Execution.class, "Function Executor");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockMember).getName();
-        will(returnValue(null));
-        oneOf(mockMember).getId();
-        will(returnValue(memberId));
-        oneOf(mockFunctionExecutor).withArgs(with(equal(hdfsStoreName)));
-        will(returnValue(mockFunctionExecutor));
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(DescribeHDFSStoreFunction.class)));
-        will(throwException(new RuntimeException("expected")));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockMember, mockFunctionExecutor);
-
-    try {
-      commands.getHDFSStoreDescription(memberId, hdfsStoreName);
-    } catch (RuntimeException expected) {
-      assertEquals("expected", expected.getMessage());
-      throw expected;
-    }
-  }
-
-  @Test(expected = RuntimeException.class)
-  public void testGetHDFSStoreDescriptionWithInvalidFunctionResultReturnType() {
-    final String hdfsStoreName = "mockHDFSStore";
-    final String memberId = "mockMember";
-
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-
-    final Execution mockFunctionExecutor = mockContext.mock(Execution.class, "Function Executor");
-
-    final ResultCollector mockResultCollector = mockContext.mock(ResultCollector.class, "ResultCollector");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockMember).getName();
-        will(returnValue(null));
-        oneOf(mockMember).getId();
-        will(returnValue(memberId));
-        oneOf(mockFunctionExecutor).withArgs(with(equal(hdfsStoreName)));
-        will(returnValue(mockFunctionExecutor));
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(DescribeHDFSStoreFunction.class)));
-        will(returnValue(mockResultCollector));
-        oneOf(mockResultCollector).getResult();
-        will(returnValue(Arrays.asList(new Object())));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockMember, mockFunctionExecutor);
-
-    try {
-      commands.getHDFSStoreDescription(memberId, hdfsStoreName);
-    } catch (RuntimeException expected) {
-      assertEquals(CliStrings.format(CliStrings.UNEXPECTED_RETURN_TYPE_EXECUTING_COMMAND_ERROR_MESSAGE, Object.class
-          .getName(), CliStrings.DESCRIBE_HDFS_STORE), expected.getMessage());
-      assertNull(expected.getCause());
-      throw expected;
-    }
-  }
-
-  @Test
-  public void testGetHDFSStoreListing() {
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-
-    final DistributedMember mockDistributedMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-
-    final AbstractExecution mockFunctionExecutor = mockContext.mock(AbstractExecution.class, "Function Executor");
-
-    final ResultCollector mockResultCollector = mockContext.mock(ResultCollector.class, "ResultCollector");
-
-    final HDFSStoreConfigHolder expectedHdfsStoreConfigHolderOne = createMockHDFSStoreConfigHolder(mockContext, "hdfsStoreName1",
-        "hdfs://localhost:9000", "testDir", 1024, 20, .25f, null, 40, 40, null, false, 0, 2048, true, true, true, 40,
-        40, 40, 800);
-    final HDFSStoreConfigHolder expectedHdfsStoreConfigHolderTwo = createMockHDFSStoreConfigHolder(mockContext, "hdfsStoreName2",
-        "hdfs://localhost:9000", "testDir", 1024, 20, .25f, null, 40, 40, null, false, 0, 2048, true, true, true, 40,
-        40, 40, 800);
-    final HDFSStoreConfigHolder expectedHdfsStoreConfigHolderThree = createMockHDFSStoreConfigHolder(mockContext, "hdfsStoreName3",
-        "hdfs://localhost:9000", "testDir", 1024, 20, .25f, null, 40, 40, null, false, 0, 2048, true, true, true, 40,
-        40, 40, 800);
- 
-    
-    HdfsStoreDetails d1=new HdfsStoreDetails(expectedHdfsStoreConfigHolderOne.getName(), "member1", "member1");
-    HdfsStoreDetails d2=new HdfsStoreDetails(expectedHdfsStoreConfigHolderTwo.getName(), "member2", "member2");
-    HdfsStoreDetails d3=new HdfsStoreDetails(expectedHdfsStoreConfigHolderThree.getName(), "member3", "member3");
-    
-    final Set<HdfsStoreDetails> expectedHdfsStores = new HashSet<HdfsStoreDetails>();
-    expectedHdfsStores.add( d1);
-    expectedHdfsStores.add(d2 );    
-    expectedHdfsStores.add(d3);
-
-    final List<Object> results = new ArrayList<Object>();
-    results.add(expectedHdfsStores);
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockFunctionExecutor).setIgnoreDepartedMembers(with(equal(true)));
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(ListHDFSStoresFunction.class)));
-        will(returnValue(mockResultCollector));
-        oneOf(mockResultCollector).getResult();
-        will(returnValue(results));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockDistributedMember, mockFunctionExecutor);
-
-    final List<?> actualHdfsStores = commands.getHdfsStoreListing(commands.getNormalMembers(mockCache));
-
-    Assert.assertNotNull(actualHdfsStores);   
-    Assert.assertTrue(actualHdfsStores.contains(d1));
-    Assert.assertTrue(actualHdfsStores.contains(d2));
-    Assert.assertTrue(actualHdfsStores.contains(d3));
-  }
-
-  @Test(expected = RuntimeException.class)
-  public void testGetHDFSStoreListThrowsRuntimeException() {
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-    final DistributedMember mockDistributedMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final Execution mockFunctionExecutor = mockContext.mock(Execution.class, "Function Executor");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(ListHDFSStoresFunction.class)));
-        will(throwException(new RuntimeException("expected")));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockDistributedMember, mockFunctionExecutor);
-
-    try {
-      commands.getHdfsStoreListing(commands.getNormalMembers(mockCache));
-    } catch (RuntimeException expected) {
-      assertEquals("expected", expected.getMessage());
-      throw expected;
-    }
-  }
-
-  @Test
-  public void testGetHDFSStoreListReturnsFunctionInvocationTargetExceptionInResults() {
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-    final DistributedMember mockDistributedMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final AbstractExecution mockFunctionExecutor = mockContext.mock(AbstractExecution.class, "Function Executor");
-    final ResultCollector mockResultCollector = mockContext.mock(ResultCollector.class, "ResultCollector");
-
-    final HDFSStoreConfigHolder expectedHdfsStoreConfigHolder = createMockHDFSStoreConfigHolder(mockContext, "hdfsStoreName",
-        "hdfs://localhost:9000", "testDir", 1024, 20, .25f, null, 40, 40, null, false, 0, 2048, true, true, true, 40,
-        40, 40, 800);
-
-    final List<HdfsStoreDetails> expectedHdfsStores = Arrays.asList(new HdfsStoreDetails(
-        expectedHdfsStoreConfigHolder.getName(), "member1", "member1"));
-
-    final List<Object> results = new ArrayList<Object>();
-
-    results.add(expectedHdfsStores);
-    results.add(new FunctionInvocationTargetException("expected"));
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockFunctionExecutor).setIgnoreDepartedMembers(with(equal(true)));
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(ListHDFSStoresFunction.class)));
-        will(returnValue(mockResultCollector));
-        oneOf(mockResultCollector).getResult();
-        will(returnValue(results));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockDistributedMember, mockFunctionExecutor);
-
-    final List<HdfsStoreDetails> actualHdfsStores = commands.getHdfsStoreListing(commands
-        .getNormalMembers(mockCache));
-
-  }
-
-  @Test
-  public void testGetCreatedHDFSStore() throws JSONException {
-    final String hdfsStoreName = "mockHdfsStore";
-    final String memberId = "mockMember";
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final Execution mockFunctionExecutor = mockContext.mock(Execution.class, "Function Executor");
-    final ResultCollector mockResultCollector = mockContext.mock(ResultCollector.class, "ResultCollector");
-    XmlEntity xml = null;
-    final CliFunctionResult cliResult = new CliFunctionResult(memberId, xml, "Success");
-    // Need to fix the return value of this function
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockFunctionExecutor).withArgs(with(aNonNull(HDFSStoreConfigHolder.class)));
-        will(returnValue(mockFunctionExecutor));
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(CreateHDFSStoreFunction.class)));
-        will(returnValue(mockResultCollector));
-        oneOf(mockResultCollector).getResult();
-        will(returnValue(Arrays.asList(cliResult)));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockMember, mockFunctionExecutor);
-
-    final Result result = commands.getCreatedHdfsStore(null, hdfsStoreName, "hdfs://localhost:9000", "test", null, 20,
-        20, true, true, 100, 10000, "testStore", true, 10, true, .23F, 10, 10, 10, 10, 10);
-
-    assertNotNull(result);
-    assertEquals(Status.OK, result.getStatus());
-    TabularResultData resultData = (TabularResultData)((CommandResult)result).getResultData();
-    GfJsonObject jsonObject = resultData.getGfJsonObject().getJSONObject("content");
-    assertNotNull(jsonObject.get("Member"));
-    assertNotNull(jsonObject.get("Result"));
-
-    assertEquals(memberId, (((JSONArray)jsonObject.get("Member")).get(0)));
-    assertEquals("Success", (((JSONArray)jsonObject.get("Result")).get(0)));
-  }
-
-  @Test
-  public void testGetCreatedHDFSStoreWithThrowable() throws JSONException {
-    final String hdfsStoreName = "mockHdfsStore";
-    final String memberId = "mockMember";
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final Execution mockFunctionExecutor = mockContext.mock(Execution.class, "Function Executor");
-    final ResultCollector mockResultCollector = mockContext.mock(ResultCollector.class, "ResultCollector");
-    RuntimeException exception = new RuntimeException("Test Exception");
-
-    final CliFunctionResult cliResult = new CliFunctionResult(memberId, exception, null);
-    // Need to fix the return value of this function
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockFunctionExecutor).withArgs(with(aNonNull(HDFSStoreConfigHolder.class)));
-        will(returnValue(mockFunctionExecutor));
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(CreateHDFSStoreFunction.class)));
-        will(returnValue(mockResultCollector));
-        oneOf(mockResultCollector).getResult();
-        will(returnValue(Arrays.asList(cliResult)));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockMember, mockFunctionExecutor);
-
-    final Result result = commands.getCreatedHdfsStore(null, hdfsStoreName, "hdfs://localhost:9000", "test", null, 20,
-        20, true, true, 100, 10000, "testStore", true, 10, true, .23F, 10, 10, 10, 10, 10);
-
-    assertNotNull(result);
-    assertEquals(Status.ERROR, result.getStatus());
-
-    TabularResultData resultData = (TabularResultData)((CommandResult)result).getResultData();
-    GfJsonObject jsonObject = resultData.getGfJsonObject().getJSONObject("content");
-    assertNotNull(jsonObject.get("Member"));
-    assertNotNull(jsonObject.get("Result"));
-    assertEquals(memberId, (((JSONArray)jsonObject.get("Member")).get(0)));
-    assertEquals("ERROR: " + exception.getClass().getName() + ": " + exception.getMessage(), (((JSONArray)jsonObject
-        .get("Result")).get(0)));
-  }
-
-  @Test
-  public void testGetCreatedHDFSStoreWithCacheClosedException() throws JSONException {
-    final String hdfsStoreName = "mockHdfsStore";
-    final String memberId = "mockMember";
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final Execution mockFunctionExecutor = mockContext.mock(Execution.class, "Function Executor");
-    final ResultCollector mockResultCollector = mockContext.mock(ResultCollector.class, "ResultCollector");
-
-    final CliFunctionResult cliResult = new CliFunctionResult(memberId, false, null);
-    // Need to fix the return value of this function
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockFunctionExecutor).withArgs(with(aNonNull(HDFSStoreConfigHolder.class)));
-        will(returnValue(mockFunctionExecutor));
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(CreateHDFSStoreFunction.class)));
-        will(returnValue(mockResultCollector));
-        oneOf(mockResultCollector).getResult();
-        will(returnValue(Arrays.asList(cliResult)));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockMember, mockFunctionExecutor);
-
-    final Result result = commands.getCreatedHdfsStore(null, hdfsStoreName, "hdfs://localhost:9000", "test", null, 20,
-        20, true, true, 100, 10000, "testStore", true, 10, true, .23F, 10, 10, 10, 10, 10);
-
-    assertNotNull(result);
-    InfoResultData resultData = (InfoResultData)((CommandResult)result).getResultData();
-    GfJsonObject jsonObject = resultData.getGfJsonObject().getJSONObject("content");
-    assertNotNull(jsonObject.get("message"));
-
-    assertEquals("Unable to create hdfs store:" + hdfsStoreName, (((JSONArray)jsonObject.get("message")).get(0)));
-  }
-
-  @Test
-  public void testGetAlteredHDFSStore() throws JSONException {
-    final String hdfsStoreName = "mockHdfsStore";
-    final String memberId = "mockMember";
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final Execution mockFunctionExecutor = mockContext.mock(Execution.class, "Function Executor");
-    final ResultCollector mockResultCollector = mockContext.mock(ResultCollector.class, "ResultCollector");
-    XmlEntity xml = null;
-    final CliFunctionResult cliResult = new CliFunctionResult(memberId, xml, "Success");
-    // Need to fix the return value of this function
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockFunctionExecutor).withArgs(with(aNonNull(HDFSStoreConfigHolder.class)));
-        will(returnValue(mockFunctionExecutor));
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(AlterHDFSStoreFunction.class)));
-        will(returnValue(mockResultCollector));
-        oneOf(mockResultCollector).getResult();
-        will(returnValue(Arrays.asList(cliResult)));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockMember, mockFunctionExecutor);
-
-    final Result result = commands.getAlteredHDFSStore(null, hdfsStoreName, 100, 100, true, 100, true, 100, 100, 100,
-        100, 100);
-
-    assertNotNull(result);
-    assertEquals(Status.OK, result.getStatus());
-    TabularResultData resultData = (TabularResultData)((CommandResult)result).getResultData();
-    GfJsonObject jsonObject = resultData.getGfJsonObject().getJSONObject("content");
-    assertNotNull(jsonObject.get("Member"));
-    assertNotNull(jsonObject.get("Result"));
-
-    assertEquals(memberId, (((JSONArray)jsonObject.get("Member")).get(0)));
-    assertEquals("Success", (((JSONArray)jsonObject.get("Result")).get(0)));
-  }
-
-  @Test
-  public void testGetAlteredHDFSStoreWithThrowable() throws JSONException {
-    final String hdfsStoreName = "mockHdfsStore";
-    final String memberId = "mockMember";
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final Execution mockFunctionExecutor = mockContext.mock(Execution.class, "Function Executor");
-    final ResultCollector mockResultCollector = mockContext.mock(ResultCollector.class, "ResultCollector");
-    RuntimeException exception = new RuntimeException("Test Exception");
-    final CliFunctionResult cliResult = new CliFunctionResult(memberId, exception, "Success");
-    // Need to fix the return value of this function
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockFunctionExecutor).withArgs(with(aNonNull(HDFSStoreConfigHolder.class)));
-        will(returnValue(mockFunctionExecutor));
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(AlterHDFSStoreFunction.class)));
-        will(returnValue(mockResultCollector));
-        oneOf(mockResultCollector).getResult();
-        will(returnValue(Arrays.asList(cliResult)));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockMember, mockFunctionExecutor);
-
-    final Result result = commands.getAlteredHDFSStore(null, hdfsStoreName, 100, 100, true, 100, true, 100, 100, 100,
-        100, 100);
-
-    assertNotNull(result);
-    assertEquals(Status.ERROR, result.getStatus());
-    TabularResultData resultData = (TabularResultData)((CommandResult)result).getResultData();
-    GfJsonObject jsonObject = resultData.getGfJsonObject().getJSONObject("content");
-    assertNotNull(jsonObject.get("Member"));
-    assertNotNull(jsonObject.get("Result"));
-
-    assertEquals(memberId, (((JSONArray)jsonObject.get("Member")).get(0)));
-    assertEquals("ERROR: " + exception.getClass().getName() + ": " + exception.getMessage(), (((JSONArray)jsonObject
-        .get("Result")).get(0)));
-  }
-
-  @Test
-  public void testGetAlteredHDFSStoreWithCacheClosedException() throws JSONException {
-    final String hdfsStoreName = "mockHdfsStore";
-    final String memberId = "mockMember";
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final Execution mockFunctionExecutor = mockContext.mock(Execution.class, "Function Executor");
-    final ResultCollector mockResultCollector = mockContext.mock(ResultCollector.class, "ResultCollector");
-    final CliFunctionResult cliResult = new CliFunctionResult(memberId, false, null);
-    // Need to fix the return value of this function
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockFunctionExecutor).withArgs(with(aNonNull(HDFSStoreConfigHolder.class)));
-        will(returnValue(mockFunctionExecutor));
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(AlterHDFSStoreFunction.class)));
-        will(returnValue(mockResultCollector));
-        oneOf(mockResultCollector).getResult();
-        will(returnValue(Arrays.asList(cliResult)));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockMember, mockFunctionExecutor);
-
-    final Result result = commands.getAlteredHDFSStore(null, hdfsStoreName, 100, 100, true, 100, true, 100, 100, 100,
-        100, 100);
-
-    assertNotNull(result);
-    TabularResultData resultData = (TabularResultData)((CommandResult)result).getResultData();
-    JSONObject jsonObject = (JSONObject)resultData.getGfJsonObject().get("content");
-    assertEquals(0, jsonObject.length());
-  }
-
-  @Test
-  public void testDestroyStore() throws JSONException {
-    final String hdfsStoreName = "mockHdfsStore";
-    final String memberId = "mockMember";
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final Execution mockFunctionExecutor = mockContext.mock(Execution.class, "Function Executor");
-    final ResultCollector mockResultCollector = mockContext.mock(ResultCollector.class, "ResultCollector");
-    XmlEntity xml = null;
-    final CliFunctionResult cliResult = new CliFunctionResult(memberId, xml, "Success");
-    // Need to fix the return value of this function
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockFunctionExecutor).withArgs(hdfsStoreName);
-        will(returnValue(mockFunctionExecutor));
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(DestroyHDFSStoreFunction.class)));
-        will(returnValue(mockResultCollector));
-        oneOf(mockResultCollector).getResult();
-        will(returnValue(Arrays.asList(cliResult)));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockMember, mockFunctionExecutor);
-
-    final Result result = commands.destroyStore(hdfsStoreName, null);
-
-    assertNotNull(result);
-    assertEquals(Status.OK, result.getStatus());
-    TabularResultData resultData = (TabularResultData)((CommandResult)result).getResultData();
-    GfJsonObject jsonObject = resultData.getGfJsonObject().getJSONObject("content");
-    assertNotNull(jsonObject.get("Member"));
-    assertNotNull(jsonObject.get("Result"));
-
-    assertEquals(memberId, (((JSONArray)jsonObject.get("Member")).get(0)));
-    assertEquals("Success", (((JSONArray)jsonObject.get("Result")).get(0)));
-  }
-
-  @Test
-  public void testDestroyStoreWithThrowable() throws JSONException {
-    final String hdfsStoreName = "mockHdfsStore";
-    final String memberId = "mockMember";
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final Execution mockFunctionExecutor = mockContext.mock(Execution.class, "Function Executor");
-    final ResultCollector mockResultCollector = mockContext.mock(ResultCollector.class, "ResultCollector");
-    RuntimeException exception = new RuntimeException("Test Exception");
-    final CliFunctionResult cliResult = new CliFunctionResult(memberId, exception, "Success");
-    // Need to fix the return value of this function
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockFunctionExecutor).withArgs(hdfsStoreName);
-        will(returnValue(mockFunctionExecutor));
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(DestroyHDFSStoreFunction.class)));
-        will(returnValue(mockResultCollector));
-        oneOf(mockResultCollector).getResult();
-        will(returnValue(Arrays.asList(cliResult)));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockMember, mockFunctionExecutor);
-
-    final Result result = commands.destroyHdfstore(hdfsStoreName, null);
-
-    assertNotNull(result);
-    assertEquals(Status.ERROR, result.getStatus());
-    TabularResultData resultData = (TabularResultData)((CommandResult)result).getResultData();
-    GfJsonObject jsonObject = resultData.getGfJsonObject().getJSONObject("content");
-    assertNotNull(jsonObject.get("Member"));
-    assertNotNull(jsonObject.get("Result"));
-
-    assertEquals(memberId, (((JSONArray)jsonObject.get("Member")).get(0)));
-    assertEquals("ERROR: " + exception.getClass().getName() + ": " + exception.getMessage(), (((JSONArray)jsonObject
-        .get("Result")).get(0)));
-  }
-
-  @Test
-  public void testDestroyStoreWithCacheClosedException() throws JSONException {
-    final String hdfsStoreName = "mockHdfsStore";
-    final String memberId = "mockMember";
-    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final Execution mockFunctionExecutor = mockContext.mock(Execution.class, "Function Executor");
-    final ResultCollector mockResultCollector = mockContext.mock(ResultCollector.class, "ResultCollector");
-    final CliFunctionResult cliResult = new CliFunctionResult(memberId, false, null);
-    // Need to fix the return value of this function
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockFunctionExecutor).withArgs(hdfsStoreName);
-        will(returnValue(mockFunctionExecutor));
-        oneOf(mockFunctionExecutor).execute(with(aNonNull(DestroyHDFSStoreFunction.class)));
-        will(returnValue(mockResultCollector));
-        oneOf(mockResultCollector).getResult();
-        will(returnValue(Arrays.asList(cliResult)));
-      }
-    });
-
-    final HDFSStoreCommands commands = new TestHDFSStoreCommands(mockCache, mockMember, mockFunctionExecutor);
-
-    final Result result = commands.destroyHdfstore(hdfsStoreName, null);
-
-    assertNotNull(result);
-
-    assertNotNull(result);
-    InfoResultData resultData = (InfoResultData)((CommandResult)result).getResultData();
-    GfJsonObject jsonObject = resultData.getGfJsonObject().getJSONObject("content");
-    assertNotNull(jsonObject.get("message"));
-
-    assertEquals("No matching hdfs stores found.", (((JSONArray)jsonObject.get("message")).get(0)));
-  }
-
-  public static HDFSStoreConfigHolder createMockHDFSStoreConfigHolder(Mockery mockContext, final String storeName, final String namenode,
-      final String homeDir, final int maxFileSize, final int fileRolloverInterval, final float blockCachesize,
-      final String clientConfigFile, final int batchSize, final int batchInterval, final String diskStoreName,
-      final boolean syncDiskwrite, final int dispatcherThreads, final int maxMemory, final boolean bufferPersistent,
-      final boolean minorCompact, final boolean majorCompact, final int majorCompactionInterval,
-      final int majorCompactionThreads, final int minorCompactionThreads, final int purgeInterval) {
-
-    HDFSStoreConfigHolder mockHdfsStore = mockContext.mock(HDFSStoreConfigHolder.class, "HDFSStoreConfigHolder_"
-        + storeName);
-
-    createMockStore(mockContext, mockHdfsStore, storeName, namenode, homeDir, maxFileSize, fileRolloverInterval,
-        minorCompact, minorCompactionThreads, majorCompact, majorCompactionThreads, majorCompactionInterval,
-        purgeInterval, blockCachesize, clientConfigFile, batchSize,
-        batchInterval, diskStoreName, syncDiskwrite, dispatcherThreads, maxMemory, bufferPersistent);
-    return mockHdfsStore;
-
-  }
-
-  public static void createMockStore(Mockery mockContext, final HDFSStore mockStore, final String storeName,
-      final String namenode, final String homeDir, final int maxFileSize, final int fileRolloverInterval,
-      final boolean minorCompact, final int minorCompactionThreads, final boolean majorCompact,
-      final int majorCompactionThreads, final int majorCompactionInterval, final int purgeInterval,
-      final float blockCachesize, final String clientConfigFile, final int batchSize, final int batchInterval,
-      final String diskStoreName, final boolean syncDiskwrite, final int dispatcherThreads, final int maxMemory,
-      final boolean bufferPersistent) {
-
-    mockContext.checking(new Expectations() {
-      {
-        allowing(mockStore).getName();
-        will(returnValue(storeName));
-        allowing(mockStore).getNameNodeURL();
-        will(returnValue(namenode));
-        allowing(mockStore).getHomeDir();
-        will(returnValue(homeDir));
-        allowing(mockStore).getWriteOnlyFileRolloverSize();
-        will(returnValue(maxFileSize));
-        allowing(mockStore).getWriteOnlyFileRolloverInterval();
-        will(returnValue(fileRolloverInterval));
-        allowing(mockStore).getMinorCompaction();
-        will(returnValue(minorCompact));
-        allowing(mockStore).getMajorCompaction();
-        will(returnValue(majorCompact));
-        allowing(mockStore).getMajorCompactionInterval();
-        will(returnValue(majorCompactionInterval));
-        allowing(mockStore).getMajorCompactionThreads();
-        will(returnValue(majorCompactionThreads));
-        allowing(mockStore).getMinorCompactionThreads();
-        will(returnValue(minorCompactionThreads));
-        allowing(mockStore).getPurgeInterval();
-        will(returnValue(purgeInterval));
-        allowing(mockStore).getInputFileCountMax();
-        will(returnValue(10));
-        allowing(mockStore).getInputFileSizeMax();
-        will(returnValue(1024));
-        allowing(mockStore).getInputFileCountMin();
-        will(returnValue(2));
-        allowing(mockStore).getBlockCacheSize();
-        will(returnValue(blockCachesize));
-        allowing(mockStore).getHDFSClientConfigFile();
-        will(returnValue(clientConfigFile));
-
-        allowing(mockStore).getBatchSize();
-        will(returnValue(batchSize));
-        allowing(mockStore).getBatchInterval();
-        will(returnValue(batchInterval));
-        allowing(mockStore).getDiskStoreName();
-        will(returnValue(diskStoreName));
-        allowing(mockStore).getSynchronousDiskWrite();
-        will(returnValue(syncDiskwrite));
-        allowing(mockStore).getBufferPersistent();
-        will(returnValue(bufferPersistent));
-        allowing(mockStore).getDispatcherThreads();
-        will(returnValue(dispatcherThreads));
-        allowing(mockStore).getMaxMemory();
-        will(returnValue(maxMemory));
-      }
-    });
-  }
-
-  protected static class TestHDFSStoreCommands extends HDFSStoreCommands {
-
-    private final Cache cache;
-
-    private final DistributedMember distributedMember;
-
-    private final Execution functionExecutor;
-
-    public TestHDFSStoreCommands(final Cache cache, final DistributedMember distributedMember,
-        final Execution functionExecutor) {
-      assert cache != null: "The Cache cannot be null!";
-      this.cache = cache;
-      this.distributedMember = distributedMember;
-      this.functionExecutor = functionExecutor;
-    }
-
-    @Override
-    protected Cache getCache() {
-      return this.cache;
-    }
-
-    @Override
-    protected Set<DistributedMember> getMembers(final Cache cache) {
-      assertSame(getCache(), cache);
-      return Collections.singleton(this.distributedMember);
-    }
-
-    @Override
-    protected Execution getMembersFunctionExecutor(final Set<DistributedMember> members) {
-      Assert.assertNotNull(members);
-      return this.functionExecutor;
-    }
-
-    @Override
-    protected Set<DistributedMember> getNormalMembers(final Cache cache) {
-      assertSame(getCache(), cache);
-      return Collections.singleton(this.distributedMember);
-    }
-
-    @Override
-    protected Set<DistributedMember> getGroupMembers(String[] groups) {
-      Set<DistributedMember> dm = new HashSet<DistributedMember>();
-      dm.add(distributedMember);
-      return dm;
-
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/functions/AlterHDFSStoreFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/functions/AlterHDFSStoreFunctionJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/functions/AlterHDFSStoreFunctionJUnitTest.java
deleted file mode 100644
index 4a93e30..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/functions/AlterHDFSStoreFunctionJUnitTest.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/*=========================================================================
- * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
- * This product is protected by U.S. and international copyright
- * and intellectual property laws. Pivotal products are covered by
- * one or more patents listed at http://www.pivotal.io/patents.
- *=========================================================================
- */
-
-package com.gemstone.gemfire.management.internal.cli.functions;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.logging.log4j.Logger;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.lib.legacy.ClassImposteriser;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheClosedException;
-import com.gemstone.gemfire.cache.execute.FunctionContext;
-import com.gemstone.gemfire.cache.execute.ResultSender;
-import com.gemstone.gemfire.cache.hdfs.HDFSStore;
-import com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreConfigHolder;
-import com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreImpl;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.InternalCache;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.management.internal.cli.commands.HDFSStoreCommandsJUnitTest;
-import com.gemstone.gemfire.management.internal.cli.functions.AlterHDFSStoreFunction.AlterHDFSStoreAttributes;
-import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity;
-import com.gemstone.gemfire.test.junit.categories.HoplogTest;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-/**
- * The AlterHDFSStoreFunctionJUnitTest test suite class tests the contract and
- * functionality of the AlterHDFSStoreFunction class. </p>
- * 
- * @author Namrata Thanvi
- * @see com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreImpl
- * @see com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreConfigHolder
- * @see com.gemstone.gemfire.management.internal.cli.functions.AlterHDFSStoreFunction
- * @see org.jmock.Expectations
- * @see org.jmock.Mockery
- * @see org.junit.Assert
- * @see org.junit.Test
- */
-@SuppressWarnings( { "unused" })
-@Category({IntegrationTest.class, HoplogTest.class})
-public class AlterHDFSStoreFunctionJUnitTest {
-
-  private static final Logger logger = LogService.getLogger();
-
-  private Mockery mockContext;
-
-  @Before
-  public void setup() {
-    mockContext = new Mockery() {
-      {
-        setImposteriser(ClassImposteriser.INSTANCE);
-      }
-    };
-  }
-
-  @After
-  public void tearDown() {
-    mockContext.assertIsSatisfied();
-    mockContext = null;
-  }
-
-  @Test
-  public void testExecute() throws Throwable {
-
-    final GemFireCacheImpl mockCache = mockContext.mock(GemFireCacheImpl.class, "Cache");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final FunctionContext mockFunctionContext = mockContext.mock(FunctionContext.class, "FunctionContext");
-    final XmlEntity xmlEntity = mockContext.mock(XmlEntity.class, "XmlEntity");
-
-    final String memberId = "mockMemberId";
-    final String memberName = "mockMemberName";
-
-    final AlterHDFSStoreFunction function = createAlterHDFSStoreFunction(mockCache, mockMember, xmlEntity);
-    final TestResultSender testResultSender = new TestResultSender();
-    final HDFSStoreImpl mockHdfsStore = CreateHDFSStoreFunctionJUnitTest.createMockHDFSStoreImpl(mockContext,
-        "hdfsStoreName", "hdfs://localhost:9000", "testDir", 1024, 20, .25f, null, 20, 20, null, false, 0, 1024, false,
-        false, true, 20, 20, 10, 100);
-	final AlterHDFSStoreAttributes alterHDFSStoreAttributes = new AlterHDFSStoreAttributes(
-				"mockStore", 100, 100, false, false, 100, 100, 100, 100, 100,
-				100);
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockMember).getId();
-        will(returnValue(memberId));
-        exactly(2).of(mockMember).getName();
-        will(returnValue(memberName));        
-        oneOf(mockFunctionContext).getArguments();
-        will(returnValue(alterHDFSStoreAttributes));
-        oneOf(mockCache).findHDFSStore(alterHDFSStoreAttributes.getHdfsUniqueName());
-        will(returnValue(mockHdfsStore));
-        oneOf(mockFunctionContext).getResultSender();
-        will(returnValue(testResultSender));
-      }
-    });
-
-    function.execute(mockFunctionContext);
-
-    final List<?> results = testResultSender.getResults();
-
-    assertNotNull(results);
-    assertEquals(1, results.size());
-
-    final CliFunctionResult result = (CliFunctionResult)results.get(0);
-    assertEquals(memberName, result.getMemberIdOrName());
-    assertEquals("Success", result.getMessage());
-
-  }
-
-  @Test
-  @SuppressWarnings("unchecked")
-  public void testExecuteOnMemberHavingNoHDFSStore() throws Throwable {
-
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final FunctionContext mockFunctionContext = mockContext.mock(FunctionContext.class, "FunctionContext");
-    final GemFireCacheImpl mockCache = mockContext.mock(GemFireCacheImpl.class, "Cache");
-    final XmlEntity xmlEntity = mockContext.mock(XmlEntity.class, "XmlEntity");
-
-    final String memberId = "mockMemberId";
-    final String memberName = "mockMemberName";
-
-    final TestResultSender testResultSender = new TestResultSender();
-    final AlterHDFSStoreFunction function = createAlterHDFSStoreFunction(mockCache, mockMember, xmlEntity);
-	final AlterHDFSStoreAttributes alterHDFSStoreAttributes = new AlterHDFSStoreAttributes(
-				"mockStore", 100, 100, false, false, 100, 100, 100, 100, 100,
-				100);
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockCache).findHDFSStore(alterHDFSStoreAttributes.getHdfsUniqueName());
-        will(returnValue(null));       
-        oneOf(mockMember).getId();
-        will(returnValue(memberId));
-        exactly(2).of(mockMember).getName();
-        will(returnValue(memberName));
-        oneOf(mockFunctionContext).getArguments();
-        will(returnValue(alterHDFSStoreAttributes));
-        oneOf(mockFunctionContext).getResultSender();
-        will(returnValue(testResultSender));
-      }
-    });
-
-    function.execute(mockFunctionContext);
-
-    final List<?> results = testResultSender.getResults();
-
-    assertNotNull(results);
-    assertEquals(1, results.size());
-
-    final CliFunctionResult result = (CliFunctionResult)results.get(0);
-    assertEquals(memberName, result.getMemberIdOrName());
-    assertEquals("Hdfs store not found on this member", result.getMessage());
-  }
-
-  @Test
-  public void testExecuteOnMemberWithNoCache() throws Throwable {
-
-    final FunctionContext mockFunctionContext = mockContext.mock(FunctionContext.class, "MockFunctionContext");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final InternalCache mockCache = mockContext.mock(InternalCache.class, "Cache");
-    final XmlEntity xmlEntity = mockContext.mock(XmlEntity.class, "XmlEntity");
-
-    final TestResultSender testResultSender = new TestResultSender();
-	final AlterHDFSStoreAttributes alterHDFSStoreAttributes = new AlterHDFSStoreAttributes(
-				"mockStore", 100, 100, false, false, 100, 100, 100, 100, 100,
-				100);
-
-    final AlterHDFSStoreFunction function = new TestAlterHDFSStoreFunction(mockCache, mockMember, xmlEntity) {
-      @Override
-      protected Cache getCache() {
-        throw new CacheClosedException("Expected");
-      }
-    };
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockFunctionContext).getArguments();
-        will(returnValue(alterHDFSStoreAttributes));
-        oneOf(mockFunctionContext).getResultSender();
-        will(returnValue(testResultSender));
-      }
-    });
-
-    function.execute(mockFunctionContext);
-    final List<?> results = testResultSender.getResults();
-
-    assertNotNull(results);
-    assertEquals(1, results.size());
-
-    final CliFunctionResult result = (CliFunctionResult)results.get(0);
-    assertEquals("", result.getMemberIdOrName());
-    assertNull(result.getMessage());
-  }
-
-  @Test
-  public void testExecuteHandleRuntimeException() throws Throwable {
-
-    final FunctionContext mockFunctionContext = mockContext.mock(FunctionContext.class, "FunctionContext");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final GemFireCacheImpl mockCache = mockContext.mock(GemFireCacheImpl.class, "Cache");
-    final XmlEntity xmlEntity = mockContext.mock(XmlEntity.class, "XmlEntity");
-
-    final String memberId = "mockMemberId";
-    final String memberName = "mockMemberName";
-    final TestResultSender testResultSender = new TestResultSender();
-    final AlterHDFSStoreFunction function = createAlterHDFSStoreFunction(mockCache, mockMember, xmlEntity);
-
-    final AlterHDFSStoreAttributes alterHDFSStoreAttributes = new AlterHDFSStoreAttributes(
-				"mockStore", 100, 100, false, false, 100, 100, 100, 100, 100,
-				100);
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockMember).getId();
-        will(returnValue(memberId));
-        exactly(2).of(mockMember).getName();
-        will(returnValue(memberName));
-        oneOf(mockFunctionContext).getArguments();
-        will(returnValue(alterHDFSStoreAttributes));
-        oneOf(mockCache).findHDFSStore(alterHDFSStoreAttributes.getHdfsUniqueName());
-        will(throwException(new RuntimeException("expected")));
-        oneOf(mockFunctionContext).getResultSender();
-        will(returnValue(testResultSender));
-      }
-    });
-
-    function.execute(mockFunctionContext);
-    final List<?> results = testResultSender.getResults();
-
-    assertNotNull(results);
-    assertEquals(1, results.size());
-
-    final CliFunctionResult result = (CliFunctionResult)results.get(0);
-    assertEquals(memberName, result.getMemberIdOrName());
-    assertEquals("expected", result.getThrowable().getMessage());
-
-  }
-
-  protected TestAlterHDFSStoreFunction createAlterHDFSStoreFunction(final Cache cache, DistributedMember member,
-      XmlEntity xml) {
-    return new TestAlterHDFSStoreFunction(cache, member, xml);
-  }
-
-  protected static class TestAlterHDFSStoreFunction extends AlterHDFSStoreFunction {
-    private static final long serialVersionUID = 1L;
-
-    private final Cache cache;
-
-    private final DistributedMember member;
-
-    private final XmlEntity xml;
-
-    public TestAlterHDFSStoreFunction(final Cache cache, DistributedMember member, XmlEntity xml) {
-      this.cache = cache;
-      this.member = member;
-      this.xml = xml;
-    }
-
-    @Override
-    protected Cache getCache() {
-      return this.cache;
-    }
-
-    @Override
-    protected DistributedMember getDistributedMember(Cache cache) {
-      return member;
-    }
-
-    @Override
-    protected XmlEntity getXMLEntity(String storeName) {
-      return xml;
-    }
-
-    @Override
-    protected HDFSStore alterHdfsStore(HDFSStore hdfsStore, AlterHDFSStoreAttributes alterAttributes) {
-      return hdfsStore;
-    }
-  }
-
-  protected static class TestResultSender implements ResultSender {
-
-    private final List<Object> results = new LinkedList<Object>();
-
-    private Throwable t;
-
-    protected List<Object> getResults() throws Throwable {
-      if (t != null) {
-        throw t;
-      }
-      return Collections.unmodifiableList(results);
-    }
-
-    public void lastResult(final Object lastResult) {
-      results.add(lastResult);
-    }
-
-    public void sendResult(final Object oneResult) {
-      results.add(oneResult);
-    }
-
-    public void sendException(final Throwable t) {
-      this.t = t;
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f251978/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/functions/CreateHDFSStoreFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/functions/CreateHDFSStoreFunctionJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/functions/CreateHDFSStoreFunctionJUnitTest.java
deleted file mode 100644
index 8a012b4..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/functions/CreateHDFSStoreFunctionJUnitTest.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*=========================================================================
- * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
- * This product is protected by U.S. and international copyright
- * and intellectual property laws. Pivotal products are covered by
- * one or more patents listed at http://www.pivotal.io/patents.
- *=========================================================================
- */
-
-package com.gemstone.gemfire.management.internal.cli.functions;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.logging.log4j.Logger;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.lib.legacy.ClassImposteriser;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheClosedException;
-import com.gemstone.gemfire.cache.execute.FunctionContext;
-import com.gemstone.gemfire.cache.execute.ResultSender;
-import com.gemstone.gemfire.cache.hdfs.HDFSStore;
-import com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreConfigHolder;
-import com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreImpl;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.management.internal.cli.commands.HDFSStoreCommandsJUnitTest;
-import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity;
-import com.gemstone.gemfire.test.junit.categories.HoplogTest;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest
-;
-
-/**
- * The AlterHDFSStoreFunctionJUnitTest test suite class tests the contract and
- * functionality of the AlterHDFSStoreFunction class. </p>
- * 
- * @author Namrata Thanvi
- * @see com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreImpl
- * @see com.gemstone.gemfire.cache.hdfs.internal.HDFSStoreConfigHolder
- * @see com.gemstone.gemfire.management.internal.cli.functions.AlterHDFSStoreFunction
- * @see org.jmock.Expectations
- * @see org.jmock.Mockery
- * @see org.junit.Assert
- * @see org.junit.Test
- */
-@SuppressWarnings( { "unused" })
-@Category({IntegrationTest.class, HoplogTest.class})
-public class CreateHDFSStoreFunctionJUnitTest {
-
-  private static final Logger logger = LogService.getLogger();
-
-  private Mockery mockContext;
-
-  private static Properties props = new Properties();
-  
-  @Before
-  public void setup() {
-    
-    mockContext = new Mockery() {
-      {
-        setImposteriser(ClassImposteriser.INSTANCE);
-      }
-    };
-  }
-
-  @After
-  public void tearDown() {
-    mockContext.assertIsSatisfied();
-    mockContext = null;
-  }
-
-  @Test
-  public void testExecute() throws Throwable {
-
-    final GemFireCacheImpl mockCache = mockContext.mock(GemFireCacheImpl.class, "Cache");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final FunctionContext mockFunctionContext = mockContext.mock(FunctionContext.class, "FunctionContext");
-    final XmlEntity xmlEntity = mockContext.mock(XmlEntity.class, "XmlEntity");
-
-    final String memberId = "mockMemberId";
-    final String memberName = "mockMemberName";
-    
-    final TestResultSender testResultSender = new TestResultSender();
-    
-    final HDFSStoreImpl mockHdfsStore = createMockHDFSStoreImpl(mockContext, "hdfsStoreName", "hdfs://localhost:9000", "testDir",
-        1024, 20, .25f, null, 20, 20, null, false, 0, 1024, false, false, true, 20, 20, 10, 100);
-    
-    final HDFSStoreConfigHolder mockHdfsStoreConfigHolder = HDFSStoreCommandsJUnitTest.createMockHDFSStoreConfigHolder(
-        mockContext, "hdfsStoreName", "hdfs://localhost:9000", "testDir", 1024, 20, .25f, null, 40, 40, null, false, 0,
-        2048, true, true, true, 40, 40, 40, 800);
-    
-    final CreateHDFSStoreFunction function = new TestCreateHDFSStoreFunction(mockCache, mockMember, xmlEntity , mockHdfsStore);
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockMember).getId();
-        will(returnValue(memberId));
-        exactly(2).of(mockMember).getName();
-        will(returnValue(memberName));
-        oneOf(mockFunctionContext).getArguments();
-        will(returnValue(mockHdfsStoreConfigHolder));
-        oneOf(mockFunctionContext).getResultSender();
-        will(returnValue(testResultSender));
-      }
-    });
-
-    function.execute(mockFunctionContext);
-
-    final List<?> results = testResultSender.getResults();
-
-    assertNotNull(results);
-    assertEquals(1, results.size());
-
-    final CliFunctionResult result = (CliFunctionResult)results.get(0);
-    assertEquals(memberName, result.getMemberIdOrName());
-    assertEquals("Success", result.getMessage());
-
-  }
-
-  
-  
-  @Test
-  public void testExecuteOnMemberWithNoCache() throws Throwable {
-
-    final FunctionContext mockFunctionContext = mockContext.mock(FunctionContext.class, "MockFunctionContext");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final GemFireCacheImpl mockCache = mockContext.mock(GemFireCacheImpl.class, "Cache");
-    final XmlEntity xmlEntity = mockContext.mock(XmlEntity.class, "XmlEntity");
-
-    final String memberId = "mockMemberId";
-    final String memberName = "mockMemberName";
-    
-    final TestResultSender testResultSender = new TestResultSender();
-    final HDFSStoreImpl mockHdfsStore = createMockHDFSStoreImpl(mockContext, "hdfsStoreName", "hdfs://localhost:9000", "testDir",
-        1024, 20, .25f, null, 20, 20, null, false, 0, 1024, false, false, true, 20, 20, 10, 100);
-    
-    final HDFSStoreConfigHolder mockHdfsStoreConfigHolder = HDFSStoreCommandsJUnitTest.createMockHDFSStoreConfigHolder(mockContext, "hdfsStoreName",
-        "hdfs://localhost:9000", "testDir", 1024, 20, .25f, null, 40, 40, null, false, 0, 2048, true, true, true, 40,
-        40, 40, 800);
-    
-    final CreateHDFSStoreFunction function = new TestCreateHDFSStoreFunction(mockCache, mockMember, xmlEntity , mockHdfsStore) {
-      @Override
-      protected Cache getCache() {
-        throw new CacheClosedException("Expected");
-      }
-    };
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockFunctionContext).getResultSender();
-        will(returnValue(testResultSender));
-      }
-    });
-
-    function.execute(mockFunctionContext);
-    final List<?> results = testResultSender.getResults();
-
-    assertNotNull(results);
-    assertEquals(1, results.size());
-
-    final CliFunctionResult result = (CliFunctionResult)results.get(0);
-    assertEquals("", result.getMemberIdOrName());
-    assertNull(result.getMessage());
-  }
-
-  
-  @Test
-  public void testExecuteHandleRuntimeException() throws Throwable {
-
-    final FunctionContext mockFunctionContext = mockContext.mock(FunctionContext.class, "MockFunctionContext");
-    final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
-    final GemFireCacheImpl mockCache = mockContext.mock(GemFireCacheImpl.class, "Cache");
-    final XmlEntity xmlEntity = mockContext.mock(XmlEntity.class, "XmlEntity");
-
-    final String memberId = "mockMemberId";
-    final String memberName = "mockMemberName";
-    
-    final TestResultSender testResultSender = new TestResultSender();
-    final HDFSStoreImpl mockHdfsStore = createMockHDFSStoreImpl(mockContext, "hdfsStoreName", "hdfs://localhost:9000", "testDir",
-        1024, 20, .25f, null, 20, 20, null, false, 0, 1024, false, false, true, 20, 20, 10, 100);
-    
-    final HDFSStoreConfigHolder mockHdfsStoreConfigHolder = HDFSStoreCommandsJUnitTest.createMockHDFSStoreConfigHolder(
-        mockContext, "hdfsStoreName", "hdfs://localhost:9000", "testDir", 1024, 20, .25f, null, 40, 40, null, false, 0,
-        2048, true, true, true, 40, 40, 40, 800);
-    
-    final CreateHDFSStoreFunction function = new TestCreateHDFSStoreFunction(mockCache, mockMember, xmlEntity , mockHdfsStore) {
-      @Override
-      protected Cache getCache() {
-        throw new RuntimeException("expected");
-      }
-    };
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockFunctionContext).getResultSender();
-        will(returnValue(testResultSender));
-      }
-    });
-
-
-    function.execute(mockFunctionContext);
-    final List<?> results = testResultSender.getResults();
-
-    assertNotNull(results);
-    assertEquals(1, results.size());
-
-    final CliFunctionResult result = (CliFunctionResult)results.get(0);
-    assertEquals("", result.getMemberIdOrName());
-    assertEquals("expected", result.getThrowable().getMessage());
-
-  }
-
-  public static HDFSStoreImpl createMockHDFSStoreImpl(Mockery mockContext, final String storeName, final String namenode, final String homeDir,
-      final int maxFileSize, final int fileRolloverInterval, final float blockCachesize, final String clientConfigFile,
-      final int batchSize, final int batchInterval, final String diskStoreName, final boolean syncDiskwrite,
-      final int dispatcherThreads, final int maxMemory, final boolean bufferPersistent, final boolean minorCompact,
-      final boolean majorCompact, final int majorCompactionInterval, final int majorCompactionThreads,
-      final int minorCompactionThreads, final int purgeInterval) {
-
-    HDFSStoreImpl mockHdfsStore = mockContext.mock(HDFSStoreImpl.class, "HDFSStoreImpl");
-
-    HDFSStoreCommandsJUnitTest.createMockStore(mockContext, mockHdfsStore, storeName, namenode, homeDir, maxFileSize,
-        fileRolloverInterval, minorCompact, minorCompactionThreads, majorCompact, majorCompactionThreads,
-        majorCompactionInterval, purgeInterval, blockCachesize, clientConfigFile, batchSize, batchInterval,
-        diskStoreName, syncDiskwrite, dispatcherThreads, maxMemory, bufferPersistent);
-    
-    return mockHdfsStore;
-  }
-
-  protected static class TestCreateHDFSStoreFunction extends CreateHDFSStoreFunction {
-    private static final long serialVersionUID = 1L;
-
-    private final Cache cache;
-
-    private final DistributedMember member;
-
-    private final XmlEntity xml;
-    
-    private final HDFSStoreImpl hdfsStore;
-
-    public TestCreateHDFSStoreFunction(Cache cache, DistributedMember member, XmlEntity xml , HDFSStoreImpl hdfsStore) {
-      this.cache = cache;
-      this.member = member;
-      this.xml = xml;
-      this.hdfsStore = hdfsStore;
-    }
-
-    @Override
-    protected Cache getCache() {
-      return this.cache;
-    }
-
-    @Override
-    protected DistributedMember getDistributedMember(Cache cache) {
-      return member;
-    }
-
-    @Override
-    protected XmlEntity getXMLEntity(String storeName) {
-      return xml;
-    }
-    
-    @Override
-    protected HDFSStoreImpl createHdfsStore(Cache cache, HDFSStoreConfigHolder configHolder){
-      return hdfsStore;
-    }
-  }
-
-  protected static class TestResultSender implements ResultSender {
-
-    private final List<Object> results = new LinkedList<Object>();
-
-    private Throwable t;
-
-    protected List<Object> getResults() throws Throwable {
-      if (t != null) {
-        throw t;
-      }
-      return Collections.unmodifiableList(results);
-    }
-
-    public void lastResult(final Object lastResult) {
-      results.add(lastResult);
-    }
-
-    public void sendResult(final Object oneResult) {
-      results.add(oneResult);
-    }
-
-    public void sendException(final Throwable t) {
-      this.t = t;
-    }
-  }
-
-}


Mime
View raw message