This is an automated email from the ASF dual-hosted git repository.
khowe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 8c28872 GEODE_3299: Refactor Gfsh functions to acquire Cache from
FunctionContex
8c28872 is described below
commit 8c288722329c558a4959ecc0e423527b23202bf4
Author: Ken Howe <[email protected]>
AuthorDate: Tue Oct 10 08:55:07 2017 -0700
GEODE_3299: Refactor Gfsh functions to acquire Cache from FunctionContex
This commit is the second set of refactored Function classes.
Update PR to remove unused imports on modified files
---
.../cli/functions/DescribeDiskStoreFunction.java | 7 +-
.../internal/cli/functions/ExportDataFunction.java | 3 +-
.../cli/functions/GarbageCollectionFunction.java | 3 +-
.../functions/GatewayReceiverCreateFunction.java | 3 +-
.../cli/functions/GatewaySenderCreateFunction.java | 3 +-
.../functions/GatewaySenderDestroyFunction.java | 3 +-
.../GetMemberConfigInformationFunction.java | 3 +-
.../functions/GetMemberInformationFunction.java | 3 +-
.../DescribeDiskStoreFunctionJUnitTest.java | 149 +++++++++------------
9 files changed, 69 insertions(+), 108 deletions(-)
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
index 68cc2e0..6a9d5b4 100644
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
@@ -17,7 +17,6 @@ package org.apache.geode.management.internal.cli.functions;
import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.DiskStore;
import org.apache.geode.cache.EvictionAction;
@@ -73,10 +72,6 @@ public class DescribeDiskStoreFunction extends
FunctionAdapter implements Intern
}
}
- protected Cache getCache() {
- return CacheFactory.getAnyInstance();
- }
-
public String getId() {
return getClass().getName();
}
@@ -85,7 +80,7 @@ public class DescribeDiskStoreFunction extends
FunctionAdapter implements Intern
public void init(final Properties props) {}
public void execute(final FunctionContext context) {
- Cache cache = getCache();
+ Cache cache = context.getCache();
try {
if (cache instanceof InternalCache) {
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportDataFunction.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportDataFunction.java
index 52561ca..6a60c91 100644
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportDataFunction.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportDataFunction.java
@@ -17,7 +17,6 @@ package org.apache.geode.management.internal.cli.functions;
import java.io.File;
import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.execute.FunctionAdapter;
import org.apache.geode.cache.execute.FunctionContext;
@@ -52,7 +51,7 @@ public class ExportDataFunction extends FunctionAdapter
implements InternalEntit
final boolean parallel = Boolean.parseBoolean(args[2]);
try {
- Cache cache = CacheFactory.getAnyInstance();
+ Cache cache = context.getCache();
Region<?, ?> region = cache.getRegion(regionName);
String hostName =
cache.getDistributedSystem().getDistributedMember().getHost();
if (region != null) {
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GarbageCollectionFunction.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GarbageCollectionFunction.java
index 46588eb..0ba0f01 100644
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GarbageCollectionFunction.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GarbageCollectionFunction.java
@@ -17,7 +17,6 @@ package org.apache.geode.management.internal.cli.functions;
import java.util.HashMap;
import java.util.Map;
import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.execute.Function;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.distributed.DistributedMember;
@@ -43,7 +42,7 @@ public class GarbageCollectionFunction implements Function,
InternalEntity {
Map<String, String> resultMap = null;
try {
- Cache cache = CacheFactory.getAnyInstance();
+ Cache cache = context.getCache();
DistributedMember member =
cache.getDistributedSystem().getDistributedMember();
long freeMemoryBeforeGC = Runtime.getRuntime().freeMemory();
long totalMemoryBeforeGC = Runtime.getRuntime().totalMemory();
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewayReceiverCreateFunction.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewayReceiverCreateFunction.java
index c3da49a..ff37ae2 100644
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewayReceiverCreateFunction.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewayReceiverCreateFunction.java
@@ -20,7 +20,6 @@ import java.util.Map;
import org.apache.logging.log4j.Logger;
import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.execute.FunctionAdapter;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.execute.ResultSender;
@@ -52,7 +51,7 @@ public class GatewayReceiverCreateFunction extends
FunctionAdapter implements In
public void execute(FunctionContext context) {
ResultSender<Object> resultSender = context.getResultSender();
- Cache cache = CacheFactory.getAnyInstance();
+ Cache cache = context.getCache();
String memberNameOrId =
CliUtil.getMemberNameOrId(cache.getDistributedSystem().getDistributedMember());
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderCreateFunction.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderCreateFunction.java
index 33bffd8..4ebeb8d 100644
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderCreateFunction.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderCreateFunction.java
@@ -17,7 +17,6 @@ package org.apache.geode.management.internal.cli.functions;
import org.apache.logging.log4j.Logger;
import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.execute.FunctionAdapter;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.execute.ResultSender;
@@ -50,7 +49,7 @@ public class GatewaySenderCreateFunction extends
FunctionAdapter implements Inte
public void execute(FunctionContext context) {
ResultSender<Object> resultSender = context.getResultSender();
- Cache cache = CacheFactory.getAnyInstance();
+ Cache cache = context.getCache();
String memberNameOrId =
CliUtil.getMemberNameOrId(cache.getDistributedSystem().getDistributedMember());
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
index 2873633..d1c5116 100644
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
@@ -15,7 +15,6 @@
package org.apache.geode.management.internal.cli.functions;
import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.execute.FunctionAdapter;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.execute.ResultSender;
@@ -38,7 +37,7 @@ public class GatewaySenderDestroyFunction extends
FunctionAdapter implements Int
public void execute(FunctionContext context) {
ResultSender<Object> resultSender = context.getResultSender();
- Cache cache = CacheFactory.getAnyInstance();
+ Cache cache = context.getCache();
String memberNameOrId =
CliUtil.getMemberNameOrId(cache.getDistributedSystem().getDistributedMember());
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberConfigInformationFunction.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberConfigInformationFunction.java
index 56ba115..9e01c93 100644
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberConfigInformationFunction.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberConfigInformationFunction.java
@@ -15,7 +15,6 @@
package org.apache.geode.management.internal.cli.functions;
import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.execute.FunctionAdapter;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.server.CacheServer;
@@ -52,7 +51,7 @@ public class GetMemberConfigInformationFunction extends
FunctionAdapter implemen
Object argsObject = context.getArguments();
boolean hideDefaults = ((Boolean) argsObject).booleanValue();
- Cache cache = CacheFactory.getAnyInstance();
+ Cache cache = context.getCache();
InternalDistributedSystem system = (InternalDistributedSystem)
cache.getDistributedSystem();
DistributionConfig config = system.getConfig();
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberInformationFunction.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberInformationFunction.java
index 70fa68b..51b3ec4 100644
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberInformationFunction.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GetMemberInformationFunction.java
@@ -16,7 +16,6 @@ package org.apache.geode.management.internal.cli.functions;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.execute.FunctionAdapter;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.server.CacheServer;
@@ -76,7 +75,7 @@ public class GetMemberInformationFunction extends
FunctionAdapter implements Int
@Override
public void execute(FunctionContext functionContext) {
try {
- Cache cache = CacheFactory.getAnyInstance();
+ Cache cache = functionContext.getCache();
/*
* TODO: 1) Get the CPU usage%
diff --git
a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
index 4c1f2cb..2339838 100644
---
a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
+++
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
@@ -48,7 +48,6 @@ import org.apache.geode.cache.execute.ResultSender;
import org.apache.geode.cache.server.CacheServer;
import org.apache.geode.cache.server.ClientSubscriptionConfig;
import org.apache.geode.cache.wan.GatewaySender;
-import org.apache.geode.distributed.DistributedMember;
import
org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.lang.Filter;
@@ -80,12 +79,14 @@ public class DescribeDiskStoreFunctionJUnitTest {
private static final Logger logger = LogService.getLogger();
private Mockery mockContext;
+ private InternalCache mockCache;
@Before
public void setup() {
mockContext = new Mockery();
mockContext.setImposteriser(ClassImposteriser.INSTANCE);
mockContext.setThreadingPolicy(new Synchroniser());
+ mockCache = mockContext.mock(InternalCache.class, "Cache");
}
@After
@@ -204,10 +205,6 @@ public class DescribeDiskStoreFunctionJUnitTest {
return cacheServerDetails;
}
- private DescribeDiskStoreFunction createDescribeDiskStoreFunction(final
Cache cache) {
- return new TestDescribeDiskStoreFunction(cache);
- }
-
private File[] createFileArray(final String... locations) {
assert locations != null : "The locations argument cannot be null!";
@@ -486,20 +483,18 @@ public class DescribeDiskStoreFunctionJUnitTest {
final String memberId = "mockMemberId";
final String memberName = "mockMemberName";
- final InternalCache mockCache = mockContext.mock(InternalCache.class,
"Cache");
-
final InternalDistributedMember mockMember =
mockContext.mock(InternalDistributedMember.class, "DistributedMember");
+ final FunctionContext mockFunctionContext =
+ mockContext.mock(FunctionContext.class, "testExecute$FunctionContext");
+
final DiskStore mockDiskStore =
createMockDiskStore(diskStoreId, diskStoreName, true, false,
75, 8192l, 500, 120l, 10240, createFileArray("/export/disk/backup",
"/export/disk/overflow", "/export/disk/persistence"),
createIntArray(10240, 204800, 4096000), 50, 75);
- final FunctionContext mockFunctionContext =
- mockContext.mock(FunctionContext.class, "testExecute$FunctionContext");
-
final TestResultSender testResultSender = new TestResultSender();
mockContext.checking(new Expectations() {
@@ -516,6 +511,8 @@ public class DescribeDiskStoreFunctionJUnitTest {
will(returnValue(memberId));
oneOf(mockMember).getName();
will(returnValue(memberName));
+ oneOf(mockFunctionContext).getCache();
+ will(returnValue(mockCache));
oneOf(mockFunctionContext).getArguments();
will(returnValue(diskStoreName));
oneOf(mockFunctionContext).getResultSender();
@@ -535,7 +532,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
final Set<DiskStoreDetails.AsyncEventQueueDetails>
expectedAsyncEventQueueDetails =
setupAsyncEventQueuesForTestExecute(mockCache, diskStoreName);
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(mockCache);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
function.execute(mockFunctionContext);
@@ -586,7 +583,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
@Test
public void testExecuteOnMemberHavingANonGemFireCache() throws Throwable {
- final Cache mockCache = mockContext.mock(Cache.class, "Cache");
+ final Cache mockNonGemCache = mockContext.mock(Cache.class, "NonGemCache");
final FunctionContext mockFunctionContext =
mockContext.mock(FunctionContext.class, "FunctionContext");
@@ -595,12 +592,14 @@ public class DescribeDiskStoreFunctionJUnitTest {
mockContext.checking(new Expectations() {
{
+ oneOf(mockFunctionContext).getCache();
+ will(returnValue(mockNonGemCache));
exactly(0).of(mockFunctionContext).getResultSender();
will(returnValue(testResultSender));
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(mockCache);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
function.execute(mockFunctionContext);
@@ -616,8 +615,6 @@ public class DescribeDiskStoreFunctionJUnitTest {
final String memberId = "mockMemberId";
final String memberName = "mockMemberName";
- final InternalCache mockCache = mockContext.mock(InternalCache.class,
"Cache");
-
final InternalDistributedMember mockMember =
mockContext.mock(InternalDistributedMember.class, "DistributedMember");
@@ -636,6 +633,8 @@ public class DescribeDiskStoreFunctionJUnitTest {
will(returnValue(memberId));
oneOf(mockMember).getName();
will(returnValue(memberName));
+ oneOf(mockFunctionContext).getCache();
+ will(returnValue(mockCache));
oneOf(mockFunctionContext).getArguments();
will(returnValue(diskStoreName));
oneOf(mockFunctionContext).getResultSender();
@@ -643,7 +642,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(mockCache);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
function.execute(mockFunctionContext);
@@ -659,8 +658,6 @@ public class DescribeDiskStoreFunctionJUnitTest {
final String memberId = "mockMemberId";
final String memberName = "mockMemberName";
- final InternalCache mockCache = mockContext.mock(InternalCache.class,
"Cache");
-
final InternalDistributedMember mockMember =
mockContext.mock(InternalDistributedMember.class, "DistributedMember");
@@ -679,6 +676,8 @@ public class DescribeDiskStoreFunctionJUnitTest {
will(returnValue(memberId));
oneOf(mockMember).getName();
will(returnValue(memberName));
+ oneOf(mockFunctionContext).getCache();
+ will(returnValue(mockCache));
oneOf(mockFunctionContext).getArguments();
will(returnValue(diskStoreName));
oneOf(mockFunctionContext).getResultSender();
@@ -686,7 +685,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(mockCache);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
function.execute(mockFunctionContext);
@@ -712,8 +711,6 @@ public class DescribeDiskStoreFunctionJUnitTest {
final UUID diskStoreId = UUID.randomUUID();
- final InternalCache mockCache = mockContext.mock(InternalCache.class,
"Cache");
-
final InternalDistributedMember mockMember =
mockContext.mock(InternalDistributedMember.class, "DistributedMember");
@@ -736,6 +733,8 @@ public class DescribeDiskStoreFunctionJUnitTest {
will(returnValue(memberId));
oneOf(mockMember).getName();
will(returnValue(memberName));
+ oneOf(mockFunctionContext).getCache();
+ will(returnValue(mockCache));
oneOf(mockFunctionContext).getArguments();
will(returnValue(diskStoreName));
oneOf(mockFunctionContext).getResultSender();
@@ -743,7 +742,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(mockCache);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
function.execute(mockFunctionContext);
@@ -769,7 +768,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertEquals(expectedDiskStoreName, function.getDiskStoreName(mockRegion));
}
@@ -789,7 +788,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertEquals(DiskStoreDetails.DEFAULT_DISK_STORE_NAME,
function.getDiskStoreName(mockRegion));
}
@@ -813,7 +812,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertFalse(function.isOverflowToDisk(mockRegion));
}
@@ -837,7 +836,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertTrue(function.isOverflowToDisk(mockRegion));
}
@@ -857,7 +856,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertFalse(function.isOverflowToDisk(mockRegion));
}
@@ -877,7 +876,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertTrue(function.isPersistent(mockRegion));
}
@@ -897,7 +896,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertTrue(function.isPersistent(mockRegion));
}
@@ -917,7 +916,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertFalse(function.isPersistent(mockRegion));
}
@@ -937,7 +936,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertFalse(function.isPersistent(mockRegion));
}
@@ -957,7 +956,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertFalse(function.isPersistent(mockRegion));
}
@@ -977,7 +976,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertFalse(function.isPersistent(mockRegion));
}
@@ -1002,7 +1001,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertTrue(function.isUsingDiskStore(mockRegion, mockDiskStore));
}
@@ -1029,7 +1028,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertTrue(function.isUsingDiskStore(mockRegion, mockDiskStore));
}
@@ -1062,7 +1061,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertTrue(function.isUsingDiskStore(mockRegion, mockDiskStore));
}
@@ -1087,7 +1086,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertFalse(function.isUsingDiskStore(mockRegion, mockDiskStore));
}
@@ -1096,8 +1095,6 @@ public class DescribeDiskStoreFunctionJUnitTest {
public void testSetRegionDetails() {
final String diskStoreName = "companyDiskStore";
- final InternalCache mockCache = mockContext.mock(InternalCache.class,
"Cache");
-
final Region mockCompanyRegion = mockContext.mock(Region.class,
"/CompanyRegion");
final Region mockContractorsRegion =
mockContext.mock(Region.class, "/CompanyRegion/ContractorsRegion");
@@ -1237,7 +1234,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
final DiskStoreDetails diskStoreDetails = new
DiskStoreDetails(diskStoreName, "memberOne");
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(mockCache);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
function.setRegionDetails(mockCache, mockDiskStore, diskStoreDetails);
@@ -1261,7 +1258,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertEquals(expectedDiskStoreName,
function.getDiskStoreName(mockCacheServer));
}
@@ -1281,7 +1278,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertEquals(DiskStoreDetails.DEFAULT_DISK_STORE_NAME,
function.getDiskStoreName(mockCacheServer));
@@ -1298,7 +1295,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertNull(function.getDiskStoreName(mockCacheServer));
}
@@ -1323,7 +1320,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertTrue(function.isUsingDiskStore(mockCacheServer, mockDiskStore));
}
@@ -1346,7 +1343,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertFalse(function.isUsingDiskStore(mockCacheServer, mockDiskStore));
}
@@ -1369,7 +1366,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertTrue(function.isUsingDiskStore(mockCacheServer, mockDiskStore));
}
@@ -1378,8 +1375,6 @@ public class DescribeDiskStoreFunctionJUnitTest {
public void testSetCacheServerDetails() {
final String diskStoreName = "testDiskStore";
- final InternalCache mockCache = mockContext.mock(InternalCache.class,
"Cache");
-
final CacheServer mockCacheServer1 = mockContext.mock(CacheServer.class,
"CacheServer1");
final CacheServer mockCacheServer2 = mockContext.mock(CacheServer.class,
"CacheServer2");
final CacheServer mockCacheServer3 = mockContext.mock(CacheServer.class,
"CacheServer3");
@@ -1421,7 +1416,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
final DiskStoreDetails diskStoreDetails = new
DiskStoreDetails(diskStoreName, "memberOne");
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
function.setCacheServerDetails(mockCache, mockDiskStore, diskStoreDetails);
@@ -1441,7 +1436,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertEquals(expectedDiskStoreName,
function.getDiskStoreName(mockGatewaySender));
}
@@ -1457,7 +1452,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertEquals(DiskStoreDetails.DEFAULT_DISK_STORE_NAME,
function.getDiskStoreName(mockGatewaySender));
@@ -1474,7 +1469,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertTrue(function.isPersistent(mockGatewaySender));
}
@@ -1490,7 +1485,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertTrue(function.isPersistent(mockGatewaySender));
}
@@ -1512,7 +1507,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertTrue(function.isUsingDiskStore(mockGatewaySender, mockDiskStore));
}
@@ -1532,7 +1527,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertFalse(function.isUsingDiskStore(mockGatewaySender, mockDiskStore));
}
@@ -1552,7 +1547,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertTrue(function.isUsingDiskStore(mockGatewaySender, mockDiskStore));
}
@@ -1561,8 +1556,6 @@ public class DescribeDiskStoreFunctionJUnitTest {
public void testSetPdxSerializationDetails() {
final String diskStoreName = "testDiskStore";
- final InternalCache mockCache = mockContext.mock(InternalCache.class,
"Cache");
-
final DiskStore mockDiskStore = mockContext.mock(DiskStore.class,
"DiskStore");
mockContext.checking(new Expectations() {
@@ -1578,7 +1571,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
final DiskStoreDetails diskStoreDetails = new
DiskStoreDetails(diskStoreName, "memberOne");
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(mockCache);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
function.setPdxSerializationDetails(mockCache, mockDiskStore,
diskStoreDetails);
@@ -1587,8 +1580,6 @@ public class DescribeDiskStoreFunctionJUnitTest {
@Test
public void testSetPdxSerializationDetailsWhenDiskStoreMismatch() {
- final InternalCache mockCache = mockContext.mock(InternalCache.class,
"Cache");
-
final DiskStore mockDiskStore = mockContext.mock(DiskStore.class,
"DiskStore");
mockContext.checking(new Expectations() {
@@ -1604,7 +1595,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
final DiskStoreDetails diskStoreDetails = new
DiskStoreDetails("testDiskStore", "memberOne");
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(mockCache);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
function.setPdxSerializationDetails(mockCache, mockDiskStore,
diskStoreDetails);
@@ -1613,8 +1604,6 @@ public class DescribeDiskStoreFunctionJUnitTest {
@Test
public void testSetPdxSerializationDetailsWhenPdxIsNotPersistent() {
- final InternalCache mockCache = mockContext.mock(InternalCache.class,
"Cache");
-
final DiskStore mockDiskStore = mockContext.mock(DiskStore.class,
"DiskStore");
mockContext.checking(new Expectations() {
@@ -1626,7 +1615,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
final DiskStoreDetails diskStoreDetails = new
DiskStoreDetails("testDiskStore", "memberOne");
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(mockCache);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
function.setPdxSerializationDetails(mockCache, mockDiskStore,
diskStoreDetails);
@@ -1646,7 +1635,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertEquals(expectedDiskStoreName, function.getDiskStoreName(mockQueue));
}
@@ -1662,7 +1651,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertEquals(DiskStoreDetails.DEFAULT_DISK_STORE_NAME,
function.getDiskStoreName(mockQueue));
}
@@ -1686,7 +1675,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertTrue(function.isUsingDiskStore(mockQueue, mockDiskStore));
}
@@ -1708,7 +1697,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertFalse(function.isUsingDiskStore(mockQueue, mockDiskStore));
}
@@ -1728,7 +1717,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertFalse(function.isUsingDiskStore(mockQueue, mockDiskStore));
}
@@ -1750,7 +1739,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
}
});
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(null);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
assertTrue(function.isUsingDiskStore(mockQueue, mockDiskStore));
}
@@ -1759,8 +1748,6 @@ public class DescribeDiskStoreFunctionJUnitTest {
public void testSetAsyncEventQueueDetails() {
final String diskStoreName = "testDiskStore";
- final InternalCache mockCache = mockContext.mock(InternalCache.class,
"Cache");
-
final AsyncEventQueue mockQueue1 = mockContext.mock(AsyncEventQueue.class,
"AsyncEvenQueue1");
final AsyncEventQueue mockQueue2 = mockContext.mock(AsyncEventQueue.class,
"AsyncEvenQueue2");
final AsyncEventQueue mockQueue3 = mockContext.mock(AsyncEventQueue.class,
"AsyncEvenQueue3");
@@ -1793,27 +1780,13 @@ public class DescribeDiskStoreFunctionJUnitTest {
final DiskStoreDetails diskStoreDetails = new
DiskStoreDetails(diskStoreName, "memberOne");
- final DescribeDiskStoreFunction function =
createDescribeDiskStoreFunction(mockCache);
+ final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
function.setAsyncEventQueueDetails(mockCache, mockDiskStore,
diskStoreDetails);
assertAsyncEventQueueDetails(expectedAsyncEventQueueDetails,
diskStoreDetails);
}
- private static class TestDescribeDiskStoreFunction extends
DescribeDiskStoreFunction {
-
- private final Cache cache;
-
- public TestDescribeDiskStoreFunction(final Cache cache) {
- this.cache = cache;
- }
-
- @Override
- protected Cache getCache() {
- return this.cache;
- }
- }
-
private static class TestResultSender implements ResultSender {
private final List<Object> results = new LinkedList<>();
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].