You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2017/05/19 21:34:28 UTC
[01/14] geode git commit: GEODE-2662: Gfsh displays field value on
wrong line when receiving objects with missing fields [Forced Update!]
Repository: geode
Updated Branches:
refs/heads/feature/GEODE-2929-1 f02180476 -> b688c9c36 (forced update)
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DataCommandFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DataCommandFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DataCommandFunction.java
index 8620cff..e2164a3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DataCommandFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DataCommandFunction.java
@@ -14,23 +14,7 @@
*/
package org.apache.geode.management.internal.cli.functions;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-
import org.apache.commons.lang.StringUtils;
-import org.apache.logging.log4j.Logger;
-import org.apache.shiro.subject.Subject;
-import org.json.JSONArray;
-
-import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.Region;
@@ -80,6 +64,19 @@ import org.apache.geode.management.internal.cli.result.ResultBuilder;
import org.apache.geode.management.internal.cli.shell.Gfsh;
import org.apache.geode.management.internal.cli.util.JsonUtil;
import org.apache.geode.pdx.PdxInstance;
+import org.apache.logging.log4j.Logger;
+import org.apache.shiro.subject.Subject;
+import org.json.JSONArray;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
/**
* @since GemFire 7.0
@@ -138,29 +135,28 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
System.getProperty("memberName"));
}
DataCommandResult result = null;
- if (request.isGet())
+ if (request.isGet()) {
result = get(request);
- else if (request.isLocateEntry())
+ } else if (request.isLocateEntry()) {
result = locateEntry(request);
- else if (request.isPut())
+ } else if (request.isPut()) {
result = put(request);
- else if (request.isRemove())
+ } else if (request.isRemove()) {
result = remove(request);
- else if (request.isSelect())
+ } else if (request.isSelect()) {
result = select(request);
+ }
if (logger.isDebugEnabled()) {
logger.debug("Result is {}", result);
}
functionContext.getResultSender().lastResult(result);
- } catch (CacheClosedException e) {
- e.printStackTrace();
- functionContext.getResultSender().sendException(e);
} catch (Exception e) {
- e.printStackTrace();
+ logger.info("Exception occurred:", e);
functionContext.getResultSender().sendException(e);
}
}
+
private InternalCache getCache() {
return (InternalCache) CacheFactory.getAnyInstance();
}
@@ -223,132 +219,131 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
@SuppressWarnings("rawtypes")
private DataCommandResult select(Object principal, String queryString) {
+
InternalCache cache = getCache();
AtomicInteger nestedObjectCount = new AtomicInteger(0);
- if (queryString != null && !queryString.isEmpty()) {
- QueryService qs = cache.getQueryService();
-
- // TODO : Find out if is this optimised use. Can you have something equivalent of parsed
- // queries with names
- // where name can be retrieved to avoid parsing every-time
- Query query = qs.newQuery(queryString);
- DefaultQuery tracedQuery = (DefaultQuery) query;
- WrappedIndexTrackingQueryObserver queryObserver = null;
- String queryVerboseMsg = null;
- long startTime = -1;
+ if (StringUtils.isEmpty(queryString)) {
+ return DataCommandResult.createSelectInfoResult(null, null, -1, null,
+ CliStrings.QUERY__MSG__QUERY_EMPTY, false);
+ }
+
+ QueryService qs = cache.getQueryService();
+
+ // TODO : Find out if is this optimised use. Can you have something equivalent of parsed
+ // queries with names where name can be retrieved to avoid parsing every-time
+ Query query = qs.newQuery(queryString);
+ DefaultQuery tracedQuery = (DefaultQuery) query;
+ WrappedIndexTrackingQueryObserver queryObserver = null;
+ String queryVerboseMsg = null;
+ long startTime = -1;
+ if (tracedQuery.isTraced()) {
+ startTime = NanoTimer.getTime();
+ queryObserver = new WrappedIndexTrackingQueryObserver();
+ QueryObserverHolder.setInstance(queryObserver);
+ }
+ List<SelectResultRow> list = new ArrayList<>();
+
+ try {
+ Object results = query.execute();
if (tracedQuery.isTraced()) {
- startTime = NanoTimer.getTime();
- queryObserver = new WrappedIndexTrackingQueryObserver();
- QueryObserverHolder.setInstance(queryObserver);
+ queryVerboseMsg = getLogMessage(queryObserver, startTime, queryString);
+ queryObserver.reset2();
}
- List<SelectResultRow> list = new ArrayList<SelectResultRow>();
+ if (results instanceof SelectResults) {
+ select_SelectResults((SelectResults) results, principal, list, nestedObjectCount);
+ } else {
+ select_NonSelectResults(results, list);
+ }
+ return DataCommandResult.createSelectResult(queryString, list, queryVerboseMsg, null, null,
+ true);
+
+ } catch (FunctionDomainException | GfJsonException | QueryInvocationTargetException
+ | NameResolutionException | TypeMismatchException e) {
+ logger.warn(e.getMessage(), e);
+ return DataCommandResult.createSelectResult(queryString, null, queryVerboseMsg, e,
+ e.getMessage(), false);
+ } finally {
+ if (queryObserver != null) {
+ QueryObserverHolder.reset();
+ }
+ }
+ }
+ private void select_NonSelectResults(Object results, List<SelectResultRow> list) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("BeanResults : Bean Results class is {}", results.getClass());
+ }
+ String str = toJson(results);
+ GfJsonObject jsonBean;
+ try {
+ jsonBean = new GfJsonObject(str);
+ } catch (GfJsonException e) {
+ logger.info("Exception occurred:", e);
+ jsonBean = new GfJsonObject();
try {
- Object results = query.execute();
- if (tracedQuery.isTraced()) {
- queryVerboseMsg = getLogMessage(queryObserver, startTime, queryString);
- queryObserver.reset2();
+ jsonBean.put("msg", e.getMessage());
+ } catch (GfJsonException e1) {
+ logger.warn("Ignored GfJsonException:", e1);
+ }
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("BeanResults : Adding bean json string : {}", jsonBean);
+ }
+ list.add(new SelectResultRow(DataCommandResult.ROW_TYPE_BEAN, jsonBean.toString()));
+ }
+
+ private void select_SelectResults(SelectResults selectResults, Object principal,
+ List<SelectResultRow> list, AtomicInteger nestedObjectCount) throws GfJsonException {
+ for (Object object : selectResults) {
+ // Post processing
+ object = securityService.postProcess(principal, null, null, object, false);
+
+ if (object instanceof Struct) {
+ StructImpl impl = (StructImpl) object;
+ GfJsonObject jsonStruct = getJSONForStruct(impl, nestedObjectCount);
+ if (logger.isDebugEnabled()) {
+ logger.debug("SelectResults : Adding select json string : {}", jsonStruct);
}
- if (results instanceof SelectResults) {
- SelectResults selectResults = (SelectResults) results;
- for (Iterator iter = selectResults.iterator(); iter.hasNext();) {
- Object object = iter.next();
- // Post processing
- object = this.securityService.postProcess(principal, null, null, object, false);
-
- if (object instanceof Struct) {
- StructImpl impl = (StructImpl) object;
- GfJsonObject jsonStruct = getJSONForStruct(impl, nestedObjectCount);
- if (logger.isDebugEnabled())
- logger.debug("SelectResults : Adding select json string : {}", jsonStruct);
- list.add(new SelectResultRow(DataCommandResult.ROW_TYPE_STRUCT_RESULT,
- jsonStruct.toString()));
- } else {
- if (JsonUtil.isPrimitiveOrWrapper(object.getClass())) {
- if (logger.isDebugEnabled())
- logger.debug("SelectResults : Adding select primitive : {}", object);
- list.add(new SelectResultRow(DataCommandResult.ROW_TYPE_PRIMITIVE, object));
- } else {
- if (logger.isDebugEnabled())
- logger.debug("SelectResults : Bean Results class is {}", object.getClass());
- String str = toJson(object);
- GfJsonObject jsonBean;
- try {
- jsonBean = new GfJsonObject(str);
- } catch (GfJsonException e) {
- logger.fatal(e.getMessage(), e);
- jsonBean = new GfJsonObject();
- try {
- jsonBean.put("msg", e.getMessage());
- } catch (GfJsonException e1) {
- }
- }
- if (logger.isDebugEnabled())
- logger.debug("SelectResults : Adding bean json string : {}", jsonBean);
- list.add(new SelectResultRow(DataCommandResult.ROW_TYPE_BEAN, jsonBean.toString()));
- }
- }
- }
- } else {
- if (logger.isDebugEnabled())
- logger.debug("BeanResults : Bean Results class is {}", results.getClass());
- String str = toJson(results);
- GfJsonObject jsonBean;
+ list.add(
+ new SelectResultRow(DataCommandResult.ROW_TYPE_STRUCT_RESULT, jsonStruct.toString()));
+ } else if (JsonUtil.isPrimitiveOrWrapper(object.getClass())) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("SelectResults : Adding select primitive : {}", object);
+ }
+ list.add(new SelectResultRow(DataCommandResult.ROW_TYPE_PRIMITIVE, object));
+ } else {
+ if (logger.isDebugEnabled()) {
+ logger.debug("SelectResults : Bean Results class is {}", object.getClass());
+ }
+ String str = toJson(object);
+ GfJsonObject jsonBean;
+ try {
+ jsonBean = new GfJsonObject(str);
+ } catch (GfJsonException e) {
+ logger.error(e.getMessage(), e);
+ jsonBean = new GfJsonObject();
try {
- jsonBean = new GfJsonObject(str);
- } catch (GfJsonException e) {
- e.printStackTrace();
- jsonBean = new GfJsonObject();
- try {
- jsonBean.put("msg", e.getMessage());
- } catch (GfJsonException e1) {
- }
+ jsonBean.put("msg", e.getMessage());
+ } catch (GfJsonException e1) {
+ logger.warn("Ignored GfJsonException:", e1);
}
- if (logger.isDebugEnabled())
- logger.debug("BeanResults : Adding bean json string : {}", jsonBean);
- list.add(new SelectResultRow(DataCommandResult.ROW_TYPE_BEAN, jsonBean.toString()));
}
- return DataCommandResult.createSelectResult(queryString, list, queryVerboseMsg, null, null,
- true);
-
- } catch (FunctionDomainException e) {
- logger.warn(e.getMessage(), e);
- return DataCommandResult.createSelectResult(queryString, null, queryVerboseMsg, e,
- e.getMessage(), false);
- } catch (TypeMismatchException e) {
- logger.warn(e.getMessage(), e);
- return DataCommandResult.createSelectResult(queryString, null, queryVerboseMsg, e,
- e.getMessage(), false);
- } catch (NameResolutionException e) {
- logger.warn(e.getMessage(), e);
- return DataCommandResult.createSelectResult(queryString, null, queryVerboseMsg, e,
- e.getMessage(), false);
- } catch (QueryInvocationTargetException e) {
- logger.warn(e.getMessage(), e);
- return DataCommandResult.createSelectResult(queryString, null, queryVerboseMsg, e,
- e.getMessage(), false);
- } catch (GfJsonException e) {
- logger.warn(e.getMessage(), e);
- return DataCommandResult.createSelectResult(queryString, null, queryVerboseMsg, e,
- e.getMessage(), false);
- } finally {
- if (queryObserver != null) {
- QueryObserverHolder.reset();
+ if (logger.isDebugEnabled()) {
+ logger.debug("SelectResults : Adding bean json string : {}", jsonBean);
}
+ list.add(new SelectResultRow(DataCommandResult.ROW_TYPE_BEAN, jsonBean.toString()));
}
- } else {
- return DataCommandResult.createSelectInfoResult(null, null, -1, null,
- CliStrings.QUERY__MSG__QUERY_EMPTY, false);
}
}
private String toJson(Object object) {
if (object instanceof Undefined) {
return "{\"Value\":\"UNDEFINED\"}";
- } else if (object instanceof PdxInstance)
+ } else if (object instanceof PdxInstance) {
return pdxToJson((PdxInstance) object);
- else
+ } else {
return JsonUtil.objectToJsonNestedChkCDep(object, NESTED_JSON_LENGTH);
+ }
}
private GfJsonObject getJSONForStruct(StructImpl impl, AtomicInteger ai) throws GfJsonException {
@@ -376,14 +371,13 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
InternalCache cache = getCache();
- if (regionName == null || regionName.isEmpty()) {
+ if (StringUtils.isEmpty(regionName)) {
return DataCommandResult.createRemoveResult(key, null, null,
CliStrings.REMOVE__MSG__REGIONNAME_EMPTY, false);
}
- boolean allKeysFlag = (removeAllKeys == null || removeAllKeys.isEmpty());
- if (allKeysFlag && (key == null)) {
- return DataCommandResult.createRemoveResult(key, null, null,
+ if (StringUtils.isEmpty(removeAllKeys) && (key == null)) {
+ return DataCommandResult.createRemoveResult(null, null, null,
CliStrings.REMOVE__MSG__KEY_EMPTY, false);
}
@@ -393,7 +387,7 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
CliStrings.format(CliStrings.REMOVE__MSG__REGION_NOT_FOUND, regionName), false);
} else {
if (removeAllKeys == null) {
- Object keyObject = null;
+ Object keyObject;
try {
keyObject = getClassObject(key, keyClass);
} catch (ClassNotFoundException e) {
@@ -406,14 +400,16 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
if (region.containsKey(keyObject)) {
Object value = region.remove(keyObject);
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Removed key {} successfully", key);
+ }
// return DataCommandResult.createRemoveResult(key, value, null, null);
Object array[] = getJSONForNonPrimitiveObject(value);
DataCommandResult result =
DataCommandResult.createRemoveResult(key, array[1], null, null, true);
- if (array[0] != null)
+ if (array[0] != null) {
result.setValueClass((String) array[0]);
+ }
return result;
} else {
return DataCommandResult.createRemoveInfoResult(key, null, null,
@@ -423,8 +419,9 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
DataPolicy policy = region.getAttributes().getDataPolicy();
if (!policy.withPartitioning()) {
region.clear();
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Cleared all keys in the region - {}", regionName);
+ }
return DataCommandResult.createRemoveInfoResult(key, null, null,
CliStrings.format(CliStrings.REMOVE__MSG__CLEARED_ALL_CLEARS, regionName), true);
} else {
@@ -441,12 +438,12 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
InternalCache cache = getCache();
- if (regionName == null || regionName.isEmpty()) {
+ if (StringUtils.isEmpty(regionName)) {
return DataCommandResult.createGetResult(key, null, null,
CliStrings.GET__MSG__REGIONNAME_EMPTY, false);
}
- if (key == null || key.isEmpty()) {
+ if (StringUtils.isEmpty(key)) {
return DataCommandResult.createGetResult(key, null, null, CliStrings.GET__MSG__KEY_EMPTY,
false);
}
@@ -454,12 +451,13 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
Region region = cache.getRegion(regionName);
if (region == null) {
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Region Not Found - {}", regionName);
+ }
return DataCommandResult.createGetResult(key, null, null,
CliStrings.format(CliStrings.GET__MSG__REGION_NOT_FOUND, regionName), false);
} else {
- Object keyObject = null;
+ Object keyObject;
try {
keyObject = getClassObject(key, keyClass);
} catch (ClassNotFoundException e) {
@@ -480,24 +478,27 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
// run it through post processor. region.get will return the deserialized object already, so
// we don't need to
// deserialize it anymore to pass it to the postProcessor
- value = this.securityService.postProcess(principal, regionName, keyObject, value, false);
+ value = securityService.postProcess(principal, regionName, keyObject, value, false);
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Get for key {} value {}", key, value);
+ }
// return DataCommandResult.createGetResult(key, value, null, null);
Object array[] = getJSONForNonPrimitiveObject(value);
if (value != null) {
DataCommandResult result =
DataCommandResult.createGetResult(key, array[1], null, null, true);
- if (array[0] != null)
+ if (array[0] != null) {
result.setValueClass((String) array[0]);
+ }
return result;
} else {
return DataCommandResult.createGetResult(key, array[1], null, null, false);
}
} else {
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Key is not present in the region {}", regionName);
+ }
return DataCommandResult.createGetInfoResult(key, null, null,
CliStrings.GET__MSG__KEY_NOT_FOUND_REGION, false);
}
@@ -510,71 +511,72 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
InternalCache cache = getCache();
- if (regionPath == null || regionPath.isEmpty()) {
+ if (StringUtils.isEmpty(regionPath)) {
return DataCommandResult.createLocateEntryResult(key, null, null,
CliStrings.LOCATE_ENTRY__MSG__REGIONNAME_EMPTY, false);
}
- if (key == null || key.isEmpty()) {
+ if (StringUtils.isEmpty(key)) {
return DataCommandResult.createLocateEntryResult(key, null, null,
CliStrings.LOCATE_ENTRY__MSG__KEY_EMPTY, false);
}
-
- List<Region> listofRegionStartingwithRegionPath = new ArrayList<Region>();
+ List<Region> listOfRegionsStartingWithRegionPath = new ArrayList<>();
if (recursive) {
// Recursively find the keys starting from the specified region path.
List<String> regionPaths = getAllRegionPaths(cache, true);
- for (int i = 0; i < regionPaths.size(); i++) {
- String path = regionPaths.get(i);
+ for (String path : regionPaths) {
if (path.startsWith(regionPath) || path.startsWith(Region.SEPARATOR + regionPath)) {
Region targetRegion = cache.getRegion(path);
- listofRegionStartingwithRegionPath.add(targetRegion);
+ listOfRegionsStartingWithRegionPath.add(targetRegion);
}
}
- if (listofRegionStartingwithRegionPath.size() == 0) {
- if (logger.isDebugEnabled())
+ if (listOfRegionsStartingWithRegionPath.size() == 0) {
+ if (logger.isDebugEnabled()) {
logger.debug("Region Not Found - {}", regionPath);
+ }
return DataCommandResult.createLocateEntryResult(key, null, null,
CliStrings.format(CliStrings.REMOVE__MSG__REGION_NOT_FOUND, regionPath), false);
}
} else {
Region region = cache.getRegion(regionPath);
if (region == null) {
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Region Not Found - {}", regionPath);
+ }
return DataCommandResult.createLocateEntryResult(key, null, null,
CliStrings.format(CliStrings.REMOVE__MSG__REGION_NOT_FOUND, regionPath), false);
- } else
- listofRegionStartingwithRegionPath.add(region);
+ } else {
+ listOfRegionsStartingWithRegionPath.add(region);
+ }
}
- Object keyObject = null;
+ Object keyObject;
try {
keyObject = getClassObject(key, keyClass);
} catch (ClassNotFoundException e) {
- logger.fatal(e.getMessage(), e);
+ logger.error(e.getMessage(), e);
return DataCommandResult.createLocateEntryResult(key, null, null,
"ClassNotFoundException " + keyClass, false);
} catch (IllegalArgumentException e) {
- logger.fatal(e.getMessage(), e);
+ logger.error(e.getMessage(), e);
return DataCommandResult.createLocateEntryResult(key, null, null,
"Error in converting JSON " + e.getMessage(), false);
}
- Object value = null;
- DataCommandResult.KeyInfo keyInfo = null;
+ Object value;
+ DataCommandResult.KeyInfo keyInfo;
keyInfo = new DataCommandResult.KeyInfo();
DistributedMember member = cache.getDistributedSystem().getDistributedMember();
keyInfo.setHost(member.getHost());
keyInfo.setMemberId(member.getId());
keyInfo.setMemberName(member.getName());
- for (Region region : listofRegionStartingwithRegionPath) {
+ for (Region region : listOfRegionsStartingWithRegionPath) {
if (region instanceof PartitionedRegion) {
// Following code is adaptation of which.java of old Gfsh
PartitionedRegion pr = (PartitionedRegion) region;
- Region localRegion = PartitionRegionHelper.getLocalData((PartitionedRegion) region);
+ Region localRegion = PartitionRegionHelper.getLocalData(region);
value = localRegion.get(keyObject);
if (value != null) {
DistributedMember primaryMember =
@@ -584,24 +586,28 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
keyInfo.addLocation(new Object[] {region.getFullPath(), true,
getJSONForNonPrimitiveObject(value)[1], isPrimary, "" + bucketId});
} else {
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Key is not present in the region {}", regionPath);
+ }
return DataCommandResult.createLocateEntryInfoResult(key, null, null,
CliStrings.LOCATE_ENTRY__MSG__KEY_NOT_FOUND_REGION, false);
}
} else {
if (region.containsKey(keyObject)) {
value = region.get(keyObject);
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Get for key {} value {} in region {}", key, value, region.getFullPath());
- if (value != null)
+ }
+ if (value != null) {
keyInfo.addLocation(new Object[] {region.getFullPath(), true,
getJSONForNonPrimitiveObject(value)[1], false, null});
- else
+ } else {
keyInfo.addLocation(new Object[] {region.getFullPath(), false, null, false, null});
+ }
} else {
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Key is not present in the region {}", regionPath);
+ }
keyInfo.addLocation(new Object[] {region.getFullPath(), false, null, false, null});
}
}
@@ -619,17 +625,17 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
public DataCommandResult put(String key, String value, boolean putIfAbsent, String keyClass,
String valueClass, String regionName) {
- if (regionName == null || regionName.isEmpty()) {
+ if (StringUtils.isEmpty(regionName)) {
return DataCommandResult.createPutResult(key, null, null,
CliStrings.PUT__MSG__REGIONNAME_EMPTY, false);
}
- if (key == null || key.isEmpty()) {
+ if (StringUtils.isEmpty(key)) {
return DataCommandResult.createPutResult(key, null, null, CliStrings.PUT__MSG__KEY_EMPTY,
false);
}
- if (value == null || value.isEmpty()) {
+ if (StringUtils.isEmpty(value)) {
return DataCommandResult.createPutResult(key, null, null, CliStrings.PUT__MSG__VALUE_EMPTY,
false);
}
@@ -640,8 +646,8 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
return DataCommandResult.createPutResult(key, null, null,
CliStrings.format(CliStrings.PUT__MSG__REGION_NOT_FOUND, regionName), false);
} else {
- Object keyObject = null;
- Object valueObject = null;
+ Object keyObject;
+ Object valueObject;
try {
keyObject = getClassObject(key, keyClass);
} catch (ClassNotFoundException e) {
@@ -659,14 +665,16 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
"ClassNotFoundException " + valueClass, false);
}
Object returnValue;
- if (putIfAbsent && region.containsKey(keyObject))
+ if (putIfAbsent && region.containsKey(keyObject)) {
returnValue = region.get(keyObject);
- else
+ } else {
returnValue = region.put(keyObject, valueObject);
+ }
Object array[] = getJSONForNonPrimitiveObject(returnValue);
DataCommandResult result = DataCommandResult.createPutResult(key, array[1], null, null, true);
- if (array[0] != null)
+ if (array[0] != null) {
result.setValueClass((String) array[0]);
+ }
return result;
}
}
@@ -674,53 +682,40 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
@SuppressWarnings({"rawtypes", "unchecked"})
private Object getClassObject(String string, String klassString)
throws ClassNotFoundException, IllegalArgumentException {
- if (klassString == null || klassString.isEmpty())
+ if (StringUtils.isEmpty(klassString)) {
return string;
- else {
- Object o = null;
- Class klass = ClassPathLoader.getLatest().forName(klassString);
-
- if (klass.equals(String.class))
- return string;
+ }
+ Class klass = ClassPathLoader.getLatest().forName(klassString);
- if (JsonUtil.isPrimitiveOrWrapper(klass)) {
- try {
- if (klass.equals(Byte.class)) {
- o = Byte.parseByte(string);
- return o;
- } else if (klass.equals(Short.class)) {
- o = Short.parseShort(string);
- return o;
- } else if (klass.equals(Integer.class)) {
- o = Integer.parseInt(string);
- return o;
- } else if (klass.equals(Long.class)) {
- o = Long.parseLong(string);
- return o;
- } else if (klass.equals(Double.class)) {
- o = Double.parseDouble(string);
- return o;
- } else if (klass.equals(Boolean.class)) {
- o = Boolean.parseBoolean(string);
- return o;
- } else if (klass.equals(Float.class)) {
- o = Float.parseFloat(string);
- return o;
- }
- return o;
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException(
- "Failed to convert input key to " + klassString + " Msg : " + e.getMessage());
- }
- }
+ if (klass.equals(String.class)) {
+ return string;
+ }
+ if (JsonUtil.isPrimitiveOrWrapper(klass)) {
try {
- o = getObjectFromJson(string, klass);
- return o;
- } catch (IllegalArgumentException e) {
- throw e;
+ if (klass.equals(Byte.class)) {
+ return Byte.parseByte(string);
+ } else if (klass.equals(Short.class)) {
+ return Short.parseShort(string);
+ } else if (klass.equals(Integer.class)) {
+ return Integer.parseInt(string);
+ } else if (klass.equals(Long.class)) {
+ return Long.parseLong(string);
+ } else if (klass.equals(Double.class)) {
+ return Double.parseDouble(string);
+ } else if (klass.equals(Boolean.class)) {
+ return Boolean.parseBoolean(string);
+ } else if (klass.equals(Float.class)) {
+ return Float.parseFloat(string);
+ }
+ return null;
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException(
+ "Failed to convert input key to " + klassString + " Msg : " + e.getMessage());
}
}
+
+ return getObjectFromJson(string, klass);
}
@SuppressWarnings({"rawtypes"})
@@ -803,10 +798,11 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
sb.append("{").append(newString.substring(1, len - 1)).append("}");
newString = sb.toString();
}
- V v = JsonUtil.jsonToObject(newString, klass);
- return v;
+ return JsonUtil.jsonToObject(newString, klass);
}
+
+
/**
* Returns a sorted list of all region full paths found in the specified cache.
*
@@ -822,18 +818,17 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
}
// get a list of all root regions
- Set regions = cache.rootRegions();
- Iterator itor = regions.iterator();
+ Set<Region<?, ?>> regions = cache.rootRegions();
- while (itor.hasNext()) {
- String regionPath = ((Region) itor.next()).getFullPath();
+ for (Region rootRegion : regions) {
+ String regionPath = rootRegion.getFullPath();
Region region = cache.getRegion(regionPath);
list.add(regionPath);
- Set subregionSet = region.subregions(true);
+ Set<Region> subregionSet = region.subregions(true);
if (recursive) {
- for (Iterator subIter = subregionSet.iterator(); subIter.hasNext();) {
- list.add(((Region) subIter.next()).getFullPath());
+ for (Region aSubregionSet : subregionSet) {
+ list.add(aSubregionSet.getFullPath());
}
}
}
@@ -856,7 +851,7 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
int startCount = args.getInt(DataCommandResult.QUERY_PAGE_START);
int endCount = args.getInt(DataCommandResult.QUERY_PAGE_END);
int rows = args.getInt(DataCommandResult.NUM_ROWS); // returns Zero if no rows added so it
- // works.
+ // works.
boolean flag = args.getBoolean(DataCommandResult.RESULT_FLAG);
CommandResult commandResult = CLIMultiStepHelper.getDisplayResultFromArgs(args);
Gfsh.println();
@@ -865,7 +860,7 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
}
if (flag) {
- boolean paginationNeeded = (startCount < rows) && (endCount < rows) && interactive && flag;
+ boolean paginationNeeded = startCount < rows && endCount < rows && interactive;
if (paginationNeeded) {
while (true) {
String message = ("Press n to move to next page, q to quit and p to previous page : ");
@@ -879,17 +874,19 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
new Object[] {nextStart, (nextStart + getPageSize())}, SELECT_STEP_MOVE);
} else if ("p".equals(step)) {
int nextStart = startCount - getPageSize();
- if (nextStart < 0)
+ if (nextStart < 0) {
nextStart = 0;
+ }
return CLIMultiStepHelper.createBannerResult(
new String[] {DataCommandResult.QUERY_PAGE_START,
DataCommandResult.QUERY_PAGE_END},
new Object[] {nextStart, (nextStart + getPageSize())}, SELECT_STEP_MOVE);
- } else if ("q".equals(step))
+ } else if ("q".equals(step)) {
return CLIMultiStepHelper.createBannerResult(new String[] {}, new Object[] {},
SELECT_STEP_END);
- else
+ } else {
Gfsh.println("Unknown option ");
+ }
} catch (IOException e) {
throw new RuntimeException(e);
}
@@ -916,7 +913,7 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
int endCount = args.getInt(DataCommandResult.QUERY_PAGE_END);
return cachedResult.pageResult(startCount, endCount, SELECT_STEP_DISPLAY);
}
- };
+ }
public static class SelectExecStep extends CLIMultiStepHelper.RemoteStep {
@@ -938,21 +935,23 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
if (interactive) {
endCount = getPageSize();
} else {
- if (result.getSelectResult() != null)
+ if (result.getSelectResult() != null) {
endCount = result.getSelectResult().size();
+ }
}
- if (interactive)
+ if (interactive) {
return result.pageResult(0, endCount, SELECT_STEP_DISPLAY);
- else
+ } else {
return CLIMultiStepHelper.createBannerResult(new String[] {}, new Object[] {},
SELECT_STEP_END);
+ }
}
public DataCommandResult _select(String query) {
InternalCache cache = (InternalCache) CacheFactory.getAnyInstance();
- DataCommandResult dataResult = null;
+ DataCommandResult dataResult;
- if (query == null || query.isEmpty()) {
+ if (StringUtils.isEmpty(query)) {
dataResult = DataCommandResult.createSelectInfoResult(null, null, -1, null,
CliStrings.QUERY__MSG__QUERY_EMPTY, false);
return dataResult;
@@ -964,15 +963,15 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
@SuppressWarnings("deprecation")
QCompiler compiler = new QCompiler();
- Set<String> regionsInQuery = null;
+ Set<String> regionsInQuery;
try {
CompiledValue compiledQuery = compiler.compileQuery(query);
- Set<String> regions = new HashSet<String>();
+ Set<String> regions = new HashSet<>();
compiledQuery.getRegionsInQuery(regions, null);
// authorize data read on these regions
for (String region : regions) {
- this.securityService.authorizeRegionRead(region);
+ securityService.authorizeRegionRead(region);
}
regionsInQuery = Collections.unmodifiableSet(regions);
@@ -984,38 +983,38 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
DataCommandRequest request = new DataCommandRequest();
request.setCommand(CliStrings.QUERY);
request.setQuery(query);
- Subject subject = this.securityService.getSubject();
+ Subject subject = securityService.getSubject();
if (subject != null) {
- request.setPrincipal((Serializable) subject.getPrincipal());
+ request.setPrincipal(subject.getPrincipal());
}
dataResult = DataCommands.callFunctionForRegion(request, function, members);
dataResult.setInputQuery(query);
- return (dataResult);
+ return dataResult;
} else {
- return (dataResult =
- DataCommandResult.createSelectInfoResult(null, null, -1, null, CliStrings.format(
- CliStrings.QUERY__MSG__REGIONS_NOT_FOUND, regionsInQuery.toString()), false));
+ return DataCommandResult.createSelectInfoResult(null, null, -1, null, CliStrings.format(
+ CliStrings.QUERY__MSG__REGIONS_NOT_FOUND, regionsInQuery.toString()), false);
}
} else {
- return (dataResult = DataCommandResult.createSelectInfoResult(null, null, -1, null,
+ return DataCommandResult.createSelectInfoResult(null, null, -1, null,
CliStrings.format(CliStrings.QUERY__MSG__INVALID_QUERY,
"Region mentioned in query probably missing /"),
- false));
+ false);
}
} catch (QueryInvalidException qe) {
logger.error("{} Failed Error {}", query, qe.getMessage(), qe);
- return (dataResult = DataCommandResult.createSelectInfoResult(null, null, -1, null,
- CliStrings.format(CliStrings.QUERY__MSG__INVALID_QUERY, qe.getMessage()), false));
+ return DataCommandResult.createSelectInfoResult(null, null, -1, null,
+ CliStrings.format(CliStrings.QUERY__MSG__INVALID_QUERY, qe.getMessage()), false);
}
}
private String addLimit(String query) {
if (StringUtils.containsIgnoreCase(query, " limit")
- || StringUtils.containsIgnoreCase(query, " count("))
+ || StringUtils.containsIgnoreCase(query, " count(")) {
return query;
+ }
return query + " limit " + getFetchSize();
}
- };
+ }
public static class SelectQuitStep extends CLIMultiStepHelper.RemoteStep {
@@ -1031,20 +1030,20 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
GfJsonObject args = CLIMultiStepHelper.getStepArgs();
DataCommandResult dataResult = cachedResult;
cachedResult = null;
- if (interactive)
+ if (interactive) {
return CLIMultiStepHelper.createEmptyResult("END");
- else {
+ } else {
CompositeResultData rd = dataResult.toSelectCommandResult();
SectionResultData section = rd.addSection(CLIMultiStepHelper.STEP_SECTION);
section.addData(CLIMultiStepHelper.NEXT_STEP_NAME, "END");
return ResultBuilder.buildResult(rd);
}
}
- };
+ }
public static int getPageSize() {
int pageSize = -1;
- Map<String, String> session = null;
+ Map<String, String> session;
if (CliUtil.isGfshVM()) {
session = Gfsh.getCurrentInstance().getEnv();
} else {
@@ -1052,13 +1051,15 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
}
if (session != null) {
String size = session.get(Gfsh.ENV_APP_COLLECTION_LIMIT);
- if (size == null || size.isEmpty())
+ if (StringUtils.isEmpty(size)) {
pageSize = Gfsh.DEFAULT_APP_COLLECTION_LIMIT;
- else
+ } else {
pageSize = Integer.parseInt(size);
+ }
}
- if (pageSize == -1)
+ if (pageSize == -1) {
pageSize = Gfsh.DEFAULT_APP_COLLECTION_LIMIT;
+ }
return pageSize;
}
@@ -1068,7 +1069,6 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
public static String getLogMessage(QueryObserver observer, long startTime, String query) {
String usedIndexesString = null;
- String rowCountString = null;
float time = 0.0f;
if (startTime > 0L) {
@@ -1087,7 +1087,7 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
buf.append(":");
for (Iterator itr = usedIndexes.entrySet().iterator(); itr.hasNext();) {
Map.Entry entry = (Map.Entry) itr.next();
- buf.append(entry.getKey().toString() + entry.getValue());
+ buf.append(entry.getKey().toString()).append(entry.getValue());
if (itr.hasNext()) {
buf.append(",");
}
@@ -1099,9 +1099,8 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
+ observer.getClass().getName() + ")";
}
- return "Query Executed" + (startTime > 0L ? " in " + time + " ms;" : ";")
- + (rowCountString != null ? rowCountString : "")
- + (usedIndexesString != null ? usedIndexesString : "");
+ return String.format("Query Executed%s%s", startTime > 0L ? " in " + time + " ms;" : ";",
+ usedIndexesString != null ? usedIndexesString : "");
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TabularResultData.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TabularResultData.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TabularResultData.java
index e72654e..fa1e4a5 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TabularResultData.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TabularResultData.java
@@ -14,20 +14,14 @@
*/
package org.apache.geode.management.internal.cli.result;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
import org.apache.geode.management.internal.cli.json.GfJsonArray;
import org.apache.geode.management.internal.cli.json.GfJsonException;
import org.apache.geode.management.internal.cli.json.GfJsonObject;
+import java.util.ArrayList;
+import java.util.List;
+
/**
- *
- *
* @since GemFire 7.0
*/
public class TabularResultData extends AbstractResultData {
@@ -70,8 +64,7 @@ public class TabularResultData extends AbstractResultData {
}
/**
- *
- * @param headerText
+ * @param headerText Text to set to header.
* @return this TabularResultData
* @throws ResultDataException If the value is non-finite number or if the key is null.
*/
@@ -80,8 +73,7 @@ public class TabularResultData extends AbstractResultData {
}
/**
- *
- * @param footerText
+ * @param footerText Text to set to footer.
* @return this TabularResultData
* @throws ResultDataException If the value is non-finite number or if the key is null.
*/
@@ -99,62 +91,8 @@ public class TabularResultData extends AbstractResultData {
return gfJsonObject.getString(RESULT_FOOTER);
}
- public Map<String, String> retrieveDataByValueInColumn(String columnName, String valueToSearch) {
- Map<String, String> foundValues = Collections.emptyMap();
- try {
- GfJsonArray jsonArray = contentObject.getJSONArray(columnName);
- int size = jsonArray.size();
- int foundIndex = -1;
- for (int i = 0; i < size; i++) {
- Object object = jsonArray.get(i);
- if (object != null && object.equals(valueToSearch)) {
- foundIndex = i;
- break;
- }
- }
-
- if (foundIndex != -1) {
- foundValues = new LinkedHashMap<String, String>();
- for (Iterator<String> iterator = contentObject.keys(); iterator.hasNext();) {
- String storedColumnNames = (String) iterator.next();
- GfJsonArray storedColumnValues = contentObject.getJSONArray(storedColumnNames);
- foundValues.put(storedColumnNames, String.valueOf(storedColumnValues.get(foundIndex)));
- }
- }
- } catch (GfJsonException e) {
- throw new ResultDataException(e.getMessage());
- }
- return foundValues;
- }
-
- public List<Map<String, String>> retrieveAllDataByValueInColumn(String columnName,
- String valueToSearch) {
- List<Map<String, String>> foundValuesList = new ArrayList<Map<String, String>>();
- try {
- GfJsonArray jsonArray = contentObject.getJSONArray(columnName);
- int size = jsonArray.size();
- for (int i = 0; i < size; i++) {
- Object object = jsonArray.get(i);
- if (object != null && object.equals(valueToSearch)) {
- Map<String, String> foundValues = new LinkedHashMap<String, String>();
-
- for (Iterator<String> iterator = contentObject.keys(); iterator.hasNext();) {
- String storedColumnNames = (String) iterator.next();
- GfJsonArray storedColumnValues = contentObject.getJSONArray(storedColumnNames);
- foundValues.put(storedColumnNames, String.valueOf(storedColumnValues.get(i)));
- }
-
- foundValuesList.add(foundValues);
- }
- }
- } catch (GfJsonException e) {
- throw new ResultDataException(e.getMessage());
- }
- return foundValuesList;
- }
-
public List<String> retrieveAllValues(String columnName) {
- List<String> values = new ArrayList<String>();
+ List<String> values = new ArrayList<>();
try {
GfJsonArray jsonArray = contentObject.getJSONArray(columnName);
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryDataInconsistencyDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
index 1af6261..eff4d29 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
@@ -14,19 +14,17 @@
*/
package org.apache.geode.cache.query.dunit;
+import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
import org.junit.experimental.categories.Category;
import org.junit.Test;
import static org.junit.Assert.*;
import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
import org.apache.geode.test.junit.categories.DistributedTest;
import java.util.Properties;
-import org.junit.experimental.categories.Category;
-
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheException;
import org.apache.geode.cache.CacheFactory;
@@ -38,16 +36,13 @@ import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.cache.client.ClientCacheFactory;
import org.apache.geode.cache.client.ClientRegionShortcut;
import org.apache.geode.cache.query.Index;
-import org.apache.geode.cache.query.IndexType;
import org.apache.geode.cache.query.QueryService;
import org.apache.geode.cache.query.SelectResults;
import org.apache.geode.cache.query.data.Portfolio;
import org.apache.geode.cache.query.data.Position;
import org.apache.geode.cache.query.internal.QueryObserverHolder;
import org.apache.geode.cache.query.internal.index.IndexManager;
-import org.apache.geode.cache.query.partitioned.PRQueryDUnitHelper;
import org.apache.geode.cache30.CacheSerializableRunnable;
-import org.apache.geode.cache30.CacheTestCase;
import org.apache.geode.internal.cache.execute.PRClientServerTestBase;
import org.apache.geode.test.dunit.Assert;
import org.apache.geode.test.dunit.AsyncInvocation;
@@ -92,17 +87,14 @@ public class QueryDataInconsistencyDUnitTest extends JUnit4CacheTestCase {
public static volatile boolean hooked = false;
- /**
- * @param name
- */
public QueryDataInconsistencyDUnitTest() {
super();
}
@Override
public final void postTearDownCacheTestCase() throws Exception {
- Invoke.invokeInEveryVM(() -> disconnectFromDS());
- Invoke.invokeInEveryVM(() -> QueryObserverHolder.reset());
+ Invoke.invokeInEveryVM(JUnit4DistributedTestCase::disconnectFromDS);
+ Invoke.invokeInEveryVM(QueryObserverHolder::reset);
}
@Override
@@ -544,8 +536,8 @@ public class QueryDataInconsistencyDUnitTest extends JUnit4CacheTestCase {
}
private void createCacheClientWithoutReg(String host, Integer port1) {
- this.disconnectFromDS();
- ClientCache cache = new ClientCacheFactory().addPoolServer(host, port1).create();
+ disconnectFromDS();
+ new ClientCacheFactory().addPoolServer(host, port1).create();
}
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
index 2af3fea..14d4d3f 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
@@ -218,8 +218,8 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
});
- final String vm1MemberId = (String) vm1.invoke(() -> getMemberId());
- final String vm2MemberId = (String) vm2.invoke(() -> getMemberId());
+ final String vm1MemberId = vm1.invoke(() -> getMemberId());
+ final String vm2MemberId = vm2.invoke(() -> getMemberId());
getLogWriter().info("Vm1 ID : " + vm1MemberId);
getLogWriter().info("Vm2 ID : " + vm2MemberId);
@@ -457,9 +457,13 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
doQueryRegionsAssociatedMembers(queryTemplate1, -1, false,
new String[] {DATA_PAR_REGION_NAME_VM2_PATH, "/jfgkdfjgkd"}); // one wrong region
doQueryRegionsAssociatedMembers(queryTemplate1, -1, true,
- new String[] {"/dhgfdhgf", "/dhgddhd"}); // both regions wrong
+ new String[] {"/dhgfdhgf", "/dhgddhd"}); // both
+ // regions
+ // wrong
doQueryRegionsAssociatedMembers(queryTemplate1, -1, false,
- new String[] {"/dhgfdhgf", "/dhgddhd"}); // both regions wrong
+ new String[] {"/dhgfdhgf", "/dhgddhd"}); // both
+ // regions
+ // wrong
}
});
}
@@ -1961,13 +1965,9 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
return false;
} else {
// verify that bean is proper before executing tests
- if (bean.getMembers() != null && bean.getMembers().length > 1
+ return bean.getMembers() != null && bean.getMembers().length > 1
&& bean.getMemberCount() > 0
- && service.getDistributedSystemMXBean().listRegions().length >= 2) {
- return true;
- } else {
- return false;
- }
+ && service.getDistributedSystemMXBean().listRegions().length >= 2;
}
}
@@ -2037,7 +2037,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(checkRegionMBeans);
- getLogWriter().info("testRebalanceCommandForSimulate verified Mbean and executin command");
+ getLogWriter().info("testRebalanceCommandForSimulate verified Mbean and executing command");
String command = "rebalance --simulate=true --include-region=" + "/" + REBALANCE_REGION_NAME;
CommandResult cmdResult = executeCommand(command);
getLogWriter().info("testRebalanceCommandForSimulate just after executing " + cmdResult);
@@ -2298,11 +2298,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
getLogWriter().info(
"waitForListClientMbean Still probing for DistributedRegionMXBean with separator Not null "
+ bean2.getMembers().length);
- if (bean2.getMembers().length > 1) {
- return true;
- } else {
- return false;
- }
+ return bean2.getMembers().length > 1;
}
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DataCommandFunctionWithPDXJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DataCommandFunctionWithPDXJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DataCommandFunctionWithPDXJUnitTest.java
new file mode 100644
index 0000000..a9a29a0
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DataCommandFunctionWithPDXJUnitTest.java
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.functions;
+
+import static org.apache.geode.management.internal.cli.domain.DataCommandResult.MISSING_VALUE;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.management.internal.cli.domain.DataCommandRequest;
+import org.apache.geode.management.internal.cli.domain.DataCommandResult;
+import org.apache.geode.management.internal.cli.json.GfJsonArray;
+import org.apache.geode.management.internal.cli.json.GfJsonException;
+import org.apache.geode.management.internal.cli.json.GfJsonObject;
+import org.apache.geode.management.internal.cli.result.CompositeResultData;
+import org.apache.geode.management.internal.cli.result.TabularResultData;
+import org.apache.geode.pdx.PdxReader;
+import org.apache.geode.pdx.PdxSerializable;
+import org.apache.geode.pdx.PdxWriter;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.assertj.core.api.SoftAssertions;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(IntegrationTest.class)
+public class DataCommandFunctionWithPDXJUnitTest {
+ private static final String PARTITIONED_REGION = "part_region";
+
+ @Rule
+ public ServerStarterRule server = new ServerStarterRule().withPDXPersistent()
+ .withRegion(RegionShortcut.PARTITION, PARTITIONED_REGION);
+
+ private Customer alice;
+ private Customer bob;
+ private CustomerWithPhone charlie;
+ private CustomerWithPhone dan;
+
+ @Before
+ public void setup() {
+ alice = new Customer("0", "Alice", "Anderson");
+ bob = new Customer("1", "Bob", "Bailey");
+ charlie = new CustomerWithPhone("2", "Charlie", "Chaplin", "(222) 222-2222");
+ dan = new CustomerWithPhone("3", "Dan", "Dickinson", "(333) 333-3333");
+
+ Region region = server.getCache().getRegion(PARTITIONED_REGION);
+ region.put(0, alice);
+ region.put(1, bob);
+ region.put(2, charlie);
+ region.put(3, dan);
+ }
+
+ // GEODE-2662: building a table where early values are missing keys causes the data to shift
+ // upward during reporting.
+ @Test
+ public void testTableIsRectangular() throws GfJsonException {
+ TabularResultData rawTable = getTableFromQuery("select * from /" + PARTITIONED_REGION);
+ // Verify any table built
+ assertThat(rawTable.getGfJsonObject()).isNotNull();
+ assertThat(rawTable.getGfJsonObject().getJSONObject("content")).isNotNull();
+ GfJsonObject tableJson = rawTable.getGfJsonObject().getJSONObject("content");
+ // Verify table is rectangular
+ SoftAssertions softly = new SoftAssertions();
+ for (String k : new String[] {"id", "phone", "firstName", "lastName"}) {
+ softly.assertThat(tableJson.getJSONArray(k).size()).isEqualTo(4);
+ }
+ softly.assertAll();
+ }
+
+ @Test
+ public void testVerifyDataDoesNotShift() throws Exception {
+ TabularResultData rawTable =
+ getTableFromQuery("select * from /" + PARTITIONED_REGION + " order by id");
+ // Verify any table built
+ assertThat(rawTable.getGfJsonObject()).isNotNull();
+ assertThat(rawTable.getGfJsonObject().getJSONObject("content")).isNotNull();
+ GfJsonObject tableJson = rawTable.getGfJsonObject().getJSONObject("content");
+ // Table only contains correct keys
+ assertThat(tableJson.getJSONArray("missingKey")).isNull();
+
+ // Table contains correct data
+ assertThatRowIsBuiltCorrectly(tableJson, 0, alice);
+ assertThatRowIsBuiltCorrectly(tableJson, 1, bob);
+ assertThatRowIsBuiltCorrectly(tableJson, 2, charlie);
+ assertThatRowIsBuiltCorrectly(tableJson, 3, dan);
+ }
+
+ @Test
+ public void testFilteredQueryWithPhone() throws Exception {
+ TabularResultData rawTable = getTableFromQuery(
+ "select * from /" + PARTITIONED_REGION + " c where IS_DEFINED ( c.phone ) order by id");
+ assertThat(rawTable.getGfJsonObject()).isNotNull();
+ assertThat(rawTable.getGfJsonObject().getJSONObject("content")).isNotNull();
+ GfJsonObject tableJson = rawTable.getGfJsonObject().getJSONObject("content");
+ for (String k : new String[] {"id", "phone", "firstName", "lastName"}) {
+ assertThat(tableJson.getJSONArray(k).size()).isEqualTo(2);
+ }
+ assertThatRowIsBuiltCorrectly(tableJson, 0, charlie);
+ assertThatRowIsBuiltCorrectly(tableJson, 1, dan);
+ }
+
+
+ @Test
+ public void testFilteredQueryWithoutPhone() throws Exception {
+ TabularResultData rawTable = getTableFromQuery(
+ "select * from /" + PARTITIONED_REGION + " c where IS_UNDEFINED ( c.phone ) order by id");
+ assertThat(rawTable.getGfJsonObject()).isNotNull();
+ assertThat(rawTable.getGfJsonObject().getJSONObject("content")).isNotNull();
+ GfJsonObject tableJson = rawTable.getGfJsonObject().getJSONObject("content");
+ for (String k : new String[] {"id", "firstName", "lastName"}) {
+ assertThat(tableJson.getJSONArray(k).size()).isEqualTo(2);
+ }
+ assertThatRowIsBuiltCorrectly(tableJson, 0, alice);
+ assertThatRowIsBuiltCorrectly(tableJson, 1, bob);
+ }
+
+ private TabularResultData getTableFromQuery(String query) {
+ DataCommandRequest request = new DataCommandRequest();
+ request.setQuery(query);
+ DataCommandResult result = new DataCommandFunction().select(request);
+ CompositeResultData r = result.toSelectCommandResult();
+ return r.retrieveSectionByIndex(0).retrieveTableByIndex(0);
+ }
+
+
+ private void assertThatRowIsBuiltCorrectly(GfJsonObject table, int rowNum, Customer customer)
+ throws Exception {
+ SoftAssertions softly = new SoftAssertions();
+ String id = (String) table.getJSONArray("id").get(rowNum);
+ String firstName = (String) table.getJSONArray("firstName").get(rowNum);
+ String lastName = (String) table.getJSONArray("lastName").get(rowNum);
+
+ softly.assertThat(id).describedAs("Customer ID").isEqualTo(customer.id);
+ softly.assertThat(firstName).describedAs("First name").isEqualTo(customer.firstName);
+ softly.assertThat(lastName).describedAs("Last name").isEqualTo(customer.lastName);
+
+ GfJsonArray phoneArray = table.getJSONArray("phone");
+
+ if (phoneArray == null) {
+ softly.assertThat(customer).describedAs("No phone data")
+ .isNotInstanceOf(CustomerWithPhone.class);
+ } else {
+ String phone = (String) phoneArray.get(rowNum);
+
+ if (customer instanceof CustomerWithPhone) {
+ softly.assertThat(phone).describedAs("Phone")
+ .isEqualTo(((CustomerWithPhone) customer).phone);
+ } else {
+ softly.assertThat(phone).describedAs("Phone (missing)").isEqualTo(MISSING_VALUE);
+ }
+ }
+ softly.assertAll();
+ }
+
+ public static class Customer implements PdxSerializable {
+ protected String id;
+ protected String firstName;
+ protected String lastName;
+
+ Customer() {}
+
+ Customer(String id, String firstName, String lastName) {
+ this.id = id;
+ this.firstName = firstName;
+ this.lastName = lastName;
+ }
+
+ @Override
+ public void toData(PdxWriter writer) {
+ writer.writeString("id", id).markIdentityField("id").writeString("firstName", firstName)
+ .writeString("lastName", lastName);
+ }
+
+ @Override
+ public void fromData(PdxReader reader) {
+ id = reader.readString("id");
+ firstName = reader.readString("firstName");
+ lastName = reader.readString("lastName");
+ }
+ }
+
+ public static class CustomerWithPhone extends Customer {
+ private String phone;
+
+ CustomerWithPhone(String id, String firstName, String lastName, String phone) {
+ this.id = id;
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.phone = phone;
+ }
+
+ @Override
+ public void toData(PdxWriter writer) {
+ writer.writeString("id", id).markIdentityField("id").writeString("firstName", firstName)
+ .writeString("lastName", lastName).writeString("phone", phone);
+ }
+
+ @Override
+ public void fromData(PdxReader reader) {
+ id = reader.readString("id");
+ firstName = reader.readString("firstName");
+ lastName = reader.readString("lastName");
+ phone = reader.readString("phone");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
index ead1047..30ae59f 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
@@ -54,6 +54,7 @@ public class ServerStarterRule extends MemberStarterRule<ServerStarterRule> impl
private transient Cache cache;
private transient CacheServer server;
private int embeddedLocatorPort = -1;
+ private boolean pdxPersistent = false;
private Map<String, RegionShortcut> regions = new HashMap<>();
@@ -107,6 +108,13 @@ public class ServerStarterRule extends MemberStarterRule<ServerStarterRule> impl
}
}
+ public ServerStarterRule withPDXPersistent() {
+ pdxPersistent = true;
+ return this;
+ }
+
+
+
public ServerStarterRule withEmbeddedLocator() {
embeddedLocatorPort = AvailablePortHelper.getRandomAvailableTCPPort();
properties.setProperty("start-locator", "localhost[" + embeddedLocatorPort + "]");
@@ -127,9 +135,6 @@ public class ServerStarterRule extends MemberStarterRule<ServerStarterRule> impl
return this;
}
- public void startServer() {
- startServer(false);
- }
public ServerStarterRule withRegion(RegionShortcut type, String name) {
this.autoStart = true;
@@ -141,7 +146,7 @@ public class ServerStarterRule extends MemberStarterRule<ServerStarterRule> impl
withProperties(properties).withConnectionToLocator(locatorPort).startServer();
}
- public void startServer(boolean pdxPersistent) {
+ public void startServer() {
CacheFactory cf = new CacheFactory(this.properties);
cf.setPdxReadSerialized(pdxPersistent);
cf.setPdxPersistent(pdxPersistent);
[13/14] geode git commit: GEODE-2929: remove superfluous final from
methods
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java
index 870e778..44171e6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java
@@ -224,8 +224,8 @@ public class DistributedRegionFunctionStreamingMessage extends DistributionMessa
}
}
- protected final boolean operateOnDistributedRegion(final DistributionManager dm,
- DistributedRegion r) throws ForceReattemptException {
+ protected boolean operateOnDistributedRegion(final DistributionManager dm, DistributedRegion r)
+ throws ForceReattemptException {
if (this.functionObject == null) {
ReplyMessage.send(getSender(), this.processorId,
new ReplyException(new FunctionException(
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRemoveAllOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRemoveAllOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRemoveAllOperation.java
index 42bf10f..e236f80 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRemoveAllOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRemoveAllOperation.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import java.io.DataInput;
@@ -21,7 +20,6 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
import java.util.Set;
import org.apache.logging.log4j.Logger;
@@ -41,7 +39,6 @@ import org.apache.geode.internal.ByteArrayDataInput;
import org.apache.geode.internal.InternalDataSerializer;
import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList;
-import org.apache.geode.internal.cache.DistributedPutAllOperation.PutAllEntryData;
import org.apache.geode.internal.cache.FilterRoutingInfo.FilterInfo;
import org.apache.geode.internal.cache.ha.ThreadIdentifier;
import org.apache.geode.internal.cache.partitioned.PutAllPRMessage;
@@ -59,13 +56,12 @@ import org.apache.geode.internal.offheap.annotations.Unretained;
/**
* Handles distribution of a Region.removeAll operation.
+ *
+ * TODO: extend DistributedCacheOperation instead of AbstractUpdateOperation
*
* @since GemFire 8.1
*/
-public class DistributedRemoveAllOperation extends AbstractUpdateOperation // TODO extend
- // DistributedCacheOperation
- // instead
-{
+public class DistributedRemoveAllOperation extends AbstractUpdateOperation {
private static final Logger logger = LogService.getLogger();
/**
@@ -247,7 +243,7 @@ public class DistributedRemoveAllOperation extends AbstractUpdateOperation // TO
}
}
- public final EntryEventImpl getBaseEvent() {
+ public EntryEventImpl getBaseEvent() {
return getEvent();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
index 1d65579..3048e52 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
@@ -307,7 +307,7 @@ public abstract class ExpiryTask extends SystemTimer.SystemTimerTask {
* whenever we try to schedule more expiration tasks.
*/
@Override
- public final void run2() {
+ public void run2() {
try {
if (executor != null) {
executor.execute(new Runnable() {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index 4ed583a..c813a80 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -4317,7 +4317,7 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
}
@Override
- public final InternalResourceManager getInternalResourceManager() {
+ public InternalResourceManager getInternalResourceManager() {
return getInternalResourceManager(true);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java
index 8d28a53..f2be3c0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java
@@ -271,24 +271,24 @@ public abstract class GridAdvisor extends DistributionAdvisor {
finishInit();
}
- public final void setHost(String host) {
+ public void setHost(String host) {
this.host = host;
}
- public final void setPort(int port) {
+ public void setPort(int port) {
this.port = port;
}
- public final String getHost() {
+ public String getHost() {
return this.host;
}
- public final int getPort() {
+ public int getPort() {
return this.port;
}
@Override
- public final ProfileId getId() {
+ public ProfileId getId() {
if (this.id == null)
throw new IllegalStateException("profile id not yet initialized");
return this.id;
@@ -300,7 +300,7 @@ public abstract class GridAdvisor extends DistributionAdvisor {
*
* @since GemFire 5.7
*/
- protected final void tellLocalControllers(boolean removeProfile, boolean exchangeProfiles,
+ protected void tellLocalControllers(boolean removeProfile, boolean exchangeProfiles,
final List<Profile> replyProfiles) {
final List<Locator> locators = Locator.getLocators();
for (int i = 0; i < locators.size(); i++) {
@@ -325,7 +325,7 @@ public abstract class GridAdvisor extends DistributionAdvisor {
*
* @since GemFire 5.7
*/
- protected final void tellLocalBridgeServers(boolean removeProfile, boolean exchangeProfiles,
+ protected void tellLocalBridgeServers(boolean removeProfile, boolean exchangeProfiles,
final List<Profile> replyProfiles) {
final InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && !cache.isClosed()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
index fb5f0cf..82df980 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
@@ -1515,7 +1515,7 @@ public class InitialImageOperation {
}
@Override
- final public int getProcessorType() {
+ public int getProcessorType() {
return this.targetReinitialized ? DistributionManager.WAITING_POOL_EXECUTOR
: DistributionManager.HIGH_PRIORITY_EXECUTOR;
}
@@ -2160,7 +2160,7 @@ public class InitialImageOperation {
}
@Override
- final public int getProcessorType() {
+ public int getProcessorType() {
return DistributionManager.HIGH_PRIORITY_EXECUTOR;
}
@@ -2431,7 +2431,7 @@ public class InitialImageOperation {
}
@Override
- final public int getProcessorType() {
+ public int getProcessorType() {
return this.targetReinitialized ? DistributionManager.WAITING_POOL_EXECUTOR
: DistributionManager.HIGH_PRIORITY_EXECUTOR;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java
index 3a0bf8e..617001f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java
@@ -375,7 +375,7 @@ public class MemberFunctionStreamingMessage extends DistributionMessage
return this.txUniqId;
}
- public final InternalDistributedMember getMemberToMasqueradeAs() {
+ public InternalDistributedMember getMemberToMasqueradeAs() {
if (txMemberId == null) {
return getSender();
} else {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/NonLocalRegionEntry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/NonLocalRegionEntry.java b/geode-core/src/main/java/org/apache/geode/internal/cache/NonLocalRegionEntry.java
index 805b900..a6bb959 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/NonLocalRegionEntry.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/NonLocalRegionEntry.java
@@ -12,9 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- *
- */
package org.apache.geode.internal.cache;
import java.io.DataInput;
@@ -40,6 +37,7 @@ import org.apache.geode.internal.cache.versions.VersionTag;
import org.apache.geode.internal.i18n.LocalizedStrings;
public class NonLocalRegionEntry implements RegionEntry, VersionStamp {
+
private long lastModified;
private boolean isRemoved;
private Object key;
@@ -291,7 +289,7 @@ public class NonLocalRegionEntry implements RegionEntry, VersionStamp {
.toLocalizedString());
}
- public final Object getValueInVM(RegionEntryContext context) {
+ public Object getValueInVM(RegionEntryContext context) {
return this.value;
}
@@ -360,7 +358,7 @@ public class NonLocalRegionEntry implements RegionEntry, VersionStamp {
return false;
}
- public final Object getValueInVMOrDiskWithoutFaultIn(LocalRegion owner) {
+ public Object getValueInVMOrDiskWithoutFaultIn(LocalRegion owner) {
return this.value;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
index b171a95..037bff6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
@@ -252,16 +252,6 @@ public class PartitionedRegionDataStore implements HasCachePerfStats {
return numPrimaries.get();
}
-
- /**
- * Indicates if this data store is managing buckets
- *
- * @return true if it is managing buckets
- */
- final boolean isManagingAnyBucket() {
- return !this.localBucket2RegionMap.isEmpty();
- }
-
/**
* Try to grab buckets for all the colocated regions /* In case we can't grab buckets there is no
* going back
@@ -872,55 +862,20 @@ public class PartitionedRegionDataStore implements HasCachePerfStats {
event.getRegion().getFullPath(), event.getKey(), event.getDistributedMember());
}
- public final void afterRegionInvalidate(RegionEvent event) {}
+ public void afterRegionInvalidate(RegionEvent event) {}
- public final void afterRegionDestroy(RegionEvent event) {}
+ public void afterRegionDestroy(RegionEvent event) {}
- public final void afterRegionClear(RegionEvent event) {}
+ public void afterRegionClear(RegionEvent event) {}
- public final void afterRegionCreate(RegionEvent event) {}
+ public void afterRegionCreate(RegionEvent event) {}
- public final void afterRegionLive(RegionEvent event) {}
+ public void afterRegionLive(RegionEvent event) {}
- public final void close() {}
+ public void close() {}
};
}
- // private void addBucketMapping(Integer bucketId, Node theNode)
- // {
- // VersionedArrayList list = (VersionedArrayList)this.partitionedRegion
- // .getBucket2Node().get(bucketId);
- // // Create a new list to avoid concurrent modification exceptions when
- // // the array list is serialized e.g. GII
- // if (list == null) {
- // list = new VersionedArrayList(
- // this.partitionedRegion.getRedundantCopies() + 1);
- // list.add(theNode);
- //
- // }
- // else {
- // for(Iterator itr =list.iterator(); itr.hasNext();) {
- // Node nd = (Node)itr.next();
- // if( !PartitionedRegionHelper.isMemberAlive(nd.getMemberId(),
- // this.partitionedRegion.cache)
- // && !this.partitionedRegion.isPresentInPRConfig(nd)) {
- // list.remove(nd);
- // if(list.size() ==0 ) {
- // PartitionedRegionHelper.logForDataLoss(this.partitionedRegion,
- // bucketId.intValue(), "addBucketMapping");
- // }
- // }
- //
- // }
- // if (!list.contains(theNode)) {
- // list.add(theNode);
- // }
- // }
- // this.partitionedRegion.checkClosed();
- // this.partitionedRegion.checkReadiness();
- // this.partitionedRegion.getBucket2Node().put(bucketId, list);
- // }
-
public CacheLoader getCacheLoader() {
return this.loader;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/PlaceHolderDiskRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PlaceHolderDiskRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PlaceHolderDiskRegion.java
index 097ca41..a06c437 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PlaceHolderDiskRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PlaceHolderDiskRegion.java
@@ -28,10 +28,10 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
* thrown away and a real DiskRegion instance will replace it. This class needs to keep track of any
* information that can be recovered from the DiskInitFile.
*
- *
* @since GemFire prPersistSprint2
*/
public class PlaceHolderDiskRegion extends AbstractDiskRegion implements DiskRecoveryStore {
+
private final String name;
/**
@@ -59,7 +59,7 @@ public class PlaceHolderDiskRegion extends AbstractDiskRegion implements DiskRec
}
@Override
- public final String getName() {
+ public String getName() {
return this.name;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
index cfc9fdd..ab90a05 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
@@ -218,7 +218,7 @@ public class ProxyBucketRegion implements Bucket {
return this.partitionedRegion.getAttributes();
}
- public final BucketAdvisor getBucketAdvisor() {
+ public BucketAdvisor getBucketAdvisor() {
return this.advisor;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteFetchEntryMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteFetchEntryMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteFetchEntryMessage.java
index 913836a..0c141cc 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteFetchEntryMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteFetchEntryMessage.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import java.io.DataInput;
@@ -94,11 +93,6 @@ public class RemoteFetchEntryMessage extends RemoteOperationMessage {
return p;
}
- // final public int getProcessorType()
- // {
- // return DistributionManager.PARTITIONED_REGION_EXECUTOR;
- // }
-
@Override
public boolean isSevereAlertCompatible() {
// allow forced-disconnect processing for all cache op messages
@@ -106,7 +100,7 @@ public class RemoteFetchEntryMessage extends RemoteOperationMessage {
}
@Override
- protected final boolean operateOnRegion(DistributionManager dm, LocalRegion r, long startTime)
+ protected boolean operateOnRegion(DistributionManager dm, LocalRegion r, long startTime)
throws RemoteOperationException {
// RemoteFetchEntryMessage is used in refreshing client caches during interest list recovery,
// so don't be too verbose or hydra tasks may time out
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/RemotePutAllMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/RemotePutAllMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/RemotePutAllMessage.java
index 0e9f8c5..f029c31 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/RemotePutAllMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/RemotePutAllMessage.java
@@ -55,7 +55,6 @@ import org.apache.geode.internal.cache.tier.sockets.VersionedObjectList;
import org.apache.geode.internal.cache.versions.VersionTag;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.offheap.annotations.Released;
@@ -232,7 +231,7 @@ public class RemotePutAllMessage extends RemoteOperationMessageWithDirectReply {
}
@Override
- public final void fromData(DataInput in) throws IOException, ClassNotFoundException {
+ public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
this.eventId = (EventID) DataSerializer.readObject(in);
this.callbackArg = DataSerializer.readObject(in);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteRemoveAllMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteRemoveAllMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteRemoveAllMessage.java
index d4d4c26..4b51705 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteRemoveAllMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteRemoveAllMessage.java
@@ -225,7 +225,7 @@ public class RemoteRemoveAllMessage extends RemoteOperationMessageWithDirectRepl
}
@Override
- public final void fromData(DataInput in) throws IOException, ClassNotFoundException {
+ public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
this.eventId = (EventID) DataSerializer.readObject(in);
this.callbackArg = DataSerializer.readObject(in);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
index 3ad1137..e093d95 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
@@ -303,7 +303,7 @@ public class StateFlushOperation {
}
@Override
- final public int getProcessorType() {
+ public int getProcessorType() {
return processorType;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/TXEvent.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXEvent.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXEvent.java
index 95c2cc2..8acc63b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXEvent.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXEvent.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import org.apache.geode.cache.*;
@@ -20,14 +19,12 @@ import java.util.*;
import org.apache.geode.internal.offheap.Releasable;
/**
- * <p>
* The internal implementation of the {@link TransactionEvent} interface
- *
*
* @since GemFire 4.0
- *
*/
public class TXEvent implements TransactionEvent, Releasable {
+
private final TXStateInterface localTxState;
private List events;
private List createEvents = null;
@@ -147,7 +144,7 @@ public class TXEvent implements TransactionEvent, Releasable {
return true;
}
- public final Cache getCache() {
+ public Cache getCache() {
return this.cache;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/TXId.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXId.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXId.java
index 32fe284..ffc0758 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXId.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXId.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import org.apache.geode.internal.ExternalizableDSFID;
@@ -25,16 +24,15 @@ import org.apache.geode.distributed.internal.membership.*;
/**
* The implementation of the {@link TransactionId} interface stored in the transaction state and
- * used, amoung other things, to uniquely identify a transaction in a confederation of transaction
+ * used, among other things, to uniquely identify a transaction in a confederation of transaction
* participants (currently VM in a Distributed System).
*
- *
* @since GemFire 4.0
- *
* @see TXManagerImpl#begin
* @see org.apache.geode.cache.CacheTransactionManager#getTransactionId
*/
public class TXId extends ExternalizableDSFID implements TransactionId {
+
/** The domain of a transaction, currently the VM's unique identifier */
private InternalDistributedMember memberId;
/** Per unique identifier within the transactions memberId */
@@ -104,7 +102,7 @@ public class TXId extends ExternalizableDSFID implements TransactionId {
this.memberId = DSFIDFactory.readInternalDistributedMember(in);
}
- public static final TXId createFromData(DataInput in) throws IOException, ClassNotFoundException {
+ public static TXId createFromData(DataInput in) throws IOException, ClassNotFoundException {
TXId result = new TXId();
InternalDataSerializer.invokeFromData(result, in);
return result;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
index 24cbaa2..2e991e6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
@@ -185,7 +185,7 @@ public abstract class TXMessage extends SerialDistributionMessage
this.txMemberId = DataSerializer.readObject(in);
}
- public final InternalDistributedMember getMemberToMasqueradeAs() {
+ public InternalDistributedMember getMemberToMasqueradeAs() {
if (txMemberId == null) {
return getSender();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
index 6a6e9ad..2c8c28b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import java.util.ArrayList;
@@ -32,7 +31,6 @@ import javax.transaction.Status;
import org.apache.logging.log4j.Logger;
import org.apache.geode.CancelException;
-import org.apache.geode.InternalGemFireException;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CommitConflictException;
@@ -68,9 +66,7 @@ import org.apache.geode.internal.offheap.annotations.Retained;
* TXState is the entity that tracks the transaction state on a per thread basis, noting changes to
* Region entries on a per operation basis. It lives on the node where transaction data exists.
*
- *
* @since GemFire 4.0
- *
* @see TXManagerImpl
*/
public class TXState implements TXStateInterface {
@@ -1204,16 +1200,6 @@ public class TXState implements TXStateInterface {
return readRegion(localRegion);
}
-
- final TXEntryState txWriteEntry(LocalRegion region, EntryEventImpl event, boolean ifNew,
- boolean requireOldValue) {
- try {
- return txWriteEntry(region, event, ifNew, requireOldValue, null);
- } catch (EntryNotFoundException e) {
- throw new InternalGemFireException("caught unexpected exception", e);
- }
- }
-
/**
* @param requireOldValue if true set the old value in the event, even if ifNew and entry doesn't
* currently exist (this is needed for putIfAbsent).
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/TXStateStub.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXStateStub.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXStateStub.java
index 5dd624b..6055705 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXStateStub.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXStateStub.java
@@ -12,9 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- * File comment
- */
package org.apache.geode.internal.cache;
import java.util.Collection;
@@ -46,10 +43,9 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
/**
* TXStateStub lives on the accessor node when we are remoting a transaction. It is a stub for
* {@link TXState}.
- *
- *
*/
public abstract class TXStateStub implements TXStateInterface {
+
protected final DistributedMember target;
protected final TXStateProxy proxy;
protected Runnable internalAfterSendRollback;
@@ -57,11 +53,6 @@ public abstract class TXStateStub implements TXStateInterface {
Map<Region<?, ?>, TXRegionStub> regionStubs = new HashMap<Region<?, ?>, TXRegionStub>();
-
- /**
- * @param stateProxy
- * @param target
- */
protected TXStateStub(TXStateProxy stateProxy, DistributedMember target) {
this.target = target;
this.proxy = stateProxy;
@@ -113,8 +104,6 @@ public abstract class TXStateStub implements TXStateInterface {
}
}
-
-
/**
* Get or create a TXRegionStub for the given region. For regions that are new to the tx, we
* validate their eligibility.
@@ -122,7 +111,7 @@ public abstract class TXStateStub implements TXStateInterface {
* @param region The region to involve in the tx.
* @return existing or new stub for region
*/
- protected final TXRegionStub getTXRegionStub(LocalRegion region) {
+ protected TXRegionStub getTXRegionStub(LocalRegion region) {
TXRegionStub stub = regionStubs.get(region);
if (stub == null) {
/*
@@ -139,7 +128,6 @@ public abstract class TXStateStub implements TXStateInterface {
return this.regionStubs;
}
-
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeap.java
index 3c0dd9b..b53d498 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VMStatsDiskLRURegionEntryHeap extends VMStatsDiskLRURegionEntry {
+
public VMStatsDiskLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VMStatsDiskLRURegionEntryHeap extends VMStatsDiskLRURegion
}
private static class VMStatsDiskLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VMStatsDiskLRURegionEntryHeap extends VMStatsDiskLRURegion
return new VMStatsDiskLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsDiskLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeap.java
index d8f5083..c14b15a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VMStatsDiskLRURegionEntryOffHeap extends VMStatsDiskLRURegionEntry
implements OffHeapRegionEntry {
+
public VMStatsDiskLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VMStatsDiskLRURegionEntryOffHeap extends VMStatsDiskLRUReg
}
private static class VMStatsDiskLRURegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VMStatsDiskLRURegionEntryOffHeap extends VMStatsDiskLRUReg
return new VMStatsDiskLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsDiskLRURegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeap.java
index c193444..554268a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VMStatsDiskRegionEntryHeap extends VMStatsDiskRegionEntry {
+
public VMStatsDiskRegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VMStatsDiskRegionEntryHeap extends VMStatsDiskRegionEntry
}
private static class VMStatsDiskRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VMStatsDiskRegionEntryHeap extends VMStatsDiskRegionEntry
return new VMStatsDiskRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsDiskRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeap.java
index 9ec129f..cfe8fef 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VMStatsDiskRegionEntryOffHeap extends VMStatsDiskRegionEntry
implements OffHeapRegionEntry {
+
public VMStatsDiskRegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VMStatsDiskRegionEntryOffHeap extends VMStatsDiskRegionEnt
}
private static class VMStatsDiskRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -55,7 +56,7 @@ public abstract class VMStatsDiskRegionEntryOffHeap extends VMStatsDiskRegionEnt
return new VMStatsDiskRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsDiskRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeap.java
index 16c1013..1d474fa 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VMStatsLRURegionEntryHeap extends VMStatsLRURegionEntry {
+
public VMStatsLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VMStatsLRURegionEntryHeap extends VMStatsLRURegionEntry {
}
private static class VMStatsLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VMStatsLRURegionEntryHeap extends VMStatsLRURegionEntry {
return new VMStatsLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeap.java
index 52d7f6f..95487d0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VMStatsLRURegionEntryOffHeap extends VMStatsLRURegionEntry
implements OffHeapRegionEntry {
+
public VMStatsLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VMStatsLRURegionEntryOffHeap extends VMStatsLRURegionEntry
}
private static class VMStatsLRURegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -55,7 +56,7 @@ public abstract class VMStatsLRURegionEntryOffHeap extends VMStatsLRURegionEntry
return new VMStatsLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsLRURegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeap.java
index ce3641b..082b645 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VMStatsRegionEntryHeap extends VMStatsRegionEntry {
+
public VMStatsRegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -28,7 +29,7 @@ public abstract class VMStatsRegionEntryHeap extends VMStatsRegionEntry {
}
private static class VMStatsRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -53,7 +54,7 @@ public abstract class VMStatsRegionEntryHeap extends VMStatsRegionEntry {
return new VMStatsRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeap.java
index 1689a8f..03fd31d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VMStatsRegionEntryOffHeap extends VMStatsRegionEntry
implements OffHeapRegionEntry {
+
public VMStatsRegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VMStatsRegionEntryOffHeap extends VMStatsRegionEntry
}
private static class VMStatsRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -55,7 +56,7 @@ public abstract class VMStatsRegionEntryOffHeap extends VMStatsRegionEntry
return new VMStatsRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeap.java
index 24bd9f4..56d5414 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VMThinDiskLRURegionEntryHeap extends VMThinDiskLRURegionEntry {
+
public VMThinDiskLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VMThinDiskLRURegionEntryHeap extends VMThinDiskLRURegionEn
}
private static class VMThinDiskLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VMThinDiskLRURegionEntryHeap extends VMThinDiskLRURegionEn
return new VMThinDiskLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinDiskLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeap.java
index 20a4127..c9d2eca 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VMThinDiskLRURegionEntryOffHeap extends VMThinDiskLRURegionEntry
implements OffHeapRegionEntry {
+
public VMThinDiskLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VMThinDiskLRURegionEntryOffHeap extends VMThinDiskLRURegio
}
private static class VMThinDiskLRURegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VMThinDiskLRURegionEntryOffHeap extends VMThinDiskLRURegio
return new VMThinDiskLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinDiskLRURegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeap.java
index 27b5a5a..6018f50 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VMThinDiskRegionEntryHeap extends VMThinDiskRegionEntry {
+
public VMThinDiskRegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VMThinDiskRegionEntryHeap extends VMThinDiskRegionEntry {
}
private static class VMThinDiskRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VMThinDiskRegionEntryHeap extends VMThinDiskRegionEntry {
return new VMThinDiskRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinDiskRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeap.java
index e900c2c..60c1628 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VMThinDiskRegionEntryOffHeap extends VMThinDiskRegionEntry
implements OffHeapRegionEntry {
+
public VMThinDiskRegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VMThinDiskRegionEntryOffHeap extends VMThinDiskRegionEntry
}
private static class VMThinDiskRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -55,7 +56,7 @@ public abstract class VMThinDiskRegionEntryOffHeap extends VMThinDiskRegionEntry
return new VMThinDiskRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinDiskRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeap.java
index 44ba283..dacba73 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VMThinLRURegionEntryHeap extends VMThinLRURegionEntry {
+
public VMThinLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VMThinLRURegionEntryHeap extends VMThinLRURegionEntry {
}
private static class VMThinLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VMThinLRURegionEntryHeap extends VMThinLRURegionEntry {
return new VMThinLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeap.java
index 9ed657d..9e6a611 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VMThinLRURegionEntryOffHeap extends VMThinLRURegionEntry
implements OffHeapRegionEntry {
+
public VMThinLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VMThinLRURegionEntryOffHeap extends VMThinLRURegionEntry
}
private static class VMThinLRURegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -55,7 +56,7 @@ public abstract class VMThinLRURegionEntryOffHeap extends VMThinLRURegionEntry
return new VMThinLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinLRURegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeap.java
index 3666a0a..d995852 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeap.java
@@ -29,7 +29,7 @@ public abstract class VMThinRegionEntryHeap extends VMThinRegionEntry {
}
private static class VMThinRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +54,7 @@ public abstract class VMThinRegionEntryHeap extends VMThinRegionEntry {
return new VMThinRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeap.java
index 6426df0..64c305e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeap.java
@@ -31,7 +31,7 @@ public abstract class VMThinRegionEntryOffHeap extends VMThinRegionEntry
}
private static class VMThinRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -56,7 +56,7 @@ public abstract class VMThinRegionEntryOffHeap extends VMThinRegionEntry
return new VMThinRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeap.java
index 6c7bc91..1f7b878 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedStatsDiskLRURegionEntryHeap
extends VersionedStatsDiskLRURegionEntry {
+
public VersionedStatsDiskLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedStatsDiskLRURegionEntryHeap
}
private static class VersionedStatsDiskLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedStatsDiskLRURegionEntryHeap
return new VersionedStatsDiskLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsDiskLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeap.java
index 8b38a2b..808a0e5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedStatsDiskLRURegionEntryOffHeap
extends VersionedStatsDiskLRURegionEntry implements OffHeapRegionEntry {
+
public VersionedStatsDiskLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -31,7 +32,7 @@ public abstract class VersionedStatsDiskLRURegionEntryOffHeap
private static class VersionedStatsDiskLRURegionEntryOffHeapFactory
implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -58,7 +59,7 @@ public abstract class VersionedStatsDiskLRURegionEntryOffHeap
return new VersionedStatsDiskLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsDiskLRURegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeap.java
index c6bdf93..3e440ff 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VersionedStatsDiskRegionEntryHeap extends VersionedStatsDiskRegionEntry {
+
public VersionedStatsDiskRegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VersionedStatsDiskRegionEntryHeap extends VersionedStatsDi
}
private static class VersionedStatsDiskRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -56,7 +57,7 @@ public abstract class VersionedStatsDiskRegionEntryHeap extends VersionedStatsDi
return new VersionedStatsDiskRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsDiskRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeap.java
index d2f1dcf..b5e0395 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedStatsDiskRegionEntryOffHeap extends VersionedStatsDiskRegionEntry
implements OffHeapRegionEntry {
+
public VersionedStatsDiskRegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedStatsDiskRegionEntryOffHeap extends VersionedStat
}
private static class VersionedStatsDiskRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedStatsDiskRegionEntryOffHeap extends VersionedStat
return new VersionedStatsDiskRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsDiskRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeap.java
index 6978d51..c698e63 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VersionedStatsLRURegionEntryHeap extends VersionedStatsLRURegionEntry {
+
public VersionedStatsLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VersionedStatsLRURegionEntryHeap extends VersionedStatsLRU
}
private static class VersionedStatsLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -56,7 +57,7 @@ public abstract class VersionedStatsLRURegionEntryHeap extends VersionedStatsLRU
return new VersionedStatsLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeap.java
index f46bcbf..124d03a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedStatsLRURegionEntryOffHeap extends VersionedStatsLRURegionEntry
implements OffHeapRegionEntry {
+
public VersionedStatsLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedStatsLRURegionEntryOffHeap extends VersionedStats
}
private static class VersionedStatsLRURegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedStatsLRURegionEntryOffHeap extends VersionedStats
return new VersionedStatsLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsLRURegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeap.java
index 55dc5ef..bc33c35 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VersionedStatsRegionEntryHeap extends VersionedStatsRegionEntry {
+
public VersionedStatsRegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VersionedStatsRegionEntryHeap extends VersionedStatsRegion
}
private static class VersionedStatsRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VersionedStatsRegionEntryHeap extends VersionedStatsRegion
return new VersionedStatsRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeap.java
index 2fe12c1..e272a5b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedStatsRegionEntryOffHeap extends VersionedStatsRegionEntry
implements OffHeapRegionEntry {
+
public VersionedStatsRegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedStatsRegionEntryOffHeap extends VersionedStatsReg
}
private static class VersionedStatsRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedStatsRegionEntryOffHeap extends VersionedStatsReg
return new VersionedStatsRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeap.java
index 1eec3e9..af7c5cb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VersionedThinDiskLRURegionEntryHeap extends VersionedThinDiskLRURegionEntry {
+
public VersionedThinDiskLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VersionedThinDiskLRURegionEntryHeap extends VersionedThinD
}
private static class VersionedThinDiskLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -56,7 +57,7 @@ public abstract class VersionedThinDiskLRURegionEntryHeap extends VersionedThinD
return new VersionedThinDiskLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinDiskLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeap.java
index e82a0aa..746ddc4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedThinDiskLRURegionEntryOffHeap extends VersionedThinDiskLRURegionEntry
implements OffHeapRegionEntry {
+
public VersionedThinDiskLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedThinDiskLRURegionEntryOffHeap extends VersionedTh
}
private static class VersionedThinDiskLRURegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedThinDiskLRURegionEntryOffHeap extends VersionedTh
return new VersionedThinDiskLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinDiskLRURegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeap.java
index 42d8564..bfa0428 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VersionedThinDiskRegionEntryHeap extends VersionedThinDiskRegionEntry {
+
public VersionedThinDiskRegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VersionedThinDiskRegionEntryHeap extends VersionedThinDisk
}
private static class VersionedThinDiskRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -56,7 +57,7 @@ public abstract class VersionedThinDiskRegionEntryHeap extends VersionedThinDisk
return new VersionedThinDiskRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinDiskRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeap.java
index 4bdb7a4..3d47afe 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedThinDiskRegionEntryOffHeap extends VersionedThinDiskRegionEntry
implements OffHeapRegionEntry {
+
public VersionedThinDiskRegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedThinDiskRegionEntryOffHeap extends VersionedThinD
}
private static class VersionedThinDiskRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedThinDiskRegionEntryOffHeap extends VersionedThinD
return new VersionedThinDiskRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinDiskRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeap.java
index fb260be..49e205b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VersionedThinLRURegionEntryHeap extends VersionedThinLRURegionEntry {
+
public VersionedThinLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VersionedThinLRURegionEntryHeap extends VersionedThinLRURe
}
private static class VersionedThinLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -56,7 +57,7 @@ public abstract class VersionedThinLRURegionEntryHeap extends VersionedThinLRURe
return new VersionedThinLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeap.java
index 1286bb6..0aa2c5f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedThinLRURegionEntryOffHeap extends VersionedThinLRURegionEntry
implements OffHeapRegionEntry {
+
public VersionedThinLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedThinLRURegionEntryOffHeap extends VersionedThinLR
}
private static class VersionedThinLRURegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedThinLRURegionEntryOffHeap extends VersionedThinLR
return new VersionedThinLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinLRURegionEntryOffHeapObjectKey.class;
[14/14] geode git commit: GEODE-2929: remove superfluous final from
methods
Posted by kl...@apache.org.
GEODE-2929: remove superfluous final from methods
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/b688c9c3
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/b688c9c3
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/b688c9c3
Branch: refs/heads/feature/GEODE-2929-1
Commit: b688c9c3611ab8e4d8361e7cf1eb4c6f5ab07c26
Parents: d16d192
Author: Kirk Lund <kl...@apache.org>
Authored: Fri May 19 14:23:17 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Fri May 19 14:23:17 2017 -0700
----------------------------------------------------------------------
.../internal/web/RestInterfaceJUnitTest.java | 2 +-
.../java/org/apache/geode/CancelCriterion.java | 4 +-
.../org/apache/geode/CanonicalInstantiator.java | 6 +-
.../java/org/apache/geode/DataSerializer.java | 30 ++---
.../java/org/apache/geode/Instantiator.java | 20 +---
.../geode/admin/RegionSubRegionSnapshot.java | 16 +--
.../apache/geode/cache/DiskAccessException.java | 4 +-
.../geode/cache/DynamicRegionFactory.java | 3 +-
.../org/apache/geode/cache/EvictionAction.java | 10 +-
.../apache/geode/cache/EvictionAlgorithm.java | 16 +--
.../apache/geode/cache/EvictionAttributes.java | 4 +-
.../geode/cache/FixedPartitionAttributes.java | 10 +-
.../geode/cache/MembershipAttributes.java | 16 ++-
.../geode/cache/client/internal/AbstractOp.java | 2 +-
.../geode/cache/execute/FunctionException.java | 10 +-
.../cache/query/internal/ObjectIntHashMap.java | 13 +--
.../geode/compression/SnappyCompressor.java | 2 +-
.../geode/distributed/AbstractLauncher.java | 2 +-
.../geode/distributed/LocatorLauncher.java | 6 +-
.../geode/distributed/ServerLauncher.java | 12 +-
.../internal/DistributionAdvisor.java | 15 ++-
.../internal/DistributionManager.java | 52 +++++++--
.../internal/DistributionMessage.java | 6 +-
.../distributed/internal/ReplyProcessor21.java | 14 ++-
.../apache/geode/internal/AbstractConfig.java | 3 +-
.../geode/internal/HeapDataOutputStream.java | 26 +++--
.../geode/internal/ObjIdConcurrentMap.java | 27 ++---
.../apache/geode/internal/SharedLibrary.java | 2 +-
.../org/apache/geode/internal/SystemTimer.java | 2 +-
.../internal/cache/AbstractDiskRegion.java | 35 +++---
.../internal/cache/AbstractLRURegionMap.java | 9 +-
.../cache/AbstractOplogDiskRegionEntry.java | 2 +-
.../geode/internal/cache/AbstractRegion.java | 4 +-
.../geode/internal/cache/AbstractRegionMap.java | 2 +-
.../geode/internal/cache/BucketAdvisor.java | 5 +-
.../geode/internal/cache/DestroyOperation.java | 9 +-
.../internal/cache/DistPeerTXStateStub.java | 5 +-
.../cache/DistributedCacheOperation.java | 8 +-
.../cache/DistributedPutAllOperation.java | 3 +-
.../geode/internal/cache/DistributedRegion.java | 2 +-
...stributedRegionFunctionStreamingMessage.java | 4 +-
.../cache/DistributedRemoveAllOperation.java | 12 +-
.../apache/geode/internal/cache/ExpiryTask.java | 2 +-
.../geode/internal/cache/GemFireCacheImpl.java | 2 +-
.../geode/internal/cache/GridAdvisor.java | 14 +--
.../internal/cache/InitialImageOperation.java | 6 +-
.../cache/MemberFunctionStreamingMessage.java | 2 +-
.../internal/cache/NonLocalRegionEntry.java | 8 +-
.../cache/PartitionedRegionDataStore.java | 57 +--------
.../internal/cache/PlaceHolderDiskRegion.java | 4 +-
.../geode/internal/cache/ProxyBucketRegion.java | 2 +-
.../internal/cache/RemoteFetchEntryMessage.java | 8 +-
.../internal/cache/RemotePutAllMessage.java | 3 +-
.../internal/cache/RemoteRemoveAllMessage.java | 2 +-
.../internal/cache/StateFlushOperation.java | 2 +-
.../apache/geode/internal/cache/TXEvent.java | 7 +-
.../org/apache/geode/internal/cache/TXId.java | 8 +-
.../apache/geode/internal/cache/TXMessage.java | 2 +-
.../apache/geode/internal/cache/TXState.java | 14 ---
.../geode/internal/cache/TXStateStub.java | 16 +--
.../cache/VMStatsDiskLRURegionEntryHeap.java | 5 +-
.../cache/VMStatsDiskLRURegionEntryOffHeap.java | 5 +-
.../cache/VMStatsDiskRegionEntryHeap.java | 5 +-
.../cache/VMStatsDiskRegionEntryOffHeap.java | 5 +-
.../cache/VMStatsLRURegionEntryHeap.java | 5 +-
.../cache/VMStatsLRURegionEntryOffHeap.java | 5 +-
.../internal/cache/VMStatsRegionEntryHeap.java | 5 +-
.../cache/VMStatsRegionEntryOffHeap.java | 5 +-
.../cache/VMThinDiskLRURegionEntryHeap.java | 5 +-
.../cache/VMThinDiskLRURegionEntryOffHeap.java | 5 +-
.../cache/VMThinDiskRegionEntryHeap.java | 5 +-
.../cache/VMThinDiskRegionEntryOffHeap.java | 5 +-
.../cache/VMThinLRURegionEntryHeap.java | 5 +-
.../cache/VMThinLRURegionEntryOffHeap.java | 5 +-
.../internal/cache/VMThinRegionEntryHeap.java | 4 +-
.../cache/VMThinRegionEntryOffHeap.java | 4 +-
.../VersionedStatsDiskLRURegionEntryHeap.java | 5 +-
...VersionedStatsDiskLRURegionEntryOffHeap.java | 5 +-
.../VersionedStatsDiskRegionEntryHeap.java | 5 +-
.../VersionedStatsDiskRegionEntryOffHeap.java | 5 +-
.../cache/VersionedStatsLRURegionEntryHeap.java | 5 +-
.../VersionedStatsLRURegionEntryOffHeap.java | 5 +-
.../cache/VersionedStatsRegionEntryHeap.java | 5 +-
.../cache/VersionedStatsRegionEntryOffHeap.java | 5 +-
.../VersionedThinDiskLRURegionEntryHeap.java | 5 +-
.../VersionedThinDiskLRURegionEntryOffHeap.java | 5 +-
.../cache/VersionedThinDiskRegionEntryHeap.java | 5 +-
.../VersionedThinDiskRegionEntryOffHeap.java | 5 +-
.../cache/VersionedThinLRURegionEntryHeap.java | 5 +-
.../VersionedThinLRURegionEntryOffHeap.java | 5 +-
.../cache/VersionedThinRegionEntryHeap.java | 5 +-
.../cache/VersionedThinRegionEntryOffHeap.java | 5 +-
.../internal/cache/control/ResourceAdvisor.java | 2 +-
.../internal/cache/locks/TXLockIdImpl.java | 6 +-
.../geode/internal/cache/lru/LRUAlgorithm.java | 42 ++-----
.../cache/partitioned/BucketBackupMessage.java | 4 +-
.../partitioned/DeposePrimaryBucketMessage.java | 4 +-
.../cache/partitioned/FetchEntryMessage.java | 18 +--
.../FetchPartitionDetailsMessage.java | 4 +-
.../cache/partitioned/MoveBucketMessage.java | 5 +-
.../cache/partitioned/PartitionMessage.java | 14 +--
.../cache/partitioned/RemoveAllPRMessage.java | 4 +-
.../cache/partitioned/RemoveBucketMessage.java | 6 +-
.../internal/cache/partitioned/SizeMessage.java | 8 +-
.../cache/tier/sockets/CacheClientUpdater.java | 4 +-
.../geode/internal/cache/tier/sockets/Part.java | 20 +---
.../parallel/ParallelGatewaySenderQueue.java | 22 ----
.../cache/wan/serial/BatchDestroyOperation.java | 10 +-
.../CacheTransactionManagerCreation.java | 10 +-
.../cache/xmlcache/CacheXmlVersion.java | 7 +-
.../cache/xmlcache/DefaultEntityResolver2.java | 9 +-
.../internal/statistics/StatArchiveWriter.java | 4 +-
.../apache/geode/internal/tcp/Connection.java | 117 +++++++++----------
.../management/internal/IdentityConverter.java | 5 +-
.../management/internal/OpenTypeConverter.java | 63 ++--------
.../management/internal/cli/json/TypedJson.java | 19 +--
.../management/internal/web/domain/Link.java | 6 +-
.../internal/web/http/ClientHttpRequest.java | 2 +-
.../internal/executor/AbstractScanExecutor.java | 6 +-
.../org/apache/geode/DataSerializerTest.java | 50 ++++++++
.../java/org/apache/geode/InstantiatorTest.java | 53 +++++++++
.../admin/RegionSubRegionSnapshotTest.java | 58 +++++++++
.../cache/ConnectionPoolFactoryJUnitTest.java | 2 +-
.../geode/cache/DiskAccessExceptionTest.java | 34 ++++++
.../cache/client/internal/AbstractOpTest.java | 39 +++++++
.../cache/execute/FunctionExceptionTest.java | 51 ++++++++
.../query/functional/PdxOrderByJUnitTest.java | 6 +-
...pdateWithInplaceObjectModFalseDUnitTest.java | 2 +-
.../cache30/CacheSerializableRunnable.java | 4 +-
.../apache/geode/cache30/RegionTestCase.java | 4 +-
.../geode/cache30/TXDistributedDUnitTest.java | 2 +-
.../apache/geode/cache30/TestCacheCallback.java | 2 +-
.../apache/geode/cache30/TestCacheListener.java | 12 +-
.../apache/geode/cache30/TestCacheLoader.java | 2 +-
.../apache/geode/cache30/TestCacheWriter.java | 19 ++-
.../geode/cache30/TestTransactionListener.java | 6 +-
.../geode/distributed/AbstractLauncherTest.java | 10 ++
...ocatorLauncherRemoteIntegrationTestCase.java | 2 +-
...ServerLauncherRemoteIntegrationTestCase.java | 2 +-
.../geode/distributed/LocatorLauncherTest.java | 19 ++-
.../geode/distributed/ServerLauncherTest.java | 30 +++++
.../internal/DistributionAdvisorTest.java | 34 ++++++
.../internal/DistributionManagerTest.java | 43 +++++++
.../internal/DistributionMessageTest.java | 37 ++++++
.../internal/ReplyProcessor21Test.java | 38 ++++++
.../geode/internal/AbstractConfigTest.java | 34 ++++++
.../internal/DataSerializableJUnitTest.java | 4 +-
.../internal/HeapDataOutputStreamTest.java | 35 ++++++
.../geode/internal/ObjIdConcurrentMapTest.java | 39 +++++++
.../internal/cache/AbstractDiskRegionTest.java | 42 +++++++
.../cache/AbstractLRURegionMapTest.java | 44 +++++++
.../cache/AbstractOplogDiskRegionEntryTest.java | 38 ++++++
.../internal/cache/AbstractRegionMapTest.java | 35 +++++-
.../internal/cache/AbstractRegionTest.java | 39 +++++++
.../geode/internal/cache/BucketAdvisorTest.java | 40 +++++++
.../geode/internal/cache/Bug37377DUnitTest.java | 4 +-
.../geode/internal/cache/Bug39079DUnitTest.java | 4 +-
.../cache/CacheOperationMessageTest.java | 50 ++++++++
.../internal/cache/DestroyMessageTest.java | 42 +++++++
.../cache/DiskRegCacheXmlJUnitTest.java | 2 +-
.../cache/DiskRegionClearJUnitTest.java | 2 +-
.../internal/cache/DiskRegionTestingBase.java | 2 +-
.../internal/cache/DistPeerTXStateStubTest.java | 44 +++++++
.../cache/DistributedCacheOperationTest.java | 50 ++++++++
.../cache/DistributedPutAllOperationTest.java | 38 ++++++
...butedRegionFunctionStreamingMessageTest.java | 44 +++++++
.../internal/cache/DistributedRegionTest.java | 42 +++++++
.../DistributedRemoveAllOperationTest.java | 38 ++++++
.../geode/internal/cache/ExpiryTaskTest.java | 34 ++++++
.../internal/cache/GemFireCacheImplTest.java | 13 +++
.../geode/internal/cache/GridProfileTest.java | 61 ++++++++++
.../MemberFunctionStreamingMessageTest.java | 39 +++++++
.../internal/cache/NonLocalRegionEntryTest.java | 45 +++++++
...gionBucketCreationDistributionDUnitTest.java | 4 +-
.../cache/PlaceHolderDiskRegionTest.java | 34 ++++++
.../internal/cache/ProxyBucketRegionTest.java | 37 ++++++
.../cache/RemoteFetchEntryMessageTest.java | 43 +++++++
.../internal/cache/RemotePutAllMessageTest.java | 39 +++++++
.../cache/RemoteRemoveAllMessageTest.java | 39 +++++++
.../cache/RequestFilterInfoMessageTest.java | 35 ++++++
.../internal/cache/RequestImageMessageTest.java | 35 ++++++
.../internal/cache/RequestRVVMessageTest.java | 35 ++++++
.../internal/cache/StateMarkerMessageTest.java | 35 ++++++
.../geode/internal/cache/TXEventTest.java | 36 ++++++
.../geode/internal/cache/TXMessageTest.java | 36 ++++++
.../geode/internal/cache/TXStateStubTest.java | 38 ++++++
.../apache/geode/internal/cache/UnzipUtil.java | 4 +-
.../cache/control/ResourceAdvisorTest.java | 37 ++++++
.../internal/cache/ha/ConflatableObject.java | 20 ++--
.../internal/cache/lru/LRUAlgorithmTest.java | 34 ++++++
.../partitioned/BucketBackupMessageTest.java | 34 ++++++
.../ColocatedRegionDetailsJUnitTest.java | 73 ++++--------
.../DeposePrimaryBucketMessageTest.java | 42 +++++++
.../partitioned/FetchEntryMessageTest.java | 48 ++++++++
.../FetchPartitionDetailsMessageTest.java | 45 +++++++
.../partitioned/MoveBucketMessageTest.java | 44 +++++++
.../cache/partitioned/PartitionMessageTest.java | 31 +++--
.../partitioned/RemoveAllPRMessageTest.java | 37 ++++++
.../partitioned/RemoveBucketMessageTest.java | 44 +++++++
.../cache/partitioned/SizeMessageTest.java | 33 ++++++
.../cache/tier/sockets/CCUStatsTest.java | 39 +++++++
.../internal/cache/tier/sockets/PartTest.java | 41 +++++++
.../versions/RegionVersionHolderJUnitTest.java | 2 +-
.../cache/versions/TombstoneDUnitTest.java | 2 +-
.../cache/wan/AsyncEventQueueTestBase.java | 2 +-
.../AsyncEventQueueValidationsJUnitTest.java | 2 +-
.../cache/wan/serial/DestroyMessageTest.java | 43 +++++++
.../CacheTransactionManagerCreationTest.java | 47 ++++++++
.../xmlcache/DefaultEntityResolver2Test.java | 40 +++++++
.../internal/jta/functional/CacheJUnitTest.java | 2 +-
.../jta/functional/TestXACacheLoader.java | 2 +-
.../internal/logging/LogServiceJUnitTest.java | 2 +-
.../logging/log4j/AlertAppenderJUnitTest.java | 4 +-
.../log4j/LogWriterAppenderJUnitTest.java | 6 +-
.../statistics/StatArchiveWriterTest.java | 39 +++++++
.../geode/internal/tcp/ConnectionTest.java | 45 +++++++
.../internal/CompositeBuilderViaFromTest.java | 45 +++++++
.../internal/CompositeBuilderViaProxyTest.java | 45 +++++++
.../internal/IdentityConverterTest.java | 36 ++++++
.../cli/commands/CliCommandTestBase.java | 4 +-
.../cli/commands/ConfigCommandsDUnitTest.java | 2 +-
.../cli/functions/ExportedLogsSizeInfoTest.java | 18 +--
.../ShowMissingDiskStoresFunctionJUnitTest.java | 82 +++----------
.../internal/cli/json/TypedJsonTest.java | 38 ++++++
.../WanCommandsControllerJUnitTest.java | 2 +-
.../internal/web/domain/LinkTest.java | 45 +++++++
.../web/http/ClientHttpRequestTest.java | 37 ++++++
.../geode/pdx/PdxSerializableDUnitTest.java | 2 +-
.../executor/AbstractScanExecutorTest.java | 39 +++++++
.../security/ClientAuthorizationTestCase.java | 4 +-
.../DeltaClientAuthorizationDUnitTest.java | 2 +-
.../DeltaClientPostAuthorizationDUnitTest.java | 2 +-
.../generator/AuthzCredentialGenerator.java | 8 +-
.../security/generator/CredentialGenerator.java | 8 +-
.../org/apache/geode/test/dunit/DUnitEnv.java | 2 +-
.../geode/test/dunit/DistributedTestUtils.java | 2 +-
.../java/org/apache/geode/test/dunit/Wait.java | 6 +-
...ingGetPropertiesDisconnectsAllDUnitTest.java | 2 +-
.../geode/test/golden/FailOutputTestCase.java | 3 +-
.../apache/geode/test/golden/PassJUnitTest.java | 2 +-
.../golden/PassWithExpectedProblemTestCase.java | 2 +-
.../internal/cache/ha/CQListGIIDUnitTest.java | 2 +-
.../geode/cache/lucene/LuceneDUnitTest.java | 2 +-
.../lucene/LuceneIndexCreationDUnitTest.java | 8 +-
...IndexCreationPersistenceIntegrationTest.java | 3 +-
.../lucene/LuceneIndexDestroyDUnitTest.java | 2 +-
.../LuceneIndexCreationProfileJUnitTest.java | 4 +-
.../cache/execute/FunctionException.java | 12 +-
.../cache/execute/FunctionExceptionTest.java | 48 ++++++++
.../geode/internal/cache/wan/WANTestBase.java | 2 +-
.../web/controllers/support/RegionData.java | 47 ++------
.../web/controllers/support/RegionDataTest.java | 35 ++++++
252 files changed, 3523 insertions(+), 1008 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestInterfaceJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestInterfaceJUnitTest.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestInterfaceJUnitTest.java
index 324284e..7cdc104 100644
--- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestInterfaceJUnitTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestInterfaceJUnitTest.java
@@ -403,7 +403,7 @@ public class RestInterfaceJUnitTest {
this.lastName = lastName;
}
- protected final String format(final Date dateTime) {
+ protected String format(final Date dateTime) {
return format(dateTime, DEFAULT_BIRTH_DATE_FORMAT_PATTERN);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/CancelCriterion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/CancelCriterion.java b/geode-core/src/main/java/org/apache/geode/CancelCriterion.java
index fec3827..704da8e 100644
--- a/geode-core/src/main/java/org/apache/geode/CancelCriterion.java
+++ b/geode-core/src/main/java/org/apache/geode/CancelCriterion.java
@@ -58,7 +58,7 @@ public abstract class CancelCriterion {
*
* @return failure string if system failure has occurred
*/
- protected final String checkFailure() {
+ protected String checkFailure() {
Throwable tilt = SystemFailure.getFailure();
if (tilt != null) {
// Allocate no objects here!
@@ -74,7 +74,7 @@ public abstract class CancelCriterion {
* @param e an underlying exception or null if there is no exception that triggered this check
* @see #cancelInProgress()
*/
- public final void checkCancelInProgress(Throwable e) {
+ public void checkCancelInProgress(Throwable e) {
SystemFailure.checkFailure();
String reason = cancelInProgress();
if (reason == null) {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/CanonicalInstantiator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/CanonicalInstantiator.java b/geode-core/src/main/java/org/apache/geode/CanonicalInstantiator.java
index 10e6f16..af34363 100644
--- a/geode-core/src/main/java/org/apache/geode/CanonicalInstantiator.java
+++ b/geode-core/src/main/java/org/apache/geode/CanonicalInstantiator.java
@@ -14,7 +14,8 @@
*/
package org.apache.geode;
-import java.io.*;
+import java.io.DataInput;
+import java.io.IOException;
/**
* <code>CanonicalInstantiator</code> is much like its parent <code>Instantiator</code> except that
@@ -31,6 +32,7 @@ import java.io.*;
* @since GemFire 5.1
*/
public abstract class CanonicalInstantiator extends Instantiator {
+
/**
* Creates a new <code>CanonicalInstantiator</code> that instantiates a given class.
*
@@ -54,7 +56,7 @@ public abstract class CanonicalInstantiator extends Instantiator {
* @throws UnsupportedOperationException in all cases
*/
@Override
- public final DataSerializable newInstance() {
+ public DataSerializable newInstance() {
throw new UnsupportedOperationException();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/DataSerializer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/DataSerializer.java b/geode-core/src/main/java/org/apache/geode/DataSerializer.java
index 34501f8..2d16459 100644
--- a/geode-core/src/main/java/org/apache/geode/DataSerializer.java
+++ b/geode-core/src/main/java/org/apache/geode/DataSerializer.java
@@ -193,10 +193,6 @@ public abstract class DataSerializer {
protected static final ThreadLocal<Boolean> DISALLOW_JAVA_SERIALIZATION =
new ThreadLocal<Boolean>();
- ////////////////////// Instance Fields /////////////////////
-
- ////////////////////// Static Methods //////////////////////
-
/**
* Writes an instance of <code>Class</code> to a <code>DataOutput</code>. This method will handle
* a <code>null</code> value and not throw a <code>NullPointerException</code>.
@@ -322,7 +318,6 @@ public abstract class DataSerializer {
return rgn;
}
-
/**
* Writes an instance of <code>Date</code> to a <code>DataOutput</code>. Note that even though
* <code>date</code> may be an instance of a subclass of <code>Date</code>, <code>readDate</code>
@@ -509,7 +504,7 @@ public abstract class DataSerializer {
out.writeByte(DSCODE.NULL_STRING);
} else {
- // [bruce] writeUTF is expensive - it creates a char[] to fetch
+ // writeUTF is expensive - it creates a char[] to fetch
// the string's contents, iterates over the array to compute the
// encoded length, creates a byte[] to hold the encoded bytes,
// iterates over the char[] again to create the encode bytes,
@@ -2903,7 +2898,7 @@ public abstract class DataSerializer {
* @see Instantiator
* @see ObjectOutputStream#writeObject
*/
- public static final void writeObject(Object o, DataOutput out, boolean allowJavaSerialization)
+ public static void writeObject(Object o, DataOutput out, boolean allowJavaSerialization)
throws IOException {
if (allowJavaSerialization) {
@@ -2937,7 +2932,7 @@ public abstract class DataSerializer {
* @see DataSerializer
* @see ObjectOutputStream#writeObject
*/
- public static final void writeObject(Object o, DataOutput out) throws IOException {
+ public static void writeObject(Object o, DataOutput out) throws IOException {
InternalDataSerializer.basicWriteObject(o, out, false);
}
@@ -2962,8 +2957,7 @@ public abstract class DataSerializer {
* @see ObjectInputStream#readObject
*/
@SuppressWarnings("unchecked")
- public static final <T> T readObject(final DataInput in)
- throws IOException, ClassNotFoundException {
+ public static <T> T readObject(final DataInput in) throws IOException, ClassNotFoundException {
return (T) InternalDataSerializer.basicReadObject(in);
}
@@ -2997,12 +2991,10 @@ public abstract class DataSerializer {
* the classes reserved by DataSerializer (see {@link #getSupportedClasses} for a list).
* @see #getSupportedClasses
*/
- public static final DataSerializer register(Class<?> c) {
+ public static DataSerializer register(Class<?> c) {
return InternalDataSerializer.register(c, true);
}
- /////////////////////// Constructors ///////////////////////
-
/**
* Creates a new <code>DataSerializer</code>. All class that implement <code>DataSerializer</code>
* must provide a zero-argument constructor.
@@ -3010,11 +3002,9 @@ public abstract class DataSerializer {
* @see #register(Class)
*/
public DataSerializer() {
-
+ // nothing
}
- ///////////////////// Instance Methods /////////////////////
-
/**
* Returns the <code>Class</code>es whose instances are data serialized by this
* <code>DataSerializer</code>. This method is invoked when this serializer is
@@ -3111,7 +3101,7 @@ public abstract class DataSerializer {
*
* @since GemFire 6.5
*/
- public final void setEventId(Object/* EventID */ eventId) {
+ public void setEventId(Object/* EventID */ eventId) {
this.eventId = (EventID) eventId;
}
@@ -3121,7 +3111,7 @@ public abstract class DataSerializer {
*
* @since GemFire 6.5
*/
- public final Object/* EventID */ getEventId() {
+ public Object/* EventID */ getEventId() {
return this.eventId;
}
@@ -3130,7 +3120,7 @@ public abstract class DataSerializer {
*
* @since GemFire 6.5
*/
- public final void setContext(Object/* ClientProxyMembershipID */ context) {
+ public void setContext(Object/* ClientProxyMembershipID */ context) {
this.context = (ClientProxyMembershipID) context;
}
@@ -3139,7 +3129,7 @@ public abstract class DataSerializer {
*
* @since GemFire 6.5
*/
- public final Object/* ClientProxyMembershipID */ getContext() {
+ public Object/* ClientProxyMembershipID */ getContext() {
return this.context;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/Instantiator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/Instantiator.java b/geode-core/src/main/java/org/apache/geode/Instantiator.java
index e4da556..3c1ca06 100644
--- a/geode-core/src/main/java/org/apache/geode/Instantiator.java
+++ b/geode-core/src/main/java/org/apache/geode/Instantiator.java
@@ -142,9 +142,6 @@ public abstract class Instantiator {
/** The originator of this <code>Instantiator</code> */
private ClientProxyMembershipID context;
-
- /////////////////////// Static Methods ///////////////////////
-
/**
* Registers a <code>DataSerializable</code> class with the data serialization framework. This
* method is usually invoked from the static initializer of a class that implements
@@ -182,8 +179,6 @@ public abstract class Instantiator {
InternalInstantiator.register(instantiator, distribute);
}
- //////////////////////// Constructors ////////////////////////
-
/**
* Creates a new <code>Instantiator</code> that instantiates a given class.
*
@@ -217,8 +212,6 @@ public abstract class Instantiator {
this.id = classId;
}
- ////////////////////// Instance Methods //////////////////////
-
/**
* Creates a new "empty" instance of a <Code>DataSerializable</code> class whose state will be
* filled in by invoking its {@link DataSerializable#fromData fromData} method.
@@ -231,21 +224,21 @@ public abstract class Instantiator {
* Returns the <code>DataSerializable</code> class that is instantiated by this
* <code>Instantiator</code>.
*/
- public final Class<? extends DataSerializable> getInstantiatedClass() {
+ public Class<? extends DataSerializable> getInstantiatedClass() {
return this.clazz;
}
/**
* Returns the unique <code>id</code> of this <code>Instantiator</code>.
*/
- public final int getId() {
+ public int getId() {
return this.id;
}
/**
* sets the unique <code>eventId</code> of this <code>Instantiator</code>. For internal use only.
*/
- public final void setEventId(Object/* EventID */ eventId) {
+ public void setEventId(Object/* EventID */ eventId) {
this.eventId = (EventID) eventId;
}
@@ -253,23 +246,22 @@ public abstract class Instantiator {
* Returns the unique <code>eventId</code> of this <code>Instantiator</code>. For internal use
* only.
*/
- public final Object/* EventID */ getEventId() {
+ public Object/* EventID */ getEventId() {
return this.eventId;
}
/**
* sets the context of this <code>Instantiator</code>. For internal use only.
*/
- public final void setContext(Object/* ClientProxyMembershipID */ context) {
+ public void setContext(Object/* ClientProxyMembershipID */ context) {
this.context = (ClientProxyMembershipID) context;
}
/**
* Returns the context of this <code>Instantiator</code>. For internal use only.
*/
- public final Object/* ClientProxyMembershipID */ getContext() {
+ public Object/* ClientProxyMembershipID */ getContext() {
return this.context;
}
-
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/admin/RegionSubRegionSnapshot.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/RegionSubRegionSnapshot.java b/geode-core/src/main/java/org/apache/geode/admin/RegionSubRegionSnapshot.java
index 19f89b2..69774b8 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/RegionSubRegionSnapshot.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/RegionSubRegionSnapshot.java
@@ -83,56 +83,56 @@ public class RegionSubRegionSnapshot implements DataSerializable {
/**
* @return get entry count of region
*/
- public final int getEntryCount() {
+ public int getEntryCount() {
return entryCount;
}
/**
* @param entryCount entry count of region
*/
- public final void setEntryCount(int entryCount) {
+ public void setEntryCount(int entryCount) {
this.entryCount = entryCount;
}
/**
* @return name of region
*/
- public final String getName() {
+ public String getName() {
return name;
}
/**
* @param name name of region
*/
- public final void setName(String name) {
+ public void setName(String name) {
this.name = name;
}
/**
* @return subRegionSnapshots of all the sub regions
*/
- public final Set getSubRegionSnapshots() {
+ public Set getSubRegionSnapshots() {
return subRegionSnapshots;
}
/**
* @param subRegionSnapshots subRegionSnapshots of all the sub regions
*/
- public final void setSubRegionSnapshots(Set subRegionSnapshots) {
+ public void setSubRegionSnapshots(Set subRegionSnapshots) {
this.subRegionSnapshots = subRegionSnapshots;
}
/**
* @return snapshot of parent region
*/
- public final RegionSubRegionSnapshot getParent() {
+ public RegionSubRegionSnapshot getParent() {
return parent;
}
/**
* @param parent snapshot of parent region
*/
- public final void setParent(RegionSubRegionSnapshot parent) {
+ public void setParent(RegionSubRegionSnapshot parent) {
this.parent = parent;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/cache/DiskAccessException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/DiskAccessException.java b/geode-core/src/main/java/org/apache/geode/cache/DiskAccessException.java
index e77e485..fb640cd 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/DiskAccessException.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/DiskAccessException.java
@@ -19,8 +19,6 @@ import java.io.IOException;
/**
* Indicates that an <code>IOException</code> during a disk region operation.
*
- *
- *
* @since GemFire 3.2
*/
public class DiskAccessException extends CacheRuntimeException {
@@ -114,7 +112,7 @@ public class DiskAccessException extends CacheRuntimeException {
/**
* Returns true if this exception originated from a remote node.
*/
- public final boolean isRemote() {
+ public boolean isRemote() {
return this.isRemote;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/cache/DynamicRegionFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/DynamicRegionFactory.java b/geode-core/src/main/java/org/apache/geode/cache/DynamicRegionFactory.java
index 9bf14cd..e9e64e7 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/DynamicRegionFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/DynamicRegionFactory.java
@@ -32,7 +32,6 @@ import org.apache.geode.cache.client.internal.ServerRegionProxy;
import org.apache.geode.cache.execute.FunctionService;
import org.apache.geode.cache.wan.GatewaySender;
import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.cache.DistributedRegion;
import org.apache.geode.internal.cache.DynamicRegionAttributes;
@@ -995,7 +994,7 @@ public abstract class DynamicRegionFactory {
// while internal, its contents should be communicated with bridge clients
@Override
- final public boolean shouldNotifyBridgeClients() {
+ public boolean shouldNotifyBridgeClients() {
return getCache().getCacheServers().size() > 0;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/cache/EvictionAction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/EvictionAction.java b/geode-core/src/main/java/org/apache/geode/cache/EvictionAction.java
index a8513d9..0fd1b27 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/EvictionAction.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/EvictionAction.java
@@ -55,7 +55,7 @@ public final class EvictionAction extends EnumSyntax {
private static final String[] stringTable = {"none", "local-destroy", "overflow-to-disk",};
@Override
- final protected String[] getStringTable() {
+ protected String[] getStringTable() {
return stringTable;
}
@@ -64,19 +64,19 @@ public final class EvictionAction extends EnumSyntax {
{NONE, LOCAL_DESTROY, OVERFLOW_TO_DISK};
@Override
- final protected EnumSyntax[] getEnumValueTable() {
+ protected EnumSyntax[] getEnumValueTable() {
return enumValueTable;
}
- public final boolean isLocalDestroy() {
+ public boolean isLocalDestroy() {
return this == LOCAL_DESTROY;
}
- public final boolean isOverflowToDisk() {
+ public boolean isOverflowToDisk() {
return this == OVERFLOW_TO_DISK;
}
- public final boolean isNone() {
+ public boolean isNone() {
return this == NONE;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/cache/EvictionAlgorithm.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/EvictionAlgorithm.java b/geode-core/src/main/java/org/apache/geode/cache/EvictionAlgorithm.java
index 96b55b6..f57f257 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/EvictionAlgorithm.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/EvictionAlgorithm.java
@@ -25,6 +25,7 @@ import javax.print.attribute.EnumSyntax;
*/
public final class EvictionAlgorithm extends EnumSyntax {
private static final long serialVersionUID = 5778669432033106789L;
+
/**
* The canonical EvictionAction that represents no eviction action
*/
@@ -71,16 +72,15 @@ public final class EvictionAlgorithm extends EnumSyntax {
"lru-memory-size", "lifo-entry-count", "lifo-memory-size"};
@Override
- final protected String[] getStringTable() {
+ protected String[] getStringTable() {
return stringTable;
}
- // TODO post Java 1.8.0u45 uncomment final flag, see JDK-8076152
- private static /* final */ EvictionAlgorithm[] enumValueTable =
+ private static final EvictionAlgorithm[] enumValueTable =
{NONE, LRU_ENTRY, LRU_HEAP, LRU_MEMORY, LIFO_ENTRY, LIFO_MEMORY,};
@Override
- final protected EnumSyntax[] getEnumValueTable() {
+ protected EnumSyntax[] getEnumValueTable() {
return enumValueTable;
}
@@ -111,15 +111,15 @@ public final class EvictionAlgorithm extends EnumSyntax {
return null;
}
- public final boolean isLRUEntry() {
+ public boolean isLRUEntry() {
return this == LRU_ENTRY;
}
- public final boolean isLRUMemory() {
+ public boolean isLRUMemory() {
return this == LRU_MEMORY;
}
- public final boolean isLRUHeap() {
+ public boolean isLRUHeap() {
return this == LRU_HEAP;
}
@@ -128,7 +128,7 @@ public final class EvictionAlgorithm extends EnumSyntax {
return this.isLRUEntry() || this.isLRUMemory() || this.isLRUHeap();
}
- public final boolean isNone() {
+ public boolean isNone() {
return this == NONE;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/cache/EvictionAttributes.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/EvictionAttributes.java b/geode-core/src/main/java/org/apache/geode/cache/EvictionAttributes.java
index 8c30b30..cdd8aeb 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/EvictionAttributes.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/EvictionAttributes.java
@@ -435,7 +435,7 @@ public abstract class EvictionAttributes implements DataSerializable {
public abstract EvictionAction getAction();
@Override
- public final boolean equals(final Object obj) {
+ public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
@@ -455,7 +455,7 @@ public abstract class EvictionAttributes implements DataSerializable {
}
@Override
- public final int hashCode() {
+ public int hashCode() {
if (getAlgorithm().isLRUHeap()) {
return getAlgorithm().hashCode();
} else {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/cache/FixedPartitionAttributes.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/FixedPartitionAttributes.java b/geode-core/src/main/java/org/apache/geode/cache/FixedPartitionAttributes.java
index dd8bd94..b257bfa 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/FixedPartitionAttributes.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/FixedPartitionAttributes.java
@@ -32,7 +32,6 @@ import org.apache.geode.internal.cache.FixedPartitionAttributesImpl;
*
* @since GemFire 6.6
*/
-
public abstract class FixedPartitionAttributes {
private final static boolean DEFAULT_PRIMARY_STATUS = false;
@@ -44,7 +43,7 @@ public abstract class FixedPartitionAttributes {
*
* @param name Name of the fixed partition.
*/
- final public static FixedPartitionAttributes createFixedPartition(String name) {
+ public static FixedPartitionAttributes createFixedPartition(String name) {
return new FixedPartitionAttributesImpl().setPartitionName(name)
.isPrimary(DEFAULT_PRIMARY_STATUS).setNumBuckets(DEFAULT_NUM_BUCKETS);
}
@@ -55,8 +54,7 @@ public abstract class FixedPartitionAttributes {
* @param name Name of the fixed partition.
* @param isPrimary True if this member is the primary for the partition.
*/
- final public static FixedPartitionAttributes createFixedPartition(String name,
- boolean isPrimary) {
+ public static FixedPartitionAttributes createFixedPartition(String name, boolean isPrimary) {
return new FixedPartitionAttributesImpl().setPartitionName(name).isPrimary(isPrimary)
.setNumBuckets(DEFAULT_NUM_BUCKETS);
}
@@ -68,7 +66,7 @@ public abstract class FixedPartitionAttributes {
* @param isPrimary True if this member is the primary for the partition.
* @param numBuckets Number of buckets allowed for the partition.
*/
- final public static FixedPartitionAttributes createFixedPartition(String name, boolean isPrimary,
+ public static FixedPartitionAttributes createFixedPartition(String name, boolean isPrimary,
int numBuckets) {
return new FixedPartitionAttributesImpl().setPartitionName(name).isPrimary(isPrimary)
.setNumBuckets(numBuckets);
@@ -80,7 +78,7 @@ public abstract class FixedPartitionAttributes {
* @param name Name of the fixed partition.
* @param numBuckets Number of buckets allowed for the partition.
*/
- final public static FixedPartitionAttributes createFixedPartition(String name, int numBuckets) {
+ public static FixedPartitionAttributes createFixedPartition(String name, int numBuckets) {
return new FixedPartitionAttributesImpl().setPartitionName(name)
.isPrimary(DEFAULT_PRIMARY_STATUS).setNumBuckets(numBuckets);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/cache/MembershipAttributes.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/MembershipAttributes.java b/geode-core/src/main/java/org/apache/geode/cache/MembershipAttributes.java
index 79f7d8a..4479899 100755
--- a/geode-core/src/main/java/org/apache/geode/cache/MembershipAttributes.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/MembershipAttributes.java
@@ -16,12 +16,20 @@ package org.apache.geode.cache;
import org.apache.geode.DataSerializable;
import org.apache.geode.DataSerializer;
-import org.apache.geode.distributed.internal.membership.InternalRole;
import org.apache.geode.distributed.Role;
+import org.apache.geode.distributed.internal.membership.InternalRole;
import org.apache.geode.internal.i18n.LocalizedStrings;
-import java.io.*;
-import java.util.*;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
/**
* Configuration attributes for defining reliability requirements and behavior for a
@@ -142,7 +150,7 @@ public class MembershipAttributes implements DataSerializable, Externalizable {
return this.resumptionAction;
}
- private final Set<Role> toRoleSet(String[] roleNames) {
+ private Set<Role> toRoleSet(String[] roleNames) {
if (roleNames == null || roleNames.length == 0) {
return Collections.emptySet();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/cache/client/internal/AbstractOp.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/AbstractOp.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/AbstractOp.java
index 593375e..a0cb7d4 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/AbstractOp.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/AbstractOp.java
@@ -274,7 +274,7 @@ public abstract class AbstractOp implements Op {
* @throws Exception if response could not be processed or we received a response with a server
* exception.
*/
- protected final Object processObjResponse(Message msg, String opName) throws Exception {
+ protected Object processObjResponse(Message msg, String opName) throws Exception {
Part part = msg.getPart(0);
final int msgType = msg.getMessageType();
if (msgType == MessageType.RESPONSE) {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionException.java b/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionException.java
index 3198b0d..54b4427 100755
--- a/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionException.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionException.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.cache.execute;
import java.util.ArrayList;
@@ -37,8 +36,7 @@ import org.apache.geode.internal.Assert;
* <p>
* The exception string provides details on the cause of failure.
* </p>
- *
- *
+ *
* @since GemFire 6.0
* @see FunctionService
*/
@@ -92,7 +90,7 @@ public class FunctionException extends GemFireException {
* @param cause
* @since GemFire 6.5
*/
- public final void addException(Throwable cause) {
+ public void addException(Throwable cause) {
Assert.assertTrue(cause != null, "unexpected null exception to add to FunctionException");
getExceptions().add(cause);
}
@@ -102,7 +100,7 @@ public class FunctionException extends GemFireException {
*
* @since GemFire 6.5
*/
- public final List<Throwable> getExceptions() {
+ public List<Throwable> getExceptions() {
if (this.exceptions == null) {
this.exceptions = new ArrayList<Throwable>();
}
@@ -114,7 +112,7 @@ public class FunctionException extends GemFireException {
*
* @since GemFire 6.5
*/
- public final void addExceptions(Collection<? extends Throwable> ex) {
+ public void addExceptions(Collection<? extends Throwable> ex) {
getExceptions().addAll(ex);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/cache/query/internal/ObjectIntHashMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/ObjectIntHashMap.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/ObjectIntHashMap.java
index d0cf5db..8a82181 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/ObjectIntHashMap.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/ObjectIntHashMap.java
@@ -113,7 +113,6 @@ import java.util.TreeMap;
* @since 1.2
* @since GemFire 7.1
*/
-
public class ObjectIntHashMap implements Cloneable, Serializable {
private static final long serialVersionUID = 7718697444988416372L;
@@ -761,21 +760,21 @@ public class ObjectIntHashMap implements Cloneable, Serializable {
hash = h;
}
- public final Object getKey() {
+ public Object getKey() {
return key;
}
- public final int getValue() {
+ public int getValue() {
return value;
}
- public final int setValue(int newValue) {
+ public int setValue(int newValue) {
int oldValue = value;
value = newValue;
return oldValue;
}
- public final boolean equals(Object o) {
+ public boolean equals(Object o) {
if (!(o instanceof Entry))
return false;
Entry e = (Entry) o;
@@ -790,11 +789,11 @@ public class ObjectIntHashMap implements Cloneable, Serializable {
return false;
}
- public final int hashCode() {
+ public int hashCode() {
return this.hash ^ value;
}
- public final String toString() {
+ public String toString() {
return getKey() + "=" + getValue();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/compression/SnappyCompressor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/compression/SnappyCompressor.java b/geode-core/src/main/java/org/apache/geode/compression/SnappyCompressor.java
index 6324823..3e56801 100644
--- a/geode-core/src/main/java/org/apache/geode/compression/SnappyCompressor.java
+++ b/geode-core/src/main/java/org/apache/geode/compression/SnappyCompressor.java
@@ -39,7 +39,7 @@ public class SnappyCompressor implements Compressor, Serializable {
*
* @deprecated As of Geode 1.0, getDefaultInstance is deprecated. Use constructor instead.
*/
- public static final SnappyCompressor getDefaultInstance() {
+ public static SnappyCompressor getDefaultInstance() {
return new SnappyCompressor();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
index 007a990..ce66057 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
@@ -200,7 +200,7 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
* @param debug a boolean used to enable or disable debug mode.
* @see #isDebugging()
*/
- public final void setDebug(final boolean debug) {
+ public void setDebug(final boolean debug) {
this.debug = debug;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
index 68aa9db..12c5c21 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
@@ -288,7 +288,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
*
* @return a reference to the Locator.
*/
- final InternalLocator getLocator() {
+ InternalLocator getLocator() {
return this.locator;
}
@@ -300,7 +300,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
* @see #getBindAddressAsString()
* @see #getPortAsString()
*/
- public final String getId() {
+ public String getId() {
return LocatorState.getBindAddressAsString(this).concat("[")
.concat(LocatorState.getPortAsString(this)).concat("]");
}
@@ -1510,7 +1510,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
return this;
}
- final boolean isBindAddressSpecified() {
+ boolean isBindAddressSpecified() {
return (getBindAddress() != null);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
index acd5e8a..a6d3064 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
@@ -328,7 +328,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* @return a reference to the Cache created by the GemFire Server start operation.
* @see org.apache.geode.cache.Cache
*/
- final Cache getCache() {
+ Cache getCache() {
if (this.cache != null) {
boolean isReconnecting = this.cache.isReconnecting();
if (isReconnecting) {
@@ -348,7 +348,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* @return a CacheConfig object with additional GemFire Cache configuration meta-data used on
* startup to configure the Cache.
*/
- public final CacheConfig getCacheConfig() {
+ public CacheConfig getCacheConfig() {
final CacheConfig copy = new CacheConfig();
copy.setDeclarativeConfig(this.cacheConfig);
return copy;
@@ -362,7 +362,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* @see #getServerBindAddressAsString()
* @see #getServerPortAsString()
*/
- public final String getId() {
+ public String getId() {
final StringBuilder buffer = new StringBuilder(ServerState.getServerBindAddressAsString(this));
final String serverPort = ServerState.getServerPortAsString(this);
@@ -899,7 +899,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* determined by the running flag and a connection to the distributed system (GemFire
* cluster).
*/
- final boolean isWaiting(final Cache cache) {
+ boolean isWaiting(final Cache cache) {
// return (isRunning() && !getCache().isClosed());
return (isRunning() && (cache.getDistributedSystem().isConnected() || cache.isReconnecting()));
}
@@ -952,7 +952,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* @param cache the Cache to which the server will be added.
* @throws IOException if the Cache server fails to start due to IO error.
*/
- final void startCacheServer(final Cache cache) throws IOException {
+ void startCacheServer(final Cache cache) throws IOException {
if (isDefaultServerEnabled(cache)) {
final String serverBindAddress =
(getServerBindAddress() == null ? null : getServerBindAddress().getHostAddress());
@@ -1894,7 +1894,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
*
* @return a boolean indicating if help was enabled.
*/
- protected final boolean isHelping() {
+ protected boolean isHelping() {
return Boolean.TRUE.equals(getHelp());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionAdvisor.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionAdvisor.java
index 4eb9888..0acc6c2 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionAdvisor.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.distributed.internal;
import org.apache.geode.CancelException;
@@ -37,7 +36,14 @@ import org.apache.logging.log4j.Logger;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
@@ -57,7 +63,6 @@ import java.util.concurrent.atomic.AtomicInteger;
* A primary design goal of this class is scalability: the footprint must be kept to a minimum as
* the number of instances grows across a growing number of members in the distributed system.
*
- *
* @since GemFire 3.0
*/
public class DistributionAdvisor {
@@ -242,7 +247,7 @@ public class DistributionAdvisor {
return advisor;
}
- protected final void initialize() {
+ protected void initialize() {
subInit();
getDistributionManager().addMembershipListener(this.ml);
}
@@ -1581,7 +1586,7 @@ public class DistributionAdvisor {
*
* @since GemFire 5.0
*/
- public final InternalDistributedMember getDistributedMember() {
+ public InternalDistributedMember getDistributedMember() {
return this.peerMemberId;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
index f4e547f..029e637 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
@@ -14,16 +14,33 @@
*/
package org.apache.geode.distributed.internal;
-import org.apache.geode.*;
+import org.apache.geode.CancelCriterion;
+import org.apache.geode.CancelException;
+import org.apache.geode.ForcedDisconnectException;
+import org.apache.geode.IncompatibleSystemException;
+import org.apache.geode.InternalGemFireError;
+import org.apache.geode.InternalGemFireException;
+import org.apache.geode.InvalidDeltaException;
+import org.apache.geode.SystemConnectException;
+import org.apache.geode.SystemFailure;
+import org.apache.geode.ToDataException;
import org.apache.geode.admin.GemFireHealthConfig;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.DistributedSystemDisconnectedException;
import org.apache.geode.distributed.Locator;
import org.apache.geode.distributed.Role;
import org.apache.geode.distributed.internal.locks.ElderState;
-import org.apache.geode.distributed.internal.membership.*;
+import org.apache.geode.distributed.internal.membership.DistributedMembershipListener;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.distributed.internal.membership.MemberFactory;
+import org.apache.geode.distributed.internal.membership.MembershipManager;
+import org.apache.geode.distributed.internal.membership.NetView;
import org.apache.geode.i18n.StringId;
-import org.apache.geode.internal.*;
+import org.apache.geode.internal.Assert;
+import org.apache.geode.internal.NanoTimer;
+import org.apache.geode.internal.OSProcess;
+import org.apache.geode.internal.SetUtils;
+import org.apache.geode.internal.Version;
import org.apache.geode.internal.admin.remote.AdminConsoleDisconnectMessage;
import org.apache.geode.internal.admin.remote.RemoteGfManagerAgent;
import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
@@ -42,11 +59,31 @@ import org.apache.geode.internal.tcp.ReenteredConnectException;
import org.apache.geode.internal.util.concurrent.StoppableReentrantLock;
import org.apache.logging.log4j.Logger;
-import java.io.*;
+import java.io.NotSerializableException;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
/**
* The <code>DistributionManager</code> uses a {@link MembershipManager} to distribute
@@ -3355,9 +3392,8 @@ public class DistributionManager implements DM {
/**
* Returns the executor for the given type of processor.
- *
*/
- public final Executor getExecutor(int processorType, InternalDistributedMember sender) {
+ public Executor getExecutor(int processorType, InternalDistributedMember sender) {
switch (processorType) {
case STANDARD_EXECUTOR:
return getThreadPool();
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java
index 403b420..bf11f7a 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java
@@ -56,8 +56,6 @@ import org.apache.geode.internal.util.Breadcrumbs;
* sequentialness/thread requirements of a message, extend DistributionMessage and implement
* getExecutor().
* </P>
- *
- *
*/
public abstract class DistributionMessage implements DataSerializableFixedID, Cloneable {
@@ -135,7 +133,7 @@ public abstract class DistributionMessage implements DataSerializableFixedID, Cl
* Get the next bit mask position while checking that the value should not exceed given maximum
* value.
*/
- protected static final int getNextBitMask(int mask, final int maxValue) {
+ protected static int getNextBitMask(int mask, final int maxValue) {
mask <<= 1;
if (mask > maxValue) {
Assert.fail("exhausted bit flags with all available bits: 0x" + Integer.toHexString(mask)
@@ -158,7 +156,7 @@ public abstract class DistributionMessage implements DataSerializableFixedID, Cl
this.doDecMessagesBeingReceived = v;
}
- public final void setReplySender(ReplySender acker) {
+ public void setReplySender(ReplySender acker) {
this.acker = acker;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/distributed/internal/ReplyProcessor21.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ReplyProcessor21.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ReplyProcessor21.java
index 7e87c8c..d93487d 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ReplyProcessor21.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ReplyProcessor21.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.distributed.internal;
import org.apache.geode.CancelCriterion;
@@ -34,7 +33,12 @@ import org.apache.geode.internal.util.Breadcrumbs;
import org.apache.geode.internal.util.concurrent.StoppableCountDownLatch;
import org.apache.logging.log4j.Logger;
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
/**
* This class processes responses to {@link DistributionMessage}s. It handles a the generic case of
@@ -69,8 +73,6 @@ import java.util.*;
* <p>
*
* @see MessageWithReply
- *
- *
* @since GemFire 2.1
*/
public class ReplyProcessor21 implements MembershipListener {
@@ -852,7 +854,7 @@ public class ReplyProcessor21 implements MembershipListener {
* @throws InternalGemFireException if ack-threshold was exceeded and system property
* "ack-threshold-exception" is set to true
*/
- public final void waitForRepliesUninterruptibly() throws ReplyException {
+ public void waitForRepliesUninterruptibly() throws ReplyException {
waitForRepliesUninterruptibly(0);
}
@@ -929,7 +931,7 @@ public class ReplyProcessor21 implements MembershipListener {
}
/** do processing required when finished */
- protected final void finished() {
+ protected void finished() {
boolean isDone = false;
synchronized (this) {
if (!this.done) { // make sure only called once
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/AbstractConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/AbstractConfig.java b/geode-core/src/main/java/org/apache/geode/internal/AbstractConfig.java
index 101ee63..7bb2de9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/AbstractConfig.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/AbstractConfig.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal;
import static org.apache.geode.distributed.ConfigurationProperties.*;
@@ -82,7 +81,7 @@ public abstract class AbstractConfig implements Config {
* all values.
*/
@Override
- public final String toString() {
+ public String toString() {
return getClass().getName() + "@" + Integer.toHexString(hashCode());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/HeapDataOutputStream.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/HeapDataOutputStream.java b/geode-core/src/main/java/org/apache/geode/internal/HeapDataOutputStream.java
index ae28120..98b1b44 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/HeapDataOutputStream.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/HeapDataOutputStream.java
@@ -22,7 +22,11 @@ import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.tcp.ByteBufferInputStream.ByteSource;
import org.apache.logging.log4j.Logger;
-import java.io.*;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UTFDataFormatException;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
@@ -35,21 +39,21 @@ import java.util.LinkedList;
* ByteArrayOutputStream.
* <p>
* This class is not thread safe
+ * <p>
+ * Added boolean flag that when turned on will throw an exception instead of allocating a new
+ * buffer. The exception is a BufferOverflowException thrown from expand, and will restore the
+ * position to the point at which the flag was set with the disallowExpansion method.
*
- * @since GemFire 5.0.2
- *
- *
+ * Usage Model: boolean succeeded = true; stream.disallowExpansion(); try {
+ * DataSerializer.writeObject(obj, stream); } catch (BufferOverflowException e) { succeeded = false;
+ * }
*
- * Added boolean flag that when turned on will throw an exception instead of allocating a new
- * buffer. The exception is a BufferOverflowException thrown from expand, and will restore
- * the position to the point at which the flag was set with the disallowExpansion method.
- * Usage Model: boolean succeeded = true; stream.disallowExpansion(); try {
- * DataSerializer.writeObject(obj, stream); } catch (BufferOverflowException e) { succeeded =
- * false; }
+ * @since GemFire 5.0.2
*/
public class HeapDataOutputStream extends OutputStream
implements ObjToByteArraySerializer, VersionedDataStream, ByteBufferWriter {
private static final Logger logger = LogService.getLogger();
+
ByteBuffer buffer;
protected LinkedList<ByteBuffer> chunks = null;
protected int size = 0;
@@ -163,7 +167,7 @@ public class HeapDataOutputStream extends OutputStream
* {@inheritDoc}
*/
@Override
- public final Version getVersion() {
+ public Version getVersion() {
return this.version;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/ObjIdConcurrentMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/ObjIdConcurrentMap.java b/geode-core/src/main/java/org/apache/geode/internal/ObjIdConcurrentMap.java
index 17894ad..a187c65 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/ObjIdConcurrentMap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/ObjIdConcurrentMap.java
@@ -12,22 +12,23 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- *
- */
package org.apache.geode.internal;
-/*
- * Written by Doug Lea with assistance from members of JCP JSR-166 Expert Group and released to the
- * public domain, as explained at http://creativecommons.org/licenses/publicdomain
- */
-
-import java.util.concurrent.locks.*;
-import java.util.*;
-import java.io.Serializable;
import java.io.IOException;
+import java.io.Serializable;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.concurrent.locks.ReentrantLock;
/**
+ * Written by Doug Lea with assistance from members of JCP JSR-166 Expert Group and released to the
+ * public domain, as explained at http://creativecommons.org/licenses/publicdomain
+ *
+ * <p>
* A hash table supporting full concurrency of retrievals and adjustable expected concurrency for
* updates. This class obeys the same functional specification as {@link java.util.Hashtable}, and
* includes versions of methods corresponding to each method of <tt>Hashtable</tt>. However, even
@@ -171,7 +172,7 @@ public class ObjIdConcurrentMap<V> /* extends AbstractMap<K, V> */
* @param hash the hash code for the key
* @return the segment
*/
- final Segment<V> segmentFor(int hash) {
+ Segment<V> segmentFor(int hash) {
return segments[(hash >>> segmentShift) & segmentMask];
}
@@ -1005,7 +1006,7 @@ public class ObjIdConcurrentMap<V> /* extends AbstractMap<K, V> */
return hasNext();
}
- final void advance() {
+ void advance() {
if (nextEntry != null && (nextEntry = nextEntry.next) != null)
return;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/SharedLibrary.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/SharedLibrary.java b/geode-core/src/main/java/org/apache/geode/internal/SharedLibrary.java
index 7faebe9..83e1422 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/SharedLibrary.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/SharedLibrary.java
@@ -222,7 +222,7 @@ public class SharedLibrary {
* @return returns a boolean indicating if the 64bit native library was loaded.
* @since GemFire 5.1
*/
- public final static boolean getIs64Bit() {
+ public static boolean getIs64Bit() {
return PureJavaMode.is64Bit();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java b/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java
index 16227d2..bd6b60a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java
@@ -435,7 +435,7 @@ public class SystemTimer {
* Does debug logging, catches critical errors, then delegates to {@link #run2()}
*/
@Override
- final public void run() {
+ public void run() {
final boolean isDebugEnabled = logger.isTraceEnabled();
if (isDebugEnabled) {
logger.trace("SystemTimer.MyTask: starting {}", this);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractDiskRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractDiskRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractDiskRegion.java
index 81011d3..1958a85 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractDiskRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractDiskRegion.java
@@ -14,16 +14,6 @@
*/
package org.apache.geode.internal.cache;
-import java.io.PrintStream;
-import java.util.EnumSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.apache.logging.log4j.Logger;
-
import org.apache.geode.cache.EvictionAction;
import org.apache.geode.cache.EvictionAlgorithm;
import org.apache.geode.compression.Compressor;
@@ -42,19 +32,25 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap;
+import org.apache.logging.log4j.Logger;
+
+import java.io.PrintStream;
+import java.util.EnumSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
import joptsimple.internal.Strings;
/**
* Code shared by both DiskRegion and RecoveredDiskRegion.
*
- *
* @since GemFire prPersistSprint2
*/
public abstract class AbstractDiskRegion implements DiskRegionView {
private static final Logger logger = LogService.getLogger();
- ////////////////////// Instance Fields ///////////////////////
-
private final DiskStoreImpl ds;
private final long id;
private long clearOplogEntryId = DiskStoreImpl.INVALID_ID;
@@ -235,11 +231,9 @@ public abstract class AbstractDiskRegion implements DiskRegionView {
this.offHeap = drv.getOffHeap();
}
- ////////////////////// Instance Methods //////////////////////
-
public abstract String getName();
- public final DiskStoreImpl getDiskStore() {
+ public DiskStoreImpl getDiskStore() {
return this.ds;
}
@@ -380,15 +374,12 @@ public abstract class AbstractDiskRegion implements DiskRegionView {
return PartitionedRegionHelper.getPRPath(bn);
}
-
-
private PersistentMemberID myInitializingId = null;
private PersistentMemberID myInitializedId = null;
private final CopyOnWriteHashSet<PersistentMemberID> onlineMembers;
private final CopyOnWriteHashSet<PersistentMemberID> offlineMembers;
private final CopyOnWriteHashSet<PersistentMemberID> equalMembers;
-
public PersistentMemberID addMyInitializingPMID(PersistentMemberID pmid) {
PersistentMemberID result = this.myInitializingId;
this.myInitializingId = pmid;
@@ -905,7 +896,7 @@ public abstract class AbstractDiskRegion implements DiskRegionView {
public void dumpMetadata() {
String name = getName();
- // TODO - DAN - make this a flag
+ // TODO: make this a flag
// if (isBucket() && !DiskStoreImpl.TRACE_RECOVERY) {
// name = getPrName();
// }
@@ -976,7 +967,7 @@ public abstract class AbstractDiskRegion implements DiskRegionView {
*
* @return an instance of BytesAndBits or Token.REMOVED_PHASE1
*/
- public final Object getRaw(DiskId id) {
+ public Object getRaw(DiskId id) {
this.acquireReadLock();
try {
return getDiskStore().getRaw(this, id);
@@ -1047,7 +1038,7 @@ public abstract class AbstractDiskRegion implements DiskRegionView {
@Override
public void oplogRecovered(long oplogId) {
- // do nothing. Overriden in ExportDiskRegion
+ // do nothing. Overridden in ExportDiskRegion
}
@Override
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
index bcaa0d0..988be0a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import java.util.Iterator;
@@ -50,8 +49,6 @@ import org.apache.geode.internal.size.ReflectionSingleObjectSizer;
* Abstract implementation of {@link RegionMap} that adds LRU behaviour.
*
* @since GemFire 3.5.1
- *
- *
*/
public abstract class AbstractLRURegionMap extends AbstractRegionMap {
private static final Logger logger = LogService.getLogger();
@@ -263,7 +260,7 @@ public abstract class AbstractLRURegionMap extends AbstractRegionMap {
}
/** unsafe audit code. */
- public final void audit() {
+ public void audit() {
if (logger.isTraceEnabled(LogMarker.LRU)) {
logger.trace(LogMarker.LRU, "Size of LRUMap = {}", sizeInVM());
}
@@ -353,7 +350,7 @@ public abstract class AbstractLRURegionMap extends AbstractRegionMap {
*
* @param delta Description of the Parameter
*/
- protected final void changeTotalEntrySize(int delta) {
+ protected void changeTotalEntrySize(int delta) {
if (_isOwnerALocalRegion()) {
if (_getOwner() instanceof BucketRegion) {
BucketRegion bucketRegion = (BucketRegion) _getOwner();
@@ -577,7 +574,7 @@ public abstract class AbstractLRURegionMap extends AbstractRegionMap {
return resourceManager.getMemoryMonitor(offheap).getState().isEviction() && this.sizeInVM() > 0;
}
- public final int centralizedLruUpdateCallback() {
+ public int centralizedLruUpdateCallback() {
final boolean isDebugEnabled_LRU = logger.isTraceEnabled(LogMarker.LRU);
int evictedBytes = 0;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntry.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntry.java
index 866ff03..bfeb941 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntry.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntry.java
@@ -35,7 +35,7 @@ public abstract class AbstractOplogDiskRegionEntry extends AbstractDiskRegionEnt
abstract void setDiskId(RegionEntry oldRe);
@Override
- public final void removePhase1(LocalRegion r, boolean isClear) throws RegionClearedException {
+ public void removePhase1(LocalRegion r, boolean isClear) throws RegionClearedException {
synchronized (this) {
Helper.removeFromDisk(this, r, isClear);
_removePhase1();
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
index ac5fb37..b7cd199 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
@@ -1529,7 +1529,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
*
* @since GemFire 5.0
*/
- final boolean isAllEvents() {
+ boolean isAllEvents() {
return getDataPolicy().withReplication()
|| getSubscriptionAttributes().getInterestPolicy().isAll();
}
@@ -1787,7 +1787,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
return this.cache;
}
- public final long cacheTimeMillis() {
+ public long cacheTimeMillis() {
return this.cache.getInternalDistributedSystem().getClock().cacheTimeMillis();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
index 5dcf3bc..a1b4a9d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
@@ -3768,7 +3768,7 @@ public abstract class AbstractRegionMap implements RegionMap {
}
/** removes a tombstone that has expired locally */
- public final boolean removeTombstone(RegionEntry re, VersionHolder version, boolean isEviction,
+ public boolean removeTombstone(RegionEntry re, VersionHolder version, boolean isEviction,
boolean isScheduledTombstone) {
boolean result = false;
int destroyedVersion = version.getEntryVersion();
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
index 04a48d0..0c58963 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
@@ -71,7 +71,6 @@ import org.apache.geode.internal.util.StopWatch;
* Specialized {@link CacheDistributionAdvisor} for {@link BucketRegion BucketRegions}. The
* <code>BucketAdvisor</code> is owned by a {@link ProxyBucketRegion} and may outlive a
* <code>BucketRegion</code>.
- *
*/
@SuppressWarnings("synthetic-access")
public class BucketAdvisor extends CacheDistributionAdvisor {
@@ -1211,7 +1210,7 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
*
* @return the member or null if no primary exists
*/
- public final InternalDistributedMember basicGetPrimaryMember() {
+ public InternalDistributedMember basicGetPrimaryMember() {
return (InternalDistributedMember) this.primaryMember.get();
}
@@ -1882,7 +1881,7 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
*
* @return current number of hosts of this bucket ; -1 if there are no hosts
*/
- public final int getBucketRedundancy() {
+ public int getBucketRedundancy() {
return redundancy;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyOperation.java
index ad3f976..20cbd28 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyOperation.java
@@ -12,14 +12,11 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
import org.apache.geode.DataSerializer;
import org.apache.geode.cache.CacheEvent;
@@ -36,10 +33,9 @@ import org.apache.geode.internal.offheap.annotations.Retained;
/**
* Handles distribution messaging for destroying an entry in a region.
- *
- *
*/
public class DestroyOperation extends DistributedCacheOperation {
+
/** Creates a new instance of DestroyOperation */
public DestroyOperation(EntryEventImpl event) {
super(event);
@@ -116,8 +112,7 @@ public class DestroyOperation extends DistributedCacheOperation {
@Override
@Retained
- protected final InternalCacheEvent createEvent(DistributedRegion rgn)
- throws EntryNotFoundException {
+ protected InternalCacheEvent createEvent(DistributedRegion rgn) throws EntryNotFoundException {
EntryEventImpl ev = createEntryEvent(rgn);
boolean evReturned = false;
try {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/DistPeerTXStateStub.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistPeerTXStateStub.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistPeerTXStateStub.java
index 6411353..4d85578 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistPeerTXStateStub.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistPeerTXStateStub.java
@@ -36,10 +36,9 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
* 1. It forwards TX operations to primary or a selected replica (in case of RR) for each op </br>
* 2.It also records those transactional operations in order to send those to
* secondaries/replicas(in one batch) at commit time.
- *
- *
*/
public class DistPeerTXStateStub extends PeerTXStateStub implements DistTXCoordinatorInterface {
+
private ArrayList<DistTxEntryEvent> primaryTransactionalOperations = null;
private ArrayList<DistTxEntryEvent> secondaryTransactionalOperations = null;
private DistTXPrecommitMessage precommitDistTxMsg = null;
@@ -108,7 +107,7 @@ public class DistPeerTXStateStub extends PeerTXStateStub implements DistTXCoordi
}
@Override
- public final ArrayList<DistTxEntryEvent> getPrimaryTransactionalOperations()
+ public ArrayList<DistTxEntryEvent> getPrimaryTransactionalOperations()
throws UnsupportedOperationInTransactionException {
return primaryTransactionalOperations;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
index 6c33c65..a2d2e9d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
@@ -750,7 +750,7 @@ public abstract class DistributedCacheOperation {
// nothing to do here - see UpdateMessage
}
- protected final void waitForAckIfNeeded(CacheOperationMessage msg,
+ protected void waitForAckIfNeeded(CacheOperationMessage msg,
Map<InternalDistributedMember, PersistentMemberID> persistentIds) {
if (this.processor == null) {
return;
@@ -1068,7 +1068,7 @@ public abstract class DistributedCacheOperation {
}
@Override
- protected final void process(final DistributionManager dm) {
+ protected void process(final DistributionManager dm) {
Throwable thr = null;
boolean sendReply = true;
@@ -1481,7 +1481,7 @@ public abstract class DistributedCacheOperation {
}
}
- public final boolean supportsDirectAck() {
+ public boolean supportsDirectAck() {
return this.directAck;
}
@@ -1518,7 +1518,7 @@ public abstract class DistributedCacheOperation {
this.hasOldValue = true;
}
- protected final boolean _mayAddToMultipleSerialGateways(DistributionManager dm) {
+ protected boolean _mayAddToMultipleSerialGateways(DistributionManager dm) {
int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.ANY_INIT);
try {
LocalRegion lr = getLocalRegionForProcessing(dm);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedPutAllOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedPutAllOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedPutAllOperation.java
index c26cd56..4dcb0b7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedPutAllOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedPutAllOperation.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
@@ -261,7 +260,7 @@ public class DistributedPutAllOperation extends AbstractUpdateOperation {
}
}
- public final EntryEventImpl getBaseEvent() {
+ public EntryEventImpl getBaseEvent() {
return getEvent();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
index 485835b..650fe2a 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
@@ -888,7 +888,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
@Override
- public final Object validatedDestroy(Object key, EntryEventImpl event)
+ public Object validatedDestroy(Object key, EntryEventImpl event)
throws TimeoutException, EntryNotFoundException, CacheWriterException {
Lock dlock = this.getDistributedLockIfGlobal(key);
try {
[08/14] geode git commit: GEODE-1994: Overhaul of
internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils
Posted by kl...@apache.org.
GEODE-1994: Overhaul of internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils
* geode.internal.lang.StringUtils has been deprecated. In the interim, it has been heavily refactored and extends commons.lang.StringUtils.
*
* Renamed:
* -- EMPTY_STRING -> EMPTY (inherited)
* -- toUpperCase -> upperCase (inherited)
* -- toLowerCase -> lowerCase (inherited)
* -- padEnding -> rightPad (inherited)
*
* Removed:
* -- EMPTY_STRING_ARRAY; usage replaced with commons.lang.ArrayUtils.EMPTY_STRING_ARRAY
* -- SPACES
* -- UTF_8; rare usage replaced with raw string
* -- concat; usage replaced with commons.lang.join, refactoring as necessary.
* -- getLettersOnly
* -- getSpaces
* -- truncate
* -- valueOf; usage refactored to use defaultString
*
* Refactored
* -- defaultIfBlank: previously relied on varargs and could return null. Usage refactored to allow inheritance from commons.
* -- defaultString(s, EMPTY) refactored to use standard signature defaultString(s) for consistency throughout codebase.
* -- isBlank: usage refactored to resolve discrepancies with commons.lang.isBlank, which is now inherited.
* -- isEmpty: usage refactored to resolve discrepancies with commons.lang.isEmpty, which is now inherited.
*
* Code Cleanup:
* -- Many uses of !isBlank -> isNotBlank
* -- Changes suggested by Inspections on most touched files.
* -- Explicit <T> -> <> when type is inferable
* -- while loops operating on iterators converted to for each loops
* -- for loops operating on array indices converted to for each loops
* -- Various string typos corrected.
* -- isEmpty(s.trim()) -> isBlank(s)
* -- s.trim().isEmpty() -> isEmpty(s)
* -- Removed some instances of 'dead' code
* -- Optimized imports in every touched file
*
* Qualitative Changes:
* -- The following functions now throw an error when called with a null string input:
* -- * LocatorLauncher.Builder.setMemberName
* -- * ServerLauncher.Builder.setMemberName
* -- * ServerLauncher.Builder.setHostnameForClients
* -- (Unit tests added to capture these changes)
*
* Notes:
* -- StringUtils.wraps may be inherited from Apache Commons when the dependency is updated.
* -- AbstractLauncher.getMember has the documented behavior of returning null when both MemberName and ID are blank. Is this the best behavior for this method?
* this closes #521
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/d16d192b
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/d16d192b
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/d16d192b
Branch: refs/heads/feature/GEODE-2929-1
Commit: d16d192b22f2932ac95780f18e92f0aece730240
Parents: 9af854a
Author: Patrick Rhomberg <pr...@pivotal.io>
Authored: Wed May 17 16:57:07 2017 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Fri May 19 10:29:16 2017 -0700
----------------------------------------------------------------------
.../LauncherLifecycleCommandsDUnitTest.java | 77 ++--
.../commands/LauncherLifecycleCommandsTest.java | 61 +--
.../web/controllers/RestAPITestBase.java | 54 +--
.../internal/locator/LocatorStatusResponse.java | 32 +-
.../query/internal/AttributeDescriptor.java | 70 +---
.../cache/query/internal/NWayMergeResults.java | 31 +-
.../geode/distributed/AbstractLauncher.java | 27 +-
.../geode/distributed/LocatorLauncher.java | 58 ++-
.../geode/distributed/ServerLauncher.java | 72 ++--
.../internal/ClusterConfigurationService.java | 64 ++--
.../distributed/internal/InternalLocator.java | 46 +--
.../membership/gms/membership/GMSJoinLeave.java | 67 ++--
.../geode/internal/InternalDataSerializer.java | 134 +++----
.../admin/remote/RemoteTransportConfig.java | 25 +-
.../cache/ClusterConfigurationLoader.java | 47 ++-
.../geode/internal/cache/EntryEventImpl.java | 20 +-
.../internal/cache/tier/sockets/HandShake.java | 85 ++---
.../apache/geode/internal/lang/StringUtils.java | 268 ++-----------
.../apache/geode/internal/lang/SystemUtils.java | 4 +-
.../internal/process/FileProcessController.java | 11 +-
.../geode/internal/process/signal/Signal.java | 4 +-
.../security/IntegratedSecurityService.java | 10 +-
.../apache/geode/internal/util/ArrayUtils.java | 11 +-
.../org/apache/geode/internal/util/IOUtils.java | 6 +-
.../geode/management/internal/AgentUtil.java | 8 +-
.../geode/management/internal/JettyHelper.java | 27 +-
.../management/internal/ManagementAgent.java | 60 ++-
.../geode/management/internal/RestAgent.java | 21 +-
.../geode/management/internal/SSLUtil.java | 5 +-
.../internal/beans/DistributedSystemBridge.java | 175 ++++-----
.../internal/beans/DistributedSystemMBean.java | 11 +-
.../internal/beans/ManagementAdapter.java | 82 ++--
.../internal/beans/QueryDataFunction.java | 90 ++---
.../geode/management/internal/cli/CliUtil.java | 48 +--
.../cli/commands/AbstractCommandsSupport.java | 15 +-
.../internal/cli/commands/ConfigCommands.java | 40 +-
.../CreateAlterDestroyRegionCommands.java | 187 ++++------
...xportImportClusterConfigurationCommands.java | 34 +-
.../internal/cli/commands/IndexCommands.java | 25 +-
.../cli/commands/LauncherLifecycleCommands.java | 372 +++++++------------
.../internal/cli/commands/ShellCommands.java | 10 +-
.../cli/converters/FilePathStringConverter.java | 2 +-
.../converters/GatewaySenderIdConverter.java | 15 +-
.../internal/cli/domain/DiskStoreDetails.java | 10 +-
.../internal/cli/domain/IndexDetails.java | 14 +-
.../functions/DescribeDiskStoreFunction.java | 13 +-
.../FetchSharedConfigurationStatusFunction.java | 2 +-
.../cli/functions/RegionCreateFunction.java | 11 +-
.../management/internal/cli/help/HelpBlock.java | 4 +-
.../management/internal/cli/help/Helper.java | 4 +-
.../internal/cli/result/ResultBuilder.java | 18 +-
.../internal/cli/result/TableBuilder.java | 30 +-
.../internal/cli/shell/GfshConfig.java | 6 +-
.../cli/shell/GfshExecutionStrategy.java | 16 +-
.../internal/cli/shell/JmxOperationInvoker.java | 4 +-
.../internal/cli/util/CommandStringBuilder.java | 4 +-
.../configuration/domain/XmlEntity.java | 50 ++-
.../messages/ConfigurationRequest.java | 12 +-
.../messages/ConfigurationResponse.java | 22 +-
.../internal/configuration/utils/XmlUtils.java | 33 +-
.../controllers/AbstractCommandsController.java | 62 ++--
.../controllers/ConfigCommandsController.java | 10 +-
.../web/controllers/DataCommandsController.java | 4 +-
.../controllers/DeployCommandsController.java | 13 +-
.../DiskStoreCommandsController.java | 16 +-
.../DurableClientCommandsController.java | 14 +-
.../web/controllers/ExportLogController.java | 2 +-
.../controllers/FunctionCommandsController.java | 10 +-
.../MiscellaneousCommandsController.java | 4 +-
.../web/controllers/PdxCommandsController.java | 9 +-
.../controllers/QueueCommandsController.java | 7 +-
.../controllers/RegionCommandsController.java | 11 +-
.../controllers/ShellCommandsController.java | 34 +-
.../web/controllers/WanCommandsController.java | 55 ++-
.../management/internal/web/domain/Link.java | 12 +-
.../internal/web/domain/LinkIndex.java | 6 +-
.../internal/web/http/HttpHeader.java | 4 +-
.../web/shell/RestHttpOperationInvoker.java | 4 +-
.../internal/web/util/ConvertUtils.java | 11 +-
.../management/internal/web/util/UriUtils.java | 4 +-
.../cache/client/internal/LocatorTestBase.java | 40 +-
.../AbstractLauncherIntegrationTestCase.java | 2 +-
.../geode/distributed/AbstractLauncherTest.java | 24 +-
.../LocatorLauncherIntegrationTest.java | 14 +-
.../geode/distributed/LocatorLauncherTest.java | 61 ++-
.../ServerLauncherIntegrationTest.java | 14 +-
.../geode/distributed/ServerLauncherTest.java | 40 +-
.../internal/lang/ClassUtilsJUnitTest.java | 15 +-
.../internal/lang/StringUtilsJUnitTest.java | 244 +-----------
.../internal/util/CollectionUtilsJUnitTest.java | 96 ++---
.../AbstractCommandsSupportJUnitTest.java | 40 +-
.../cli/commands/ListIndexCommandDUnitTest.java | 45 ++-
.../internal/configuration/ClusterConfig.java | 14 +-
.../dunit/rules/GfshShellConnectionRule.java | 2 +-
.../internal/cli/LuceneIndexCommands.java | 45 +--
.../functions/LuceneCreateIndexFunction.java | 3 +-
.../cli/LuceneIndexCommandsJUnitTest.java | 61 +--
.../pulse/testbed/PropMockDataUpdater.java | 17 +-
.../geodefunctions/RetrieveRegionFunction.java | 20 +-
.../internal/web/AbstractWebTestCase.java | 14 +-
.../ShellCommandsControllerJUnitTest.java | 38 +-
.../RestHttpOperationInvokerJUnitTest.java | 40 +-
102 files changed, 1648 insertions(+), 2297 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
index 5277e57..27bc098 100644
--- a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
@@ -14,41 +14,13 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.apache.geode.test.dunit.Assert.*;
-import static org.apache.geode.test.dunit.Wait.*;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.lang.management.ManagementFactory;
-import java.net.InetAddress;
-import java.nio.charset.Charset;
-import java.text.DateFormat;
-import java.text.MessageFormat;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Queue;
-import java.util.Set;
-import java.util.concurrent.ConcurrentLinkedDeque;
-import java.util.concurrent.TimeUnit;
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.management.Query;
-import javax.management.QueryExp;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXConnectorFactory;
-import javax.management.remote.JMXServiceURL;
-
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runners.MethodSorters;
+import static org.apache.geode.distributed.ConfigurationProperties.DURABLE_CLIENT_ID;
+import static org.apache.geode.distributed.ConfigurationProperties.START_LOCATOR;
+import static org.apache.geode.test.dunit.Assert.assertEquals;
+import static org.apache.geode.test.dunit.Assert.assertFalse;
+import static org.apache.geode.test.dunit.Assert.assertNotNull;
+import static org.apache.geode.test.dunit.Assert.assertTrue;
+import static org.apache.geode.test.dunit.Wait.waitForCriterion;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.client.ClientCache;
@@ -79,6 +51,37 @@ import org.apache.geode.management.internal.cli.result.CommandResult;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
import org.apache.geode.test.dunit.WaitCriterion;
import org.apache.geode.test.junit.categories.DistributedTest;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runners.MethodSorters;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.lang.management.ManagementFactory;
+import java.net.InetAddress;
+import java.nio.charset.Charset;
+import java.text.DateFormat;
+import java.text.MessageFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Queue;
+import java.util.Set;
+import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.concurrent.TimeUnit;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.Query;
+import javax.management.QueryExp;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
/**
* The LauncherLifecycleCommandsDUnitTest class is a test suite of integration tests testing the
@@ -389,7 +392,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
assertTrue(resultString,
resultString
.contains(MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE,
- StringUtils.EMPTY_STRING, gemfirePropertiesPathname)));
+ StringUtils.EMPTY, gemfirePropertiesPathname)));
}
/**
@@ -525,7 +528,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
assertTrue(resultString,
resultString
.contains(MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE,
- StringUtils.EMPTY_STRING, gemfirePropertiesFile)));
+ StringUtils.EMPTY, gemfirePropertiesFile)));
}
@Test
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsTest.java b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsTest.java
index 0554f69..2a1662e 100755
--- a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsTest.java
@@ -14,33 +14,42 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Stack;
-
-import org.apache.geode.distributed.LocatorLauncher;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS;
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.apache.geode.distributed.ConfigurationProperties.START_DEV_REST_API;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.GemFireException;
import org.apache.geode.cache.server.CacheServer;
+import org.apache.geode.distributed.LocatorLauncher;
import org.apache.geode.distributed.ServerLauncher;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.DistributionLocator;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.lang.SystemUtils;
import org.apache.geode.internal.util.IOUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.Stack;
/**
* The LauncherLifecycleCommandsTest class is a test suite of test cases testing the contract and
@@ -77,7 +86,7 @@ public class LauncherLifecycleCommandsTest {
assertTrue(commandLine.isEmpty());
- getLauncherLifecycleCommands().addGemFirePropertyFile(commandLine, StringUtils.EMPTY_STRING);
+ getLauncherLifecycleCommands().addGemFirePropertyFile(commandLine, StringUtils.EMPTY);
assertTrue(commandLine.isEmpty());
@@ -106,7 +115,7 @@ public class LauncherLifecycleCommandsTest {
gemfireProperties.setProperty(LOCATORS, "localhost[11235]");
gemfireProperties.setProperty(LOG_LEVEL, "config");
- gemfireProperties.setProperty(LOG_FILE, StringUtils.EMPTY_STRING);
+ gemfireProperties.setProperty(LOG_FILE, StringUtils.EMPTY);
gemfireProperties.setProperty(MCAST_PORT, "0");
gemfireProperties.setProperty(NAME, "machine");
@@ -144,7 +153,7 @@ public class LauncherLifecycleCommandsTest {
gemfireProperties.setProperty(LOCATORS, "localhost[11235]");
gemfireProperties.setProperty(LOG_LEVEL, "config");
- gemfireProperties.setProperty(LOG_FILE, StringUtils.EMPTY_STRING);
+ gemfireProperties.setProperty(LOG_FILE, StringUtils.EMPTY);
gemfireProperties.setProperty(MCAST_PORT, "0");
gemfireProperties.setProperty(NAME, "machine");
@@ -182,7 +191,7 @@ public class LauncherLifecycleCommandsTest {
assertTrue(commandLine.isEmpty());
- getLauncherLifecycleCommands().addInitialHeap(commandLine, StringUtils.EMPTY_STRING);
+ getLauncherLifecycleCommands().addInitialHeap(commandLine, StringUtils.EMPTY);
assertTrue(commandLine.isEmpty());
@@ -255,7 +264,7 @@ public class LauncherLifecycleCommandsTest {
assertTrue(commandLine.isEmpty());
- getLauncherLifecycleCommands().addMaxHeap(commandLine, StringUtils.EMPTY_STRING);
+ getLauncherLifecycleCommands().addMaxHeap(commandLine, StringUtils.EMPTY);
assertTrue(commandLine.isEmpty());
@@ -621,11 +630,11 @@ public class LauncherLifecycleCommandsTest {
}
private String toClasspath(final String... jarFilePathnames) {
- String classpath = StringUtils.EMPTY_STRING;
+ String classpath = StringUtils.EMPTY;
if (jarFilePathnames != null) {
for (final String jarFilePathname : jarFilePathnames) {
- classpath += (classpath.isEmpty() ? StringUtils.EMPTY_STRING : File.pathSeparator);
+ classpath += (classpath.isEmpty() ? StringUtils.EMPTY : File.pathSeparator);
classpath += jarFilePathname;
}
}
@@ -637,7 +646,7 @@ public class LauncherLifecycleCommandsTest {
String path = "";
for (Object pathElement : pathElements) {
- path += (path.isEmpty() ? StringUtils.EMPTY_STRING : File.pathSeparator);
+ path += (path.isEmpty() ? StringUtils.EMPTY : File.pathSeparator);
path += pathElement;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPITestBase.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPITestBase.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPITestBase.java
index f2e90a4..4529f2c 100644
--- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPITestBase.java
+++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPITestBase.java
@@ -14,36 +14,21 @@
*/
package org.apache.geode.rest.internal.web.controllers;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.apache.geode.test.dunit.Assert.*;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.json.JSONArray;
-import org.junit.experimental.categories.Category;
-
+import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS;
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.START_DEV_REST_API;
+import static org.apache.geode.test.dunit.Assert.assertEquals;
+import static org.apache.geode.test.dunit.Assert.assertNotNull;
+import static org.apache.geode.test.dunit.Assert.fail;
+
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.execute.FunctionService;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.AvailablePortHelper;
import org.apache.geode.internal.GemFireVersion;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.AgentUtil;
import org.apache.geode.rest.internal.web.RestFunctionTemplate;
import org.apache.geode.test.dunit.Host;
@@ -51,6 +36,25 @@ import org.apache.geode.test.dunit.Invoke;
import org.apache.geode.test.dunit.VM;
import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.json.JSONArray;
+import org.junit.experimental.categories.Category;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.Random;
@Category(DistributedTest.class)
class RestAPITestBase extends JUnit4DistributedTestCase {
@@ -168,7 +172,7 @@ class RestAPITestBase extends JUnit4DistributedTestCase {
HttpPost post = new HttpPost(restString);
post.addHeader("Content-Type", "application/json");
post.addHeader("Accept", "application/json");
- if (jsonBody != null && !StringUtils.isEmpty(jsonBody)) {
+ if (StringUtils.isNotEmpty(jsonBody)) {
StringEntity jsonStringEntity = new StringEntity(jsonBody, ContentType.DEFAULT_TEXT);
post.setEntity(jsonStringEntity);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/cache/client/internal/locator/LocatorStatusResponse.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/locator/LocatorStatusResponse.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/locator/LocatorStatusResponse.java
index d531cc1..677db4d 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/locator/LocatorStatusResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/locator/LocatorStatusResponse.java
@@ -15,6 +15,13 @@
package org.apache.geode.cache.client.internal.locator;
+import org.apache.geode.internal.DataSerializableFixedID;
+import org.apache.geode.internal.GemFireVersion;
+import org.apache.geode.internal.lang.ObjectUtils;
+import org.apache.geode.internal.lang.StringUtils;
+import org.apache.geode.internal.process.PidUnavailableException;
+import org.apache.geode.internal.process.ProcessUtils;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@@ -24,13 +31,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import org.apache.geode.internal.DataSerializableFixedID;
-import org.apache.geode.internal.GemFireVersion;
-import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.process.PidUnavailableException;
-import org.apache.geode.internal.process.ProcessUtils;
-
/**
* The LocatorStatusResponse class...
* </p>
@@ -101,7 +101,7 @@ public class LocatorStatusResponse extends ServerLocationResponse {
@SuppressWarnings("unchecked")
public List<String> getJvmArgs() {
return Collections
- .unmodifiableList(ObjectUtils.defaultIfNull(jvmArgs, Collections.<String>emptyList()));
+ .unmodifiableList(ObjectUtils.defaultIfNull(jvmArgs, Collections.emptyList()));
}
public Integer getPid() {
@@ -162,12 +162,12 @@ public class LocatorStatusResponse extends ServerLocationResponse {
}
protected void readWorkingDirectory(final DataInput in) throws IOException {
- this.workingDirectory = StringUtils.defaultIfBlank(in.readUTF());
+ this.workingDirectory = StringUtils.nullifyIfBlank(in.readUTF());
}
protected void readJvmArguments(final DataInput in) throws IOException {
final int length = in.readInt();
- final List<String> jvmArgs = new ArrayList<String>(length);
+ final List<String> jvmArgs = new ArrayList<>(length);
for (int index = 0; index < length; index++) {
jvmArgs.add(in.readUTF());
}
@@ -175,23 +175,23 @@ public class LocatorStatusResponse extends ServerLocationResponse {
}
protected void readClasspath(final DataInput in) throws IOException {
- this.classpath = StringUtils.defaultIfBlank(in.readUTF());
+ this.classpath = StringUtils.nullifyIfBlank(in.readUTF());
}
protected void readGemFireVersion(final DataInput in) throws IOException {
- this.gemfireVersion = StringUtils.defaultIfBlank(in.readUTF());
+ this.gemfireVersion = StringUtils.nullifyIfBlank(in.readUTF());
}
protected void readJavaVersion(final DataInput in) throws IOException {
- this.javaVersion = StringUtils.defaultIfBlank(in.readUTF());
+ this.javaVersion = StringUtils.nullifyIfBlank(in.readUTF());
}
protected void readLogFile(final DataInput in) throws IOException {
- this.logFile = StringUtils.defaultIfBlank(in.readUTF());
+ this.logFile = StringUtils.nullifyIfBlank(in.readUTF());
}
protected void readHost(final DataInput in) throws IOException {
- this.host = StringUtils.defaultIfBlank(in.readUTF());
+ this.host = StringUtils.nullifyIfBlank(in.readUTF());
}
protected void readPort(final DataInput in) throws IOException {
@@ -200,7 +200,7 @@ public class LocatorStatusResponse extends ServerLocationResponse {
}
protected void readName(final DataInput in) throws IOException {
- this.name = StringUtils.defaultIfBlank(in.readUTF());
+ this.name = StringUtils.nullifyIfBlank(in.readUTF());
}
@Override
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/cache/query/internal/AttributeDescriptor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/AttributeDescriptor.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/AttributeDescriptor.java
index f40ab3e..5bfba0e 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/AttributeDescriptor.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/AttributeDescriptor.java
@@ -15,6 +15,19 @@
package org.apache.geode.cache.query.internal;
+import org.apache.geode.cache.EntryDestroyedException;
+import org.apache.geode.cache.query.NameNotFoundException;
+import org.apache.geode.cache.query.QueryInvocationTargetException;
+import org.apache.geode.cache.query.QueryService;
+import org.apache.geode.cache.query.types.ObjectType;
+import org.apache.geode.internal.cache.Token;
+import org.apache.geode.internal.i18n.LocalizedStrings;
+import org.apache.geode.pdx.JSONFormatter;
+import org.apache.geode.pdx.PdxInstance;
+import org.apache.geode.pdx.PdxSerializationException;
+import org.apache.geode.pdx.internal.FieldNotFoundInPdxVersion;
+import org.apache.geode.pdx.internal.PdxInstanceImpl;
+
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -28,19 +41,6 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import org.apache.geode.cache.EntryDestroyedException;
-import org.apache.geode.cache.query.NameNotFoundException;
-import org.apache.geode.cache.query.QueryInvocationTargetException;
-import org.apache.geode.cache.query.QueryService;
-import org.apache.geode.cache.query.types.ObjectType;
-import org.apache.geode.internal.cache.Token;
-import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.pdx.PdxInstance;
-import org.apache.geode.pdx.PdxSerializationException;
-import org.apache.geode.pdx.internal.FieldNotFoundInPdxVersion;
-import org.apache.geode.pdx.internal.PdxInstanceImpl;
-import org.apache.geode.pdx.JSONFormatter;
-
/**
* Utility for managing an attribute
*
@@ -137,25 +137,6 @@ public class AttributeDescriptor {
}
- /* this method is not yet used. Here to support Update statements */
- // returns either null or UNDEFINED
- /*
- * public Object write(Object target, Object newValue) throws PathEvaluationException { if (target
- * == null) return QueryService.UNDEFINED;
- *
- *
- * Class targetType = target.getClass(); Class argType = newValue == null ? null :
- * newValue.getClass(); Member m = getWriteMember(targetType, argType); if (m == null) throw new
- * PathEvaluationException(LocalizedStrings.AttributeDescriptor_NO_UPDATE_PATH_MAPPING_FOUND_FOR_0
- * .toLocalizedString(_name)); try { if (m instanceof Method) { try { ((Method)m).invoke(target,
- * new Object[] { newValue }); return null; } catch (InvocationTargetException e) { throw new
- * PathEvaluationException(e.getTargetException()); } } else { ((Field)m).set(target, newValue);
- * return null; } } catch (IllegalAccessException e) { throw new PathEvaluationException(e)); }
- *
- * }
- */
-
-
Member getReadMember(ObjectType targetType) throws NameNotFoundException {
return getReadMember(targetType.resolveClass());
}
@@ -186,14 +167,6 @@ public class AttributeDescriptor {
}
- /*
- * Not yet used, Here to support Update statements private Member getWriteMember(Class targetType,
- * Class argType) { // mapping: public field (same name), method (setAttribute(val)), // method
- * attribute(val) Member m; m = getWriteField(targetType, argType); if (m != null) return m;
- * return getWriteMethod(targetType, argType); }
- */
-
-
private Field getReadField(Class targetType) {
try {
@@ -203,11 +176,6 @@ public class AttributeDescriptor {
}
}
- /*
- * not yet used private Field getWriteField(Class targetType, Class argType) { try { return
- * targetType.getField(_name); } catch (NoSuchFieldException e) { return null; } }
- */
-
private Method getReadMethod(Class targetType) {
@@ -219,12 +187,6 @@ public class AttributeDescriptor {
return getReadMethod(targetType, _name);
}
- /*
- * not yet used private Method getWriteMethod(Class targetType, Class argType) { Method m; String
- * beanMethod = "set" + _name.substring(0,1).toUpperCase() + _name.substring(1); m =
- * getWriteMethod(targetType, argType, beanMethod); if (m != null) return m; return
- * getWriteMethod(targetType, argType, _name); }
- */
private Method getReadMethod(Class targetType, String methodName) {
@@ -236,12 +198,6 @@ public class AttributeDescriptor {
}
}
- /*
- * not yet used private Method getWriteMethod(Class targetType, Class argType, String methodName)
- * { try { // @todo look up maximally specific method based on argType return
- * targetType.getMethod(methodName, new Class[] { argType }); } catch (NoSuchMethodException e) {
- * return null; } }
- */
/**
* reads field value from a PdxInstance
*
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/cache/query/internal/NWayMergeResults.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/NWayMergeResults.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/NWayMergeResults.java
index 4e52a67..1a267d8 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/NWayMergeResults.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/NWayMergeResults.java
@@ -14,19 +14,6 @@
*/
package org.apache.geode.cache.query.internal;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.AbstractCollection;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
import org.apache.geode.DataSerializer;
import org.apache.geode.cache.query.SelectResults;
import org.apache.geode.cache.query.Struct;
@@ -40,6 +27,19 @@ import org.apache.geode.internal.HeapDataOutputStream;
import org.apache.geode.internal.HeapDataOutputStream.LongUpdater;
import org.apache.geode.internal.Version;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.AbstractCollection;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
/**
* The n - way merge results returns a sorted results on the cumulative sorted results for
* partitioned region based query
@@ -210,11 +210,6 @@ public class NWayMergeResults<E> implements SelectResults<E>, Ordered, DataSeria
}
- /*
- * @Override public boolean isEmpty() { boolean isEmpty = true; for (SelectResults<E> result :
- * this.sortedResults) { isEmpty = result.isEmpty(); if (!isEmpty) { break; } } return isEmpty;
- * }
- */
@Override
public Iterator<E> iterator() {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
index feba893..007a990 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
@@ -37,14 +37,11 @@ import org.apache.geode.management.internal.cli.json.GfJsonObject;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
import java.net.BindException;
import java.net.InetAddress;
import java.net.URL;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
@@ -144,7 +141,7 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
* @see java.util.Properties
*/
protected static boolean isSet(final Properties properties, final String propertyName) {
- return !StringUtils.isBlank(properties.getProperty(propertyName));
+ return StringUtils.isNotBlank(properties.getProperty(propertyName));
}
/**
@@ -243,7 +240,7 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
distributedSystemProperties.putAll(defaults);
}
- if (!StringUtils.isBlank(getMemberName())) {
+ if (StringUtils.isNotBlank(getMemberName())) {
distributedSystemProperties.setProperty(NAME, getMemberName());
}
@@ -291,7 +288,13 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
* @see #getMemberId()
*/
public String getMember() {
- return StringUtils.defaultIfBlank(getMemberName(), getMemberId());
+ if (StringUtils.isNotBlank(getMemberName())) {
+ return getMemberName();
+ }
+ if (StringUtils.isNotBlank(getMemberId())) {
+ return getMemberId();
+ }
+ return null;
}
/**
@@ -501,7 +504,7 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
// TODO refactor the logic in this method into a DateTimeFormatUtils class
protected static String toDaysHoursMinutesSeconds(final Long milliseconds) {
- final StringBuilder buffer = new StringBuilder(StringUtils.EMPTY_STRING);
+ final StringBuilder buffer = new StringBuilder();
if (milliseconds != null) {
long millisecondsRemaining = milliseconds;
@@ -569,7 +572,7 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
* @return a String value containing the JSON representation of this state object.
*/
public String toJson() {
- final Map<String, Object> map = new HashMap<String, Object>();
+ final Map<String, Object> map = new HashMap<>();
map.put(JSON_CLASSPATH, getClasspath());
map.put(JSON_GEMFIREVERSION, getGemFireVersion());
map.put(JSON_HOST, getHost());
@@ -778,12 +781,12 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
// the value of a Number as a String, or "" if null
protected String toString(final Number value) {
- return StringUtils.valueOf(value, "");
+ return StringUtils.defaultString(value);
}
// a String concatenation of all values separated by " "
protected String toString(final Object... values) {
- return StringUtils.concat(values, " ");
+ return values == null ? "" : StringUtils.join(values, " ");
}
// the value of the String, or "" if value is null
@@ -805,8 +808,8 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
private final String description;
Status(final String description) {
- assert !StringUtils.isBlank(description) : "The Status description must be specified!";
- this.description = StringUtils.toLowerCase(description);
+ assert StringUtils.isNotBlank(description) : "The Status description must be specified!";
+ this.description = StringUtils.lowerCase(description);
}
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
index 641e009..68aa9db 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
@@ -15,32 +15,42 @@
package org.apache.geode.distributed;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
-import org.apache.geode.cache.client.internal.locator.*;
+import org.apache.geode.cache.client.internal.locator.LocatorStatusRequest;
+import org.apache.geode.cache.client.internal.locator.LocatorStatusResponse;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.DistributionConfigImpl;
import org.apache.geode.distributed.internal.InternalLocator;
-import org.apache.geode.distributed.internal.tcpserver.*;
+import org.apache.geode.distributed.internal.tcpserver.TcpClient;
import org.apache.geode.internal.DistributionLocator;
import org.apache.geode.internal.GemFireVersion;
-import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.lang.ObjectUtils;
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.lang.SystemUtils;
-import org.apache.geode.internal.process.*;
+import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.process.ConnectionFailedException;
+import org.apache.geode.internal.process.ControlNotificationHandler;
+import org.apache.geode.internal.process.ControllableProcess;
+import org.apache.geode.internal.process.FileAlreadyExistsException;
+import org.apache.geode.internal.process.MBeanInvocationFailedException;
+import org.apache.geode.internal.process.PidUnavailableException;
+import org.apache.geode.internal.process.ProcessController;
+import org.apache.geode.internal.process.ProcessControllerFactory;
+import org.apache.geode.internal.process.ProcessControllerParameters;
+import org.apache.geode.internal.process.ProcessLauncherContext;
+import org.apache.geode.internal.process.ProcessType;
+import org.apache.geode.internal.process.ProcessUtils;
+import org.apache.geode.internal.process.StartupStatusListener;
+import org.apache.geode.internal.process.UnableToControlProcessException;
import org.apache.geode.internal.util.IOUtils;
import org.apache.geode.lang.AttachAPINotFoundException;
import org.apache.geode.management.internal.cli.json.GfJsonArray;
import org.apache.geode.management.internal.cli.json.GfJsonException;
import org.apache.geode.management.internal.cli.json.GfJsonObject;
-import joptsimple.OptionException;
-import joptsimple.OptionParser;
-import joptsimple.OptionSet;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -48,12 +58,23 @@ import java.lang.management.ManagementFactory;
import java.net.ConnectException;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Level;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import joptsimple.OptionException;
+import joptsimple.OptionParser;
+import joptsimple.OptionSet;
/**
* The LocatorLauncher class is a launcher for a GemFire Locator.
@@ -1563,7 +1584,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
* @see #getHostnameForClients()
*/
public Builder setHostnameForClients(final String hostnameForClients) {
- if (StringUtils.isEmpty(StringUtils.trim(hostnameForClients))) {
+ if (StringUtils.isBlank(hostnameForClients)) {
throw new IllegalArgumentException(
LocalizedStrings.LocatorLauncher_Builder_INVALID_HOSTNAME_FOR_CLIENTS_ERROR_MESSAGE
.toLocalizedString());
@@ -1591,7 +1612,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
* @see #getMemberName()
*/
public Builder setMemberName(final String memberName) {
- if (StringUtils.isEmpty(StringUtils.trim(memberName))) {
+ if (StringUtils.isBlank(memberName)) {
throw new IllegalArgumentException(
LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE
.toLocalizedString("Locator"));
@@ -1707,7 +1728,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
}
boolean isWorkingDirectorySpecified() {
- return !StringUtils.isBlank(this.workingDirectory);
+ return StringUtils.isNotBlank(this.workingDirectory);
}
/**
@@ -1931,7 +1952,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
* option.
*/
public boolean hasOption(final String option) {
- return getOptions().contains(StringUtils.toLowerCase(option));
+ return getOptions().contains(StringUtils.lowerCase(option));
}
/**
@@ -2043,8 +2064,9 @@ public class LocatorLauncher extends AbstractLauncher<String> {
if (logFile != null && logFile.isFile()) {
final String logFileCanonicalPath =
IOUtils.tryGetCanonicalPathElseGetAbsolutePath(logFile);
- if (!StringUtils.isBlank(logFileCanonicalPath)) { // this is probably not need but a safe
- // check none-the-less.
+ if (StringUtils.isNotBlank(logFileCanonicalPath)) { // this is probably not need but a
+ // safe
+ // check none-the-less.
return logFileCanonicalPath;
}
}
@@ -2056,7 +2078,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
if (InternalLocator.hasLocator()) {
final InternalLocator locator = InternalLocator.getLocator();
final String portAsString = String.valueOf(locator.getPort());
- if (!StringUtils.isBlank(portAsString)) {
+ if (StringUtils.isNotBlank(portAsString)) {
return portAsString;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
index b2d0151..acd5e8a 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
@@ -15,33 +15,9 @@
package org.apache.geode.distributed;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.ServiceLoader;
-import java.util.TreeMap;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import joptsimple.OptionException;
-import joptsimple.OptionParser;
-import joptsimple.OptionSet;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.apache.geode.distributed.ConfigurationProperties.SERVER_BIND_ADDRESS;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.Cache;
@@ -87,6 +63,30 @@ import org.apache.geode.pdx.PdxSerializer;
import org.apache.geode.security.AuthenticationRequiredException;
import org.apache.geode.security.GemFireSecurityException;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.ServiceLoader;
+import java.util.TreeMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import joptsimple.OptionException;
+import joptsimple.OptionParser;
+import joptsimple.OptionSet;
+
/**
* The ServerLauncher class is a launcher class with main method to start a GemFire Server (implying
* a GemFire Cache Server process).
@@ -366,7 +366,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
final StringBuilder buffer = new StringBuilder(ServerState.getServerBindAddressAsString(this));
final String serverPort = ServerState.getServerPortAsString(this);
- if (!StringUtils.isBlank(serverPort)) {
+ if (StringUtils.isNotBlank(serverPort)) {
buffer.append("[").append(serverPort).append("]");
}
@@ -590,7 +590,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* configuration meta-data.
*/
public boolean isSpringXmlLocationSpecified() {
- return !StringUtils.isBlank(this.springXmlLocation);
+ return StringUtils.isNotBlank(this.springXmlLocation);
}
/**
@@ -1956,7 +1956,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* @see #getMemberName()
*/
public Builder setMemberName(final String memberName) {
- if (StringUtils.isEmpty(StringUtils.trim(memberName))) {
+ if (StringUtils.isBlank(memberName)) {
throw new IllegalArgumentException(
LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE
.toLocalizedString("Server"));
@@ -2496,7 +2496,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
private final String name;
Command(final String name, final String... options) {
- assert !StringUtils.isBlank(name) : "The name of the command must be specified!";
+ assert StringUtils.isNotBlank(name) : "The name of the command must be specified!";
this.name = name;
this.options = (options != null ? Collections.unmodifiableList(Arrays.asList(options))
: Collections.<String>emptyList());
@@ -2572,7 +2572,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* option.
*/
public boolean hasOption(final String option) {
- return getOptions().contains(StringUtils.toLowerCase(option));
+ return getOptions().contains(StringUtils.lowerCase(option));
}
/**
@@ -2678,7 +2678,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
if (logFile != null && logFile.isFile()) {
final String logFileCanonicalPath =
IOUtils.tryGetCanonicalPathElseGetAbsolutePath(logFile);
- if (!StringUtils.isBlank(logFileCanonicalPath)) {
+ if (StringUtils.isNotBlank(logFileCanonicalPath)) {
return logFileCanonicalPath;
}
}
@@ -2696,7 +2696,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
if (csList != null && !csList.isEmpty()) {
final CacheServer cs = csList.get(0);
final String serverBindAddressAsString = cs.getBindAddress();
- if (!StringUtils.isBlank(serverBindAddressAsString)) {
+ if (StringUtils.isNotBlank(serverBindAddressAsString)) {
return serverBindAddressAsString;
}
}
@@ -2714,13 +2714,13 @@ public class ServerLauncher extends AbstractLauncher<String> {
if (csList != null && !csList.isEmpty()) {
final CacheServer cs = csList.get(0);
final String portAsString = String.valueOf(cs.getPort());
- if (!StringUtils.isBlank(portAsString)) {
+ if (StringUtils.isNotBlank(portAsString)) {
return portAsString;
}
}
}
- return (launcher.isDisableDefaultServer() ? StringUtils.EMPTY_STRING
+ return (launcher.isDisableDefaultServer() ? StringUtils.EMPTY
: launcher.getServerPortAsString());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterConfigurationService.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterConfigurationService.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterConfigurationService.java
index 10623b4..d990015 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterConfigurationService.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterConfigurationService.java
@@ -14,41 +14,14 @@
*/
package org.apache.geode.distributed.internal;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.nio.file.Path;
-import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.stream.Collectors;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactoryConfigurationError;
+import static org.apache.geode.distributed.ConfigurationProperties.CLUSTER_CONFIGURATION_DIR;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_POST_PROCESSOR;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.filefilter.DirectoryFileFilter;
-import org.apache.logging.log4j.Logger;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.CancelException;
import org.apache.geode.cache.AttributesFactory;
import org.apache.geode.cache.CacheLoaderException;
@@ -69,7 +42,6 @@ import org.apache.geode.internal.cache.persistence.PersistentMemberID;
import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
import org.apache.geode.internal.cache.xmlcache.CacheXmlGenerator;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.management.internal.cli.CliUtil;
import org.apache.geode.management.internal.configuration.callbacks.ConfigurationChangeListener;
@@ -81,6 +53,34 @@ import org.apache.geode.management.internal.configuration.messages.Configuration
import org.apache.geode.management.internal.configuration.messages.ConfigurationResponse;
import org.apache.geode.management.internal.configuration.messages.SharedConfigurationStatusResponse;
import org.apache.geode.management.internal.configuration.utils.XmlUtils;
+import org.apache.logging.log4j.Logger;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.file.Path;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactoryConfigurationError;
@SuppressWarnings({"deprecation", "unchecked"})
public class ClusterConfigurationService {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
index ad5e04d..6500385 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
@@ -14,26 +14,11 @@
*/
package org.apache.geode.distributed.internal;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.ConnectException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.logging.log4j.Logger;
+import static org.apache.geode.distributed.ConfigurationProperties.BIND_ADDRESS;
+import static org.apache.geode.distributed.ConfigurationProperties.CACHE_XML_FILE;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.CancelException;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.GemFireCache;
@@ -69,7 +54,6 @@ import org.apache.geode.internal.logging.LoggingThreadGroup;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.logging.log4j.LogWriterAppenders;
-import org.apache.geode.internal.logging.log4j.LogWriterLogger;
import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.net.SocketCreatorFactory;
import org.apache.geode.management.internal.JmxManagerLocator;
@@ -81,6 +65,22 @@ import org.apache.geode.management.internal.configuration.handlers.SharedConfigu
import org.apache.geode.management.internal.configuration.messages.ConfigurationRequest;
import org.apache.geode.management.internal.configuration.messages.SharedConfigurationStatusRequest;
import org.apache.geode.management.internal.configuration.messages.SharedConfigurationStatusResponse;
+import org.apache.logging.log4j.Logger;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.ConnectException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
/**
* Provides the implementation of a distribution {@code Locator} as well as internal-only
@@ -675,7 +675,7 @@ public class InternalLocator extends Locator implements ConnectListener {
// this.logger.config("ensuring that this locator is in the locators list");
boolean setLocatorsProp = false;
String locatorsProp = this.config.getLocators();
- if (locatorsProp != null && !locatorsProp.trim().isEmpty()) {
+ if (StringUtils.isNotBlank(locatorsProp)) {
if (!locatorsProp.contains(thisLocator)) {
locatorsProp = locatorsProp + ',' + thisLocator;
setLocatorsProp = true;
@@ -756,7 +756,7 @@ public class InternalLocator extends Locator implements ConnectListener {
*
* @since GemFire 5.7
*/
- void endStartLocator(InternalDistributedSystem distributedSystem) throws UnknownHostException {
+ void endStartLocator(InternalDistributedSystem distributedSystem) {
this.env = null;
if (distributedSystem == null) {
distributedSystem = InternalDistributedSystem.getConnectedInstance();
@@ -1262,7 +1262,7 @@ public class InternalLocator extends Locator implements ConnectListener {
public Object processRequest(Object request) throws IOException {
long giveup = 0;
while (giveup == 0 || System.currentTimeMillis() < giveup) {
- TcpHandler handler = null;
+ TcpHandler handler;
if (request instanceof PeerLocatorRequest) {
handler = this.handlerMapping.get(PeerLocatorRequest.class);
} else {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
index 9dc7fe2..478c4e8 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
@@ -14,33 +14,20 @@
*/
package org.apache.geode.distributed.internal.membership.gms.membership;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.apache.geode.distributed.internal.membership.gms.ServiceConfig.*;
-import static org.apache.geode.internal.DataSerializableFixedID.*;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TimerTask;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.logging.log4j.Logger;
-
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.START_LOCATOR;
+import static org.apache.geode.distributed.internal.membership.gms.ServiceConfig.MEMBER_REQUEST_COLLECTION_INTERVAL;
+import static org.apache.geode.internal.DataSerializableFixedID.FIND_COORDINATOR_REQ;
+import static org.apache.geode.internal.DataSerializableFixedID.FIND_COORDINATOR_RESP;
+import static org.apache.geode.internal.DataSerializableFixedID.INSTALL_VIEW_MESSAGE;
+import static org.apache.geode.internal.DataSerializableFixedID.JOIN_REQUEST;
+import static org.apache.geode.internal.DataSerializableFixedID.JOIN_RESPONSE;
+import static org.apache.geode.internal.DataSerializableFixedID.LEAVE_REQUEST_MESSAGE;
+import static org.apache.geode.internal.DataSerializableFixedID.NETWORK_PARTITION_MESSAGE;
+import static org.apache.geode.internal.DataSerializableFixedID.REMOVE_MEMBER_REQUEST;
+import static org.apache.geode.internal.DataSerializableFixedID.VIEW_ACK_MESSAGE;
+
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.GemFireConfigException;
import org.apache.geode.SystemConnectException;
import org.apache.geode.distributed.DistributedMember;
@@ -72,6 +59,28 @@ import org.apache.geode.internal.Version;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.security.AuthenticationRequiredException;
import org.apache.geode.security.GemFireSecurityException;
+import org.apache.logging.log4j.Logger;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TimerTask;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
/**
* GMSJoinLeave handles membership communication with other processes in the distributed system. It
@@ -1627,8 +1636,8 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
this.services = s;
DistributionConfig dc = services.getConfig().getDistributionConfig();
- if (dc.getMcastPort() != 0 && dc.getLocators().trim().isEmpty()
- && dc.getStartLocator().trim().isEmpty()) {
+ if (dc.getMcastPort() != 0 && StringUtils.isBlank(dc.getLocators())
+ && StringUtils.isBlank(dc.getStartLocator())) {
throw new GemFireConfigException("Multicast cannot be configured for a non-distributed cache."
+ " Please configure the locator services for this cache using " + LOCATORS + " or "
+ START_LOCATOR + ".");
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
index 78b2944..019c35c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
@@ -14,56 +14,7 @@
*/
package org.apache.geode.internal;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.EOFException;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.NotSerializableException;
-import java.io.ObjectInput;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamClass;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.io.UTFDataFormatException;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Proxy;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.InetAddress;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.IdentityHashMap;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Stack;
-import java.util.TreeMap;
-import java.util.TreeSet;
-import java.util.UUID;
-import java.util.Vector;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.logging.log4j.Logger;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.CancelException;
import org.apache.geode.CanonicalInstantiator;
import org.apache.geode.DataSerializable;
@@ -115,6 +66,55 @@ import org.apache.geode.pdx.internal.PdxReaderImpl;
import org.apache.geode.pdx.internal.PdxType;
import org.apache.geode.pdx.internal.PdxWriterImpl;
import org.apache.geode.pdx.internal.TypeRegistry;
+import org.apache.logging.log4j.Logger;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.EOFException;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.NotSerializableException;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.io.UTFDataFormatException;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Proxy;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.InetAddress;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
+import java.util.Stack;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.UUID;
+import java.util.Vector;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
/**
* Contains static methods for data serializing instances of internal GemFire classes. It also
@@ -879,8 +879,8 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
// send it to cache servers if it is a client
sendRegistrationMessageToServers(s);
}
- // send it to all cache clients irelevent of distribute
- // bridge servers send it all the clients irelevent of
+ // send it to all cache clients irrelevant of distribute
+ // bridge servers send it all the clients irrelevant of
// originator VM
sendRegistrationMessageToClients(s);
@@ -918,7 +918,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
private static void register(String className, boolean distribute,
SerializerAttributesHolder holder) {
- if (className == null || className.trim().isEmpty()) {
+ if (StringUtils.isBlank(className)) {
throw new IllegalArgumentException("Class name cannot be null or empty.");
}
@@ -1062,9 +1062,9 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
if (o instanceof DataSerializer) {
DataSerializer s = (DataSerializer) o;
Class[] classes = s.getSupportedClasses();
- for (int i = 0; i < classes.length; i++) {
- classesToSerializers.remove(classes[i].getName(), s);
- supportedClassesToHolders.remove(classes[i].getName());
+ for (Class aClass : classes) {
+ classesToSerializers.remove(aClass.getName(), s);
+ supportedClassesToHolders.remove(aClass.getName());
}
dsClassesToHolders.remove(s.getClass().getName());
idsToHolders.remove(idx);
@@ -1185,7 +1185,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
SerializerAttributesHolder holder = entry.getValue();
try {
Class cl = getCachedClass(name);
- DataSerializer ds = null;
+ DataSerializer ds;
if (holder.getEventId() != null) {
ds = register(cl, false, holder.getEventId(), holder.getProxyId());
} else {
@@ -1404,13 +1404,13 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
try {
invokeToData(o, out);
- } catch (IOException io) {
+ } catch (IOException | CancelException | ToDataException | GemFireRethrowable io) {
// Note: this is not a user code toData but one from our
// internal code since only GemFire product code implements DSFID
- throw io;
- } catch (CancelException | ToDataException | GemFireRethrowable ex) {
+
// Serializing a PDX can result in a cache closed exception. Just rethrow
- throw ex;
+
+ throw io;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// If this ever returns, rethrow the error. We're poisoned
@@ -1726,7 +1726,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
final int size = readArrayLength(in);
if (size >= 0) {
for (int index = 0; index < size; ++index) {
- E element = DataSerializer.<E>readObject(in);
+ E element = DataSerializer.readObject(in);
c.add(element);
}
@@ -2582,7 +2582,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
}
- public static int readDSFIDHeader(final DataInput in) throws IOException, ClassNotFoundException {
+ public static int readDSFIDHeader(final DataInput in) throws IOException {
checkIn(in);
byte header = in.readByte();
if (header == DS_FIXED_ID_BYTE) {
@@ -2666,11 +2666,11 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
throws IOException, ClassNotFoundException {
boolean wouldReadSerialized = PdxInstanceImpl.getPdxReadSerialized();
if (!wouldReadSerialized) {
- return DataSerializer.<T>readObject(in);
+ return DataSerializer.readObject(in);
} else {
PdxInstanceImpl.setPdxReadSerialized(false);
try {
- return DataSerializer.<T>readObject(in);
+ return DataSerializer.readObject(in);
} finally {
PdxInstanceImpl.setPdxReadSerialized(true);
}
@@ -2878,7 +2878,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
private static Object readUserDataSerializable(final DataInput in, int classId)
- throws IOException, ClassNotFoundException {
+ throws IOException {
Instantiator instantiator = InternalInstantiator.getInstantiator(classId);
if (instantiator == null) {
logger.error(LogMarker.SERIALIZER,
@@ -3698,7 +3698,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
synchronized (cacheAccessLock) {
Class<?> cachedClass = getExistingCachedClass(className);
if (cachedClass == null) {
- classCache.put(className, new WeakReference<Class<?>>(result));
+ classCache.put(className, new WeakReference<>(result));
} else {
result = cachedClass;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteTransportConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteTransportConfig.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteTransportConfig.java
index af3cb5d..1dc2fd1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteTransportConfig.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteTransportConfig.java
@@ -14,7 +14,21 @@
*/
package org.apache.geode.internal.admin.remote;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.apache.geode.distributed.ConfigurationProperties.BIND_ADDRESS;
+import static org.apache.geode.distributed.ConfigurationProperties.DISABLE_AUTO_RECONNECT;
+import static org.apache.geode.distributed.ConfigurationProperties.DISABLE_TCP;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_ADDRESS;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.MEMBERSHIP_PORT_RANGE;
+import static org.apache.geode.distributed.ConfigurationProperties.TCP_PORT;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.internal.Assert;
+import org.apache.geode.internal.admin.SSLConfig;
+import org.apache.geode.internal.admin.TransportConfig;
+import org.apache.geode.internal.i18n.LocalizedStrings;
import java.util.Collection;
import java.util.Collections;
@@ -24,13 +38,6 @@ import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.Assert;
-import org.apache.geode.internal.admin.SSLConfig;
-import org.apache.geode.internal.admin.TransportConfig;
-import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.internal.lang.StringUtils;
-
/**
* Tranport config for RemoteGfManagerAgent.
*/
@@ -99,7 +106,7 @@ public class RemoteTransportConfig implements TransportConfig {
StringTokenizer stringTokenizer = new StringTokenizer(initialHosts, ",");
while (stringTokenizer.hasMoreTokens()) {
String locator = stringTokenizer.nextToken();
- if (!StringUtils.isEmpty(locator)) {
+ if (StringUtils.isNotEmpty(locator)) {
locators.add(new DistributionLocatorId(locator));
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
index 55e3542..37f2120 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
@@ -17,41 +17,40 @@ package org.apache.geode.internal.cache;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.Set;
-import java.util.stream.Stream;
-
import org.apache.commons.lang.ArrayUtils;
-import org.apache.geode.internal.ClassPathLoader;
-import org.apache.logging.log4j.Logger;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.UnmodifiableException;
import org.apache.geode.cache.Cache;
-import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.ClusterConfigurationService;
+import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.tcpserver.TcpClient;
+import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.internal.ConfigSource;
import org.apache.geode.internal.DeployedJar;
import org.apache.geode.internal.JarDeployer;
import org.apache.geode.internal.admin.remote.DistributionLocatorId;
import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.process.ClusterConfigurationNotAvailableException;
import org.apache.geode.management.internal.configuration.domain.Configuration;
import org.apache.geode.management.internal.configuration.messages.ConfigurationRequest;
import org.apache.geode.management.internal.configuration.messages.ConfigurationResponse;
+import org.apache.logging.log4j.Logger;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.Set;
+import java.util.stream.Stream;
public class ClusterConfigurationLoader {
@@ -121,7 +120,7 @@ public class ClusterConfigurationLoader {
requestedConfiguration.get(ClusterConfigurationService.CLUSTER_CONFIG);
if (clusterConfiguration != null) {
String cacheXmlContent = clusterConfiguration.getCacheXmlContent();
- if (!StringUtils.isBlank(cacheXmlContent)) {
+ if (StringUtils.isNotBlank(cacheXmlContent)) {
cacheXmlContentList.add(cacheXmlContent);
}
}
@@ -131,7 +130,7 @@ public class ClusterConfigurationLoader {
Configuration groupConfiguration = requestedConfiguration.get(group);
if (groupConfiguration != null) {
String cacheXmlContent = groupConfiguration.getCacheXmlContent();
- if (!StringUtils.isBlank(cacheXmlContent)) {
+ if (StringUtils.isNotBlank(cacheXmlContent)) {
cacheXmlContentList.add(cacheXmlContent);
}
}
@@ -230,7 +229,7 @@ public class ClusterConfigurationLoader {
String ipaddress = dlId.getBindAddress();
InetAddress locatorInetAddress = null;
- if (!StringUtils.isBlank(ipaddress)) {
+ if (StringUtils.isNotBlank(ipaddress)) {
locatorInetAddress = InetAddress.getByName(ipaddress);
} else {
locatorInetAddress = dlId.getHost();
@@ -265,7 +264,7 @@ public class ClusterConfigurationLoader {
private static List<String> getGroups(DistributionConfig config) {
String groupString = config.getGroups();
List<String> groups = new ArrayList<String>();
- if (!StringUtils.isBlank(groupString)) {
+ if (StringUtils.isNotBlank(groupString)) {
groups.addAll((Arrays.asList(groupString.split(","))));
}
return groups;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java
index 185fde7..69684a3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java
@@ -14,16 +14,8 @@
*/
package org.apache.geode.internal.cache;
-import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.*;
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.function.Function;
-
-import org.apache.logging.log4j.Logger;
+import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.ENTRY_EVENT_NEW_VALUE;
+import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.ENTRY_EVENT_OLD_VALUE;
import org.apache.geode.CopyHelper;
import org.apache.geode.DataSerializer;
@@ -83,6 +75,14 @@ import org.apache.geode.internal.offheap.annotations.Unretained;
import org.apache.geode.internal.util.ArrayUtils;
import org.apache.geode.internal.util.BlobHelper;
import org.apache.geode.pdx.internal.PeerTypeRegistration;
+import org.apache.logging.log4j.Logger;
+
+import java.io.ByteArrayInputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.function.Function;
/**
* Implementation of an entry event
[03/14] geode git commit: GEODE-1994: Overhaul of
internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherIntegrationTest.java
index 7bd7462..d3c1200 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherIntegrationTest.java
@@ -14,6 +14,12 @@
*/
package org.apache.geode.distributed;
+import static com.googlecode.catchexception.apis.BDDCatchException.caughtException;
+import static com.googlecode.catchexception.apis.BDDCatchException.when;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.BDDAssertions.then;
+
import org.apache.geode.distributed.ServerLauncher.Builder;
import org.apache.geode.distributed.ServerLauncher.Command;
import org.apache.geode.distributed.internal.DistributionConfig;
@@ -32,12 +38,6 @@ import java.io.FileWriter;
import java.net.InetAddress;
import java.util.Properties;
-import static com.googlecode.catchexception.apis.BDDCatchException.caughtException;
-import static com.googlecode.catchexception.apis.BDDCatchException.when;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.BDDAssertions.then;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
/**
* Integration tests for ServerLauncher class. These tests may require file system and/or network
* I/O.
@@ -157,7 +157,7 @@ public class ServerLauncherIntegrationTest {
gemfireProperties);
// when: starting with null MemberName
- ServerLauncher launcher = new Builder().setCommand(Command.START).setMemberName(null).build();
+ ServerLauncher launcher = new Builder().setCommand(Command.START).build();
// then: name in gemfire.properties file should be used for MemberName
assertThat(launcher).isNotNull();
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
index f5d6271..98f73d8 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
@@ -14,17 +14,24 @@
*/
package org.apache.geode.distributed;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.server.CacheServer;
import org.apache.geode.distributed.ServerLauncher.Builder;
import org.apache.geode.distributed.ServerLauncher.Command;
import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.support.DistributedSystemAdapter;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.test.junit.categories.FlakyTest;
import org.apache.geode.test.junit.categories.UnitTest;
-import edu.umd.cs.mtc.MultithreadedTestCase;
-import edu.umd.cs.mtc.TestFramework;
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.jmock.lib.concurrent.Synchroniser;
@@ -42,9 +49,8 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Collections;
import java.util.concurrent.atomic.AtomicBoolean;
-
-import static org.junit.Assert.*;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
+import edu.umd.cs.mtc.MultithreadedTestCase;
+import edu.umd.cs.mtc.TestFramework;
/**
* The ServerLauncherTest class is a test suite of unit tests testing the contract, functionality
@@ -77,6 +83,7 @@ public class ServerLauncherTest {
setThreadingPolicy(new Synchroniser());
}
};
+ DistributedSystem.removeSystem(InternalDistributedSystem.getConnectedInstance());
}
@After
@@ -162,8 +169,6 @@ public class ServerLauncherTest {
assertNull(builder.getMemberName());
assertSame(builder, builder.setMemberName("serverOne"));
assertEquals("serverOne", builder.getMemberName());
- assertSame(builder, builder.setMemberName(null));
- assertNull(builder.getMemberName());
}
@Test(expected = IllegalArgumentException.class)
@@ -190,6 +195,18 @@ public class ServerLauncherTest {
}
}
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMemberNameToNullString() {
+ try {
+ new Builder().setMemberName(null);
+ } catch (IllegalArgumentException expected) {
+ assertEquals(
+ LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE.toLocalizedString("Server"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
@Test
public void testSetAndGetPid() {
Builder builder = new Builder();
@@ -277,8 +294,6 @@ public class ServerLauncherTest {
assertNull(builder.getHostNameForClients());
assertSame(builder, builder.setHostNameForClients("Pegasus"));
assertEquals("Pegasus", builder.getHostNameForClients());
- assertSame(builder, builder.setHostNameForClients(null));
- assertNull(builder.getHostNameForClients());
}
@Test
@@ -498,8 +513,8 @@ public class ServerLauncherTest {
@Test
public void testBuildWithMemberNameSetInApiPropertiesOnStart() {
- ServerLauncher launcher = new Builder().setCommand(ServerLauncher.Command.START)
- .setMemberName(null).set(NAME, "serverABC").build();
+ ServerLauncher launcher =
+ new Builder().setCommand(ServerLauncher.Command.START).set(NAME, "serverABC").build();
assertNotNull(launcher);
assertEquals(ServerLauncher.Command.START, launcher.getCommand());
@@ -511,8 +526,7 @@ public class ServerLauncherTest {
public void testBuildWithMemberNameSetInSystemPropertiesOnStart() {
System.setProperty(DistributionConfig.GEMFIRE_PREFIX + NAME, "serverXYZ");
- ServerLauncher launcher =
- new Builder().setCommand(ServerLauncher.Command.START).setMemberName(null).build();
+ ServerLauncher launcher = new Builder().setCommand(ServerLauncher.Command.START).build();
assertNotNull(launcher);
assertEquals(ServerLauncher.Command.START, launcher.getCommand());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java
index 3ec3b06..cc83faa 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java
@@ -14,15 +14,17 @@
*/
package org.apache.geode.internal.lang;
-import static org.junit.Assert.*;
-
-import java.util.Calendar;
-import java.util.Date;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import org.apache.geode.test.junit.categories.UnitTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.apache.geode.test.junit.categories.UnitTest;
+import java.util.Calendar;
+import java.util.Date;
/**
* The ClassUtilsJUnitTest class is a test suite with test cases to test the contract and
@@ -61,8 +63,7 @@ public class ClassUtilsJUnitTest {
@Test(expected = IllegalArgumentException.class)
public void testForNameWithEmptyClassName() {
try {
- ClassUtils.forName(StringUtils.EMPTY_STRING,
- new IllegalArgumentException("Empty Class Name!"));
+ ClassUtils.forName(StringUtils.EMPTY, new IllegalArgumentException("Empty Class Name!"));
} catch (IllegalArgumentException expected) {
assertEquals("Empty Class Name!", expected.getMessage());
throw expected;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/internal/lang/StringUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/lang/StringUtilsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/lang/StringUtilsJUnitTest.java
index f3e0abe..503356a 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/lang/StringUtilsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/lang/StringUtilsJUnitTest.java
@@ -14,19 +14,20 @@
*/
package org.apache.geode.internal.lang;
-import static org.junit.Assert.*;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
import org.apache.geode.DataSerializer;
import org.apache.geode.internal.cache.CachedDeserializable;
import org.apache.geode.internal.cache.CachedDeserializableFactory;
import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
/**
* The StringUtilsJUnitTest is a test suite containing test cases for testing the contract and
@@ -42,55 +43,7 @@ import org.apache.geode.test.junit.categories.UnitTest;
@Category(UnitTest.class)
public class StringUtilsJUnitTest {
- @Test
- public void testConcat() {
- assertEquals("", StringUtils.concat((Object[]) null));
- assertEquals("", StringUtils.concat(""));
- assertEquals(" ", StringUtils.concat(" "));
- assertEquals(" ", StringUtils.concat(" "));
- assertEquals("123", StringUtils.concat("123"));
- assertEquals("1 2 3", StringUtils.concat("1 2 3"));
- assertEquals(" 1 2 3 ", StringUtils.concat(" 1 2 3 "));
- assertEquals("trueC13.14159test", StringUtils.concat(true, 'C', 1, 3.14159f, "test"));
- assertEquals("test testing tested", StringUtils.concat("test", " testing", " tested"));
- }
- @Test
- public void testConcatWithDelimiter() {
- assertEquals("", StringUtils.concat(null, null));
- assertEquals("", StringUtils.concat(null, " "));
- assertEquals("", StringUtils.concat(new Object[] {""}, " "));
- assertEquals(" ", StringUtils.concat(new Object[] {" "}, " "));
- assertEquals(" ", StringUtils.concat(new Object[] {" ", " ", " "}, " "));
- assertEquals(" | | ", StringUtils.concat(new Object[] {" ", " ", " "}, "|"));
- assertEquals("abc", StringUtils.concat(new Object[] {"a", "b", "c"}, null));
- assertEquals("abc", StringUtils.concat(new Object[] {"a", "b", "c"}, ""));
- assertEquals("a b c", StringUtils.concat(new Object[] {"a", "b", "c"}, " "));
- assertEquals("a b c", StringUtils.concat(new Object[] {"a", "b", "c"}, " "));
- assertEquals("a_b_c", StringUtils.concat(new Object[] {"a", "b", "c"}, "_"));
- assertEquals("a|b|c", StringUtils.concat(new Object[] {"a", "b", "c"}, "|"));
- assertEquals("a>b>c", StringUtils.concat(new Object[] {"a", "b", "c"}, ">"));
- assertEquals("a&b&c", StringUtils.concat(new Object[] {"a", "b", "c"}, "&"));
- assertEquals("*", StringUtils.concat(new Object[] {"*"}, "*"));
- assertEquals("***", StringUtils.concat(new Object[] {"*", "*"}, "*"));
- assertEquals("*-*", StringUtils.concat(new Object[] {"*", "*"}, "-"));
- }
-
- @Test
- public void testDefaultIfBlank() {
- assertNull(StringUtils.defaultIfBlank((String[]) null));
- assertNull(null, StringUtils.defaultIfBlank(null, ""));
- assertNull(null, StringUtils.defaultIfBlank(null, "", " "));
- assertNull(null, StringUtils.defaultIfBlank(null, "", " ", "\0"));
- assertEquals("test", StringUtils.defaultIfBlank("test", null, "", " "));
- assertEquals("test", StringUtils.defaultIfBlank(null, "", " ", "test"));
- assertEquals("test", StringUtils.defaultIfBlank(null, "", "test", " ", null));
- assertEquals("_", StringUtils.defaultIfBlank("_", null, "", " "));
- assertEquals("empty", StringUtils.defaultIfBlank(null, "", "empty", " "));
- assertEquals("blank", StringUtils.defaultIfBlank(null, "", " ", "blank"));
- assertEquals("null", StringUtils.defaultIfBlank("null", null, "", " "));
- assertEquals("null", StringUtils.defaultIfBlank("null", "empty", "blank"));
- }
@Test
public void testGetDigitsOnly() {
@@ -107,186 +60,7 @@ public class StringUtilsJUnitTest {
assertEquals("123456789", StringUtils.getDigitsOnly("123,456.789"));
}
- @Test
- public void testGetLettersOnly() {
- assertEquals("", StringUtils.getLettersOnly(null));
- assertEquals("", StringUtils.getLettersOnly(""));
- assertEquals("", StringUtils.getLettersOnly(" "));
- assertEquals("", StringUtils.getLettersOnly("123"));
- assertEquals("", StringUtils.getLettersOnly("123@$$!"));
- assertEquals("", StringUtils.getLettersOnly("!@$$%#*?"));
- assertEquals("", StringUtils.getLettersOnly("10101"));
- assertEquals("lll", StringUtils.getLettersOnly("l0l0l"));
- assertEquals("", StringUtils.getLettersOnly("007"));
- assertEquals("OO", StringUtils.getLettersOnly("OO7"));
- assertEquals("OOSeven", StringUtils.getLettersOnly("OOSeven"));
- }
-
- @Test
- public void testGetSpaces() {
- assertEquals("", StringUtils.getSpaces(0));
- assertEquals(" ", StringUtils.getSpaces(1));
- assertEquals(" ", StringUtils.getSpaces(2));
- assertEquals(" ", StringUtils.getSpaces(3));
- assertEquals(" ", StringUtils.getSpaces(4));
- assertEquals(" ", StringUtils.getSpaces(5));
- assertEquals(" ", StringUtils.getSpaces(6));
- assertEquals(" ", StringUtils.getSpaces(7));
- assertEquals(" ", StringUtils.getSpaces(8));
- assertEquals(" ", StringUtils.getSpaces(9));
- assertEquals(" ", StringUtils.getSpaces(10));
- assertEquals(" ", StringUtils.getSpaces(11));
- assertEquals(" ", StringUtils.getSpaces(12));
- assertEquals(" ", StringUtils.getSpaces(13));
- assertEquals(" ", StringUtils.getSpaces(14));
- assertEquals(" ", StringUtils.getSpaces(15));
- assertEquals(" ", StringUtils.getSpaces(16));
- assertEquals(" ", StringUtils.getSpaces(17));
- assertEquals(" ", StringUtils.getSpaces(18));
- assertEquals(" ", StringUtils.getSpaces(19));
- assertEquals(" ", StringUtils.getSpaces(20));
- assertEquals(" ", StringUtils.getSpaces(21));
- }
-
- @Test
- public void testIsBlank() {
- assertTrue(StringUtils.isBlank(null));
- assertTrue(StringUtils.isBlank(""));
- assertTrue(StringUtils.isBlank("\0"));
- assertTrue(StringUtils.isBlank(" "));
- assertTrue(StringUtils.isBlank(" "));
- }
-
- @Test
- public void testIsNotBlank() {
- assertFalse(StringUtils.isBlank("test"));
- assertFalse(StringUtils.isBlank("null"));
- assertFalse(StringUtils.isBlank("empty"));
- assertFalse(StringUtils.isBlank("_"));
- assertFalse(StringUtils.isBlank("____"));
- }
-
- @Test
- public void testIsEmpty() {
- assertTrue(StringUtils.isEmpty(""));
- }
-
- @Test
- public void testIsNotEmpty() {
- assertFalse(StringUtils.isEmpty("test"));
- assertFalse(StringUtils.isEmpty("null"));
- assertFalse(StringUtils.isEmpty("empty"));
- assertFalse(StringUtils.isEmpty(null));
- assertFalse(StringUtils.isEmpty(" "));
- assertFalse(StringUtils.isEmpty(" "));
- assertFalse(StringUtils.isEmpty("_"));
- assertFalse(StringUtils.isEmpty("___"));
- }
- @Test
- public void testPadEnding() {
- assertEquals("", StringUtils.padEnding("", 'X', 0));
- assertEquals(" ", StringUtils.padEnding(" ", 'X', 0));
- assertEquals(" ", StringUtils.padEnding(" ", 'X', 1));
- assertEquals(" ", StringUtils.padEnding(" ", 'X', 0));
- assertEquals(" ", StringUtils.padEnding(" ", 'X', 3));
- assertEquals("X", StringUtils.padEnding("", 'X', 1));
- assertEquals(" X", StringUtils.padEnding(" ", 'X', 2));
- assertEquals(" XX", StringUtils.padEnding(" ", 'X', 4));
- assertEquals("test", StringUtils.padEnding("test", 'X', 0));
- assertEquals("test", StringUtils.padEnding("test", 'X', 4));
- assertEquals("testX", StringUtils.padEnding("test", 'X', 5));
- assertEquals("testXXX", StringUtils.padEnding("test", 'X', 7));
- }
-
- @Test(expected = NullPointerException.class)
- public void testPadEndingWithNull() {
- try {
- StringUtils.padEnding(null, 'X', 10);
- } catch (NullPointerException expected) {
- assertEquals("The String value to pad cannot be null!", expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testToLowerCase() {
- assertNull(StringUtils.toLowerCase(null));
- assertEquals("null", StringUtils.toLowerCase("null"));
- assertEquals("null", StringUtils.toLowerCase("NULL"));
- assertEquals("", StringUtils.toLowerCase(""));
- assertEquals(" ", StringUtils.toLowerCase(" "));
- assertEquals("test", StringUtils.toLowerCase("TEST"));
- assertEquals("1", StringUtils.toLowerCase("1"));
- assertEquals("!", StringUtils.toLowerCase("!"));
- assertEquals("$00", StringUtils.toLowerCase("$00"));
- assertEquals("jon doe", StringUtils.toLowerCase("Jon Doe"));
- }
-
- @Test
- public void testToUpperCase() {
- assertNull(StringUtils.toUpperCase(null));
- assertEquals("NULL", StringUtils.toUpperCase("NULL"));
- assertEquals("NULL", StringUtils.toUpperCase("null"));
- assertEquals("", StringUtils.toUpperCase(""));
- assertEquals(" ", StringUtils.toUpperCase(" "));
- assertEquals("TEST", StringUtils.toUpperCase("test"));
- assertEquals("2", StringUtils.toUpperCase("2"));
- assertEquals("!", StringUtils.toUpperCase("!"));
- assertEquals("$00", StringUtils.toUpperCase("$00"));
- assertEquals("JON DOE", StringUtils.toUpperCase("Jon Doe"));
- }
-
- @Test
- public void testTrim() {
- assertNull(StringUtils.trim(null));
- assertEquals("", StringUtils.trim(""));
- assertEquals("", StringUtils.trim(" "));
- assertEquals("", StringUtils.trim(" "));
- assertEquals("null", StringUtils.trim("null"));
- assertEquals("test", StringUtils.trim(" test"));
- assertEquals("test", StringUtils.trim("test "));
- assertEquals("test", StringUtils.trim(" test "));
- assertEquals("a b c d", StringUtils.trim(" a b c d "));
- }
-
- @Test
- public void testTruncate() {
- assertEquals("", StringUtils.truncate("", 0));
- assertEquals("", StringUtils.truncate("", 1));
- assertEquals(" ", StringUtils.truncate(" ", 1));
- assertEquals(" ", StringUtils.truncate(" ", 5));
- assertEquals(" ", StringUtils.truncate(" ", 1));
- assertEquals("XX", StringUtils.truncate("XXX", 2));
- assertEquals("XX", StringUtils.truncate("XX", 4));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testTruncateWithNegativeLength() {
- try {
- StringUtils.truncate("XX", -1);
- } catch (IllegalArgumentException expected) {
- assertEquals("Length must be greater than equal to 0!", expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testValueOf() {
- assertEquals("null", StringUtils.valueOf(null));
- assertEquals("null", StringUtils.valueOf(null, (String[]) null));
- assertEquals("null", StringUtils.valueOf(null, new String[] {}));
- assertEquals("test", StringUtils.valueOf(null, "test"));
- assertEquals("nil", StringUtils.valueOf(null, "nil", "test"));
- assertEquals("test", StringUtils.valueOf("test", (String[]) null));
- assertEquals("null", StringUtils.valueOf("null", "test"));
- assertEquals("nil", StringUtils.valueOf("nil", "mock", "test"));
- assertEquals("", StringUtils.valueOf("", "test", "mock", "null"));
- assertEquals(" ", StringUtils.valueOf(" ", "test", "mock", "nil"));
- assertEquals("true", StringUtils.valueOf(true, "test", "nil", null));
- assertEquals("1", StringUtils.valueOf(1, "one"));
- assertEquals(String.valueOf(Math.PI), StringUtils.valueOf(Math.PI, "314159"));
- }
@Test
public void testWrap() {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/internal/util/CollectionUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/util/CollectionUtilsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/util/CollectionUtilsJUnitTest.java
index 36be8b8..c760597 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/util/CollectionUtilsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/util/CollectionUtilsJUnitTest.java
@@ -14,7 +14,19 @@
*/
package org.apache.geode.internal.util;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
import java.util.ArrayList;
import java.util.Arrays;
@@ -26,18 +38,11 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Vector;
import java.util.Map.Entry;
+import java.util.NoSuchElementException;
import java.util.Properties;
import java.util.Set;
-
-import org.apache.geode.internal.lang.Filter;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.test.junit.categories.UnitTest;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import java.util.Vector;
/**
* The CollectionUtilsJUnitTest class is a test suite of test cases testing the contract and
@@ -105,7 +110,7 @@ public class CollectionUtilsJUnitTest {
@Test
public void testCreateMultipleProperties() {
- Map<String, String> map = new HashMap<String, String>(3);
+ Map<String, String> map = new HashMap<>(3);
map.put("one", "A");
map.put("two", "B");
@@ -141,7 +146,7 @@ public class CollectionUtilsJUnitTest {
@Test
public void testEmptyListWithEmptyList() {
- final List<Object> expectedList = new ArrayList<Object>(0);
+ final List<Object> expectedList = new ArrayList<>(0);
assertNotNull(expectedList);
assertTrue(expectedList.isEmpty());
@@ -174,7 +179,7 @@ public class CollectionUtilsJUnitTest {
@Test
public void testEmptySetWithEmptySet() {
- final Set<Object> expectedSet = new HashSet<Object>(0);
+ final Set<Object> expectedSet = new HashSet<>(0);
assertNotNull(expectedSet);
assertTrue(expectedSet.isEmpty());
@@ -187,7 +192,7 @@ public class CollectionUtilsJUnitTest {
@Test
public void testEmptySetWithSet() {
final Set<String> expectedSet =
- new HashSet<String>(Arrays.asList("aardvark", "baboon", "cat", "dog", "ferret"));
+ new HashSet<>(Arrays.asList("aardvark", "baboon", "cat", "dog", "ferret"));
assertNotNull(expectedSet);
assertFalse(expectedSet.isEmpty());
@@ -201,12 +206,8 @@ public class CollectionUtilsJUnitTest {
public void testFindAll() {
final List<Integer> numbers = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9);
- final List<Integer> matches = CollectionUtils.findAll(numbers, new Filter<Integer>() {
- // accept all even numbers
- public boolean accept(final Integer number) {
- return (number % 2 == 0);
- }
- });
+ // accept all even numbers
+ final List<Integer> matches = CollectionUtils.findAll(numbers, number -> (number % 2 == 0));
assertNotNull(matches);
assertFalse(matches.isEmpty());
@@ -217,12 +218,8 @@ public class CollectionUtilsJUnitTest {
public void testFindAllWhenMultipleElementsMatch() {
final List<Integer> numbers = Arrays.asList(0, 1, 2, 1, 4, 1, 6, 1, 7, 1, 9);
- final List<Integer> matches = CollectionUtils.findAll(numbers, new Filter<Integer>() {
- // accept 1
- public boolean accept(final Integer number) {
- return (number == 1);
- }
- });
+ // accept 1
+ final List<Integer> matches = CollectionUtils.findAll(numbers, number -> (number == 1));
assertNotNull(matches);
assertEquals(5, matches.size());
@@ -233,12 +230,8 @@ public class CollectionUtilsJUnitTest {
public void testFindAllWhenNoElementsMatch() {
final List<Integer> numbers = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- final List<Integer> matches = CollectionUtils.findAll(numbers, new Filter<Integer>() {
- // accept negative numbers
- public boolean accept(final Integer number) {
- return (number < 0);
- }
- });
+ // accept negative numbers
+ final List<Integer> matches = CollectionUtils.findAll(numbers, number -> (number < 0));
assertNotNull(matches);
assertTrue(matches.isEmpty());
@@ -248,12 +241,8 @@ public class CollectionUtilsJUnitTest {
public void testFindBy() {
final List<Integer> numbers = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9);
- final Integer match = CollectionUtils.findBy(numbers, new Filter<Integer>() {
- // accept 2
- public boolean accept(final Integer number) {
- return (number == 2);
- }
- });
+ // accept 2
+ final Integer match = CollectionUtils.findBy(numbers, number -> (number == 2));
assertNotNull(match);
assertEquals(2, match.intValue());
@@ -263,12 +252,8 @@ public class CollectionUtilsJUnitTest {
public void testFindByWhenMultipleElementsMatch() {
final List<Integer> numbers = Arrays.asList(0, 1, 2, 1, 4, 1, 6, 1, 7, 1, 9);
- final Integer match = CollectionUtils.findBy(numbers, new Filter<Integer>() {
- // accept 1
- public boolean accept(final Integer number) {
- return (number == 1);
- }
- });
+ // accept 1
+ final Integer match = CollectionUtils.findBy(numbers, number -> (number == 1));
assertNotNull(match);
assertEquals(1, match.intValue());
@@ -278,19 +263,15 @@ public class CollectionUtilsJUnitTest {
public void testFindByWhenNoElementsMatch() {
final List<Integer> numbers = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9);
- final Integer match = CollectionUtils.findBy(numbers, new Filter<Integer>() {
- // accept 10
- public boolean accept(final Integer number) {
- return (number == 10);
- }
- });
+ // accept 10
+ final Integer match = CollectionUtils.findBy(numbers, number -> (number == 10));
assertNull(match);
}
@Test
public void testRemoveKeys() {
- final Map<Object, String> expectedMap = new HashMap<Object, String>(6);
+ final Map<Object, String> expectedMap = new HashMap<>(6);
expectedMap.put("key1", "value");
expectedMap.put("key2", "null");
@@ -303,12 +284,7 @@ public class CollectionUtilsJUnitTest {
assertEquals(6, expectedMap.size());
final Map<Object, String> actualMap =
- CollectionUtils.removeKeys(expectedMap, new Filter<Map.Entry<Object, String>>() {
- @Override
- public boolean accept(final Map.Entry<Object, String> entry) {
- return !StringUtils.isBlank(entry.getValue());
- }
- });
+ CollectionUtils.removeKeys(expectedMap, entry -> StringUtils.isNotBlank(entry.getValue()));
assertSame(expectedMap, actualMap);
assertFalse(actualMap.isEmpty());
@@ -318,7 +294,7 @@ public class CollectionUtilsJUnitTest {
@Test
public void testRemoveKeysWithNullValues() {
- final Map<Object, Object> expectedMap = new HashMap<Object, Object>(3);
+ final Map<Object, Object> expectedMap = new HashMap<>(3);
expectedMap.put("one", "test");
expectedMap.put("two", null);
@@ -350,7 +326,7 @@ public class CollectionUtilsJUnitTest {
@Test
public void testRemoveKeysWithNullValuesFromMapWithNoNullValues() {
- final Map<String, Object> map = new HashMap<String, Object>(5);
+ final Map<String, Object> map = new HashMap<>(5);
map.put("one", "test");
map.put("null", "null");
@@ -430,7 +406,7 @@ public class CollectionUtilsJUnitTest {
list.add("one");
list.add("two");
- boolean modified = CollectionUtils.addAll(list, (Enumeration<String>) null);
+ boolean modified = CollectionUtils.addAll(list, null);
assertTrue(!modified);
assertEquals(2, list.size());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupportJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupportJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupportJUnitTest.java
index 91a59f8..7fedb9f 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupportJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupportJUnitTest.java
@@ -14,21 +14,12 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import static org.junit.Assert.*;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Collections;
-import java.util.Set;
-
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.lib.concurrent.Synchroniser;
-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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
import org.apache.geode.cache.execute.Function;
import org.apache.geode.cache.execute.FunctionService;
@@ -41,6 +32,19 @@ import org.apache.geode.management.cli.CliMetaData;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.MemberNotFoundException;
import org.apache.geode.test.junit.categories.UnitTest;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.lib.concurrent.Synchroniser;
+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 java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Collections;
+import java.util.Set;
/**
* The AbstractCommandsSupportJUnitTest class is a test suite of test cases testing the contract and
@@ -140,9 +144,9 @@ public class AbstractCommandsSupportJUnitTest {
@Test
public void testConvertDefaultValue() {
- assertNull(AbstractCommandsSupport.convertDefaultValue(null, StringUtils.EMPTY_STRING));
- assertEquals(StringUtils.EMPTY_STRING,
- AbstractCommandsSupport.convertDefaultValue(StringUtils.EMPTY_STRING, "test"));
+ assertNull(AbstractCommandsSupport.convertDefaultValue(null, StringUtils.EMPTY));
+ assertEquals(StringUtils.EMPTY,
+ AbstractCommandsSupport.convertDefaultValue(StringUtils.EMPTY, "test"));
assertEquals(StringUtils.SPACE,
AbstractCommandsSupport.convertDefaultValue(StringUtils.SPACE, "testing"));
assertEquals("tested", AbstractCommandsSupport
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandDUnitTest.java
index 8bf1c43..5ff0a67 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandDUnitTest.java
@@ -14,14 +14,27 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import org.apache.geode.cache.*;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.apache.geode.test.dunit.Assert.assertEquals;
+import static org.apache.geode.test.dunit.Assert.assertNotNull;
+import static org.apache.geode.test.dunit.Assert.assertSame;
+import static org.apache.geode.test.dunit.Assert.assertTrue;
+import static org.apache.geode.test.dunit.LogWriterUtils.getDUnitLogLevel;
+import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionFactory;
+import org.apache.geode.cache.Scope;
import org.apache.geode.cache.query.Index;
import org.apache.geode.cache.query.IndexStatistics;
import org.apache.geode.cache.query.IndexType;
import org.apache.geode.cache.query.SelectResults;
import org.apache.geode.internal.lang.MutableIdentifiable;
import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.cli.Result;
import org.apache.geode.management.internal.cli.domain.IndexDetails;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
@@ -34,15 +47,17 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.io.Serializable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Random;
+import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
-import static org.apache.geode.test.dunit.Assert.*;
-import static org.apache.geode.test.dunit.LogWriterUtils.getDUnitLogLevel;
-import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
/**
* The ListIndexCommandDUnitTest class is distributed test suite of test cases for testing the
* index-based GemFire shell (Gfsh) commands.
@@ -57,7 +72,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
private static final int DEFAULT_REGION_INITIAL_CAPACITY = 10000;
- private final AtomicLong idGenerator = new AtomicLong(0l);
+ private final AtomicLong idGenerator = new AtomicLong(0L);
@Override
public final void postSetUpCliCommandTestBase() throws Exception {
@@ -186,7 +201,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
final Random random = new Random(System.currentTimeMillis());
int count = 0;
- final List<Proxy> proxies = new ArrayList<Proxy>();
+ final List<Proxy> proxies = new ArrayList<>();
Consumer consumer;
Proxy proxy;
@@ -232,7 +247,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
final Random random = new Random(System.currentTimeMillis());
int count = 0;
- final List<Proxy> proxies = new ArrayList<Proxy>();
+ final List<Proxy> proxies = new ArrayList<>();
Producer producer;
Proxy proxy;
@@ -322,7 +337,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
private final Properties distributedSystemProperties;
- private final Set<RegionDefinition> regions = new HashSet<RegionDefinition>();
+ private final Set<RegionDefinition> regions = new HashSet<>();
private final VM vm;
@@ -471,14 +486,14 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
private final Class<?> keyConstraint;
private final Class<?> valueConstraint;
- private final Set<Index> indexes = new HashSet<Index>();
+ private final Set<Index> indexes = new HashSet<>();
private final String regionName;
@SuppressWarnings("unchecked")
protected RegionDefinition(final String regionName, final Class<?> keyConstraint,
final Class<?> valueConstraint) {
- assert !StringUtils.isBlank(regionName) : "The name of the Region must be specified!";
+ assert StringUtils.isNotBlank(regionName) : "The name of the Region must be specified!";
this.regionName = regionName;
this.keyConstraint = ObjectUtils.defaultIfNull(keyConstraint, Object.class);
this.valueConstraint = ObjectUtils.defaultIfNull(valueConstraint, Object.class);
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
index fc920c4..cea77fa 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
@@ -21,14 +21,13 @@ import static java.util.stream.Collectors.toSet;
import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE_SIZE_LIMIT;
import static org.assertj.core.api.Assertions.assertThat;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.Cache;
import org.apache.geode.distributed.internal.ClusterConfigurationService;
import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.internal.DeployedJar;
-import org.apache.geode.internal.JarDeployer;
import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.configuration.domain.Configuration;
import org.apache.geode.test.dunit.rules.Locator;
import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
@@ -41,7 +40,6 @@ import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -93,7 +91,7 @@ public class ClusterConfig implements Serializable {
Set<String> expectedGroupConfigs =
this.getGroups().stream().map(ConfigGroup::getName).collect(toSet());
- // verify info exists in memeory
+ // verify info exists in memory
locatorVM.invoke(() -> {
InternalLocator internalLocator = LocatorServerStartupRule.locatorStarter.getLocator();
ClusterConfigurationService sc = internalLocator.getSharedConfiguration();
@@ -107,8 +105,8 @@ public class ClusterConfig implements Serializable {
Configuration config = sc.getConfiguration(configGroup.name);
assertThat(config.getJarNames()).isEqualTo(configGroup.getJars());
- // verify proeprty is as expected
- if (!StringUtils.isBlank(configGroup.getMaxLogFileSize())) {
+ // verify property is as expected
+ if (StringUtils.isNotBlank(configGroup.getMaxLogFileSize())) {
Properties props = config.getGemfireProperties();
assertThat(props.getProperty(LOG_FILE_SIZE_LIMIT))
.isEqualTo(configGroup.getMaxLogFileSize());
@@ -135,7 +133,7 @@ public class ClusterConfig implements Serializable {
}
}
- public void verifyServer(MemberVM<Server> serverVM) throws ClassNotFoundException {
+ public void verifyServer(MemberVM<Server> serverVM) {
// verify files exist in filesystem
Set<String> expectedJarNames = this.getJarNames().stream().collect(toSet());
@@ -156,7 +154,7 @@ public class ClusterConfig implements Serializable {
assertThat(cache.getRegion(region)).isNotNull();
}
- if (!StringUtils.isBlank(this.getMaxLogFileSize())) {
+ if (StringUtils.isNotBlank(this.getMaxLogFileSize())) {
Properties props = cache.getDistributedSystem().getProperties();
assertThat(props.getProperty(LOG_FILE_SIZE_LIMIT)).isEqualTo(this.getMaxLogFileSize());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
index 19a1662..bc709db 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
@@ -17,7 +17,7 @@ package org.apache.geode.test.dunit.rules;
import static org.apache.geode.test.dunit.IgnoredException.addIgnoredException;
import static org.assertj.core.api.Assertions.assertThat;
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.management.cli.Result;
import org.apache.geode.management.internal.cli.CliUtil;
import org.apache.geode.management.internal.cli.HeadlessGfsh;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
index b2be12a..033fedc 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.cache.lucene.internal.cli;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.execute.Execution;
@@ -28,7 +29,6 @@ import org.apache.geode.cache.lucene.internal.cli.functions.LuceneSearchIndexFun
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.execute.AbstractExecution;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.security.IntegratedSecurityService;
import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.management.cli.CliMetaData;
@@ -82,11 +82,10 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
@CliCommand(value = LuceneCliStrings.LUCENE_LIST_INDEX,
help = LuceneCliStrings.LUCENE_LIST_INDEX__HELP)
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
public Result listIndex(@CliOption(key = LuceneCliStrings.LUCENE_LIST_INDEX__STATS,
- mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false",
+ specifiedDefaultValue = "true", unspecifiedDefaultValue = "false",
help = LuceneCliStrings.LUCENE_LIST_INDEX__STATS__HELP) final boolean stats) {
try {
@@ -120,7 +119,7 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
List<LuceneIndexDetails> sortedResults =
results.stream().flatMap(set -> set.stream()).sorted().collect(Collectors.toList());
- LinkedHashSet<LuceneIndexDetails> uniqResults = new LinkedHashSet<LuceneIndexDetails>();
+ LinkedHashSet<LuceneIndexDetails> uniqResults = new LinkedHashSet<>();
uniqResults.addAll(sortedResults);
sortedResults.clear();
sortedResults.addAll(uniqResults);
@@ -137,10 +136,9 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
indexData.accumulate("Server Name", indexDetails.getServerName());
indexData.accumulate("Indexed Fields", indexDetails.getSearchableFieldNamesString());
indexData.accumulate("Field Analyzer", indexDetails.getFieldAnalyzersString());
- indexData.accumulate("Status",
- indexDetails.getInitialized() == true ? "Initialized" : "Defined");
+ indexData.accumulate("Status", indexDetails.getInitialized() ? "Initialized" : "Defined");
- if (stats == true) {
+ if (stats) {
if (!indexDetails.getInitialized()) {
indexData.accumulate("Query Executions", "NA");
indexData.accumulate("Updates", "NA");
@@ -164,8 +162,7 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
@CliCommand(value = LuceneCliStrings.LUCENE_CREATE_INDEX,
help = LuceneCliStrings.LUCENE_CREATE_INDEX__HELP)
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
// TODO : Add optionContext for indexName
public Result createIndex(@CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME, mandatory = true,
help = LuceneCliStrings.LUCENE_CREATE_INDEX__NAME__HELP) final String indexName,
@@ -177,11 +174,10 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
@CliOption(key = LuceneCliStrings.LUCENE_CREATE_INDEX__FIELD, mandatory = true,
help = LuceneCliStrings.LUCENE_CREATE_INDEX__FIELD_HELP) final String[] fields,
- @CliOption(key = LuceneCliStrings.LUCENE_CREATE_INDEX__ANALYZER, mandatory = false,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
+ @CliOption(key = LuceneCliStrings.LUCENE_CREATE_INDEX__ANALYZER,
help = LuceneCliStrings.LUCENE_CREATE_INDEX__ANALYZER_HELP) final String[] analyzers) {
- Result result = null;
+ Result result;
XmlEntity xmlEntity = null;
this.securityService.authorizeRegionManage(regionPath);
@@ -222,8 +218,7 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
@CliCommand(value = LuceneCliStrings.LUCENE_DESCRIBE_INDEX,
help = LuceneCliStrings.LUCENE_DESCRIBE_INDEX__HELP)
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
public Result describeIndex(
@CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME, mandatory = true,
@@ -262,8 +257,7 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
@CliCommand(value = LuceneCliStrings.LUCENE_SEARCH_INDEX,
help = LuceneCliStrings.LUCENE_SEARCH_INDEX__HELP)
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
@ResourceOperation(resource = Resource.DATA, operation = Operation.WRITE)
public Result searchIndex(@CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME, mandatory = true,
help = LuceneCliStrings.LUCENE_SEARCH_INDEX__NAME__HELP) final String indexName,
@@ -278,15 +272,14 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
@CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__DEFAULT_FIELD, mandatory = true,
help = LuceneCliStrings.LUCENE_SEARCH_INDEX__DEFAULT_FIELD__HELP) final String defaultField,
- @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__LIMIT, mandatory = false,
- unspecifiedDefaultValue = "-1",
+ @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__LIMIT, unspecifiedDefaultValue = "-1",
help = LuceneCliStrings.LUCENE_SEARCH_INDEX__LIMIT__HELP) final int limit,
- @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__PAGE_SIZE, mandatory = false,
+ @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__PAGE_SIZE,
unspecifiedDefaultValue = "-1",
help = LuceneCliStrings.LUCENE_SEARCH_INDEX__PAGE_SIZE__HELP) int pageSize,
- @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__KEYSONLY, mandatory = false,
+ @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__KEYSONLY,
unspecifiedDefaultValue = "false",
help = LuceneCliStrings.LUCENE_SEARCH_INDEX__KEYSONLY__HELP) boolean keysOnly) {
try {
@@ -315,11 +308,9 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
@CliCommand(value = LuceneCliStrings.LUCENE_DESTROY_INDEX,
help = LuceneCliStrings.LUCENE_DESTROY_INDEX__HELP)
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
- public Result destroyIndex(
- @CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME, mandatory = false,
- help = LuceneCliStrings.LUCENE_DESTROY_INDEX__NAME__HELP) final String indexName,
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
+ public Result destroyIndex(@CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME,
+ help = LuceneCliStrings.LUCENE_DESTROY_INDEX__NAME__HELP) final String indexName,
@CliOption(key = LuceneCliStrings.LUCENE__REGION_PATH, mandatory = true,
optionContext = ConverterHint.REGION_PATH,
@@ -329,7 +320,7 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
CliStrings.format(LuceneCliStrings.LUCENE_DESTROY_INDEX__MSG__REGION_CANNOT_BE_EMPTY));
}
- if (StringUtils.isEmpty(indexName)) {
+ if (indexName != null && StringUtils.isEmpty(indexName)) {
return ResultBuilder.createInfoResult(
CliStrings.format(LuceneCliStrings.LUCENE_DESTROY_INDEX__MSG__INDEX_CANNOT_BE_EMPTY));
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java
index f7edd8f..a5ec7d5 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java
@@ -15,6 +15,7 @@
package org.apache.geode.cache.lucene.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.execute.FunctionAdapter;
@@ -26,12 +27,10 @@ import org.apache.geode.cache.lucene.internal.cli.LuceneCliStrings;
import org.apache.geode.cache.lucene.internal.cli.LuceneIndexDetails;
import org.apache.geode.cache.lucene.internal.cli.LuceneIndexInfo;
import org.apache.geode.internal.InternalEntity;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.CliUtil;
import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.configuration.domain.XmlEntity;
-
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
index d4dca4a..143e99d 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
@@ -14,32 +14,18 @@
*/
package org.apache.geode.cache.lucene.internal.cli;
-import static org.junit.Assert.*;
+import static junit.framework.TestCase.assertSame;
+import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.anyString;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.eq;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junitparams.JUnitParamsRunner;
-import junitparams.Parameters;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.core.KeywordAnalyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import org.apache.geode.cache.execute.Execution;
import org.apache.geode.cache.execute.ResultCollector;
@@ -60,6 +46,25 @@ import org.apache.geode.management.internal.cli.result.ResultBuilder;
import org.apache.geode.management.internal.cli.result.TabularResultData;
import org.apache.geode.management.internal.cli.shell.Gfsh;
import org.apache.geode.test.junit.categories.UnitTest;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.core.KeywordAnalyzer;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
/**
* The LuceneIndexCommandsJUnitTest class is a test suite of test cases testing the contract and
@@ -409,7 +414,7 @@ public class LuceneIndexCommandsJUnitTest {
final ResultCollector mockResultCollector = mock(ResultCollector.class);
final List<CliFunctionResult> cliFunctionResults = new ArrayList<>();
- String expectedStatus = null;
+ String expectedStatus;
if (expectedToSucceed) {
expectedStatus = CliStrings.format(
LuceneCliStrings.LUCENE_DESTROY_INDEX__MSG__SUCCESSFULLY_DESTROYED_INDEX_0_FROM_REGION_1,
@@ -446,7 +451,7 @@ public class LuceneIndexCommandsJUnitTest {
final ResultCollector mockResultCollector = mock(ResultCollector.class);
final List<CliFunctionResult> cliFunctionResults = new ArrayList<>();
- String expectedStatus = null;
+ String expectedStatus;
if (expectedToSucceed) {
expectedStatus = CliStrings.format(
LuceneCliStrings.LUCENE_DESTROY_INDEX__MSG__SUCCESSFULLY_DESTROYED_INDEX_0_FROM_REGION_1,
@@ -478,7 +483,7 @@ public class LuceneIndexCommandsJUnitTest {
final ResultCollector mockResultCollector = mock(ResultCollector.class);
final List<CliFunctionResult> cliFunctionResults = new ArrayList<>();
- String expectedStatus = null;
+ String expectedStatus;
if (expectedToSucceed) {
expectedStatus = CliStrings.format(
LuceneCliStrings.LUCENE_DESTROY_INDEX__MSG__SUCCESSFULLY_DESTROYED_INDEXES_FROM_REGION_0,
@@ -515,7 +520,7 @@ public class LuceneIndexCommandsJUnitTest {
final ResultCollector mockResultCollector = mock(ResultCollector.class);
final List<CliFunctionResult> cliFunctionResults = new ArrayList<>();
- String expectedStatus = null;
+ String expectedStatus;
if (expectedToSucceed) {
expectedStatus = CliStrings.format(
LuceneCliStrings.LUCENE_DESTROY_INDEX__MSG__SUCCESSFULLY_DESTROYED_INDEXES_FROM_REGION_0,
@@ -564,8 +569,8 @@ public class LuceneIndexCommandsJUnitTest {
}
// Verify each status
List<String> status = data.retrieveAllValues("Status");
- for (int i = 0; i < status.size(); i++) {
- assertEquals(expectedStatus, status.get(i));
+ for (String statu : status) {
+ assertEquals(expectedStatus, statu);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-pulse/src/test/java/org/apache/geode/tools/pulse/testbed/PropMockDataUpdater.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/test/java/org/apache/geode/tools/pulse/testbed/PropMockDataUpdater.java b/geode-pulse/src/test/java/org/apache/geode/tools/pulse/testbed/PropMockDataUpdater.java
index 6ee5b53..7ce9c46 100644
--- a/geode-pulse/src/test/java/org/apache/geode/tools/pulse/testbed/PropMockDataUpdater.java
+++ b/geode-pulse/src/test/java/org/apache/geode/tools/pulse/testbed/PropMockDataUpdater.java
@@ -34,7 +34,6 @@ import org.apache.geode.tools.pulse.testbed.GemFireDistributedSystem.Server;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -57,7 +56,7 @@ public class PropMockDataUpdater implements IClusterUpdater {
private Cluster cluster = null;
private TestBed testbed;
- private final String testbedFile = System.getProperty("pulse.propMockDataUpdaterFile");;
+ private final String testbedFile = System.getProperty("pulse.propMockDataUpdaterFile");
private final ObjectMapper mapper = new ObjectMapper();
@@ -65,14 +64,12 @@ public class PropMockDataUpdater implements IClusterUpdater {
this.cluster = cluster;
try {
loadPropertiesFile();
- } catch (FileNotFoundException e) {
- throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
- private void loadPropertiesFile() throws FileNotFoundException, IOException {
+ private void loadPropertiesFile() throws IOException {
this.testbed = new TestBed(testbedFile, true);
}
@@ -161,8 +158,8 @@ public class PropMockDataUpdater implements IClusterUpdater {
}
for (Entry<String, Member> memberSet : membersHMap.entrySet()) {
- HashMap<String, Cluster.Region> memberRegions = new HashMap<String, Cluster.Region>();
- HashMap<String, Cluster.Client> memberClientsHM = new HashMap<String, Cluster.Client>();
+ HashMap<String, Cluster.Region> memberRegions = new HashMap<>();
+ HashMap<String, Cluster.Client> memberClientsHM = new HashMap<>();
Random randomGenerator = new Random();
@@ -277,10 +274,6 @@ public class PropMockDataUpdater implements IClusterUpdater {
memberRegion.setWanEnabled(false);
}
memberRegion.setWanEnabled(true);
- /*
- * memberRegion.setSystemRegionEntryCount(Long.valueOf(String.valueOf(Math
- * .abs(randomGenerator.nextInt(100)))));
- */
memberRegion.getMemberName().add(memName);
memberRegion.setMemberCount(memberCount);
return memberRegion;
@@ -369,7 +362,7 @@ public class PropMockDataUpdater implements IClusterUpdater {
if (memberArrList != null) {
memberArrList.add(m);
} else {
- ArrayList<Cluster.Member> memberList = new ArrayList<Cluster.Member>();
+ ArrayList<Cluster.Member> memberList = new ArrayList<>();
memberList.add(m);
physicalToMember.put(m.getHost(), memberList);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-spark-connector/geode-functions/src/main/java/org/apache/geode/spark/connector/internal/geodefunctions/RetrieveRegionFunction.java
----------------------------------------------------------------------
diff --git a/geode-spark-connector/geode-functions/src/main/java/org/apache/geode/spark/connector/internal/geodefunctions/RetrieveRegionFunction.java b/geode-spark-connector/geode-functions/src/main/java/org/apache/geode/spark/connector/internal/geodefunctions/RetrieveRegionFunction.java
index 096e4d5..7407cc8 100644
--- a/geode-spark-connector/geode-functions/src/main/java/org/apache/geode/spark/connector/internal/geodefunctions/RetrieveRegionFunction.java
+++ b/geode-spark-connector/geode-functions/src/main/java/org/apache/geode/spark/connector/internal/geodefunctions/RetrieveRegionFunction.java
@@ -16,25 +16,24 @@
*/
package org.apache.geode.spark.connector.internal.geodefunctions;
-import java.util.Iterator;
-import org.apache.logging.log4j.Logger;
-
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.execute.FunctionException;
+import org.apache.geode.cache.partition.PartitionRegionHelper;
import org.apache.geode.cache.query.Query;
import org.apache.geode.cache.query.QueryService;
import org.apache.geode.cache.query.SelectResults;
import org.apache.geode.cache.query.Struct;
-import org.apache.geode.internal.cache.*;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionContext;
-import org.apache.geode.cache.partition.PartitionRegionHelper;
import org.apache.geode.internal.cache.execute.InternalRegionFunctionContext;
import org.apache.geode.internal.cache.execute.InternalResultSender;
import org.apache.geode.internal.cache.partitioned.PREntriesIterator;
import org.apache.geode.internal.logging.LogService;
+import org.apache.logging.log4j.Logger;
+
+import java.util.Iterator;
/**
* GemFire function that is used by `SparkContext.geodeRegion(regionPath, whereClause)`
@@ -85,10 +84,11 @@ public class RetrieveRegionFunction implements Function {
InternalRegionFunctionContext irfc = (InternalRegionFunctionContext) context;
LocalRegion localRegion = (LocalRegion) irfc.getDataSet();
boolean partitioned = localRegion.getDataPolicy().withPartitioning();
- if (where.trim().isEmpty())
+ if (StringUtils.isBlank(where)) {
retrieveFullRegion(irfc, partitioned, taskDesc);
- else
+ } else {
retrieveRegionWithWhereClause(irfc, localRegion, partitioned, where, taskDesc);
+ }
}
/** ------------------------------------------ */
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-web/src/test/java/org/apache/geode/management/internal/web/AbstractWebTestCase.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/AbstractWebTestCase.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/AbstractWebTestCase.java
index eac0b8d..73be12a 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/web/AbstractWebTestCase.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/AbstractWebTestCase.java
@@ -14,6 +14,9 @@
*/
package org.apache.geode.management.internal.web;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.management.internal.web.domain.Link;
+
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -22,9 +25,6 @@ import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.management.internal.web.domain.Link;
-
/**
* The AbstractWebDomainTests class is abstract base class containing functionality common to a test
* suite classes in the org.apache.geode.management.internal.web.domain package.
@@ -48,7 +48,7 @@ public abstract class AbstractWebTestCase {
assert values != null : "The Values for the Map cannot be null!";
assert keys.length == values.length;
- final Map<K, V> map = new HashMap<K, V>(keys.length);
+ final Map<K, V> map = new HashMap<>(keys.length);
int index = 0;
for (final K key : keys) {
@@ -59,11 +59,11 @@ public abstract class AbstractWebTestCase {
}
protected String decode(final String encodedValue) throws UnsupportedEncodingException {
- return URLDecoder.decode(encodedValue, StringUtils.UTF_8);
+ return URLDecoder.decode(encodedValue, "UTF-8");
}
protected String encode(final String value) throws UnsupportedEncodingException {
- return URLEncoder.encode(value, StringUtils.UTF_8);
+ return URLEncoder.encode(value, "UTF-8");
}
protected String toString(final Link... links) throws UnsupportedEncodingException {
@@ -71,7 +71,7 @@ public abstract class AbstractWebTestCase {
int count = 0;
for (final Link link : links) {
- buffer.append(count++ > 0 ? ", " : StringUtils.EMPTY_STRING).append(toString(link));
+ buffer.append(count++ > 0 ? ", " : StringUtils.EMPTY).append(toString(link));
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java
index 37ec508..10e26f6 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java
@@ -14,17 +14,18 @@
*/
package org.apache.geode.management.internal.web.controllers;
-import static org.junit.Assert.*;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.servlet.http.HttpServletRequest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.management.cli.CliMetaData;
+import org.apache.geode.management.internal.cli.util.ClasspathScanLoadHelper;
+import org.apache.geode.management.internal.web.domain.Link;
+import org.apache.geode.management.internal.web.domain.LinkIndex;
+import org.apache.geode.management.internal.web.util.UriUtils;
+import org.apache.geode.test.junit.categories.UnitTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -37,12 +38,14 @@ import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
-import org.apache.geode.management.cli.CliMetaData;
-import org.apache.geode.management.internal.cli.util.ClasspathScanLoadHelper;
-import org.apache.geode.management.internal.web.domain.Link;
-import org.apache.geode.management.internal.web.domain.LinkIndex;
-import org.apache.geode.management.internal.web.util.UriUtils;
-import org.apache.geode.test.junit.categories.UnitTest;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.servlet.http.HttpServletRequest;
/**
* The ShellCommandsControllerJUnitTest class is a test suite of test cases testing the contract and
@@ -123,8 +126,7 @@ public class ShellCommandsControllerJUnitTest {
String[] requestParameters = requestMappingAnnotation.params();
if (requestParameters.length > 0) {
- webServiceEndpoint += "?".concat(
- org.apache.geode.internal.lang.StringUtils.concat(requestParameters, "&"));
+ webServiceEndpoint += "?".concat(StringUtils.join(requestParameters, "&"));
}
controllerWebServiceEndpoints.add(webServiceEndpoint);
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java
index c69013b..2bebd2e 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java
@@ -21,7 +21,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.management.internal.cli.CommandRequest;
import org.apache.geode.management.internal.web.AbstractWebTestCase;
import org.apache.geode.management.internal.web.domain.Link;
@@ -112,7 +112,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
private CommandRequest createCommandRequest(final String command,
final Map<String, String> options) {
- return new TestCommandRequest(command, options, Collections.<String, String>emptyMap(), null);
+ return new TestCommandRequest(command, options, Collections.emptyMap(), null);
}
private CommandRequest createCommandRequest(final String command,
@@ -122,8 +122,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
private CommandRequest createCommandRequest(final String command,
final Map<String, String> options, final byte[][] fileData) {
- return new TestCommandRequest(command, options, Collections.<String, String>emptyMap(),
- fileData);
+ return new TestCommandRequest(command, options, Collections.emptyMap(), fileData);
}
private CommandRequest createCommandRequest(final String command,
@@ -145,12 +144,12 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
@Test
public void testCreateHttpRequest() {
- final Map<String, String> commandOptions = new HashMap<String, String>();
+ final Map<String, String> commandOptions = new HashMap<>();
commandOptions.put("author", "Adams");
commandOptions.put("blankOption", " ");
commandOptions.put("category", "sci-fi");
- commandOptions.put("emptyOption", StringUtils.EMPTY_STRING);
+ commandOptions.put("emptyOption", StringUtils.EMPTY);
commandOptions.put("isbn", "0-123456789");
commandOptions.put("nullOption", null);
commandOptions.put("title", "Hitch Hiker's Guide to the Galaxy");
@@ -182,12 +181,12 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
@Test
public void testCreateHttpRequestWithEnvironmentVariables() {
- final Map<String, String> commandOptions = new HashMap<String, String>(2);
+ final Map<String, String> commandOptions = new HashMap<>(2);
commandOptions.put("name", "ElLibreDeCongress");
commandOptions.put("isbn", "${ISBN}");
- final Map<String, String> environment = new HashMap<String, String>(2);
+ final Map<String, String> environment = new HashMap<>(2);
environment.put("ISBN", "0-987654321");
environment.put("VAR", "test");
@@ -209,7 +208,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
}
@Test
- public void testCreatHttpRequestWithFileData() {
+ public void testCreateHttpRequestWithFileData() {
final Map<String, String> commandOptions = Collections.singletonMap("isbn", "0-123456789");
final byte[][] fileData = {"/path/to/book/content.txt".getBytes(),
@@ -238,7 +237,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
@Test
public void testFindAndResolveLink() throws Exception {
- final Map<String, String> commandOptions = new HashMap<String, String>();
+ final Map<String, String> commandOptions = new HashMap<>();
commandOptions.put("name", "BarnesN'Noble");
@@ -253,7 +252,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
assertNotNull(link);
assertEquals("http://host.domain.com/service/v1/libraries/{name}", toString(link.getHref()));
- commandOptions.put("author", "J.K.Rowlings");
+ commandOptions.put("author", "J.K.Rowling");
link = getOperationInvoker().findLink(createCommandRequest("list-books", commandOptions));
@@ -323,8 +322,8 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
}
};
- final Object actualResult = operationInvoker.processCommand(
- createCommandRequest("list-libraries", Collections.<String, String>emptyMap()));
+ final Object actualResult = operationInvoker
+ .processCommand(createCommandRequest("list-libraries", Collections.emptyMap()));
assertEquals(expectedResult, actualResult);
}
@@ -353,8 +352,8 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
protected void printWarning(final String message, final Object... args) {}
};
- final Object actualResult = operationInvoker.processCommand(
- createCommandRequest("get resource", Collections.<String, String>emptyMap()));
+ final Object actualResult = operationInvoker
+ .processCommand(createCommandRequest("get resource", Collections.emptyMap()));
assertEquals(expectedResult, actualResult);
}
@@ -391,8 +390,8 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
+ "Please try reconnecting or see the GemFire Manager's log file for further details.",
operationInvoker.getBaseUrl(), "test");
- final Object actualResult = operationInvoker.processCommand(
- createCommandRequest("list-libraries", Collections.<String, String>emptyMap()));
+ final Object actualResult = operationInvoker
+ .processCommand(createCommandRequest("list-libraries", Collections.emptyMap()));
assertFalse(operationInvoker.isConnected());
assertEquals(expectedResult, actualResult);
@@ -413,8 +412,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
};
try {
- operationInvoker.processCommand(
- createCommandRequest("get resource", Collections.<String, String>emptyMap()));
+ operationInvoker.processCommand(createCommandRequest("get resource", Collections.emptyMap()));
} catch (RestApiCallForCommandNotFoundException e) {
assertEquals("No REST API call for command (get resource) was found!", e.getMessage());
throw e;
@@ -425,7 +423,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
public void testProcessCommandWhenNotConnected() {
try {
getOperationInvoker()
- .processCommand(createCommandRequest("get-book", Collections.<String, String>emptyMap()));
+ .processCommand(createCommandRequest("get-book", Collections.emptyMap()));
} catch (IllegalStateException e) {
assertEquals(
"Gfsh must be connected to the GemFire Manager in order to process commands remotely!",
@@ -436,7 +434,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
private static class TestCommandRequest extends CommandRequest {
- private final Map<String, String> commandParameters = new TreeMap<String, String>();
+ private final Map<String, String> commandParameters = new TreeMap<>();
private final String command;
[09/14] geode git commit: GEODE-2929: remove superfluous final from
methods
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/LogWriterAppenderJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/LogWriterAppenderJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/LogWriterAppenderJUnitTest.java
index dbdebea..5a81b6e 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/LogWriterAppenderJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/LogWriterAppenderJUnitTest.java
@@ -65,7 +65,7 @@ public class LogWriterAppenderJUnitTest {
* when the configuration is changed the appender is still there.
*/
@Test
- public final void testAppenderToConfigHandling() throws IOException {
+ public void testAppenderToConfigHandling() throws IOException {
LogService.setBaseLogLevel(Level.TRACE);
final AppenderContext rootContext = LogService.getAppenderContext();
@@ -110,7 +110,7 @@ public class LogWriterAppenderJUnitTest {
* Verifies that writing to a Log4j logger will end up in the LogWriter's output.
*/
@Test
- public final void testLogOutput() throws IOException {
+ public void testLogOutput() throws IOException {
// Create the appender
final StringWriter stringWriter = new StringWriter();
final PureLogWriter logWriter =
@@ -178,7 +178,7 @@ public class LogWriterAppenderJUnitTest {
* Verifies that logging occurs at the levels set in the LogWriter
*/
@Test
- public final void testLogWriterLevels() throws IOException {
+ public void testLogWriterLevels() throws IOException {
final String loggerName = LogService.MAIN_LOGGER_NAME; // this.getClass().getName();
LogService.getLogger(); // Force logging to be initialized
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWriterTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWriterTest.java b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWriterTest.java
new file mode 100644
index 0000000..84dc959
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWriterTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.statistics;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class StatArchiveWriterTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ StatArchiveWriter mockStatArchiveWriter = mock(StatArchiveWriter.class);
+
+ when(mockStatArchiveWriter.bytesWritten()).thenReturn(1L);
+
+ mockStatArchiveWriter.close();
+
+ verify(mockStatArchiveWriter, times(1)).close();
+
+ assertThat(mockStatArchiveWriter.bytesWritten()).isEqualTo(1L);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionTest.java b/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionTest.java
new file mode 100644
index 0000000..ca141b4
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.tcp;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.nio.ByteBuffer;
+import java.nio.channels.SocketChannel;
+
+@Category(UnitTest.class)
+public class ConnectionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ Connection mockConnection = mock(Connection.class);
+ SocketChannel channel = null;
+ ByteBuffer buffer = null;
+ boolean forceAsync = true;
+ DistributionMessage mockDistributionMessage = mock(DistributionMessage.class);
+
+ mockConnection.nioWriteFully(channel, buffer, forceAsync, mockDistributionMessage);
+
+ verify(mockConnection, times(1)).nioWriteFully(channel, buffer, forceAsync,
+ mockDistributionMessage);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaFromTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaFromTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaFromTest.java
new file mode 100644
index 0000000..2c23ddc
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaFromTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.management.internal.OpenTypeConverter.CompositeBuilderViaFrom;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import javax.management.openmbean.CompositeData;
+
+@Category(UnitTest.class)
+public class CompositeBuilderViaFromTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ CompositeBuilderViaFrom mockCompositeBuilderViaFrom = mock(CompositeBuilderViaFrom.class);
+ CompositeData compositeData = null;
+ String[] itemNames = new String[1];
+ OpenTypeConverter[] converters = new OpenTypeConverter[1];
+ Object result = new Object();
+
+ when(mockCompositeBuilderViaFrom.fromCompositeData(eq(compositeData), eq(itemNames),
+ eq(converters))).thenReturn(result);
+
+ assertThat(mockCompositeBuilderViaFrom.fromCompositeData(compositeData, itemNames, converters))
+ .isSameAs(result);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaProxyTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaProxyTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaProxyTest.java
new file mode 100644
index 0000000..8fea2b6
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaProxyTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.management.internal.OpenTypeConverter.CompositeBuilderViaProxy;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import javax.management.openmbean.CompositeData;
+
+@Category(UnitTest.class)
+public class CompositeBuilderViaProxyTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ CompositeBuilderViaProxy mockCompositeBuilderViaProxy = mock(CompositeBuilderViaProxy.class);
+ CompositeData compositeData = null;
+ String[] itemNames = new String[1];
+ OpenTypeConverter[] converters = new OpenTypeConverter[1];
+ Object result = new Object();
+
+ when(mockCompositeBuilderViaProxy.fromCompositeData(eq(compositeData), eq(itemNames),
+ eq(converters))).thenReturn(result);
+
+ assertThat(mockCompositeBuilderViaProxy.fromCompositeData(compositeData, itemNames, converters))
+ .isSameAs(result);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/management/internal/IdentityConverterTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/IdentityConverterTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/IdentityConverterTest.java
new file mode 100644
index 0000000..2dea75b
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/IdentityConverterTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class IdentityConverterTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ IdentityConverter mockIdentityConverter = mock(IdentityConverter.class);
+ Object value = new Object();
+ Object result = new Object();
+
+ when(mockIdentityConverter.toNonNullOpenValue(value)).thenReturn(result);
+ assertThat(mockIdentityConverter.toNonNullOpenValue(value)).isSameAs(result);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CliCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CliCommandTestBase.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CliCommandTestBase.java
index f624ab4..b582e52 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CliCommandTestBase.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CliCommandTestBase.java
@@ -197,7 +197,7 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
/**
* Destroy all of the components created for the default setup.
*/
- protected final void destroyDefaultSetup() {
+ protected void destroyDefaultSetup() {
if (this.shell != null) {
executeCommand(shell, "exit");
this.shell.terminate();
@@ -276,7 +276,7 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
*
* @return The default shell
*/
- protected synchronized final HeadlessGfsh getDefaultShell() {
+ protected synchronized HeadlessGfsh getDefaultShell() {
if (this.shell == null) {
this.shell = createShell();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandsDUnitTest.java
index 760d2c4..edec00a 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandsDUnitTest.java
@@ -554,7 +554,7 @@ public class ConfigCommandsDUnitTest extends CliCommandTestBase {
});
}
- private final void deleteTestFiles() throws IOException {
+ private void deleteTestFiles() throws IOException {
this.managerConfigFile.delete();
this.managerPropsFile.delete();
this.vm1ConfigFile.delete();
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportedLogsSizeInfoTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportedLogsSizeInfoTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportedLogsSizeInfoTest.java
index 77a2453..0bfbefa 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportedLogsSizeInfoTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportedLogsSizeInfoTest.java
@@ -17,8 +17,6 @@ package org.apache.geode.management.internal.cli.functions;
import static org.assertj.core.api.Assertions.*;
import org.apache.geode.test.junit.categories.UnitTest;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -30,18 +28,9 @@ import java.io.DataOutputStream;
@Category(UnitTest.class)
public class ExportedLogsSizeInfoTest {
- @Before
- public void setUp() throws Exception {
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
@Test
- public final void testExportedLogsSizeInfoConstructor() {
+ public void testExportedLogsSizeInfoConstructor() {
ExportedLogsSizeInfo sizeDetail = new ExportedLogsSizeInfo(1L, 11L, 111L);
assertThat(sizeDetail).isNotNull();
assertThat(sizeDetail.getLogsSize()).isEqualTo(1L);
@@ -50,7 +39,7 @@ public class ExportedLogsSizeInfoTest {
}
@Test
- public final void testExportedLogsSizeInfoZeroArgConstructor() {
+ public void testExportedLogsSizeInfoZeroArgConstructor() {
ExportedLogsSizeInfo sizeDetail = new ExportedLogsSizeInfo();
assertThat(sizeDetail).isNotNull();
assertThat(sizeDetail.getLogsSize()).isEqualTo(0L);
@@ -99,7 +88,7 @@ public class ExportedLogsSizeInfoTest {
}
@Test
- public final void testClassInequality() {
+ public void testClassInequality() {
ExportedLogsSizeInfo sizeDeatai1 = new ExportedLogsSizeInfo(7L, 77L, 777L);
String sizeDetail2 = sizeDeatai1.toString();
assertThat(sizeDeatai1.equals(sizeDetail2)).isFalse();
@@ -119,7 +108,6 @@ public class ExportedLogsSizeInfoTest {
assertThat(sizeDetail1.hashCode()).isEqualTo(29791);
assertThat(sizeDetail2.hashCode()).isEqualTo(41095);
assertThat(sizeDetail3.hashCode()).isEqualTo(115495);
-
}
@Test
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ShowMissingDiskStoresFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ShowMissingDiskStoresFunctionJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ShowMissingDiskStoresFunctionJUnitTest.java
index ba436c5..0bd0ee9 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ShowMissingDiskStoresFunctionJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ShowMissingDiskStoresFunctionJUnitTest.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.management.internal.cli.functions;
import static org.junit.Assert.*;
@@ -63,6 +62,7 @@ import org.apache.geode.test.junit.categories.UnitTest;
@Category(UnitTest.class)
public class ShowMissingDiskStoresFunctionJUnitTest {
+
private GemFireCacheImpl cache;
private GemFireCacheImpl oldCacheInstance;
private InternalDistributedSystem system;
@@ -81,9 +81,6 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
- /**
- * @throws java.lang.Exception
- */
@Before
public void setUp() throws Exception {
cache = Fakes.cache();
@@ -100,9 +97,6 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
memberManager = mock(PersistentMemberManager.class);
}
- /**
- * @throws java.lang.Exception
- */
@After
public void tearDown() throws Exception {
GemFireCacheImpl.setInstanceForTests(oldCacheInstance);
@@ -122,21 +116,14 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
}
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#getCache()}.
- */
@Test
- public final void testGetCache() {
+ public void testGetCache() {
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
assertTrue(smdsFunc.getCache() instanceof Cache);
}
- /**
- * Test method for {@link ShowMissingDiskStoresFunction#execute(FunctionContext)}.
- */
@Test
- public final void testExecute() {
+ public void testExecute() {
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
List<?> results = null;
@@ -152,12 +139,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
assertNotNull(results);
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
- */
@Test
- public final void testExecuteWithNullContextThrowsRuntimeException() {
+ public void testExecuteWithNullContextThrowsRuntimeException() {
expectedException.expect(RuntimeException.class);
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
@@ -170,7 +153,7 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
* {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
*/
@Test
- public final void testExecuteWithNullCacheInstanceHasEmptyResults() throws Throwable {
+ public void testExecuteWithNullCacheInstanceHasEmptyResults() throws Throwable {
TestSMDSFFunc1 testSMDSFunc = new TestSMDSFFunc1();
List<?> results = null;
@@ -181,12 +164,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
assertNull(results.get(0));
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
- */
@Test
- public final void testExecuteWithNullGFCIResultValueIsNull() throws Throwable {
+ public void testExecuteWithNullGFCIResultValueIsNull() throws Throwable {
TestSMDSFFunc2 testSMDSFunc = new TestSMDSFFunc2();
List<?> results = null;
@@ -200,12 +179,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
assertNull(results.get(0));
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
- */
@Test
- public final void testExecuteWhenGFCIClosedResultValueIsNull() throws Throwable {
+ public void testExecuteWhenGFCIClosedResultValueIsNull() throws Throwable {
TestSMDSFFunc2 testSMDSFunc = new TestSMDSFFunc2();
List<?> results = null;
@@ -216,14 +191,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
assertNotNull(results);
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
- *
- * @throws UnknownHostException
- */
@Test
- public final void testExecuteReturnsMissingDiskStores() throws Throwable {
+ public void testExecuteReturnsMissingDiskStores() throws Throwable {
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
List<?> results = null;
@@ -261,12 +230,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
}
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
- */
@Test
- public final void testExecuteReturnsMissingColocatedRegions() throws Throwable {
+ public void testExecuteReturnsMissingColocatedRegions() throws Throwable {
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
List<?> results = null;
@@ -300,14 +265,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
}
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
- *
- * @throws UnknownHostException
- */
@Test
- public final void testExecuteReturnsMissingStoresAndRegions() throws Throwable {
+ public void testExecuteReturnsMissingStoresAndRegions() throws Throwable {
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
List<?> results = null;
@@ -372,14 +331,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
}
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
- *
- * @throws Throwable
- */
@Test
- public final void testExecuteCatchesExceptions() throws Throwable {
+ public void testExecuteCatchesExceptions() throws Exception {
expectedException.expect(RuntimeException.class);
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
@@ -391,13 +344,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
fail("Failed to catch expected RuntimeException");
}
-
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#getId()}.
- */
@Test
- public final void testGetId() {
+ public void testGetId() {
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
assertEquals(ShowMissingDiskStoresFunction.class.getName(), smdsFunc.getId());
}
@@ -406,9 +354,9 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
private final List<Object> results = new LinkedList<Object>();
- private Throwable t;
+ private Exception t;
- protected List<Object> getResults() throws Throwable {
+ protected List<Object> getResults() throws Exception {
if (t != null) {
throw t;
}
@@ -427,7 +375,7 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
@Override
public void sendException(final Throwable t) {
- this.t = t;
+ this.t = (Exception) t;
}
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/management/internal/cli/json/TypedJsonTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/json/TypedJsonTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/json/TypedJsonTest.java
new file mode 100644
index 0000000..c894594
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/json/TypedJsonTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.json;
+
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.Writer;
+
+@Category(UnitTest.class)
+public class TypedJsonTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ TypedJson mockTypedJson = mock(TypedJson.class);
+ Writer writer = null;
+ Object value = new Object();
+
+ mockTypedJson.writeVal(writer, value);
+
+ verify(mockTypedJson, times(1)).writeVal(writer, value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/web/controllers/WanCommandsControllerJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
index 2731b95..8ee3e0f 100755
--- a/geode-core/src/test/java/org/apache/geode/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
@@ -117,7 +117,7 @@ public class WanCommandsControllerJUnitTest {
.contains("--" + START_GATEWAYSENDER__ID + "=" + "");
}
- private static final Object[] getParametersWithGroupsAndMembers() {
+ private static Object[] getParametersWithGroupsAndMembers() {
return $(new Object[] {"sender1", new String[] {}, new String[] {}, false, false},
new Object[] {"sender2", new String[] {"group1"}, new String[] {}, true, false},
new Object[] {"sender3", new String[] {"group1", "group2"}, new String[] {}, true, false},
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/management/internal/web/domain/LinkTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/web/domain/LinkTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/web/domain/LinkTest.java
new file mode 100644
index 0000000..ff98b7e
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/web/domain/LinkTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.web.domain;
+
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.net.URI;
+
+import org.apache.geode.management.internal.web.http.HttpMethod;
+
+@Category(UnitTest.class)
+public class LinkTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ Link mockLink = mock(Link.class);
+ URI href = null;
+ HttpMethod method = HttpMethod.CONNECT;
+ String relation = "";
+
+ mockLink.setHref(href);
+ mockLink.setMethod(method);
+ mockLink.setRelation(relation);
+
+ verify(mockLink, times(1)).setHref(href);
+ verify(mockLink, times(1)).setMethod(method);
+ verify(mockLink, times(1)).setRelation(relation);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/management/internal/web/http/ClientHttpRequestTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/web/http/ClientHttpRequestTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/web/http/ClientHttpRequestTest.java
new file mode 100644
index 0000000..4a5a0d4
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/web/http/ClientHttpRequestTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.web.http;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.management.internal.web.domain.Link;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class ClientHttpRequestTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ ClientHttpRequest mockClientHttpRequest = mock(ClientHttpRequest.class);
+ Link mockLink = mock(Link.class);
+
+ when(mockClientHttpRequest.getLink()).thenReturn(mockLink);
+
+ assertThat(mockClientHttpRequest.getLink()).isSameAs(mockLink);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/pdx/PdxSerializableDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/pdx/PdxSerializableDUnitTest.java b/geode-core/src/test/java/org/apache/geode/pdx/PdxSerializableDUnitTest.java
index 4e8a271..497f428 100644
--- a/geode-core/src/test/java/org/apache/geode/pdx/PdxSerializableDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/pdx/PdxSerializableDUnitTest.java
@@ -433,7 +433,7 @@ public class PdxSerializableDUnitTest extends JUnit4CacheTestCase {
* add a listener and writer that will throw an exception when invoked if events are for internal
* regions
*/
- public final void addPoisonedTransactionListeners() {
+ public void addPoisonedTransactionListeners() {
MyTestTransactionListener listener = new MyTestTransactionListener();
getCache().getCacheTransactionManager().addListener(listener);
getCache().getCacheTransactionManager().setWriter(listener);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/redis/internal/executor/AbstractScanExecutorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/redis/internal/executor/AbstractScanExecutorTest.java b/geode-core/src/test/java/org/apache/geode/redis/internal/executor/AbstractScanExecutorTest.java
new file mode 100644
index 0000000..2644741
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/redis/internal/executor/AbstractScanExecutorTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.regex.Pattern;
+
+@Category(UnitTest.class)
+public class AbstractScanExecutorTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractScanExecutor mockAbstractScanExecutor = mock(AbstractScanExecutor.class);
+ Pattern pattern = Pattern.compile(".");
+
+ when(mockAbstractScanExecutor.convertGlobToRegex(eq("pattern"))).thenReturn(pattern);
+
+ assertThat(mockAbstractScanExecutor.convertGlobToRegex("pattern")).isSameAs(pattern);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/security/ClientAuthorizationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientAuthorizationTestCase.java b/geode-core/src/test/java/org/apache/geode/security/ClientAuthorizationTestCase.java
index 244f4e5..9d3f721 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientAuthorizationTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientAuthorizationTestCase.java
@@ -102,7 +102,7 @@ public abstract class ClientAuthorizationTestCase extends JUnit4DistributedTestC
postSetUpClientAuthorizationTestBase();
}
- private final void setUpClientAuthorizationTestBase() throws Exception {
+ private void setUpClientAuthorizationTestBase() throws Exception {
server1 = getHost(0).getVM(0);
server2 = getHost(0).getVM(1);
client1 = getHost(0).getVM(2);
@@ -110,7 +110,7 @@ public abstract class ClientAuthorizationTestCase extends JUnit4DistributedTestC
setUpIgnoredExceptions();
}
- private final void setUpIgnoredExceptions() {
+ private void setUpIgnoredExceptions() {
Set<String> serverExceptions = new HashSet<>();
serverExceptions.addAll(Arrays.asList(serverIgnoredExceptions()));
if (serverExceptions.isEmpty()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/security/DeltaClientAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/DeltaClientAuthorizationDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/DeltaClientAuthorizationDUnitTest.java
index 9a3ce86..1b09a83 100644
--- a/geode-core/src/test/java/org/apache/geode/security/DeltaClientAuthorizationDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/DeltaClientAuthorizationDUnitTest.java
@@ -155,7 +155,7 @@ public class DeltaClientAuthorizationDUnitTest extends ClientAuthorizationTestCa
}
}
- private final void setUpDeltas() {
+ private void setUpDeltas() {
for (int i = 0; i < 8; i++) {
deltas[i] = new DeltaTestImpl(0, "0", new Double(0), new byte[0], new TestObject1("0", 0));
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/security/DeltaClientPostAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/DeltaClientPostAuthorizationDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/DeltaClientPostAuthorizationDUnitTest.java
index 4cc8442..dc4ffac 100644
--- a/geode-core/src/test/java/org/apache/geode/security/DeltaClientPostAuthorizationDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/DeltaClientPostAuthorizationDUnitTest.java
@@ -130,7 +130,7 @@ public class DeltaClientPostAuthorizationDUnitTest extends ClientAuthorizationTe
}
@Override
- protected final void executeOpBlock(final List<OperationWithAction> opBlock, final int port1,
+ protected void executeOpBlock(final List<OperationWithAction> opBlock, final int port1,
final int port2, final String authInit, final Properties extraAuthProps,
final Properties extraAuthzProps, final TestCredentialGenerator credentialGenerator,
final Random random) throws InterruptedException {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/security/generator/AuthzCredentialGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/generator/AuthzCredentialGenerator.java b/geode-core/src/test/java/org/apache/geode/security/generator/AuthzCredentialGenerator.java
index 13d68b5..3a61bfc 100755
--- a/geode-core/src/test/java/org/apache/geode/security/generator/AuthzCredentialGenerator.java
+++ b/geode-core/src/test/java/org/apache/geode/security/generator/AuthzCredentialGenerator.java
@@ -373,7 +373,7 @@ public abstract class AuthzCredentialGenerator {
* @return the name of this class code.
*/
@Override
- public final String toString() {
+ public String toString() {
return this.name;
}
@@ -383,7 +383,7 @@ public abstract class AuthzCredentialGenerator {
* @return true if other object is same as this one.
*/
@Override
- public final boolean equals(final Object obj) {
+ public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
@@ -399,7 +399,7 @@ public abstract class AuthzCredentialGenerator {
*
* @return true if other {@code ClassCode} is same as this one.
*/
- public final boolean equals(final ClassCode opCode) {
+ public boolean equals(final ClassCode opCode) {
return opCode != null && opCode.ordinal == this.ordinal;
}
@@ -409,7 +409,7 @@ public abstract class AuthzCredentialGenerator {
* @return the ordinal of this {@code ClassCode}.
*/
@Override
- public final int hashCode() {
+ public int hashCode() {
return this.ordinal;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/security/generator/CredentialGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/generator/CredentialGenerator.java b/geode-core/src/test/java/org/apache/geode/security/generator/CredentialGenerator.java
index 8695451..0ab4252 100755
--- a/geode-core/src/test/java/org/apache/geode/security/generator/CredentialGenerator.java
+++ b/geode-core/src/test/java/org/apache/geode/security/generator/CredentialGenerator.java
@@ -283,7 +283,7 @@ public abstract class CredentialGenerator {
* @return the name of this operation.
*/
@Override
- public final String toString() {
+ public String toString() {
return this.name;
}
@@ -293,7 +293,7 @@ public abstract class CredentialGenerator {
* @return true if other object is same as this one.
*/
@Override
- public final boolean equals(final Object obj) {
+ public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
@@ -309,7 +309,7 @@ public abstract class CredentialGenerator {
*
* @return true if other {@code ClassCode} is same as this one.
*/
- public final boolean equals(final ClassCode opCode) {
+ public boolean equals(final ClassCode opCode) {
return opCode != null && opCode.ordinal == this.ordinal;
}
@@ -319,7 +319,7 @@ public abstract class CredentialGenerator {
* @return the ordinal of this operation.
*/
@Override
- public final int hashCode() {
+ public int hashCode() {
return this.ordinal;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/test/dunit/DUnitEnv.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/DUnitEnv.java b/geode-core/src/test/java/org/apache/geode/test/dunit/DUnitEnv.java
index 42ccf38..45fb919 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/DUnitEnv.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/DUnitEnv.java
@@ -35,7 +35,7 @@ public abstract class DUnitEnv {
public static DUnitEnv instance = null;
- public static final DUnitEnv get() {
+ public static DUnitEnv get() {
if (instance == null) {
try {
// for tests that are still being migrated to the open-source
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/test/dunit/DistributedTestUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/DistributedTestUtils.java b/geode-core/src/test/java/org/apache/geode/test/dunit/DistributedTestUtils.java
index 5b8e615..72b8190 100755
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/DistributedTestUtils.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/DistributedTestUtils.java
@@ -122,7 +122,7 @@ public class DistributedTestUtils {
}
}
- public final static Properties getAllDistributedSystemProperties(final Properties properties) {
+ public static Properties getAllDistributedSystemProperties(final Properties properties) {
Properties dsProperties = DUnitEnv.get().getDistributedSystemProperties();
// our tests do not expect auto-reconnect to be on by default
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/test/dunit/Wait.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/Wait.java b/geode-core/src/test/java/org/apache/geode/test/dunit/Wait.java
index 20fbb5b..a2ff978 100755
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/Wait.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/Wait.java
@@ -135,7 +135,7 @@ public class Wait {
*
* @deprecated Please use {@link org.awaitility.Awaitility} instead.
*/
- public static final void pause(final int milliseconds) {
+ public static void pause(final int milliseconds) {
if (milliseconds >= 1000 || logger.isDebugEnabled()) { // check for debug but log at info
logger.info("Pausing for {} ms...", milliseconds);
}
@@ -211,7 +211,7 @@ public class Wait {
* @return the last time stamp observed
* @deprecated Please use {@link org.awaitility.Awaitility} instead.
*/
- public static final long waitForExpiryClockToChange(final LocalRegion cacheTimeMillisSource) {
+ public static long waitForExpiryClockToChange(final LocalRegion cacheTimeMillisSource) {
return waitForExpiryClockToChange(cacheTimeMillisSource,
cacheTimeMillisSource.cacheTimeMillis());
}
@@ -224,7 +224,7 @@ public class Wait {
* @return the last time stamp observed
* @deprecated Please use {@link org.awaitility.Awaitility} instead.
*/
- public static final long waitForExpiryClockToChange(final LocalRegion cacheTimeMillisSource,
+ public static long waitForExpiryClockToChange(final LocalRegion cacheTimeMillisSource,
final long baseTime) {
long nowTime;
do {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/test/dunit/tests/OverridingGetPropertiesDisconnectsAllDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/tests/OverridingGetPropertiesDisconnectsAllDUnitTest.java b/geode-core/src/test/java/org/apache/geode/test/dunit/tests/OverridingGetPropertiesDisconnectsAllDUnitTest.java
index 1d67dcd..4c7d7f2 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/tests/OverridingGetPropertiesDisconnectsAllDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/tests/OverridingGetPropertiesDisconnectsAllDUnitTest.java
@@ -44,7 +44,7 @@ public class OverridingGetPropertiesDisconnectsAllDUnitTest extends JUnit4Distri
}
@Override
- public final Properties getDistributedSystemProperties() {
+ public Properties getDistributedSystemProperties() {
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
return props;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/test/golden/FailOutputTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/golden/FailOutputTestCase.java b/geode-core/src/test/java/org/apache/geode/test/golden/FailOutputTestCase.java
index 71040ef..ceb1586 100755
--- a/geode-core/src/test/java/org/apache/geode/test/golden/FailOutputTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/test/golden/FailOutputTestCase.java
@@ -20,7 +20,6 @@ import java.io.InputStreamReader;
/**
* Abstract test case for tests verifying that unexpected test output will cause expected failures.
- *
*/
public abstract class FailOutputTestCase extends GoldenTestCase implements ExecutableProcess {
@@ -38,7 +37,7 @@ public abstract class FailOutputTestCase extends GoldenTestCase implements Execu
abstract void outputProblemInProcess(String message);
@Override
- public final void executeInProcess() throws IOException {
+ public void executeInProcess() throws IOException {
outputLine("Begin " + name() + ".main");
outputLine("Press Enter to continue.");
new BufferedReader(new InputStreamReader(System.in)).readLine();
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/test/golden/PassJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/golden/PassJUnitTest.java b/geode-core/src/test/java/org/apache/geode/test/golden/PassJUnitTest.java
index 2e9b8f9..e3374f4 100755
--- a/geode-core/src/test/java/org/apache/geode/test/golden/PassJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/test/golden/PassJUnitTest.java
@@ -68,7 +68,7 @@ public class PassJUnitTest extends GoldenTestCase implements ExecutableProcess {
}
@Override
- public final void executeInProcess() throws IOException {
+ public void executeInProcess() throws IOException {
outputLine("Begin " + name() + ".main");
outputLine("Press Enter to continue.");
new BufferedReader(new InputStreamReader(System.in)).readLine();
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/test/golden/PassWithExpectedProblemTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/golden/PassWithExpectedProblemTestCase.java b/geode-core/src/test/java/org/apache/geode/test/golden/PassWithExpectedProblemTestCase.java
index 2d60c27..e88a11d 100755
--- a/geode-core/src/test/java/org/apache/geode/test/golden/PassWithExpectedProblemTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/test/golden/PassWithExpectedProblemTestCase.java
@@ -74,7 +74,7 @@ public abstract class PassWithExpectedProblemTestCase extends GoldenTestCase
}
@Override
- public final void executeInProcess() throws IOException {
+ public void executeInProcess() throws IOException {
outputLine("Begin " + name() + ".main");
outputLine("Press Enter to continue.");
new BufferedReader(new InputStreamReader(System.in)).readLine();
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-cq/src/test/java/org/apache/geode/internal/cache/ha/CQListGIIDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/internal/cache/ha/CQListGIIDUnitTest.java b/geode-cq/src/test/java/org/apache/geode/internal/cache/ha/CQListGIIDUnitTest.java
index e979f72..5e8bdac 100755
--- a/geode-cq/src/test/java/org/apache/geode/internal/cache/ha/CQListGIIDUnitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/internal/cache/ha/CQListGIIDUnitTest.java
@@ -225,7 +225,7 @@ public class CQListGIIDUnitTest extends JUnit4DistributedTestCase {
return Integer.valueOf(server1.getPort());
}
- public static final Region createRegion(String name, String rootName, RegionAttributes attrs)
+ public static Region createRegion(String name, String rootName, RegionAttributes attrs)
throws CacheException {
Region root = cache.getRegion(rootName);
if (root == null) {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneDUnitTest.java
index b80f5de..aa1b084 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneDUnitTest.java
@@ -66,7 +66,7 @@ public abstract class LuceneDUnitTest extends JUnit4CacheTestCase {
RegionTestableType.PARTITION_PERSISTENT, RegionTestableType.FIXED_PARTITION};
}
- protected final Object[] parameterCombiner(Object[] aValues, Object[] bValues) {
+ protected Object[] parameterCombiner(Object[] aValues, Object[] bValues) {
Object[] parameters = new Object[aValues.length * bValues.length];
for (int i = 0; i < aValues.length; i++) {
for (int j = 0; j < bValues.length; j++) {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationDUnitTest.java
index a16646e..b83ca44 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationDUnitTest.java
@@ -41,13 +41,13 @@ import static org.junit.Assert.*;
@RunWith(JUnitParamsRunner.class)
public class LuceneIndexCreationDUnitTest extends LuceneDUnitTest {
- private final Object[] parametersForMultipleIndexCreates() {
+ private Object[] parametersForMultipleIndexCreates() {
Integer[] numIndexes = {1, 2, 10};
RegionTestableType[] regionTestTypes = getListOfRegionTestTypes();
return parameterCombiner(numIndexes, regionTestTypes);
}
- protected final Object[] parametersForIndexAndRegions() {
+ protected Object[] parametersForIndexAndRegions() {
Object[] indexCreations = new Object[] {getFieldsIndexWithOneField(),
getFieldsIndexWithTwoFields(), get2FieldsIndexes(), getAnalyzersIndexWithOneField(),
getAnalyzersIndexWithTwoFields(), getAnalyzersIndexWithNullField1()};
@@ -282,9 +282,7 @@ public class LuceneIndexCreationDUnitTest extends LuceneDUnitTest {
dataStore2.invoke(() -> verifyIndexList(0));
}
-
-
- protected final Object[] getXmlAndExceptionMessages() {
+ protected Object[] getXmlAndExceptionMessages() {
return $(
new Object[] {"verifyDifferentFieldsFails", CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_FIELDS},
new Object[] {"verifyDifferentFieldAnalyzerSizesFails1",
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
index bed6f13..a8ab8d3 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
@@ -224,8 +224,7 @@ public class LuceneIndexCreationPersistenceIntegrationTest extends LuceneIntegra
LuceneTestUtilities.verifyInternalRegions(luceneService, cache, verify);
}
-
- private static final Object[] getRegionShortcuts() {
+ private static Object[] getRegionShortcuts() {
return $(new Object[] {PARTITION}, new Object[] {PARTITION_REDUNDANT},
new Object[] {PARTITION_PERSISTENT}, new Object[] {PARTITION_REDUNDANT_PERSISTENT},
new Object[] {PARTITION_OVERFLOW}, new Object[] {PARTITION_REDUNDANT_OVERFLOW},
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
index 67adfb9..a6252c8 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
@@ -73,7 +73,7 @@ public class LuceneIndexDestroyDUnitTest extends LuceneDUnitTest {
accessor = Host.getHost(0).getVM(3);
}
- private final Object[] parametersForIndexDestroys() {
+ private Object[] parametersForIndexDestroys() {
String[] destroyDataRegionParameters = {"true", "false"};
RegionTestableType[] regionTestTypes = getListOfRegionTestTypes();
return parameterCombiner(destroyDataRegionParameters, regionTestTypes);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfileJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfileJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfileJUnitTest.java
index 4d72639..b378ca5 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfileJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfileJUnitTest.java
@@ -50,7 +50,7 @@ public class LuceneIndexCreationProfileJUnitTest {
assertEquals(profile.getFieldAnalyzers(), copy.getFieldAnalyzers());
}
- private final Object[] getSerializationProfiles() {
+ private Object[] getSerializationProfiles() {
return $(new Object[] {getOneFieldLuceneIndexCreationProfile()},
new Object[] {getTwoFieldLuceneIndexCreationProfile()},
new Object[] {getTwoAnalyzersLuceneIndexCreationProfile()},
@@ -64,7 +64,7 @@ public class LuceneIndexCreationProfileJUnitTest {
assertEquals(expectedResult, otherProfile.checkCompatibility("/" + REGION_NAME, myProfile));
}
- private final Object[] getCheckCompatibilityProfiles() {
+ private Object[] getCheckCompatibilityProfiles() {
return $(
new Object[] {getOneFieldLuceneIndexCreationProfile(),
getTwoFieldLuceneIndexCreationProfile(), CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_FIELDS},
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-old-client-support/src/main/java/com/gemstone/gemfire/cache/execute/FunctionException.java
----------------------------------------------------------------------
diff --git a/geode-old-client-support/src/main/java/com/gemstone/gemfire/cache/execute/FunctionException.java b/geode-old-client-support/src/main/java/com/gemstone/gemfire/cache/execute/FunctionException.java
index d19d900..de8825b 100644
--- a/geode-old-client-support/src/main/java/com/gemstone/gemfire/cache/execute/FunctionException.java
+++ b/geode-old-client-support/src/main/java/com/gemstone/gemfire/cache/execute/FunctionException.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package com.gemstone.gemfire.cache.execute;
import java.util.ArrayList;
@@ -36,12 +35,9 @@ import org.apache.geode.cache.execute.FunctionService;
* This allows for separation of business and error handling logic, as client code that processes
* function execution results does not have to deal with errors; errors can be dealt with in the
* exception handling logic, by catching this exception.
- *
* <p>
* The exception string provides details on the cause of failure.
- * </p>
- *
- *
+ *
* @since GemFire 6.0
* @see FunctionService
* @deprecated please use the org.apache.geode version of this class
@@ -96,7 +92,7 @@ public class FunctionException extends GemFireException {
* @param cause
* @since GemFire 6.5
*/
- public final void addException(Throwable cause) {
+ public void addException(Throwable cause) {
Assert.assertTrue(cause != null, "unexpected null exception to add to FunctionException");
getExceptions().add(cause);
}
@@ -106,7 +102,7 @@ public class FunctionException extends GemFireException {
*
* @since GemFire 6.5
*/
- public final List<Throwable> getExceptions() {
+ public List<Throwable> getExceptions() {
if (this.exceptions == null) {
this.exceptions = new ArrayList<Throwable>();
}
@@ -118,7 +114,7 @@ public class FunctionException extends GemFireException {
*
* @since GemFire 6.5
*/
- public final void addExceptions(Collection<? extends Throwable> ex) {
+ public void addExceptions(Collection<? extends Throwable> ex) {
getExceptions().addAll(ex);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-old-client-support/src/test/java/com/gemstone/gemfire/cache/execute/FunctionExceptionTest.java
----------------------------------------------------------------------
diff --git a/geode-old-client-support/src/test/java/com/gemstone/gemfire/cache/execute/FunctionExceptionTest.java b/geode-old-client-support/src/test/java/com/gemstone/gemfire/cache/execute/FunctionExceptionTest.java
new file mode 100644
index 0000000..5104466
--- /dev/null
+++ b/geode-old-client-support/src/test/java/com/gemstone/gemfire/cache/execute/FunctionExceptionTest.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.gemstone.gemfire.cache.execute;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+@Category(UnitTest.class)
+public class FunctionExceptionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ FunctionException mockFunctionException = mock(FunctionException.class);
+ Throwable cause = new Exception("message");
+ List<Throwable> listOfThrowables = new ArrayList<>();
+ Collection<? extends Throwable> collectionOfThrowables = new ArrayList<>();
+
+ when(mockFunctionException.getExceptions()).thenReturn(listOfThrowables);
+
+ mockFunctionException.addException(cause);
+ mockFunctionException.addExceptions(collectionOfThrowables);
+
+ verify(mockFunctionException, times(1)).addException(cause);
+ verify(mockFunctionException, times(1)).addExceptions(collectionOfThrowables);
+
+ assertThat(mockFunctionException.getExceptions()).isSameAs(listOfThrowables);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
index f101027..8aa88b2 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
@@ -3768,7 +3768,7 @@ public class WANTestBase extends JUnit4DistributedTestCase {
}
@Override
- public final Properties getDistributedSystemProperties() {
+ public Properties getDistributedSystemProperties() {
// For now all WANTestBase tests allocate off-heap memory even though
// many of them never use it.
// The problem is that WANTestBase has static methods that create instances
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/RegionData.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/RegionData.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/RegionData.java
index ea9237e..03dc0ad 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/RegionData.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/RegionData.java
@@ -15,45 +15,31 @@
package org.apache.geode.rest.internal.web.controllers.support;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializable;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
-import org.apache.geode.cache.query.Struct;
-import org.apache.geode.cache.query.internal.StructImpl;
import org.apache.geode.pdx.JSONFormatter;
import org.apache.geode.pdx.PdxInstance;
-import org.apache.geode.rest.internal.web.util.JSONUtils;
import org.apache.geode.rest.internal.web.util.JsonWriter;
-
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
/**
* The RegionData class is a container for data fetched from a GemFire Cache Region.
- * <p/>
- *
+ *
* @see com.fasterxml.jackson.databind.JsonSerializable
* @see java.lang.Iterable
* @since GemFire 8.0
*/
-
@SuppressWarnings("unused")
@XmlRootElement(name = "region")
@XmlType(name = "org.gopivotal.app.web.controllers.support.RegionData")
@@ -75,18 +61,13 @@ public class RegionData<T> implements Iterable<T>, JsonSerializable {
return regionNamePath;
}
- public final void setRegionNamePath(final String regionNamePath) {
+ public void setRegionNamePath(final String regionNamePath) {
Assert.hasText(regionNamePath, "The name or path of the Region must be specified!");
this.regionNamePath = regionNamePath;
}
public RegionData<T> add(final T data) {
- // We are adding null data into the response
- // Assert.notNull(data, String.format("The data to add to Region (%1$s) cannot be null!",
- // getRegionNamePath()));
- // if(data != null) {
this.data.add(data);
- // }
return this;
}
@@ -102,10 +83,6 @@ public class RegionData<T> implements Iterable<T>, JsonSerializable {
public RegionData<T> add(final Iterable<T> data) {
for (final T element : data) {
- // Adding null data into the response
- /*
- * if (element != null) { add(element); }
- */
add(element);
}
@@ -139,19 +116,15 @@ public class RegionData<T> implements Iterable<T>, JsonSerializable {
public void serialize(final JsonGenerator jsonGenerator,
final SerializerProvider serializerProvider) throws IOException {
- // if(this!=null && this.size() > 1) {
jsonGenerator.writeStartObject();
jsonGenerator.writeArrayFieldStart(getRegionNamePath());
- // }
for (T element : this) {
JsonWriter.writeValueAsJson(jsonGenerator, element, null);
}
- // if(this!=null && this.size() > 1) {
jsonGenerator.writeEndArray();
jsonGenerator.writeEndObject();
- // }
}
public void serializeWithType(final JsonGenerator jsonGenerator,
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-web-api/src/test/java/org/apache/geode/rest/internal/web/controllers/support/RegionDataTest.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/test/java/org/apache/geode/rest/internal/web/controllers/support/RegionDataTest.java b/geode-web-api/src/test/java/org/apache/geode/rest/internal/web/controllers/support/RegionDataTest.java
new file mode 100644
index 0000000..5f32d13
--- /dev/null
+++ b/geode-web-api/src/test/java/org/apache/geode/rest/internal/web/controllers/support/RegionDataTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.rest.internal.web.controllers.support;
+
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class RegionDataTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RegionData mockRegionData = mock(RegionData.class);
+ String regionNamePath = "regionNamePath";
+
+ mockRegionData.setRegionNamePath(regionNamePath);
+
+ verify(mockRegionData, times(1)).setRegionNamePath(regionNamePath);
+ }
+}
[11/14] geode git commit: GEODE-2929: remove superfluous final from
methods
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
index 1700ccd..ea3f8d6 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
@@ -95,7 +95,7 @@ public class ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest
}
}
- private final void getAvailableCacheElseCreateCache() {
+ private void getAvailableCacheElseCreateCache() {
synchronized (ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.class) {
try {
Cache newCache = GemFireCacheImpl.getInstance();
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/cache30/CacheSerializableRunnable.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/CacheSerializableRunnable.java b/geode-core/src/test/java/org/apache/geode/cache30/CacheSerializableRunnable.java
index cfd75ba..5a5c80d 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/CacheSerializableRunnable.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/CacheSerializableRunnable.java
@@ -49,7 +49,7 @@ public abstract class CacheSerializableRunnable extends SerializableRunnable
* Invokes the {@link #run2} method and will wrap any {@link CacheException} thrown by
* <code>run2</code> in a {@link CacheSerializableRunnableException}.
*/
- public final void run() {
+ public void run() {
try {
if (args == null) {
run2();
@@ -68,7 +68,7 @@ public abstract class CacheSerializableRunnable extends SerializableRunnable
* repeat the {@link #run} method until it either succeeds or repeatTimeoutMs milliseconds have
* passed. The AssertionError is only thrown to the caller if the last run still throws it.
*/
- public final void runRepeatingIfNecessary(long repeatTimeoutMs) {
+ public void runRepeatingIfNecessary(long repeatTimeoutMs) {
long start = System.currentTimeMillis();
AssertionError lastErr = null;
do {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java b/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
index db92dc8..3b56748 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
@@ -124,12 +124,12 @@ public abstract class RegionTestCase extends JUnit4CacheTestCase {
*
* @see #getRegionAttributes
*/
- protected final Region createRegion(String name) throws CacheException {
+ protected Region createRegion(String name) throws CacheException {
return createRegion(name, getRegionAttributes());
}
- protected final Region createRootRegion() throws CacheException {
+ protected Region createRootRegion() throws CacheException {
return createRootRegion(getRegionAttributes());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
index c8a629c..e801392 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
@@ -399,7 +399,7 @@ public class TXDistributedDUnitTest extends JUnit4CacheTestCase {
rgn2.destroyRegion();
}
- static final void setInternalCallbacks(TXStateInterface txp, final byte[] cbSensors) {
+ static void setInternalCallbacks(TXStateInterface txp, final byte[] cbSensors) {
((TXStateProxyImpl) txp).forceLocalBootstrap();
TXState tx = (TXState) ((TXStateProxyImpl) txp).getRealDeal(null, null);
assertEquals(9, cbSensors.length);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/cache30/TestCacheCallback.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheCallback.java b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheCallback.java
index 37f67e8..3004ea8 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheCallback.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheCallback.java
@@ -77,7 +77,7 @@ public abstract class TestCacheCallback implements CacheCallback {
return this.isClosed;
}
- public final void close() {
+ public void close() {
this.isClosed = true;
close2();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/cache30/TestCacheListener.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheListener.java b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheListener.java
index db318d5..b7f811a 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheListener.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheListener.java
@@ -86,7 +86,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
}
}
- public final void afterCreate(EntryEvent event) {
+ public void afterCreate(EntryEvent event) {
addEvent(event);
try {
afterCreate2(event);
@@ -103,7 +103,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
throw new UnsupportedOperationException(s);
}
- public final void afterUpdate(EntryEvent event) {
+ public void afterUpdate(EntryEvent event) {
addEvent(event);
try {
afterUpdate2(event);
@@ -120,7 +120,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
throw new UnsupportedOperationException(s);
}
- public final void afterInvalidate(EntryEvent event) {
+ public void afterInvalidate(EntryEvent event) {
addEvent(event);
try {
afterInvalidate2(event);
@@ -137,7 +137,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
throw new UnsupportedOperationException(s);
}
- public final void afterDestroy(EntryEvent event) {
+ public void afterDestroy(EntryEvent event) {
afterDestroyBeforeAddEvent(event);
addEvent(event);
try {
@@ -159,7 +159,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
throw new UnsupportedOperationException(s);
}
- public final void afterRegionInvalidate(RegionEvent event) {
+ public void afterRegionInvalidate(RegionEvent event) {
addEvent(event);
try {
afterRegionInvalidate2(event);
@@ -176,7 +176,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
throw new UnsupportedOperationException(s);
}
- public final void afterRegionDestroy(RegionEvent event) {
+ public void afterRegionDestroy(RegionEvent event) {
// check argument to see if this is during tearDown
if ("teardown".equals(event.getCallbackArgument()))
return;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/cache30/TestCacheLoader.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheLoader.java b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheLoader.java
index d9158a5..8f91515 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheLoader.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheLoader.java
@@ -27,7 +27,7 @@ import org.apache.geode.cache.*;
*/
public abstract class TestCacheLoader extends TestCacheCallback implements CacheLoader {
- public final Object load(LoaderHelper helper) throws CacheLoaderException {
+ public Object load(LoaderHelper helper) throws CacheLoaderException {
this.invoked = true;
return load2(helper);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/cache30/TestCacheWriter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheWriter.java b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheWriter.java
index 95d7f75..ea1ed1a 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheWriter.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheWriter.java
@@ -29,7 +29,7 @@ import org.apache.geode.cache.*;
public abstract class TestCacheWriter extends TestCacheCallback implements CacheWriter {
- public final void beforeUpdate(EntryEvent event) throws CacheWriterException {
+ public void beforeUpdate(EntryEvent event) throws CacheWriterException {
this.invoked = true;
beforeUpdate2(event);
@@ -41,13 +41,13 @@ public abstract class TestCacheWriter extends TestCacheCallback implements Cache
throw new UnsupportedOperationException(s);
}
- public final void beforeUpdate2(EntryEvent event, Object arg) throws CacheWriterException {
+ public void beforeUpdate2(EntryEvent event, Object arg) throws CacheWriterException {
String s = "Shouldn't be invoked";
throw new UnsupportedOperationException(s);
}
- public final void beforeCreate(EntryEvent event) throws CacheWriterException {
+ public void beforeCreate(EntryEvent event) throws CacheWriterException {
this.invoked = true;
beforeCreate2(event);
@@ -62,13 +62,13 @@ public abstract class TestCacheWriter extends TestCacheCallback implements Cache
/**
* Causes code that uses the old API to not compile
*/
- public final void beforeCreate2(EntryEvent event, Object arg) throws CacheWriterException {
+ public void beforeCreate2(EntryEvent event, Object arg) throws CacheWriterException {
String s = "Shouldn't be invoked";
throw new UnsupportedOperationException(s);
}
- public final void beforeDestroy(EntryEvent event) throws CacheWriterException {
+ public void beforeDestroy(EntryEvent event) throws CacheWriterException {
this.invoked = true;
beforeDestroy2(event);
@@ -80,13 +80,13 @@ public abstract class TestCacheWriter extends TestCacheCallback implements Cache
throw new UnsupportedOperationException(s);
}
- public final void beforeDestroy2(EntryEvent event, Object arg) throws CacheWriterException {
+ public void beforeDestroy2(EntryEvent event, Object arg) throws CacheWriterException {
String s = "Shouldn't be invoked";
throw new UnsupportedOperationException(s);
}
- public final void beforeRegionDestroy(RegionEvent event) throws CacheWriterException {
+ public void beforeRegionDestroy(RegionEvent event) throws CacheWriterException {
// check argument to see if this is during tearDown
if ("teardown".equals(event.getCallbackArgument()))
@@ -102,14 +102,13 @@ public abstract class TestCacheWriter extends TestCacheCallback implements Cache
throw new UnsupportedOperationException(s);
}
- public final void beforeRegionDestroy2(RegionEvent event, Object arg)
- throws CacheWriterException {
+ public void beforeRegionDestroy2(RegionEvent event, Object arg) throws CacheWriterException {
String s = "Shouldn't be invoked";
throw new UnsupportedOperationException(s);
}
- public final void beforeRegionClear(RegionEvent event) throws CacheWriterException {
+ public void beforeRegionClear(RegionEvent event) throws CacheWriterException {
String s = "Unexpected callback invocation";
throw new UnsupportedOperationException(s);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/cache30/TestTransactionListener.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TestTransactionListener.java b/geode-core/src/test/java/org/apache/geode/cache30/TestTransactionListener.java
index 2b75ccc..d29cb3c 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TestTransactionListener.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TestTransactionListener.java
@@ -28,7 +28,7 @@ import org.apache.geode.cache.*;
public abstract class TestTransactionListener extends TestCacheCallback
implements TransactionListener {
- public final void afterCommit(TransactionEvent event) {
+ public void afterCommit(TransactionEvent event) {
this.invoked = true;
try {
afterCommit2(event);
@@ -45,7 +45,7 @@ public abstract class TestTransactionListener extends TestCacheCallback
throw new UnsupportedOperationException(s);
}
- public final void afterFailedCommit(TransactionEvent event) {
+ public void afterFailedCommit(TransactionEvent event) {
this.invoked = true;
try {
afterFailedCommit2(event);
@@ -63,7 +63,7 @@ public abstract class TestTransactionListener extends TestCacheCallback
}
- public final void afterRollback(TransactionEvent event) {
+ public void afterRollback(TransactionEvent event) {
this.invoked = true;
try {
afterRollback2(event);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
index 416b459..46d51e8 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
@@ -20,6 +20,9 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
import org.apache.commons.lang.StringUtils;
import org.apache.geode.test.junit.categories.UnitTest;
@@ -50,6 +53,13 @@ public class AbstractLauncherTest {
}
@Test
+ public void shouldBeMockable() throws Exception {
+ AbstractLauncher mockAbstractLauncher = mock(AbstractLauncher.class);
+ mockAbstractLauncher.setDebug(true);
+ verify(mockAbstractLauncher, times(1)).setDebug(true);
+ }
+
+ @Test
public void testIsSet() {
final Properties properties = new Properties();
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
index 2a6dfa6..4117d25 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
@@ -58,7 +58,7 @@ public abstract class AbstractLocatorLauncherRemoteIntegrationTestCase
/**
* Remove final if a test needs to override.
*/
- protected final AbstractLauncher.Status getExpectedStopStatusForNotRunning() {
+ protected AbstractLauncher.Status getExpectedStopStatusForNotRunning() {
return AbstractLauncher.Status.NOT_RESPONDING;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java b/geode-core/src/test/java/org/apache/geode/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java
index d3aa05b..b50b77a 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java
@@ -62,7 +62,7 @@ public abstract class AbstractServerLauncherRemoteIntegrationTestCase
/**
* Remove final if a test needs to override.
*/
- protected final AbstractLauncher.Status getExpectedStopStatusForNotRunning() {
+ protected AbstractLauncher.Status getExpectedStopStatusForNotRunning() {
return AbstractLauncher.Status.NOT_RESPONDING;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
index 50cea4d..0281a37 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
@@ -21,15 +21,16 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import org.apache.geode.distributed.LocatorLauncher.Builder;
import org.apache.geode.distributed.LocatorLauncher.Command;
import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.test.junit.categories.FlakyTest;
import org.apache.geode.test.junit.categories.UnitTest;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.RestoreSystemProperties;
@@ -40,7 +41,6 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import joptsimple.OptionException;
-
/**
* The LocatorLauncherTest class is a test suite of test cases for testing the contract and
* functionality of launching a GemFire Locator.
@@ -61,9 +61,16 @@ public class LocatorLauncherTest {
@Rule
public final TestName testName = new TestName();
- @Before
- public void setup() {
- DistributedSystem.removeSystem(InternalDistributedSystem.getConnectedInstance());
+ @Test
+ public void shouldBeMockable() throws Exception {
+ LocatorLauncher mockLocatorLauncher = mock(LocatorLauncher.class);
+ InternalLocator mockInternalLocator = mock(InternalLocator.class);
+
+ when(mockLocatorLauncher.getLocator()).thenReturn(mockInternalLocator);
+ when(mockLocatorLauncher.getId()).thenReturn("ID");
+
+ assertThat(mockLocatorLauncher.getLocator()).isSameAs(mockInternalLocator);
+ assertThat(mockLocatorLauncher.getId()).isEqualTo("ID");
}
@Test(expected = IllegalArgumentException.class)
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
index 98f73d8..9611e32 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
@@ -15,12 +15,18 @@
package org.apache.geode.distributed;
import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.server.CacheServer;
@@ -29,6 +35,7 @@ import org.apache.geode.distributed.ServerLauncher.Command;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.support.DistributedSystemAdapter;
+import org.apache.geode.internal.cache.CacheConfig;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.test.junit.categories.FlakyTest;
import org.apache.geode.test.junit.categories.UnitTest;
@@ -93,6 +100,29 @@ public class ServerLauncherTest {
}
@Test
+ public void shouldBeMockable() throws Exception {
+ ServerLauncher mockServerLauncher = mock(ServerLauncher.class);
+ Cache mockCache = mock(Cache.class);
+ CacheConfig mockCacheConfig = mock(CacheConfig.class);
+
+ when(mockServerLauncher.getCache()).thenReturn(mockCache);
+ when(mockServerLauncher.getCacheConfig()).thenReturn(mockCacheConfig);
+ when(mockServerLauncher.getId()).thenReturn("ID");
+ when(mockServerLauncher.isWaiting(eq(mockCache))).thenReturn(true);
+ when(mockServerLauncher.isHelping()).thenReturn(true);
+
+ mockServerLauncher.startCacheServer(mockCache);
+
+ verify(mockServerLauncher, times(1)).startCacheServer(mockCache);
+
+ assertThat(mockServerLauncher.getCache()).isSameAs(mockCache);
+ assertThat(mockServerLauncher.getCacheConfig()).isSameAs(mockCacheConfig);
+ assertThat(mockServerLauncher.getId()).isSameAs("ID");
+ assertThat(mockServerLauncher.isWaiting(mockCache)).isTrue();
+ assertThat(mockServerLauncher.isHelping()).isTrue();
+ }
+
+ @Test
public void testParseCommand() {
Builder builder = new Builder();
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionAdvisorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionAdvisorTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionAdvisorTest.java
new file mode 100644
index 0000000..ab5124a
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionAdvisorTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributionAdvisorTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributionAdvisor mockDistributionAdvisor = mock(DistributionAdvisor.class);
+ mockDistributionAdvisor.initialize();
+ verify(mockDistributionAdvisor, times(1)).initialize();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionManagerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionManagerTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionManagerTest.java
new file mode 100644
index 0000000..5e37c18
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionManagerTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.concurrent.Executor;
+
+@Category(UnitTest.class)
+public class DistributionManagerTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ InternalDistributedMember mockInternalDistributedMember = mock(InternalDistributedMember.class);
+ Executor mockExecutor = mock(Executor.class);
+ when(mockDistributionManager.getExecutor(anyInt(), eq(mockInternalDistributedMember)))
+ .thenReturn(mockExecutor);
+ assertThat(mockDistributionManager.getExecutor(1, mockInternalDistributedMember))
+ .isSameAs(mockExecutor);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionMessageTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionMessageTest.java
new file mode 100644
index 0000000..df6e7c5
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionMessageTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributionMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributionMessage mockDistributionMessage = mock(DistributionMessage.class);
+ ReplySender mockReplySender = mock(ReplySender.class);
+
+ mockDistributionMessage.setReplySender(mockReplySender);
+
+ verify(mockDistributionMessage, times(1)).setReplySender(mockReplySender);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/distributed/internal/ReplyProcessor21Test.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/ReplyProcessor21Test.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/ReplyProcessor21Test.java
new file mode 100644
index 0000000..224e845
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/ReplyProcessor21Test.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class ReplyProcessor21Test {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ ReplyProcessor21 mockReplyProcessor21 = mock(ReplyProcessor21.class);
+
+ mockReplyProcessor21.waitForRepliesUninterruptibly();
+ mockReplyProcessor21.finished();
+
+ verify(mockReplyProcessor21, times(1)).waitForRepliesUninterruptibly();
+ verify(mockReplyProcessor21, times(1)).finished();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java b/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java
new file mode 100644
index 0000000..88105d3
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractConfigTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractConfig mockAbstractConfig = mock(AbstractConfig.class);
+ when(mockAbstractConfig.toString()).thenReturn("STRING");
+ assertThat(mockAbstractConfig.toString()).isEqualTo("STRING");
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java
index 2f853db..12e20c7 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java
@@ -3283,7 +3283,7 @@ public class DataSerializableJUnitTest implements Serializable {
}
@Override
- public final void newDataSerializer(DataSerializer ds) {
+ public void newDataSerializer(DataSerializer ds) {
this.invoked = true;
try {
newDataSerializer2(ds);
@@ -3302,7 +3302,7 @@ public class DataSerializableJUnitTest implements Serializable {
}
@Override
- public final void newInstantiator(Instantiator instantiator) {
+ public void newInstantiator(Instantiator instantiator) {
this.invoked = true;
try {
newInstantiator2(instantiator);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/HeapDataOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/HeapDataOutputStreamTest.java b/geode-core/src/test/java/org/apache/geode/internal/HeapDataOutputStreamTest.java
new file mode 100644
index 0000000..fa79ff2
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/HeapDataOutputStreamTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class HeapDataOutputStreamTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ HeapDataOutputStream mockHeapDataOutputStream = mock(HeapDataOutputStream.class);
+ Version mockVersion = mock(Version.class);
+ when(mockHeapDataOutputStream.getVersion()).thenReturn(mockVersion);
+ assertThat(mockHeapDataOutputStream.getVersion()).isEqualTo(mockVersion);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/ObjIdConcurrentMapTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/ObjIdConcurrentMapTest.java b/geode-core/src/test/java/org/apache/geode/internal/ObjIdConcurrentMapTest.java
new file mode 100644
index 0000000..4d9f480
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/ObjIdConcurrentMapTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.ObjIdConcurrentMap.Segment;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class ObjIdConcurrentMapTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ ObjIdConcurrentMap mockObjIdConcurrentMap = mock(ObjIdConcurrentMap.class);
+ Segment mockSegment = mock(Segment.class);
+
+ when(mockObjIdConcurrentMap.segmentFor(anyInt())).thenReturn(mockSegment);
+
+ assertThat(mockObjIdConcurrentMap.segmentFor(0)).isEqualTo(mockSegment);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractDiskRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractDiskRegionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractDiskRegionTest.java
new file mode 100644
index 0000000..d994fe9
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractDiskRegionTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractDiskRegionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractDiskRegion mockAbstractDiskRegion = mock(AbstractDiskRegion.class);
+ DiskStoreImpl mockDiskStoreImpl = mock(DiskStoreImpl.class);
+ DiskId mockDiskId = mock(DiskId.class);
+ Object object = new Object();
+
+ when(mockAbstractDiskRegion.getDiskStore()).thenReturn(mockDiskStoreImpl);
+ when(mockAbstractDiskRegion.getRaw(eq(mockDiskId))).thenReturn(object);
+
+ assertThat(mockAbstractDiskRegion.getDiskStore()).isEqualTo(mockDiskStoreImpl);
+ assertThat(mockAbstractDiskRegion.getRaw(mockDiskId)).isEqualTo(object);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractLRURegionMapTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractLRURegionMapTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractLRURegionMapTest.java
new file mode 100644
index 0000000..abead95
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractLRURegionMapTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractLRURegionMapTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractLRURegionMap mockAbstractLRURegionMap = mock(AbstractLRURegionMap.class);
+
+ when(mockAbstractLRURegionMap.centralizedLruUpdateCallback()).thenReturn(1);
+
+ mockAbstractLRURegionMap.audit();
+ mockAbstractLRURegionMap.changeTotalEntrySize(1);
+
+ verify(mockAbstractLRURegionMap, times(1)).audit();
+ verify(mockAbstractLRURegionMap, times(1)).changeTotalEntrySize(1);
+
+ assertThat(mockAbstractLRURegionMap.centralizedLruUpdateCallback()).isEqualTo(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntryTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntryTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntryTest.java
new file mode 100644
index 0000000..5043f09
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntryTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractOplogDiskRegionEntryTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractOplogDiskRegionEntry mockAbstractOplogDiskRegionEntry =
+ mock(AbstractOplogDiskRegionEntry.class);
+ LocalRegion mockLocalRegion = mock(LocalRegion.class);
+
+ mockAbstractOplogDiskRegionEntry.removePhase1(mockLocalRegion, true);
+
+ verify(mockAbstractOplogDiskRegionEntry, times(1)).removePhase1(mockLocalRegion, true);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionMapTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionMapTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionMapTest.java
index eee588e..60b93a9 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionMapTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionMapTest.java
@@ -14,21 +14,46 @@
*/
package org.apache.geode.internal.cache;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyBoolean;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.EntryNotFoundException;
import org.apache.geode.cache.Operation;
+import org.apache.geode.internal.cache.versions.VersionHolder;
import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
@Category(UnitTest.class)
public class AbstractRegionMapTest {
@Test
+ public void shouldBeMockable() throws Exception {
+ AbstractRegionMap mockAbstractRegionMap = mock(AbstractRegionMap.class);
+ RegionEntry mockRegionEntry = mock(RegionEntry.class);
+ VersionHolder mockVersionHolder = mock(VersionHolder.class);
+
+ when(mockAbstractRegionMap.removeTombstone(eq(mockRegionEntry), eq(mockVersionHolder),
+ anyBoolean(), anyBoolean())).thenReturn(true);
+
+ assertThat(
+ mockAbstractRegionMap.removeTombstone(mockRegionEntry, mockVersionHolder, true, true))
+ .isTrue();
+ }
+
+ @Test
public void invalidateOfNonExistentRegionThrowsEntryNotFound() {
TestableAbstractRegionMap arm = new TestableAbstractRegionMap();
EntryEventImpl event = createEventForInvalidate(arm.owner);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionTest.java
new file mode 100644
index 0000000..adbfa02
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractRegionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractRegion mockAbstractRegion = mock(AbstractRegion.class);
+ long millis = System.currentTimeMillis();
+
+ when(mockAbstractRegion.isAllEvents()).thenReturn(true);
+ when(mockAbstractRegion.cacheTimeMillis()).thenReturn(millis);
+
+ assertThat(mockAbstractRegion.isAllEvents()).isTrue();
+ assertThat(mockAbstractRegion.cacheTimeMillis()).isEqualTo(millis);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/BucketAdvisorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/BucketAdvisorTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/BucketAdvisorTest.java
new file mode 100644
index 0000000..2b17f36
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/BucketAdvisorTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class BucketAdvisorTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ BucketAdvisor mockBucketAdvisor = mock(BucketAdvisor.class);
+ InternalDistributedMember mockInternalDistributedMember = mock(InternalDistributedMember.class);
+
+ when(mockBucketAdvisor.basicGetPrimaryMember()).thenReturn(mockInternalDistributedMember);
+ when(mockBucketAdvisor.getBucketRedundancy()).thenReturn(1);
+
+ assertThat(mockBucketAdvisor.basicGetPrimaryMember()).isEqualTo(mockInternalDistributedMember);
+ assertThat(mockBucketAdvisor.getBucketRedundancy()).isEqualTo(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/Bug37377DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug37377DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug37377DUnitTest.java
index 3d0be6a..5718055 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug37377DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug37377DUnitTest.java
@@ -267,11 +267,11 @@ public class Bug37377DUnitTest extends JUnit4CacheTestCase {
private static RegionEntryFactory factory = new RegionEntryFactory() {
- public final RegionEntry createEntry(RegionEntryContext r, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext r, Object key, Object value) {
return new TestAbstractDiskRegionEntry(r, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
return TestAbstractDiskRegionEntry.class;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/Bug39079DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug39079DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug39079DUnitTest.java
index 6dc52ba..1a4e51e 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug39079DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug39079DUnitTest.java
@@ -305,12 +305,12 @@ public class Bug39079DUnitTest extends JUnit4CacheTestCase {
private static RegionEntryFactory factory = new RegionEntryFactory() {
@Override
- public final RegionEntry createEntry(RegionEntryContext r, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext r, Object key, Object value) {
throw new DiskAccessException(new IOException("Test Exception"));
}
@Override
- public final Class getEntryClass() {
+ public Class getEntryClass() {
return getClass();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java
new file mode 100644
index 0000000..3e60ef2
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.internal.cache.DistributedCacheOperation.CacheOperationMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class CacheOperationMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ CacheOperationMessage mockCacheOperationMessage = mock(CacheOperationMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+
+ when(mockCacheOperationMessage.supportsDirectAck()).thenReturn(true);
+ when(mockCacheOperationMessage._mayAddToMultipleSerialGateways(eq(mockDistributionManager)))
+ .thenReturn(true);
+
+ mockCacheOperationMessage.process(mockDistributionManager);
+
+ verify(mockCacheOperationMessage, times(1)).process(mockDistributionManager);
+
+ assertThat(mockCacheOperationMessage.supportsDirectAck()).isTrue();
+ assertThat(mockCacheOperationMessage._mayAddToMultipleSerialGateways(mockDistributionManager))
+ .isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/DestroyMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DestroyMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DestroyMessageTest.java
new file mode 100644
index 0000000..8ffbdaf
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DestroyMessageTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.DestroyOperation.DestroyMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DestroyMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DestroyMessage mockDestroyOperation = mock(DestroyMessage.class);
+ DistributedRegion mockDistributedRegion = mock(DistributedRegion.class);
+ InternalCacheEvent mockInternalCacheEvent = mock(InternalCacheEvent.class);
+
+ when(mockDestroyOperation.createEvent(eq(mockDistributedRegion)))
+ .thenReturn(mockInternalCacheEvent);
+
+ assertThat(mockDestroyOperation.createEvent(mockDistributedRegion))
+ .isEqualTo(mockInternalCacheEvent);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegCacheXmlJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegCacheXmlJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegCacheXmlJUnitTest.java
index dd29c74..81747f1 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegCacheXmlJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegCacheXmlJUnitTest.java
@@ -240,7 +240,7 @@ public class DiskRegCacheXmlJUnitTest {
}
/** Close the cache */
- private synchronized final void closeCache() {
+ private synchronized void closeCache() {
if (cache != null) {
try {
if (!cache.isClosed()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionClearJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionClearJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionClearJUnitTest.java
index 63e6d62..8a99972 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionClearJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionClearJUnitTest.java
@@ -120,7 +120,7 @@ public class DiskRegionClearJUnitTest {
}
/** Close the cache */
- private static synchronized final void closeCache() {
+ private static synchronized void closeCache() {
if (cache != null) {
try {
if (!cache.isClosed()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
index 913d56d..2d3ac3a 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
@@ -175,7 +175,7 @@ public abstract class DiskRegionTestingBase {
}
/** Close the cache */
- private static synchronized final void closeCache() {
+ private static synchronized void closeCache() {
if (cache != null) {
try {
if (!cache.isClosed()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/DistPeerTXStateStubTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistPeerTXStateStubTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistPeerTXStateStubTest.java
new file mode 100644
index 0000000..f2806fe
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistPeerTXStateStubTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.tx.DistTxEntryEvent;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+
+@Category(UnitTest.class)
+public class DistPeerTXStateStubTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistPeerTXStateStub mockDistPeerTXStateStub = mock(DistPeerTXStateStub.class);
+ DistTxEntryEvent mockDistTxEntryEvent = mock(DistTxEntryEvent.class);
+ ArrayList<DistTxEntryEvent> arrayOfDistTxEntryEvents = new ArrayList<>();
+ arrayOfDistTxEntryEvents.add(mockDistTxEntryEvent);
+
+ when(mockDistPeerTXStateStub.getPrimaryTransactionalOperations())
+ .thenReturn(arrayOfDistTxEntryEvents);
+
+ assertThat(mockDistPeerTXStateStub.getPrimaryTransactionalOperations())
+ .isSameAs(arrayOfDistTxEntryEvents);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedCacheOperationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedCacheOperationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedCacheOperationTest.java
new file mode 100644
index 0000000..cba7c98
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedCacheOperationTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.DistributedCacheOperation.CacheOperationMessage;
+import org.apache.geode.internal.cache.persistence.PersistentMemberID;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Category(UnitTest.class)
+public class DistributedCacheOperationTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributedCacheOperation mockDistributedCacheOperation = mock(DistributedCacheOperation.class);
+ CacheOperationMessage mockCacheOperationMessage = mock(CacheOperationMessage.class);
+ Map<InternalDistributedMember, PersistentMemberID> persistentIds = new HashMap<>();
+ when(mockDistributedCacheOperation.supportsDirectAck()).thenReturn(false);
+
+ mockDistributedCacheOperation.waitForAckIfNeeded(mockCacheOperationMessage, persistentIds);
+
+ verify(mockDistributedCacheOperation, times(1)).waitForAckIfNeeded(mockCacheOperationMessage,
+ persistentIds);
+
+ assertThat(mockDistributedCacheOperation.supportsDirectAck()).isFalse();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedPutAllOperationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedPutAllOperationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedPutAllOperationTest.java
new file mode 100644
index 0000000..3d60475
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedPutAllOperationTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributedPutAllOperationTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributedPutAllOperation mockDistributedPutAllOperation =
+ mock(DistributedPutAllOperation.class);
+ EntryEventImpl mockEntryEventImpl = mock(EntryEventImpl.class);
+
+ when(mockDistributedPutAllOperation.getBaseEvent()).thenReturn(mockEntryEventImpl);
+
+ assertThat(mockDistributedPutAllOperation.getBaseEvent()).isSameAs(mockEntryEventImpl);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessageTest.java
new file mode 100644
index 0000000..7c6aebc
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessageTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributedRegionFunctionStreamingMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributedRegionFunctionStreamingMessage mockDistributedRegionFunctionStreamingMessage =
+ mock(DistributedRegionFunctionStreamingMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ DistributedRegion mockDistributedRegion = mock(DistributedRegion.class);
+
+ when(mockDistributedRegionFunctionStreamingMessage
+ .operateOnDistributedRegion(eq(mockDistributionManager), eq(mockDistributedRegion)))
+ .thenReturn(true);
+
+ assertThat(mockDistributedRegionFunctionStreamingMessage
+ .operateOnDistributedRegion(mockDistributionManager, mockDistributedRegion)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionTest.java
new file mode 100644
index 0000000..67b0c6c
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributedRegionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributedRegion mockDistributedRegion = mock(DistributedRegion.class);
+ EntryEventImpl mockEntryEventImpl = mock(EntryEventImpl.class);
+ Object returnValue = new Object();
+
+ when(mockDistributedRegion.validatedDestroy(anyObject(), eq(mockEntryEventImpl)))
+ .thenReturn(returnValue);
+
+ assertThat(mockDistributedRegion.validatedDestroy(new Object(), mockEntryEventImpl))
+ .isSameAs(returnValue);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRemoveAllOperationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRemoveAllOperationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRemoveAllOperationTest.java
new file mode 100644
index 0000000..42780db
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRemoveAllOperationTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributedRemoveAllOperationTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributedRemoveAllOperation mockDistributedRemoveAllOperation =
+ mock(DistributedRemoveAllOperation.class);
+ EntryEventImpl mockEntryEventImpl = mock(EntryEventImpl.class);
+
+ when(mockDistributedRemoveAllOperation.getBaseEvent()).thenReturn(mockEntryEventImpl);
+
+ assertThat(mockDistributedRemoveAllOperation.getBaseEvent()).isSameAs(mockEntryEventImpl);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/ExpiryTaskTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ExpiryTaskTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ExpiryTaskTest.java
new file mode 100644
index 0000000..4bcebda
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ExpiryTaskTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class ExpiryTaskTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ ExpiryTask mockExpiryTask = mock(ExpiryTask.class);
+ mockExpiryTask.run2();
+ verify(mockExpiryTask, times(1)).run2();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
index a24fc5a..d867959 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.internal.cache;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
@@ -22,6 +23,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import org.apache.geode.internal.cache.control.InternalResourceManager;
import org.awaitility.Awaitility;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -38,6 +40,17 @@ import org.apache.geode.test.junit.categories.UnitTest;
public class GemFireCacheImplTest {
@Test
+ public void shouldBeMockable() throws Exception {
+ GemFireCacheImpl mockGemFireCacheImpl = mock(GemFireCacheImpl.class);
+ InternalResourceManager mockInternalResourceManager = mock(InternalResourceManager.class);
+
+ when(mockGemFireCacheImpl.getInternalResourceManager()).thenReturn(mockInternalResourceManager);
+
+ assertThat(mockGemFireCacheImpl.getInternalResourceManager())
+ .isSameAs(mockInternalResourceManager);
+ }
+
+ @Test
public void checkPurgeCCPTimer() {
InternalDistributedSystem ds = Fakes.distributedSystem();
CacheConfig cc = new CacheConfig();
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/GridProfileTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/GridProfileTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/GridProfileTest.java
new file mode 100644
index 0000000..afaa04b
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/GridProfileTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
+import org.apache.geode.distributed.internal.DistributionAdvisor.ProfileId;
+import org.apache.geode.internal.cache.GridAdvisor.GridProfile;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Category(UnitTest.class)
+public class GridProfileTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ GridProfile mockGridProfile = mock(GridProfile.class);
+ ProfileId mockProfileId = mock(ProfileId.class);
+ List<Profile> listOfProfiles = new ArrayList<>();
+ listOfProfiles.add(mock(Profile.class));
+
+ when(mockGridProfile.getHost()).thenReturn("HOST");
+ when(mockGridProfile.getPort()).thenReturn(1);
+ when(mockGridProfile.getId()).thenReturn(mockProfileId);
+
+ mockGridProfile.setHost("host");
+ mockGridProfile.setPort(2);
+ mockGridProfile.tellLocalControllers(true, true, listOfProfiles);
+ mockGridProfile.tellLocalBridgeServers(true, true, listOfProfiles);
+
+ verify(mockGridProfile, times(1)).setHost("host");
+ verify(mockGridProfile, times(1)).setPort(2);
+ verify(mockGridProfile, times(1)).tellLocalControllers(true, true, listOfProfiles);
+ verify(mockGridProfile, times(1)).tellLocalBridgeServers(true, true, listOfProfiles);
+
+ assertThat(mockGridProfile.getHost()).isEqualTo("HOST");
+ assertThat(mockGridProfile.getPort()).isEqualTo(1);
+ assertThat(mockGridProfile.getId()).isSameAs(mockProfileId);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessageTest.java
new file mode 100644
index 0000000..b9cb872
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessageTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class MemberFunctionStreamingMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ MemberFunctionStreamingMessage mockMemberFunctionStreamingMessage =
+ mock(MemberFunctionStreamingMessage.class);
+ InternalDistributedMember mockInternalDistributedMember = mock(InternalDistributedMember.class);
+ when(mockMemberFunctionStreamingMessage.getMemberToMasqueradeAs())
+ .thenReturn(mockInternalDistributedMember);
+ assertThat(mockMemberFunctionStreamingMessage.getMemberToMasqueradeAs())
+ .isSameAs(mockInternalDistributedMember);
+ }
+}
[07/14] geode git commit: GEODE-1994: Overhaul of
internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HandShake.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HandShake.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HandShake.java
index 0b11bf1..388f838 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HandShake.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HandShake.java
@@ -14,7 +14,49 @@
*/
package org.apache.geode.internal.cache.tier.sockets;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.apache.geode.distributed.ConfigurationProperties.CONFLATE_EVENTS;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_CLIENT_AUTHENTICATOR;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_CLIENT_AUTH_INIT;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.CancelCriterion;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.GemFireConfigException;
+import org.apache.geode.InternalGemFireException;
+import org.apache.geode.cache.GatewayConfigurationException;
+import org.apache.geode.cache.client.PoolFactory;
+import org.apache.geode.cache.client.ServerRefusedConnectionException;
+import org.apache.geode.cache.client.internal.Connection;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.DistributedSystem;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.LonerDistributionManager;
+import org.apache.geode.distributed.internal.ServerLocation;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.ClassLoadUtil;
+import org.apache.geode.internal.HeapDataOutputStream;
+import org.apache.geode.internal.InternalDataSerializer;
+import org.apache.geode.internal.InternalInstantiator;
+import org.apache.geode.internal.Version;
+import org.apache.geode.internal.VersionedDataInputStream;
+import org.apache.geode.internal.VersionedDataOutputStream;
+import org.apache.geode.internal.cache.tier.Acceptor;
+import org.apache.geode.internal.cache.tier.ClientHandShake;
+import org.apache.geode.internal.cache.tier.ConnectionProxy;
+import org.apache.geode.internal.i18n.LocalizedStrings;
+import org.apache.geode.internal.logging.InternalLogWriter;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.security.IntegratedSecurityService;
+import org.apache.geode.internal.security.SecurityService;
+import org.apache.geode.pdx.internal.PeerTypeRegistration;
+import org.apache.geode.security.AuthInitialize;
+import org.apache.geode.security.AuthenticationFailedException;
+import org.apache.geode.security.AuthenticationRequiredException;
+import org.apache.geode.security.Authenticator;
+import org.apache.geode.security.GemFireSecurityException;
+import org.apache.logging.log4j.Logger;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
@@ -49,7 +91,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-
import javax.crypto.Cipher;
import javax.crypto.KeyAgreement;
import javax.crypto.SecretKey;
@@ -58,46 +99,6 @@ import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.SSLSocket;
-import org.apache.geode.CancelCriterion;
-import org.apache.geode.DataSerializer;
-import org.apache.geode.GemFireConfigException;
-import org.apache.geode.InternalGemFireException;
-import org.apache.geode.cache.GatewayConfigurationException;
-import org.apache.geode.cache.client.PoolFactory;
-import org.apache.geode.cache.client.ServerRefusedConnectionException;
-import org.apache.geode.cache.client.internal.Connection;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.distributed.internal.DM;
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.distributed.internal.LonerDistributionManager;
-import org.apache.geode.distributed.internal.ServerLocation;
-import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.ClassLoadUtil;
-import org.apache.geode.internal.HeapDataOutputStream;
-import org.apache.geode.internal.InternalDataSerializer;
-import org.apache.geode.internal.InternalInstantiator;
-import org.apache.geode.internal.Version;
-import org.apache.geode.internal.VersionedDataInputStream;
-import org.apache.geode.internal.VersionedDataOutputStream;
-import org.apache.geode.internal.cache.tier.Acceptor;
-import org.apache.geode.internal.cache.tier.ClientHandShake;
-import org.apache.geode.internal.cache.tier.ConnectionProxy;
-import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.logging.InternalLogWriter;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.security.IntegratedSecurityService;
-import org.apache.geode.internal.security.SecurityService;
-import org.apache.geode.pdx.internal.PeerTypeRegistration;
-import org.apache.geode.security.AuthInitialize;
-import org.apache.geode.security.AuthenticationFailedException;
-import org.apache.geode.security.AuthenticationRequiredException;
-import org.apache.geode.security.Authenticator;
-import org.apache.geode.security.GemFireSecurityException;
-import org.apache.logging.log4j.Logger;
-
public class HandShake implements ClientHandShake {
private static final Logger logger = LogService.getLogger();
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/lang/StringUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/lang/StringUtils.java b/geode-core/src/main/java/org/apache/geode/internal/lang/StringUtils.java
index 499d546..8a44564 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/lang/StringUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/lang/StringUtils.java
@@ -22,91 +22,30 @@ import org.apache.geode.internal.cache.Token;
* The StringUtils is an abstract utility class for working with and invoking operations on String
* literals.
* <p/>
- *
+ *
* @see java.lang.String
* @since GemFire 7.0
*/
@SuppressWarnings("unused")
-public abstract class StringUtils {
+@Deprecated
+public class StringUtils extends org.apache.commons.lang.StringUtils {
public static final String COMMA_DELIMITER = ",";
- public static final String EMPTY_STRING = "";
public static final String LINE_SEPARATOR = System.getProperty("line.separator");
public static final String SPACE = " ";
- public static final String UTF_8 = "UTF-8";
-
- public static final String[] EMPTY_STRING_ARRAY = new String[0];
- public static final String[] SPACES = {"", " ", " ", " ", " ", " ", " ", " ",
- " ", " ", " "};
-
- /**
- * Concatenates all Objects in the array into a single String by calling toString on the Object.
- * </p>
- *
- * @param values the Object elements of the array to be concatenated into the String.
- * @return a single String with all the individual Objects in the array concatenated.
- * @see #concat(Object[], String)
- */
- public static String concat(final Object... values) {
- return concat(values, EMPTY_STRING);
- }
-
- /**
- * Concatenates all Objects in the array into a single String using the Object's toString method,
- * delimited by the specified delimiter.
- * </p>
- *
- * @param values an array of Objects to concatenate into a single String value.
- * @param delimiter the String value to use as a separator between the individual Object values.
- * If delimiter is null, then a empty String is used.
- * @return a single String with all the individual Objects of the array concatenated together,
- * separated by the specified delimiter.
- * @see java.lang.Object#toString()
- * @see java.lang.StringBuilder
- */
- public static String concat(final Object[] values, String delimiter) {
- delimiter = ObjectUtils.defaultIfNull(delimiter, EMPTY_STRING);
-
- final StringBuilder buffer = new StringBuilder();
- int count = 0;
-
- if (values != null) {
- for (Object value : values) {
- buffer.append(count++ > 0 ? delimiter : EMPTY_STRING);
- buffer.append(value);
- }
- }
-
- return buffer.toString();
- }
+ private static final int MAX_ARRAY_ELEMENTS_TO_CONVERT =
+ Integer.getInteger("StringUtils.MAX_ARRAY_ELEMENTS_TO_CONVERT", 16);
- /**
- * Returns the first non-null, non-empty and non-blank String value in the array of String values.
- * </p>
- *
- * @param values an array of String values, usually consisting of the preferred value followed by
- * default values if any value in the array of String values is null, empty or blank.
- * @return the first non-null, non-empty and non-blank String value in the array of Strings. If
- * all values are either null, empty or blank then null is returned.
- * @see #isBlank(String)
- */
- public static String defaultIfBlank(final String... values) {
- if (values != null) {
- for (final String value : values) {
- if (!isBlank(value)) {
- return value;
- }
- }
- }
- return null;
+ public static String nullifyIfBlank(final String value) {
+ return isBlank(value) ? null : value;
}
/**
* Returns only the digits (0..9) from the specified String value.
* </p>
- *
+ *
* @param value the String value from which to extract digits.
* @return only the digits from the specified String value. If the String is null or contains no
* digits, then this method returns an empty String.
@@ -126,156 +65,7 @@ public abstract class StringUtils {
return buffer.toString();
}
- /**
- * Returns only the letters (a..zA..Z) from the specified String value.
- * </p>
- *
- * @param value the String value from which to extract letters.
- * @return only the letters from the specified String value. If the String is null or contains no
- * letters, then this method returns an empty String.
- * @see java.lang.Character#isLetter(char)
- */
- public static String getLettersOnly(final String value) {
- final StringBuilder buffer = new StringBuilder();
-
- if (value != null) {
- for (final char chr : value.toCharArray()) {
- if (Character.isLetter(chr)) {
- buffer.append(chr);
- }
- }
- }
-
- return buffer.toString();
- }
-
- /**
- * Gets a number of spaces determined by number.
- * </p>
- *
- * @param number an integer value indicating the number of spaces to return.
- * @return a String value containing a number of spaces given by number.
- */
- public static String getSpaces(int number) {
- final StringBuilder spaces = new StringBuilder(SPACES[Math.min(number, SPACES.length - 1)]);
-
- do {
- number -= (SPACES.length - 1);
- number = Math.max(number, 0);
- spaces.append(SPACES[Math.min(number, SPACES.length - 1)]);
- } while (number > 0);
-
- return spaces.toString();
- }
-
- /**
- * Determines whether the specified String value is blank, which is true if it is null, an empty
- * String or a String containing only spaces (blanks).
- * </p>
- *
- * @param value the String value used in the determination for the "blank" check.
- * @return a boolean value indicating whether the specified String is blank.
- * @see #isEmpty(String)
- */
- public static boolean isBlank(final String value) {
- return (value == null || EMPTY_STRING.equals(value.trim()));
- }
-
- /**
- * Determines whether the specified String value is empty, which is true if and only if the value
- * is the empty String.
- * </p>
- *
- * @param value the String value used in the determination of the "empty" check.
- * @return a boolean value indicating if the specified String is empty.
- * @see #isBlank(String)
- */
- public static boolean isEmpty(final String value) {
- return EMPTY_STRING.equals(value);
- }
-
- /**
- * Pads the specified String value by appending the specified character up to the given length.
- * </p>
- *
- * @param value the String value to pad by appending 'paddingCharacter' to the end.
- * @param paddingCharacter the character used to pad the end of the String value.
- * @param length an int value indicating the final length of the String value with padding of the
- * 'paddingCharacter'.
- * @return the String value padded with the specified character by appending 'paddingCharacter' to
- * the end of the String value up to the given length.
- * @throws NullPointerException if the String value is null.
- */
- public static String padEnding(final String value, final char paddingCharacter,
- final int length) {
- if (value == null) {
- throw new NullPointerException("The String value to pad cannot be null!");
- }
-
- final StringBuilder buffer = new StringBuilder(value);
-
- for (int valueLength = value.length(); valueLength < length; valueLength++) {
- buffer.append(paddingCharacter);
- }
-
- return buffer.toString();
- }
-
- /**
- * A null-safe implementation of the String.toLowerCase method.
- * </p>
- *
- * @param value a String value to convert to lower case.
- * @return a lower case representation of the specified String value.
- * @see java.lang.String#toLowerCase()
- */
- public static String toLowerCase(final String value) {
- return (value == null ? null : value.toLowerCase());
- }
-
- /**
- * A null-safe implementation of the String.toUpperCase method.
- * </p>
- *
- * @param value a String value to convert to upper case.
- * @return an upper case representation of the specified String value.
- * @see java.lang.String#toUpperCase()
- */
- public static String toUpperCase(final String value) {
- return (value == null ? null : value.toUpperCase());
- }
- /**
- * A method to trim the value of a String and guard against null values.
- * <p/>
- *
- * @param value the String value that will be trimmed if not null.
- * @return null if the String value is null or the trimmed version of the String value if String
- * value is not null.
- * @see java.lang.String#trim()
- */
- public static String trim(final String value) {
- return (value == null ? null : value.trim());
- }
-
- /**
- * Null-safe implementation of String truncate using substring. Truncates the specified String
- * value to the specified length. Returns null if the String value is null.
- * </p>
- *
- * @param value the String value to truncate.
- * @param length an int value indicating the length to truncate the String value to.
- * @return the String value truncated to specified length, or null if the String value is null.
- * @throws IllegalArgumentException if the value of length is less than 0.
- * @see java.lang.String#substring(int, int)
- */
- public static String truncate(final String value, final int length) {
- if (length < 0) {
- throw new IllegalArgumentException("Length must be greater than equal to 0!");
- }
-
- return (value == null ? null : value.substring(0, Math.min(value.length(), length)));
- }
/**
* Gets the value of the specified Object as a String. If the Object is null then the first
@@ -283,9 +73,9 @@ public abstract class StringUtils {
* String values is null or all the elements in the default String values array are null, then the
* value of String.valueOf(value) is returned.
* </p>
- *
+ *
* @param value the Object who's String representation is being evaluated.
- * @param defaultValues an array of default String values to assess if the specified Object value
+ * @param defaultValue an array of default String values to assess if the specified Object value
* is null.
* @return a String representation of the specified Object value or one of the default String
* values from the array if the Object value is null. If either the default String array
@@ -293,20 +83,12 @@ public abstract class StringUtils {
* returned.
* @see java.lang.String#valueOf(Object)
*/
- public static String valueOf(final Object value, final String... defaultValues) {
- if (value != null) {
- return value.toString();
- } else {
- if (defaultValues != null) {
- for (String defaultValue : defaultValues) {
- if (defaultValue != null) {
- return defaultValue;
- }
- }
- }
+ public static String defaultString(final Object value, final String defaultValue) {
+ return value == null ? defaultValue : value.toString();
+ }
- return String.valueOf(value);
- }
+ public static String defaultString(final Object value) {
+ return value == null ? EMPTY : value.toString();
}
/**
@@ -314,7 +96,7 @@ public abstract class StringUtils {
* characters in each line, indenting all subsequent lines with the indent. If the indent is null,
* then an empty String is used.
* </p>
- *
+ *
* @param line a String containing the line of text to wrap.
* @param widthInCharacters an integer value indicating the width of each line measured by the
* number of characters.
@@ -324,18 +106,19 @@ public abstract class StringUtils {
* boundaries within the given width on any given split.
* @throws NullPointerException if the line of text is null.
*/
+ // Can be removed when commons is updated.
public static String wrap(String line, final int widthInCharacters, String indent) {
final StringBuilder buffer = new StringBuilder();
int lineCount = 1;
- int spaceIndex = -1;
+ int spaceIndex;
// if indent is null, then do not indent the wrapped lines
- indent = valueOf(indent, EMPTY_STRING);
+ indent = StringUtils.defaultString(indent);
while (line.length() > widthInCharacters) {
spaceIndex = line.substring(0, widthInCharacters).lastIndexOf(SPACE);
- buffer.append(lineCount++ > 1 ? indent : EMPTY_STRING);
+ buffer.append(lineCount++ > 1 ? indent : EMPTY);
// throws IndexOutOfBoundsException if spaceIndex is -1, implying no word boundary was found
// within
// the given width; this also avoids the infinite loop
@@ -351,13 +134,10 @@ public abstract class StringUtils {
return buffer.toString();
}
- private static final int MAX_ARRAY_ELEMENTS_TO_CONVERT =
- Integer.getInteger("StringUtils.MAX_ARRAY_ELEMENTS_TO_CONVERT", 16);
-
/**
* Used to convert the given object to a String. If anything goes wrong in this conversion put
* some info about what went wrong on the result string but do not throw an exception.
- *
+ *
* @param o the object to convert to a string
* @return the string from of the given object.
*/
@@ -373,7 +153,7 @@ public abstract class StringUtils {
* Convert an object to a string and return it. Handled CacheDeserializables without having them
* change the form they store. If deserialization is needed and fails then the string contains a
* message saying so instead of throwing an exception.
- *
+ *
* @param o the object to convert to a string
* @param convertArrayContents if true then the contents of the array will be in the string;
* otherwise just the array identity
@@ -414,13 +194,15 @@ public abstract class StringUtils {
}
}
- private static String arrayToString(Object[] a, int maxArrayElements) {
+
+ private static <T> String arrayToString(T[] a, int maxArrayElements) {
if (maxArrayElements < 0) {
maxArrayElements = 0;
}
if (a == null) {
return "null";
}
+ String className = a.getClass().getSimpleName();
int iMax = a.length;
if (iMax > maxArrayElements) {
iMax = maxArrayElements;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java b/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java
index 2e47556..4c50851 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java
@@ -80,8 +80,8 @@ public class SystemUtils {
actualVersionDigits = StringUtils.getDigitsOnly(System.getProperty("java.version"));
}
- String expectedVersionDigits = StringUtils.padEnding(StringUtils.getDigitsOnly(expectedVersion),
- '0', actualVersionDigits.length());
+ String expectedVersionDigits = StringUtils.rightPad(StringUtils.getDigitsOnly(expectedVersion),
+ actualVersionDigits.length(), '0');
try {
return Long.parseLong(actualVersionDigits) >= Long.parseLong(expectedVersionDigits);
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/process/FileProcessController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/process/FileProcessController.java b/geode-core/src/main/java/org/apache/geode/internal/process/FileProcessController.java
index 629740c..c8ec49d 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/process/FileProcessController.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/process/FileProcessController.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.internal.process;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
@@ -101,8 +102,7 @@ public class FileProcessController implements ProcessController {
LocalizedStrings.Launcher_ATTACH_API_NOT_FOUND_ERROR_MESSAGE.toLocalizedString());
}
- private void stop(final File workingDir, final String stopRequestFileName)
- throws UnableToControlProcessException, IOException {
+ private void stop(final File workingDir, final String stopRequestFileName) throws IOException {
final File stopRequestFile = new File(workingDir, stopRequestFileName);
if (!stopRequestFile.exists()) {
stopRequestFile.createNewFile();
@@ -110,11 +110,10 @@ public class FileProcessController implements ProcessController {
}
private String status(final File workingDir, final String statusRequestFileName,
- final String statusFileName)
- throws UnableToControlProcessException, IOException, InterruptedException, TimeoutException {
+ final String statusFileName) throws IOException, InterruptedException, TimeoutException {
// monitor for statusFile
final File statusFile = new File(workingDir, statusFileName);
- final AtomicReference<String> statusRef = new AtomicReference<String>();
+ final AtomicReference<String> statusRef = new AtomicReference<>();
final ControlRequestHandler statusHandler = new ControlRequestHandler() {
@Override
@@ -162,7 +161,7 @@ public class FileProcessController implements ProcessController {
}
final String lines = statusRef.get();
- if (null == lines || lines.trim().isEmpty()) {
+ if (StringUtils.isBlank(lines)) {
throw new IllegalStateException("Failed to read status file");
}
return lines;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/process/signal/Signal.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/process/signal/Signal.java b/geode-core/src/main/java/org/apache/geode/internal/process/signal/Signal.java
index faab4ed..78b19db 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/process/signal/Signal.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/process/signal/Signal.java
@@ -15,7 +15,7 @@
package org.apache.geode.internal.process.signal;
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
/**
* Signals defined in the enumerated type were based on Open BSD and the IBM JVM...
@@ -78,7 +78,7 @@ public enum Signal {
private final String name;
Signal(final int number, final String name, final SignalType type, final String description) {
- assertValidArgument(!StringUtils.isBlank(name), "The name of the signal must be specified!");
+ assertValidArgument(StringUtils.isNotBlank(name), "The name of the signal must be specified!");
this.number = number;
this.name = name;
this.type = type;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/security/IntegratedSecurityService.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/security/IntegratedSecurityService.java b/geode-core/src/main/java/org/apache/geode/internal/security/IntegratedSecurityService.java
index 8366930..600d546 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/security/IntegratedSecurityService.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/security/IntegratedSecurityService.java
@@ -293,7 +293,7 @@ public class IntegratedSecurityService implements SecurityService {
String clientAuthenticatorConfig = securityProps.getProperty(SECURITY_CLIENT_AUTHENTICATOR);
String peerAuthenticatorConfig = securityProps.getProperty(SECURITY_PEER_AUTHENTICATOR);
- if (!StringUtils.isBlank(shiroConfig)) {
+ if (StringUtils.isNotBlank(shiroConfig)) {
IniSecurityManagerFactory factory = new IniSecurityManagerFactory("classpath:" + shiroConfig);
// we will need to make sure that shiro uses a case sensitive permission resolver
@@ -311,20 +311,20 @@ public class IntegratedSecurityService implements SecurityService {
isPeerAuthenticator = false;
}
// only set up shiro realm if user has implemented SecurityManager
- else if (!StringUtils.isBlank(securityManagerConfig)) {
+ else if (StringUtils.isNotBlank(securityManagerConfig)) {
SecurityManager securityManager = SecurityService
.getObjectOfTypeFromClassName(securityManagerConfig, SecurityManager.class);
securityManager.init(securityProps);
this.setSecurityManager(securityManager);
} else {
isIntegratedSecurity = null;
- isClientAuthenticator = !StringUtils.isBlank(clientAuthenticatorConfig);
- isPeerAuthenticator = !StringUtils.isBlank(peerAuthenticatorConfig);
+ isClientAuthenticator = StringUtils.isNotBlank(clientAuthenticatorConfig);
+ isPeerAuthenticator = StringUtils.isNotBlank(peerAuthenticatorConfig);
}
// this initializes the post processor
String customPostProcessor = securityProps.getProperty(SECURITY_POST_PROCESSOR);
- if (!StringUtils.isBlank(customPostProcessor)) {
+ if (StringUtils.isNotBlank(customPostProcessor)) {
postProcessor =
SecurityService.getObjectOfTypeFromClassName(customPostProcessor, PostProcessor.class);
postProcessor.init(securityProps);
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/util/ArrayUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/util/ArrayUtils.java b/geode-core/src/main/java/org/apache/geode/internal/util/ArrayUtils.java
index 6f1c7cc..6f1292a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/util/ArrayUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/util/ArrayUtils.java
@@ -15,15 +15,12 @@
package org.apache.geode.internal.util;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.internal.offheap.annotations.Unretained;
+
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.List;
-import java.util.Objects;
-import java.util.RandomAccess;
-
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.offheap.annotations.Unretained;
/**
*
@@ -82,7 +79,7 @@ public abstract class ArrayUtils {
if (array != null) {
for (final Object element : array) {
- buffer.append(count++ > 0 ? ", " : StringUtils.EMPTY_STRING).append(element);
+ buffer.append(count++ > 0 ? ", " : StringUtils.EMPTY).append(element);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/util/IOUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/util/IOUtils.java b/geode-core/src/main/java/org/apache/geode/internal/util/IOUtils.java
index c1a1952..031f827 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/util/IOUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/util/IOUtils.java
@@ -14,8 +14,8 @@
*/
package org.apache.geode.internal.util;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.lang.StringUtils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -186,7 +186,7 @@ public abstract class IOUtils {
public static String getFilename(final String pathname) {
String filename = pathname;
- if (!StringUtils.isBlank(filename)) {
+ if (StringUtils.isNotBlank(filename)) {
final int index = filename.lastIndexOf(File.separator);
filename = (index == -1 ? filename : filename.substring(index + 1));
}
@@ -205,7 +205,7 @@ public abstract class IOUtils {
* @see java.io.File#exists()
*/
public static boolean isExistingPathname(final String pathname) {
- return (!StringUtils.isBlank(pathname) && new File(pathname).exists());
+ return (StringUtils.isNotBlank(pathname) && new File(pathname).exists());
}
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java b/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java
index ba15508..3bd442a 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java
@@ -15,8 +15,8 @@
package org.apache.geode.management.internal;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.logging.log4j.Logger;
@@ -53,7 +53,7 @@ public class AgentUtil {
*/
public String findWarLocation(String warFilePrefix) {
String geodeHome = getGeodeHome();
- if (!StringUtils.isBlank(geodeHome)) {
+ if (StringUtils.isNotBlank(geodeHome)) {
String[] possibleFiles =
{geodeHome + "/tools/Extensions/" + warFilePrefix + "-" + gemfireVersion + ".war",
geodeHome + "/tools/Pulse/" + warFilePrefix + "-" + gemfireVersion + ".war",
@@ -91,7 +91,7 @@ public class AgentUtil {
}
public boolean isWebApplicationAvailable(final String warFileLocation) {
- return !StringUtils.isBlank(warFileLocation);
+ return StringUtils.isNotBlank(warFileLocation);
}
public boolean isWebApplicationAvailable(final String... warFileLocations) {
@@ -124,6 +124,6 @@ public class AgentUtil {
public boolean isGemfireHomeDefined() {
String gemfireHome = getGeodeHome();
- return !StringUtils.isBlank(gemfireHome);
+ return StringUtils.isNotBlank(gemfireHome);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/JettyHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/JettyHelper.java b/geode-core/src/main/java/org/apache/geode/management/internal/JettyHelper.java
index 7c26297..92987cb 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/JettyHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/JettyHelper.java
@@ -14,9 +14,10 @@
*/
package org.apache.geode.management.internal;
-import java.io.File;
-import java.util.concurrent.CountDownLatch;
-
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.GemFireConfigException;
+import org.apache.geode.internal.admin.SSLConfig;
+import org.apache.geode.internal.logging.LogService;
import org.apache.logging.log4j.Logger;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.server.Connector;
@@ -30,10 +31,8 @@ import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.webapp.WebAppContext;
-import org.apache.geode.GemFireConfigException;
-import org.apache.geode.internal.admin.SSLConfig;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.logging.LogService;
+import java.io.File;
+import java.util.concurrent.CountDownLatch;
/**
* @since GemFire 8.1
@@ -70,13 +69,13 @@ public class JettyHelper {
if (sslConfig.isEnabled()) {
SslContextFactory sslContextFactory = new SslContextFactory();
- if (!StringUtils.isBlank(sslConfig.getAlias())) {
+ if (StringUtils.isNotBlank(sslConfig.getAlias())) {
sslContextFactory.setCertAlias(sslConfig.getAlias());
}
sslContextFactory.setNeedClientAuth(sslConfig.isRequireAuth());
- if (!StringUtils.isBlank(sslConfig.getCiphers())
+ if (StringUtils.isNotBlank(sslConfig.getCiphers())
&& !"any".equalsIgnoreCase(sslConfig.getCiphers())) {
// If use has mentioned "any" let the SSL layer decide on the ciphers
sslContextFactory.setIncludeCipherSuites(SSLUtil.readArray(sslConfig.getCiphers()));
@@ -97,19 +96,19 @@ public class JettyHelper {
sslContextFactory.setKeyStorePath(sslConfig.getKeystore());
- if (!StringUtils.isBlank(sslConfig.getKeystoreType())) {
+ if (StringUtils.isNotBlank(sslConfig.getKeystoreType())) {
sslContextFactory.setKeyStoreType(sslConfig.getKeystoreType());
}
- if (!StringUtils.isBlank(sslConfig.getKeystorePassword())) {
+ if (StringUtils.isNotBlank(sslConfig.getKeystorePassword())) {
sslContextFactory.setKeyStorePassword(sslConfig.getKeystorePassword());
}
- if (!StringUtils.isBlank(sslConfig.getTruststore())) {
+ if (StringUtils.isNotBlank(sslConfig.getTruststore())) {
sslContextFactory.setTrustStorePath(sslConfig.getTruststore());
}
- if (!StringUtils.isBlank(sslConfig.getTruststorePassword())) {
+ if (StringUtils.isNotBlank(sslConfig.getTruststorePassword())) {
sslContextFactory.setTrustStorePassword(sslConfig.getTruststorePassword());
}
@@ -131,7 +130,7 @@ public class JettyHelper {
jettyServer.setConnectors(new Connector[] {connector});
- if (!StringUtils.isBlank(bindAddress)) {
+ if (StringUtils.isNotBlank(bindAddress)) {
connector.setHost(bindAddress);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
index bf0b99c..3e6e4484 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
@@ -14,6 +14,32 @@
*/
package org.apache.geode.management.internal;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.GemFireConfigException;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.internal.GemFireVersion;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.net.SSLConfigurationFactory;
+import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.net.SocketCreatorFactory;
+import org.apache.geode.internal.security.SecurableCommunicationChannel;
+import org.apache.geode.internal.security.SecurityService;
+import org.apache.geode.internal.security.shiro.JMXShiroAuthenticator;
+import org.apache.geode.internal.tcp.TCPConduit;
+import org.apache.geode.management.ManagementException;
+import org.apache.geode.management.ManagementService;
+import org.apache.geode.management.ManagerMXBean;
+import org.apache.geode.management.internal.security.AccessControlMBean;
+import org.apache.geode.management.internal.security.MBeanServerWrapper;
+import org.apache.geode.management.internal.security.ResourceConstants;
+import org.apache.geode.management.internal.unsafe.ReadOpFileAccessController;
+import org.apache.logging.log4j.Logger;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+
import java.io.IOException;
import java.io.Serializable;
import java.lang.management.ManagementFactory;
@@ -29,7 +55,6 @@ import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.UnicastRemoteObject;
import java.util.HashMap;
import java.util.Set;
-
import javax.management.InstanceAlreadyExistsException;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
@@ -43,33 +68,6 @@ import javax.management.remote.rmi.RMIJRMPServerImpl;
import javax.management.remote.rmi.RMIServerImpl;
import javax.rmi.ssl.SslRMIClientSocketFactory;
-import org.apache.logging.log4j.Logger;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-
-import org.apache.geode.GemFireConfigException;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.DistributionManager;
-import org.apache.geode.internal.GemFireVersion;
-import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.net.SSLConfigurationFactory;
-import org.apache.geode.internal.net.SocketCreator;
-import org.apache.geode.internal.net.SocketCreatorFactory;
-import org.apache.geode.internal.security.SecurableCommunicationChannel;
-import org.apache.geode.internal.security.SecurityService;
-import org.apache.geode.internal.security.shiro.JMXShiroAuthenticator;
-import org.apache.geode.internal.tcp.TCPConduit;
-import org.apache.geode.management.ManagementException;
-import org.apache.geode.management.ManagementService;
-import org.apache.geode.management.ManagerMXBean;
-import org.apache.geode.management.internal.security.AccessControlMBean;
-import org.apache.geode.management.internal.security.MBeanServerWrapper;
-import org.apache.geode.management.internal.security.ResourceConstants;
-import org.apache.geode.management.internal.unsafe.ReadOpFileAccessController;
-
/**
* Agent implementation that controls the JMX server end points for JMX clients to connect, such as
* an RMI server.
@@ -317,9 +315,9 @@ public class ManagementAgent {
}
private String getHost(final String bindAddress) throws UnknownHostException {
- if (!StringUtils.isBlank(this.config.getJmxManagerHostnameForClients())) {
+ if (StringUtils.isNotBlank(this.config.getJmxManagerHostnameForClients())) {
return this.config.getJmxManagerHostnameForClients();
- } else if (!StringUtils.isBlank(bindAddress)) {
+ } else if (StringUtils.isNotBlank(bindAddress)) {
return InetAddress.getByName(bindAddress).getHostAddress();
} else {
return SocketCreator.getLocalHost().getHostAddress();
@@ -376,7 +374,7 @@ public class ManagementAgent {
}
String jmxManagerHostnameForClients = this.config.getJmxManagerHostnameForClients();
- if (!StringUtils.isBlank(jmxManagerHostnameForClients)) {
+ if (StringUtils.isNotBlank(jmxManagerHostnameForClients)) {
System.setProperty("java.rmi.server.hostname", jmxManagerHostnameForClients);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java b/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java
index 837e815..7c9256d 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java
@@ -14,13 +14,7 @@
*/
package org.apache.geode.management.internal;
-import java.net.UnknownHostException;
-
import org.apache.commons.lang.StringUtils;
-import org.apache.logging.log4j.Logger;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-
import org.apache.geode.cache.AttributesFactory;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.DataPolicy;
@@ -29,12 +23,17 @@ import org.apache.geode.cache.Scope;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.GemFireVersion;
import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.net.SSLConfigurationFactory;
-import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.cache.InternalRegionArguments;
import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.net.SSLConfigurationFactory;
+import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.security.SecurableCommunicationChannel;
import org.apache.geode.management.ManagementService;
+import org.apache.logging.log4j.Logger;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+
+import java.net.UnknownHostException;
/**
* Agent implementation that controls the HTTP server end points used for REST clients to connect
@@ -156,15 +155,15 @@ public class RestAgent {
public static String getBindAddressForHttpService(DistributionConfig config) {
String bindAddress = config.getHttpServiceBindAddress();
- if (!StringUtils.isBlank(bindAddress))
+ if (StringUtils.isNotBlank(bindAddress))
return bindAddress;
bindAddress = config.getServerBindAddress();
- if (!StringUtils.isBlank(bindAddress))
+ if (StringUtils.isNotBlank(bindAddress))
return bindAddress;
bindAddress = config.getBindAddress();
- if (!StringUtils.isBlank(bindAddress))
+ if (StringUtils.isNotBlank(bindAddress))
return bindAddress;
try {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/SSLUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/SSLUtil.java b/geode-core/src/main/java/org/apache/geode/management/internal/SSLUtil.java
index 1b39b73..820e8a5 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/SSLUtil.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/SSLUtil.java
@@ -14,15 +14,14 @@
*/
package org.apache.geode.management.internal;
+import org.apache.commons.lang.StringUtils;
+
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
-
import javax.net.ssl.SSLContext;
-import org.apache.geode.internal.lang.StringUtils;
-
/**
*
* @since GemFire 8.1
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java
index ef643ac..770695a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java
@@ -14,34 +14,7 @@
*/
package org.apache.geode.management.internal.beans;
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.Notification;
-import javax.management.NotificationBroadcasterSupport;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-
-import org.apache.logging.log4j.Logger;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.admin.internal.BackupDataStoreHelper;
import org.apache.geode.admin.internal.BackupDataStoreResult;
import org.apache.geode.cache.persistence.PersistentID;
@@ -89,6 +62,32 @@ import org.apache.geode.management.internal.beans.stats.GatewaySenderClusterStat
import org.apache.geode.management.internal.beans.stats.MemberClusterStatsMonitor;
import org.apache.geode.management.internal.beans.stats.ServerClusterStatsMonitor;
import org.apache.geode.management.internal.cli.json.TypedJson;
+import org.apache.logging.log4j.Logger;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import javax.management.InstanceNotFoundException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanServer;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
/**
* This is the gateway to distributed system as a whole. Aggregated metrics and stats are shown
@@ -134,12 +133,12 @@ public class DistributedSystemBridge {
private volatile int serverSetSize;
/**
- * Gatway Sender Proxy set size
+ * Gateway Sender Proxy set size
*/
private volatile int gatewaySenderSetSize;
/**
- * Gatway Receiver Proxy set size
+ * Gateway Receiver Proxy set size
*/
private volatile int gatewayReceiverSetSize;
@@ -238,12 +237,12 @@ public class DistributedSystemBridge {
* @param service Management service
*/
public DistributedSystemBridge(SystemManagementService service) {
- this.distrLockServiceMap = new ConcurrentHashMap<ObjectName, DistributedLockServiceBridge>();
- this.distrRegionMap = new ConcurrentHashMap<ObjectName, DistributedRegionBridge>();
- this.mapOfMembers = new ConcurrentHashMap<ObjectName, MemberMXBean>();
- this.mapOfServers = new ConcurrentHashMap<ObjectName, CacheServerMXBean>();
- this.mapOfGatewayReceivers = new ConcurrentHashMap<ObjectName, GatewayReceiverMXBean>();
- this.mapOfGatewaySenders = new ConcurrentHashMap<ObjectName, GatewaySenderMXBean>();
+ this.distrLockServiceMap = new ConcurrentHashMap<>();
+ this.distrRegionMap = new ConcurrentHashMap<>();
+ this.mapOfMembers = new ConcurrentHashMap<>();
+ this.mapOfServers = new ConcurrentHashMap<>();
+ this.mapOfGatewayReceivers = new ConcurrentHashMap<>();
+ this.mapOfGatewaySenders = new ConcurrentHashMap<>();
this.service = service;
this.cache = GemFireCacheImpl.getInstance();
this.system = cache.getInternalDistributedSystem();
@@ -506,7 +505,7 @@ public class DistributedSystemBridge {
Iterator<DistributedMember> it = result.getSuccessfulMembers().keySet().iterator();
- Map<String, String[]> backedUpDiskStores = new HashMap<String, String[]>();
+ Map<String, String[]> backedUpDiskStores = new HashMap<>();
while (it.hasNext()) {
DistributedMember member = it.next();
Set<PersistentID> setOfDisk = result.getSuccessfulMembers().get(member);
@@ -573,7 +572,7 @@ public class DistributedSystemBridge {
Iterator<GatewayReceiverMXBean> gatewayReceiverIterator =
mapOfGatewayReceivers.values().iterator();
if (gatewayReceiverIterator != null) {
- List<String> listOfReceivers = new ArrayList<String>();
+ List<String> listOfReceivers = new ArrayList<>();
while (gatewayReceiverIterator.hasNext()) {
listOfReceivers.add(gatewayReceiverIterator.next().getBindAddress());
}
@@ -606,7 +605,7 @@ public class DistributedSystemBridge {
Iterator<MemberMXBean> memberIterator = mapOfMembers.values().iterator();
if (memberIterator != null) {
- List<String> listOfServer = new ArrayList<String>();
+ List<String> listOfServer = new ArrayList<>();
while (memberIterator.hasNext()) {
MemberMXBean bean = memberIterator.next();
if (bean.isCacheServer()) {
@@ -626,7 +625,7 @@ public class DistributedSystemBridge {
Iterator<MemberMXBean> memberIterator = mapOfMembers.values().iterator();
if (memberIterator != null) {
- List<String> listOfServer = new ArrayList<String>();
+ List<String> listOfServer = new ArrayList<>();
while (memberIterator.hasNext()) {
MemberMXBean bean = memberIterator.next();
if (bean.isServer()) {
@@ -657,10 +656,10 @@ public class DistributedSystemBridge {
/**
* @return a list of Gateway Senders
*/
- public String[] listGatwaySenders() {
+ public String[] listGatewaySenders() {
Iterator<GatewaySenderMXBean> gatewaySenderIterator = mapOfGatewaySenders.values().iterator();
if (gatewaySenderIterator != null) {
- List<String> listOfSenders = new ArrayList<String>();
+ List<String> listOfSenders = new ArrayList<>();
while (gatewaySenderIterator.hasNext()) {
listOfSenders.add(gatewaySenderIterator.next().getSenderId());
}
@@ -709,18 +708,15 @@ public class DistributedSystemBridge {
public String[] listLocators() {
if (cache != null) {
// each locator is a string of the form host[port] or bind-addr[port]
- Set<String> set = new HashSet<String>();
+ Set<String> set = new HashSet<>();
Map<InternalDistributedMember, Collection<String>> map =
cache.getDistributionManager().getAllHostedLocators();
for (Collection<String> hostedLocators : map.values()) {
- for (String locator : hostedLocators) {
- set.add(locator);
- }
+ set.addAll(hostedLocators);
}
- String[] locators = set.toArray(new String[set.size()]);
- return locators;
+ return set.toArray(new String[set.size()]);
}
return ManagementConstants.NO_DATA_STRING;
}
@@ -755,7 +751,7 @@ public class DistributedSystemBridge {
Iterator<MemberMXBean> memberIterator = mapOfMembers.values().iterator();
if (memberIterator != null) {
- Map<String, String[]> mapOfDisks = new HashMap<String, String[]>();
+ Map<String, String[]> mapOfDisks = new HashMap<>();
while (memberIterator.hasNext()) {
MemberMXBean bean = memberIterator.next();
mapOfDisks.put(bean.getMember(), bean.getDiskStores());
@@ -803,7 +799,7 @@ public class DistributedSystemBridge {
Iterator<MemberMXBean> memberIterator = mapOfMembers.values().iterator();
if (memberIterator != null) {
- Set<String> locatorMemberSet = new TreeSet<String>();
+ Set<String> locatorMemberSet = new TreeSet<>();
while (memberIterator.hasNext()) {
MemberMXBean memberMxBean = memberIterator.next();
if (memberMxBean.isLocator()) {
@@ -822,17 +818,17 @@ public class DistributedSystemBridge {
private String[] listStandAloneLocatorMembers() {
String[] locatorMembers = ManagementConstants.NO_DATA_STRING;
- Set<DistributedMember> members = new HashSet<DistributedMember>();
+ Set<DistributedMember> members = new HashSet<>();
members.add(system.getDistributedMember());
members.addAll(system.getAllOtherMembers());
if (!members.isEmpty()) {
- Set<String> locatorMemberSet = new TreeSet<String>();
+ Set<String> locatorMemberSet = new TreeSet<>();
for (DistributedMember member : members) {
if (DistributionManager.LOCATOR_DM_TYPE == ((InternalDistributedMember) member)
.getVmKind()) {
String name = member.getName();
- name = name != null && !name.trim().isEmpty() ? name : member.getId();
+ name = StringUtils.isNotBlank(name) ? name : member.getId();
locatorMemberSet.add(name);
}
}
@@ -852,7 +848,7 @@ public class DistributedSystemBridge {
Collection<MemberMXBean> values = mapOfMembers.values();
if (values != null) {
- Set<String> groupSet = new TreeSet<String>();
+ Set<String> groupSet = new TreeSet<>();
for (MemberMXBean memberMXBean : values) {
String[] memberGroups = memberMXBean.getGroups();
if (memberGroups != null && memberGroups.length != 0) {
@@ -878,7 +874,7 @@ public class DistributedSystemBridge {
/**
* @param member name or id of the member
- * @return basic Opertaing metrics for a given member.
+ * @return basic Operating metrics for a given member.
*/
public OSMetrics showOSMetrics(String member) throws Exception {
MemberMXBean bean = validateMember(member);
@@ -911,7 +907,7 @@ public class DistributedSystemBridge {
return ManagementConstants.NO_DATA_STRING;
}
// Sort region paths
- SortedSet<String> regionPathsSet = new TreeSet<String>();
+ SortedSet<String> regionPathsSet = new TreeSet<>();
for (DistributedRegionBridge bridge : distrRegionMap.values()) {
regionPathsSet.add(bridge.getFullPath());
}
@@ -933,9 +929,8 @@ public class DistributedSystemBridge {
Set<InternalDistributedMember> members = ShutdownAllRequest.send(dm, 0);
String[] shutDownMembers = new String[members.size()];
int j = 0;
- Iterator<InternalDistributedMember> it = members.iterator();
- while (it.hasNext()) {
- shutDownMembers[j] = it.next().getId();
+ for (InternalDistributedMember member : members) {
+ shutDownMembers[j] = member.getId();
j++;
}
return shutDownMembers;
@@ -949,16 +944,16 @@ public class DistributedSystemBridge {
* replicated region member are up and running so that the recovered data from the disk will be in
* sync;
*
- * @return Array of PeristentMemberDetails (which contains host, directory and disk store id)
+ * @return Array of PersistentMemberDetails (which contains host, directory and disk store id)
*/
public PersistentMemberDetails[] listMissingDiskStores() {
PersistentMemberDetails[] missingDiskStores = null;
- Set<PersistentID> persitentMemberSet = MissingPersistentIDsRequest.send(dm);
- if (persitentMemberSet != null && persitentMemberSet.size() > 0) {
- missingDiskStores = new PersistentMemberDetails[persitentMemberSet.size()];
+ Set<PersistentID> persistentMemberSet = MissingPersistentIDsRequest.send(dm);
+ if (persistentMemberSet != null && persistentMemberSet.size() > 0) {
+ missingDiskStores = new PersistentMemberDetails[persistentMemberSet.size()];
int j = 0;
- for (PersistentID id : persitentMemberSet) {
+ for (PersistentID id : persistentMemberSet) {
missingDiskStores[j] = new PersistentMemberDetails(id.getHost().getCanonicalHostName(),
id.getDirectory(), id.getUUID().toString());
j++;
@@ -974,7 +969,7 @@ public class DistributedSystemBridge {
* @param diskStoreId UUID of the disk store to revoke
* @return successful or failure
*/
- public boolean revokeMissingDiskStores(final String diskStoreId) throws Exception {
+ public boolean revokeMissingDiskStores(final String diskStoreId) {
// make sure that the disk store we're revoking is actually missing
boolean found = false;
PersistentMemberDetails[] details = listMissingDiskStores();
@@ -1018,8 +1013,7 @@ public class DistributedSystemBridge {
public ObjectName fetchMemberObjectName(String member) throws Exception {
validateMember(member);
- ObjectName memberName = MBeanJMXAdapter.getMemberMBeanName(member);
- return memberName;
+ return MBeanJMXAdapter.getMemberMBeanName(member);
}
public ObjectName[] listMemberObjectNames() {
@@ -1062,7 +1056,7 @@ public class DistributedSystemBridge {
}
public ObjectName[] fetchRegionObjectNames(ObjectName memberMBeanName) throws Exception {
- List<ObjectName> list = new ArrayList<ObjectName>();
+ List<ObjectName> list = new ArrayList<>();
if (mapOfMembers.get(memberMBeanName) != null) {
MemberMXBean bean = mapOfMembers.get(memberMBeanName);
String member =
@@ -1080,11 +1074,8 @@ public class DistributedSystemBridge {
}
public ObjectName[] listDistributedRegionObjectNames() {
- List<ObjectName> list = new ArrayList<ObjectName>();
- Iterator<ObjectName> it = distrRegionMap.keySet().iterator();
- while (it.hasNext()) {
- list.add(it.next());
- }
+ List<ObjectName> list = new ArrayList<>();
+ list.addAll(distrRegionMap.keySet());
ObjectName[] objNames = new ObjectName[list.size()];
return list.toArray(objNames);
}
@@ -1127,8 +1118,7 @@ public class DistributedSystemBridge {
public ObjectName fetchDistributedLockServiceObjectName(String lockServiceName) throws Exception {
DistributedLockServiceMXBean bean = service.getDistributedLockServiceMXBean(lockServiceName);
if (bean != null) {
- ObjectName lockSerName = service.getDistributedLockServiceMBeanName(lockServiceName);
- return lockSerName;
+ return service.getDistributedLockServiceMBeanName(lockServiceName);
} else {
throw new Exception(
ManagementStrings.DISTRIBUTED_LOCK_SERVICE_MBEAN_NOT_FOUND_IN_SYSTEM.toString());
@@ -1217,7 +1207,7 @@ public class DistributedSystemBridge {
Set<ObjectName> mbeanSet = service.queryMBeanNames(distributedMember);
if (mbeanSet != null && mbeanSet.size() > 0) {
- listName = new ArrayList<ObjectName>();
+ listName = new ArrayList<>();
for (ObjectName name : mbeanSet) {
if (pattern.apply(name)) {
listName.add(name);
@@ -1226,8 +1216,8 @@ public class DistributedSystemBridge {
}
if (listName != null && listName.size() > 0) {
- ObjectName[] arry = new ObjectName[listName.size()];
- return listName.toArray(arry);
+ ObjectName[] array = new ObjectName[listName.size()];
+ return listName.toArray(array);
}
return ManagementConstants.NO_DATA_OBJECTNAME;
}
@@ -1240,21 +1230,18 @@ public class DistributedSystemBridge {
*/
public int getNumClients() {
if (mapOfServers.keySet().size() > 0) {
- Set<String> uniqueClientSet = new HashSet<String>();
- Iterator<CacheServerMXBean> it = mapOfServers.values().iterator();
- while (it.hasNext()) {
- String[] clients = null;
+ Set<String> uniqueClientSet = new HashSet<>();
+ for (CacheServerMXBean cacheServerMXBean : mapOfServers.values()) {
+ String[] clients;
try {
- clients = it.next().getClientIds();
+ clients = cacheServerMXBean.getClientIds();
} catch (Exception e) {
// Mostly due to condition where member is departed and proxy is still
// with Manager.
clients = null;
}
if (clients != null) {
- for (String client : clients) {
- uniqueClientSet.add(client);
- }
+ Collections.addAll(uniqueClientSet, clients);
}
}
return uniqueClientSet.size();
@@ -1477,10 +1464,8 @@ public class DistributedSystemBridge {
public Map<String, Boolean> viewRemoteClusterStatus() {
if (mapOfGatewaySenders.values().size() > 0) {
- Map<String, Boolean> senderMap = new HashMap<String, Boolean>();
- Iterator<GatewaySenderMXBean> it = mapOfGatewaySenders.values().iterator();
- while (it.hasNext()) {
- GatewaySenderMXBean bean = it.next();
+ Map<String, Boolean> senderMap = new HashMap<>();
+ for (GatewaySenderMXBean bean : mapOfGatewaySenders.values()) {
Integer dsId = bean.getRemoteDSId();
if (dsId != null) {
senderMap.merge(dsId.toString(), bean.isRunning(), Boolean::logicalAnd);
@@ -1548,10 +1533,10 @@ public class DistributedSystemBridge {
synchronized (distrRegionMap) {
DistributedRegionBridge bridge = distrRegionMap.get(distributedRegionObjectName);
if (bridge != null) {
- FederationComponent newObj = (FederationComponent) (fedComp);
+ FederationComponent newObj = fedComp;
bridge.addProxyToMap(proxyName, regionProxy, newObj);
} else {
- FederationComponent newObj = (FederationComponent) (fedComp);
+ FederationComponent newObj = fedComp;
bridge = new DistributedRegionBridge(proxyName, regionProxy, newObj);
DistributedRegionMXBean mbean = new DistributedRegionMBean(bridge);
@@ -1591,10 +1576,10 @@ public class DistributedSystemBridge {
DistributedRegionBridge bridge = distrRegionMap.get(distributedRegionObjectName);
if (bridge != null) {
- FederationComponent newProxy = (FederationComponent) (newValue);
+ FederationComponent newProxy = newValue;
FederationComponent oldProxy = null;
if (oldValue != null) {
- oldProxy = (FederationComponent) oldValue;
+ oldProxy = oldValue;
}
bridge.updateRegion(newProxy, oldProxy);
}
@@ -1651,7 +1636,7 @@ public class DistributedSystemBridge {
FederationComponent newValue) {
// No body is calling this method right now.
// If aggregate stats are added in Distributed Lock Service it will be
- // neeeded.
+ // needed.
}
public void memberDeparted(InternalDistributedMember id, boolean crashed) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemMBean.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemMBean.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemMBean.java
index a87b366..c45da73 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemMBean.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemMBean.java
@@ -14,11 +14,6 @@
*/
package org.apache.geode.management.internal.beans;
-import java.util.Map;
-
-import javax.management.NotificationBroadcasterSupport;
-import javax.management.ObjectName;
-
import org.apache.geode.management.DiskBackupStatus;
import org.apache.geode.management.DiskMetrics;
import org.apache.geode.management.DistributedSystemMXBean;
@@ -28,6 +23,10 @@ import org.apache.geode.management.NetworkMetrics;
import org.apache.geode.management.OSMetrics;
import org.apache.geode.management.PersistentMemberDetails;
+import java.util.Map;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.ObjectName;
+
/**
* Distributed System MBean
*
@@ -103,7 +102,7 @@ public class DistributedSystemMBean extends NotificationBroadcasterSupport
@Override
public String[] listGatewaySenders() {
- return bridge.listGatwaySenders();
+ return bridge.listGatewaySenders();
}
@Override
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java
index 7dce602..003a8f3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java
@@ -14,26 +14,7 @@
*/
package org.apache.geode.management.internal.beans;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.Notification;
-import javax.management.NotificationBroadcasterSupport;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-
-import org.apache.geode.distributed.internal.DistributionManager;
-import org.apache.geode.internal.cache.CacheService;
-import org.apache.logging.log4j.Logger;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.DiskStore;
import org.apache.geode.cache.Region;
@@ -42,11 +23,13 @@ import org.apache.geode.cache.server.CacheServer;
import org.apache.geode.cache.wan.GatewayReceiver;
import org.apache.geode.cache.wan.GatewaySender;
import org.apache.geode.distributed.Locator;
+import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.distributed.internal.locks.DLockService;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.ClassLoadUtil;
+import org.apache.geode.internal.cache.CacheService;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.PartitionedRegionHelper;
@@ -75,6 +58,21 @@ import org.apache.geode.management.membership.ClientMembershipEvent;
import org.apache.geode.management.membership.ClientMembershipListener;
import org.apache.geode.management.membership.ClientMembershipListenerAdapter;
import org.apache.geode.pdx.internal.PeerTypeRegistration;
+import org.apache.logging.log4j.Logger;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
/**
* Acts as an intermediate between MBean layer and Federation Layer. Handles all Call backs from
@@ -111,9 +109,9 @@ public class ManagementAdapter {
private MBeanAggregator aggregator;
- public static final List<Class> refreshOnInit = new ArrayList<Class>();
+ public static final List<Class> refreshOnInit = new ArrayList<>();
- public static final List<String> internalLocks = new ArrayList<String>();
+ public static final List<String> internalLocks = new ArrayList<>();
static {
refreshOnInit.add(RegionMXBean.class);
@@ -219,9 +217,7 @@ public class ManagementAdapter {
service.afterCreateProxy(memberObjectName, MemberMXBean.class, localMember, addedComp);
- Iterator<ObjectName> it = registeredMBeans.keySet().iterator();
- while (it.hasNext()) {
- ObjectName objectName = it.next();
+ for (ObjectName objectName : registeredMBeans.keySet()) {
if (objectName.equals(memberObjectName)) {
continue;
}
@@ -235,8 +231,8 @@ public class ManagementAdapter {
FederationComponent newObj = service.getLocalManager().getFedComponents().get(objectName);
- for (int i = 0; i < intfTyps.length; i++) {
- Class intfTyp = (Class) intfTyps[i];
+ for (Type intfTyp1 : intfTyps) {
+ Class intfTyp = (Class) intfTyp1;
service.afterCreateProxy(objectName, intfTyp, object, newObj);
}
@@ -265,12 +261,10 @@ public class ManagementAdapter {
MBeanJMXAdapter jmxAdapter = service.getJMXAdapter();
Map<ObjectName, Object> registeredMBeans = jmxAdapter.getLocalGemFireMBean();
- ObjectName aggregatemMBeanPattern = null;
+ ObjectName aggregatemMBeanPattern;
try {
aggregatemMBeanPattern = new ObjectName(ManagementConstants.AGGREGATE_MBEAN_PATTERN);
- } catch (MalformedObjectNameException e1) {
- throw new ManagementException(e1);
- } catch (NullPointerException e1) {
+ } catch (MalformedObjectNameException | NullPointerException e1) {
throw new ManagementException(e1);
}
@@ -284,10 +278,7 @@ public class ManagementAdapter {
service.afterRemoveProxy(memberObjectName, MemberMXBean.class, localMember, removedComp);
- Iterator<ObjectName> it = registeredMBeans.keySet().iterator();
-
- while (it.hasNext()) {
- ObjectName objectName = it.next();
+ for (ObjectName objectName : registeredMBeans.keySet()) {
if (objectName.equals(memberObjectName)) {
continue;
}
@@ -304,14 +295,11 @@ public class ManagementAdapter {
FederationComponent oldObj = service.getLocalManager().getFedComponents().get(objectName);
- for (int i = 0; i < intfTyps.length; i++) {
- Class intfTyp = (Class) intfTyps[i];
+ for (Type intfTyp1 : intfTyps) {
+ Class intfTyp = (Class) intfTyp1;
service.afterRemoveProxy(objectName, intfTyp, object, oldObj);
}
- } catch (InstanceNotFoundException e) {
- logger.warn("Failed to invoke aggregator for {} with exception {}", objectName,
- e.getMessage(), e);
- } catch (ClassNotFoundException e) {
+ } catch (InstanceNotFoundException | ClassNotFoundException e) {
logger.warn("Failed to invoke aggregator for {} with exception {}", objectName,
e.getMessage(), e);
}
@@ -359,7 +347,7 @@ public class ManagementAdapter {
// Bridge is responsible for extracting data from GemFire Layer
RegionMBeanBridge<K, V> bridge = RegionMBeanBridge.getInstance(region);
- RegionMXBean regionMBean = new RegionMBean<K, V>(bridge);
+ RegionMXBean regionMBean = new RegionMBean<>(bridge);
ObjectName regionMBeanName = MBeanJMXAdapter.getRegionMBeanName(
internalCache.getDistributedSystem().getDistributedMember(), region.getFullPath());
ObjectName changedMBeanName = service.registerInternalMBean(regionMBean, regionMBeanName);
@@ -567,7 +555,7 @@ public class ManagementAdapter {
ObjectName asycnEventQueueMBeanName = MBeanJMXAdapter.getAsycnEventQueueMBeanName(
internalCache.getDistributedSystem().getDistributedMember(), queue.getId());
- AsyncEventQueueMBean bean = null;
+ AsyncEventQueueMBean bean;
try {
bean = (AsyncEventQueueMBean) service.getLocalAsyncEventQueueMXBean(queue.getId());
if (bean == null) {
@@ -616,7 +604,7 @@ public class ManagementAdapter {
}
private Map<String, String> prepareUserData(AlertDetails details) {
- Map<String, String> userData = new HashMap<String, String>();
+ Map<String, String> userData = new HashMap<>();
userData.put(JMXNotificationUserData.ALERT_LEVEL,
AlertDetails.getAlertLevelAsString(details.getAlertLevel()));
@@ -627,7 +615,7 @@ public class ManagementAdapter {
String nameOrId = memberSource; // TODO: what if sender is null?
if (sender != null) {
nameOrId = sender.getName();
- nameOrId = nameOrId != null && !nameOrId.trim().isEmpty() ? nameOrId : sender.getId();
+ nameOrId = StringUtils.isNotBlank(nameOrId) ? nameOrId : sender.getId();
}
userData.put(JMXNotificationUserData.MEMBER, nameOrId);
@@ -799,7 +787,7 @@ public class ManagementAdapter {
synchronized (regionOpLock) {
ObjectName regionMBeanName = MBeanJMXAdapter.getRegionMBeanName(
internalCache.getDistributedSystem().getDistributedMember(), region.getFullPath());
- RegionMBean bean = null;
+ RegionMBean bean;
try {
bean = (RegionMBean) service.getLocalRegionMBean(region.getFullPath());
} catch (ManagementException e) {
@@ -838,7 +826,7 @@ public class ManagementAdapter {
ObjectName diskStoreMBeanName = MBeanJMXAdapter.getDiskStoreMBeanName(
internalCache.getDistributedSystem().getDistributedMember(), disk.getName());
- DiskStoreMBean bean = null;
+ DiskStoreMBean bean;
try {
bean = (DiskStoreMBean) service.getLocalDiskStoreMBean(disk.getName());
if (bean == null) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/beans/QueryDataFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/QueryDataFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/QueryDataFunction.java
index f701d29..9829df3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/QueryDataFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/QueryDataFunction.java
@@ -14,21 +14,7 @@
*/
package org.apache.geode.management.internal.beans;
-import java.io.IOException;
-import java.io.Serializable;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.logging.log4j.Logger;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.DataPolicy;
@@ -64,6 +50,19 @@ import org.apache.geode.management.internal.cli.commands.DataCommands;
import org.apache.geode.management.internal.cli.json.GfJsonException;
import org.apache.geode.management.internal.cli.json.GfJsonObject;
import org.apache.geode.management.internal.cli.json.TypedJson;
+import org.apache.logging.log4j.Logger;
+
+import java.io.Serializable;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* This function is executed on one or multiple members based on the member input to
@@ -128,7 +127,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
final boolean showMember, final String regionName, final int limit,
final int queryResultSetLimit, final int queryCollectionsDepth) throws Exception {
InternalCache cache = getCache();
- Function loclQueryFunc = new LocalQueryFunction("LocalQueryFunction", regionName, showMember)
+ Function localQueryFunc = new LocalQueryFunction("LocalQueryFunction", regionName, showMember)
.setOptimizeForWrite(true);
queryString = applyLimitClause(queryString, limit, queryResultSetLimit);
@@ -154,7 +153,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
results = query.execute();
} else {
- ResultCollector rcollector = null;
+ ResultCollector rcollector;
PartitionedRegion parRegion =
PartitionedRegionHelper.getPartitionedRegion(regionName, cache);
@@ -169,13 +168,11 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
}
LocalDataSet lds = new LocalDataSet(parRegion, localPrimaryBucketSet);
DefaultQuery query = (DefaultQuery) cache.getQueryService().newQuery(queryString);
- SelectResults selectResults =
- (SelectResults) lds.executeQuery(query, null, localPrimaryBucketSet);
- results = selectResults;
+ results = (SelectResults) lds.executeQuery(query, null, localPrimaryBucketSet);
}
} else {
rcollector = FunctionService.onRegion(cache.getRegion(regionName))
- .setArguments(queryString).execute(loclQueryFunc);
+ .setArguments(queryString).execute(localQueryFunc);
results = rcollector.getResult();
}
}
@@ -183,8 +180,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
if (results != null && results instanceof SelectResults) {
SelectResults selectResults = (SelectResults) results;
- for (Iterator iter = selectResults.iterator(); iter.hasNext();) {
- Object object = iter.next();
+ for (Object object : selectResults) {
result.add(RESULT_KEY, object);
noDataFound = false;
}
@@ -203,7 +199,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
if (noDataFound) {
return new QueryDataFunctionResult(QUERY_EXEC_SUCCESS,
- BeanUtilFuncs.compress(new JsonisedErroMessage(NO_DATA_FOUND).toString()));
+ BeanUtilFuncs.compress(new JsonisedErrorMessage(NO_DATA_FOUND).toString()));
}
return new QueryDataFunctionResult(QUERY_EXEC_SUCCESS,
BeanUtilFuncs.compress(result.toString()));
@@ -272,7 +268,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
// member.
// Note , if no member is selected this is the code path executed. A
// random associated member is chosen.
- List<String> decompressedList = new ArrayList<String>();
+ List<String> decompressedList = new ArrayList<>();
decompressedList.add(BeanUtilFuncs.decompress(result.compressedBytes));
return wrapResult(decompressedList.toString());
}
@@ -290,10 +286,10 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
}
Iterator<QueryDataFunctionResult> it = list.iterator();
- List<String> decompressedList = new ArrayList<String>();
+ List<String> decompressedList = new ArrayList<>();
while (it.hasNext()) {
- String decompressedStr = null;
+ String decompressedStr;
decompressedStr = BeanUtilFuncs.decompress(it.next().compressedBytes);
decompressedList.add(decompressedStr);
}
@@ -308,12 +304,6 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
} catch (FunctionException fe) {
throw new Exception(
ManagementStrings.QUERY__MSG__QUERY_EXEC.toLocalizedString(fe.getMessage()));
- } catch (IOException e) {
- throw new Exception(
- ManagementStrings.QUERY__MSG__QUERY_EXEC.toLocalizedString(e.getMessage()));
- } catch (Exception e) {
- throw new Exception(
- ManagementStrings.QUERY__MSG__QUERY_EXEC.toLocalizedString(e.getMessage()));
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
throw e;
@@ -339,20 +329,20 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
throws Exception {
if (query == null || query.isEmpty()) {
- return new JsonisedErroMessage(ManagementStrings.QUERY__MSG__QUERY_EMPTY.toLocalizedString())
+ return new JsonisedErrorMessage(ManagementStrings.QUERY__MSG__QUERY_EMPTY.toLocalizedString())
.toString();
}
Set<DistributedMember> inputMembers = null;
- if (members != null && !members.trim().isEmpty()) {
- inputMembers = new HashSet<DistributedMember>();
+ if (StringUtils.isNotBlank(members)) {
+ inputMembers = new HashSet<>();
StringTokenizer st = new StringTokenizer(members, ",");
while (st.hasMoreTokens()) {
String member = st.nextToken();
DistributedMember distributedMember = BeanUtilFuncs.getDistributedMemberByNameOrId(member);
inputMembers.add(distributedMember);
if (distributedMember == null) {
- return new JsonisedErroMessage(
+ return new JsonisedErrorMessage(
ManagementStrings.QUERY__MSG__INVALID_MEMBER.toLocalizedString(member)).toString();
}
}
@@ -370,7 +360,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
for (String regionPath : regionsInQuery) {
DistributedRegionMXBean regionMBean = service.getDistributedRegionMXBean(regionPath);
if (regionMBean == null) {
- return new JsonisedErroMessage(
+ return new JsonisedErrorMessage(
ManagementStrings.QUERY__MSG__REGIONS_NOT_FOUND.toLocalizedString(regionPath))
.toString();
} else {
@@ -379,7 +369,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
if (inputMembers != null && inputMembers.size() > 0) {
if (!associatedMembers.containsAll(inputMembers)) {
- return new JsonisedErroMessage(
+ return new JsonisedErrorMessage(
ManagementStrings.QUERY__MSG__REGIONS_NOT_FOUND_ON_MEMBERS
.toLocalizedString(regionPath)).toString();
}
@@ -387,7 +377,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
}
}
} else {
- return new JsonisedErroMessage(ManagementStrings.QUERY__MSG__INVALID_QUERY
+ return new JsonisedErrorMessage(ManagementStrings.QUERY__MSG__INVALID_QUERY
.toLocalizedString("Region mentioned in query probably missing /")).toString();
}
@@ -398,7 +388,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
if (regionMBean.getRegionType().equals(DataPolicy.PARTITION.toString())
|| regionMBean.getRegionType().equals(DataPolicy.PERSISTENT_PARTITION.toString())) {
- return new JsonisedErroMessage(
+ return new JsonisedErrorMessage(
ManagementStrings.QUERY__MSG__JOIN_OP_EX.toLocalizedString()).toString();
}
}
@@ -422,8 +412,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
functionArgs[LIMIT] = limit;
functionArgs[QUERY_RESULTSET_LIMIT] = queryResultSetLimit;
functionArgs[QUERY_COLLECTIONS_DEPTH] = queryCollectionsDepth;
- Object result = callFunction(functionArgs, inputMembers, zipResult);
- return result;
+ return callFunction(functionArgs, inputMembers, zipResult);
} else { // Query on any random member
functionArgs[DISPLAY_MEMBERWISE] = false;
functionArgs[QUERY] = query;
@@ -431,17 +420,16 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
functionArgs[LIMIT] = limit;
functionArgs[QUERY_RESULTSET_LIMIT] = queryResultSetLimit;
functionArgs[QUERY_COLLECTIONS_DEPTH] = queryCollectionsDepth;
- Object result = callFunction(functionArgs, associatedMembers, zipResult);
- return result;
+ return callFunction(functionArgs, associatedMembers, zipResult);
}
} else {
- return new JsonisedErroMessage(ManagementStrings.QUERY__MSG__REGIONS_NOT_FOUND
+ return new JsonisedErrorMessage(ManagementStrings.QUERY__MSG__REGIONS_NOT_FOUND
.toLocalizedString(regionsInQuery.toString())).toString();
}
} catch (QueryInvalidException qe) {
- return new JsonisedErroMessage(
+ return new JsonisedErrorMessage(
ManagementStrings.QUERY__MSG__INVALID_QUERY.toLocalizedString(qe.getMessage()))
.toString();
}
@@ -451,13 +439,13 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
return (InternalCache) CacheFactory.getAnyInstance();
}
- private static class JsonisedErroMessage {
+ private static class JsonisedErrorMessage {
private static String message = "message";
private GfJsonObject gFJsonObject = new GfJsonObject();
- public JsonisedErroMessage(final String errorMessage) throws Exception {
+ public JsonisedErrorMessage(final String errorMessage) throws Exception {
try {
gFJsonObject.put(message, errorMessage);
} catch (GfJsonException e) {
@@ -483,10 +471,10 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
private static Set<String> compileQuery(final InternalCache cache, final String query)
throws QueryInvalidException {
QCompiler compiler = new QCompiler();
- Set<String> regionsInQuery = null;
+ Set<String> regionsInQuery;
try {
CompiledValue compiledQuery = compiler.compileQuery(query);
- Set<String> regions = new HashSet<String>();
+ Set<String> regions = new HashSet<>();
compiledQuery.getRegionsInQuery(regions, null);
regionsInQuery = Collections.unmodifiableSet(regions);
return regionsInQuery;
[04/14] geode git commit: GEODE-1994: Overhaul of
internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshConfig.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshConfig.java
index c35f420..3c368c5 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshConfig.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshConfig.java
@@ -14,12 +14,12 @@
*/
package org.apache.geode.management.internal.cli.shell;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.internal.util.IOUtils;
+
import java.io.File;
import java.util.logging.Level;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.util.IOUtils;
-
/**
*
* @since GemFire 7.0
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshExecutionStrategy.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshExecutionStrategy.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshExecutionStrategy.java
index 7c80e0d..2b39bed 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshExecutionStrategy.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshExecutionStrategy.java
@@ -16,6 +16,7 @@ package org.apache.geode.management.internal.cli.shell;
import static org.apache.geode.management.internal.cli.multistep.CLIMultiStepHelper.execCLISteps;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.management.cli.CliMetaData;
import org.apache.geode.management.cli.CommandProcessingException;
@@ -101,10 +102,7 @@ public class GfshExecutionStrategy implements ExecutionStrategy {
} catch (NotAuthorizedException e) {
result = ResultBuilder
.createGemFireUnAuthorizedErrorResult("Unauthorized. Reason: " + e.getMessage());
- } catch (JMXInvocationException e) {
- Gfsh.getCurrentInstance().logWarning(e.getMessage(), e);
- } catch (IllegalStateException e) {
- // Shouldn't occur - we are always using GfsParseResult
+ } catch (JMXInvocationException | IllegalStateException e) {
Gfsh.getCurrentInstance().logWarning(e.getMessage(), e);
} catch (CommandProcessingException e) {
Gfsh.getCurrentInstance().logWarning(e.getMessage(), null);
@@ -204,11 +202,7 @@ public class GfshExecutionStrategy implements ExecutionStrategy {
try {
interceptor = (CliAroundInterceptor) ClassPathLoader.getLatest().forName(interceptorClass)
.newInstance();
- } catch (InstantiationException e) {
- shell.logWarning("Configuration error", e);
- } catch (IllegalAccessException e) {
- shell.logWarning("Configuration error", e);
- } catch (ClassNotFoundException e) {
+ } catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) {
shell.logWarning("Configuration error", e);
}
if (interceptor != null) {
@@ -247,7 +241,7 @@ public class GfshExecutionStrategy implements ExecutionStrategy {
+ "Please check manager logs for error.");
}
- // the response could be a string which is a json respresentation of the CommandResult object
+ // the response could be a string which is a json representation of the CommandResult object
// it can also be a Path to a temp file downloaded from the rest http request
if (response instanceof String) {
CommandResponse commandResponse =
@@ -259,7 +253,7 @@ public class GfshExecutionStrategy implements ExecutionStrategy {
}
String debugInfo = commandResponse.getDebugInfo();
- if (debugInfo != null && !debugInfo.trim().isEmpty()) {
+ if (StringUtils.isNotBlank(debugInfo)) {
// TODO - Abhishek When debug is ON, log response in gfsh logs
// TODO - Abhishek handle \n better. Is it coming from GemFire formatter
debugInfo = debugInfo.replaceAll("\n\n\n", "\n");
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/JmxOperationInvoker.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/JmxOperationInvoker.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/JmxOperationInvoker.java
index e9d183e..7ae7c3b 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/JmxOperationInvoker.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/JmxOperationInvoker.java
@@ -17,8 +17,8 @@ package org.apache.geode.management.internal.cli.shell;
import static org.apache.geode.distributed.ConfigurationProperties.CLUSTER_SSL_PREFIX;
import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_SSL_PREFIX;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.util.ArrayUtils;
import org.apache.geode.internal.util.IOUtils;
import org.apache.geode.management.DistributedSystemMXBean;
@@ -192,7 +192,7 @@ public class JmxOperationInvoker implements OperationInvoker {
URL gfSecurityPropertiesUrl = null;
// Case 1: User has specified gfSecurity properties file
- if (!StringUtils.isBlank(gfSecurityPropertiesPathToUse)) {
+ if (StringUtils.isNotBlank(gfSecurityPropertiesPathToUse)) {
// User specified gfSecurity properties doesn't exist
if (!IOUtils.isExistingPathname(gfSecurityPropertiesPathToUse)) {
gfshInstance
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/CommandStringBuilder.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/CommandStringBuilder.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/CommandStringBuilder.java
index 4410fea..cfb8a24 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/CommandStringBuilder.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/CommandStringBuilder.java
@@ -14,7 +14,7 @@
*/
package org.apache.geode.management.internal.cli.util;
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.internal.lang.SystemUtils;
import org.apache.geode.management.internal.cli.GfshParser;
@@ -59,7 +59,7 @@ public class CommandStringBuilder {
}
public CommandStringBuilder addOptionWithValueCheck(String option, String value) {
- if (!StringUtils.isBlank(value)) {
+ if (StringUtils.isNotBlank(value)) {
return addOption(option, value);
}
return this;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/domain/XmlEntity.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/domain/XmlEntity.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/domain/XmlEntity.java
index 0dbe7e5..00902a9 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/domain/XmlEntity.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/domain/XmlEntity.java
@@ -14,6 +14,25 @@
*/
package org.apache.geode.management.internal.configuration.domain;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.InternalGemFireError;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.internal.Assert;
+import org.apache.geode.internal.Version;
+import org.apache.geode.internal.VersionedDataSerializable;
+import org.apache.geode.internal.cache.xmlcache.CacheXml;
+import org.apache.geode.internal.cache.xmlcache.CacheXmlGenerator;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.management.internal.configuration.utils.XmlUtils;
+import org.apache.geode.management.internal.configuration.utils.XmlUtils.XPathContext;
+import org.apache.logging.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@@ -24,32 +43,11 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
-
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.xpath.XPathExpressionException;
-import org.apache.geode.internal.Assert;
-import org.apache.geode.internal.Version;
-import org.apache.geode.internal.VersionedDataSerializable;
-import org.apache.logging.log4j.Logger;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-import org.apache.geode.DataSerializer;
-import org.apache.geode.InternalGemFireError;
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.internal.cache.xmlcache.CacheXml;
-import org.apache.geode.internal.cache.xmlcache.CacheXmlGenerator;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.management.internal.configuration.utils.XmlUtils;
-import org.apache.geode.management.internal.configuration.utils.XmlUtils.XPathContext;
-
/****
* Domain class for defining a GemFire entity in XML.
*
@@ -156,13 +154,13 @@ public class XmlEntity implements VersionedDataSerializable {
StringBuffer sb = new StringBuffer();
sb.append("//").append(this.prefix).append(':').append(this.parentType);
- if (!StringUtils.isBlank(parentKey) && !StringUtils.isBlank(parentValue)) {
+ if (StringUtils.isNotBlank(parentKey) && StringUtils.isNotBlank(parentValue)) {
sb.append("[@").append(parentKey).append("='").append(parentValue).append("']");
}
sb.append("/").append(childPrefix).append(':').append(this.type);
- if (!StringUtils.isBlank(childKey) && !StringUtils.isBlank(childValue)) {
+ if (StringUtils.isNotBlank(childKey) && StringUtils.isNotBlank(childValue)) {
sb.append("[@").append(childKey).append("='").append(childValue).append("']");
}
this.searchString = sb.toString();
@@ -175,9 +173,9 @@ public class XmlEntity implements VersionedDataSerializable {
* @since GemFire 8.1
*/
private void init() {
- Assert.assertTrue(!StringUtils.isBlank(type));
- Assert.assertTrue(!StringUtils.isBlank(prefix));
- Assert.assertTrue(!StringUtils.isBlank(namespace));
+ Assert.assertTrue(StringUtils.isNotBlank(type));
+ Assert.assertTrue(StringUtils.isNotBlank(prefix));
+ Assert.assertTrue(StringUtils.isNotBlank(namespace));
Assert.assertTrue(attributes != null);
if (null == xmlDefinition) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationRequest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationRequest.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationRequest.java
index 837d99e..ac5e99a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationRequest.java
@@ -14,18 +14,16 @@
*/
package org.apache.geode.management.internal.configuration.messages;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.internal.DataSerializableFixedID;
+import org.apache.geode.internal.Version;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Set;
-import org.apache.geode.internal.DataSerializableFixedID;
-import org.apache.geode.internal.Version;
-import org.apache.geode.internal.lang.StringUtils;
-
/***
* Request sent by a member to the locator requesting the shared configuration
*
@@ -50,7 +48,7 @@ public class ConfigurationRequest implements DataSerializableFixedID {
}
public void addGroups(String group) {
- if (!StringUtils.isBlank(group))
+ if (StringUtils.isNotBlank(group))
this.groups.add(group);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationResponse.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationResponse.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationResponse.java
index 3248c98..cb9951f 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationResponse.java
@@ -14,6 +14,15 @@
*/
package org.apache.geode.management.internal.configuration.messages;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.InternalGemFireError;
+import org.apache.geode.internal.DataSerializableFixedID;
+import org.apache.geode.internal.Version;
+import org.apache.geode.management.internal.configuration.domain.Configuration;
+import org.apache.geode.management.internal.configuration.utils.XmlUtils;
+import org.xml.sax.SAXException;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@@ -22,21 +31,10 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactoryConfigurationError;
-import org.xml.sax.SAXException;
-
-import org.apache.geode.DataSerializer;
-import org.apache.geode.InternalGemFireError;
-import org.apache.geode.internal.DataSerializableFixedID;
-import org.apache.geode.internal.Version;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.management.internal.configuration.domain.Configuration;
-import org.apache.geode.management.internal.configuration.utils.XmlUtils;
-
/***
* Response containing the configuration requested by the {@link ConfigurationRequest}
*/
@@ -127,7 +125,7 @@ public class ConfigurationResponse implements DataSerializableFixedID {
try {
String cacheXmlContent = config.getCacheXmlContent();
- if (!StringUtils.isBlank(cacheXmlContent)) {
+ if (StringUtils.isNotBlank(cacheXmlContent)) {
sb.append("\n" + XmlUtils.prettyXml(cacheXmlContent));
}
} catch (IOException | TransformerFactoryConfigurationError | TransformerException
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/utils/XmlUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/utils/XmlUtils.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/utils/XmlUtils.java
index 218762c..f86b9a3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/utils/XmlUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/utils/XmlUtils.java
@@ -14,12 +14,24 @@
*/
package org.apache.geode.management.internal.configuration.utils;
-import static org.apache.geode.management.internal.configuration.utils.XmlConstants.W3C_XML_SCHEMA_INSTANCE_ATTRIBUTE_SCHEMA_LOCATION;
-import static org.apache.geode.management.internal.configuration.utils.XmlConstants.W3C_XML_SCHEMA_INSTANCE_PREFIX;
import static javax.xml.XMLConstants.NULL_NS_URI;
import static javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI;
+import static org.apache.geode.management.internal.configuration.utils.XmlConstants.W3C_XML_SCHEMA_INSTANCE_ATTRIBUTE_SCHEMA_LOCATION;
+import static org.apache.geode.management.internal.configuration.utils.XmlConstants.W3C_XML_SCHEMA_INSTANCE_PREFIX;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.internal.cache.xmlcache.CacheXml;
+import org.apache.geode.internal.cache.xmlcache.CacheXmlParser;
+import org.apache.geode.management.internal.configuration.domain.CacheElement;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
-import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
@@ -33,7 +45,6 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.StringTokenizer;
-
import javax.xml.namespace.NamespaceContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -50,20 +61,6 @@ import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-import org.apache.geode.internal.cache.xmlcache.CacheXml;
-import org.apache.geode.internal.cache.xmlcache.CacheXmlParser;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.management.internal.configuration.domain.CacheElement;
-import org.apache.geode.management.internal.configuration.domain.XmlEntity;
-
public class XmlUtils {
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/AbstractCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/AbstractCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/AbstractCommandsController.java
index 0b64a44..54c29f8 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/AbstractCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/AbstractCommandsController.java
@@ -15,36 +15,6 @@
package org.apache.geode.management.internal.web.controllers;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.lang.management.ManagementFactory;
-import java.net.URI;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-import javax.management.JMX;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.Query;
-import javax.management.QueryExp;
-
-import org.apache.logging.log4j.Logger;
-import org.springframework.beans.propertyeditors.StringArrayPropertyEditor;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.WebDataBinder;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.InitBinder;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.ResponseStatus;
-import org.springframework.web.context.request.WebRequest;
-import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
-
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.lang.StringUtils;
@@ -64,6 +34,34 @@ import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
import org.apache.geode.management.internal.web.controllers.support.LoginHandlerInterceptor;
import org.apache.geode.management.internal.web.util.UriUtils;
import org.apache.geode.security.NotAuthorizedException;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.propertyeditors.StringArrayPropertyEditor;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.InitBinder;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.context.request.WebRequest;
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.management.ManagementFactory;
+import java.net.URI;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import javax.management.JMX;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.Query;
+import javax.management.QueryExp;
/**
* The AbstractCommandsController class is the abstract base class encapsulating common
@@ -251,7 +249,7 @@ public abstract class AbstractCommandsController {
* @see java.lang.String
*/
protected static boolean hasValue(final String value) {
- return !StringUtils.isBlank(value);
+ return StringUtils.isNotBlank(value);
}
/**
@@ -530,7 +528,7 @@ public abstract class AbstractCommandsController {
if (hasValue(optionValue)) {
final String optionValueString = (optionValue instanceof String[]
- ? StringUtils.concat((String[]) optionValue, StringUtils.COMMA_DELIMITER)
+ ? StringUtils.join((String[]) optionValue, StringUtils.COMMA_DELIMITER)
: String.valueOf(optionValue));
command.addOption(optionName, optionValueString);
} else if (request != null && request.getParameterMap().containsKey(optionName)) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ConfigCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ConfigCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ConfigCommandsController.java
index f468c65..25d0cc3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ConfigCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ConfigCommandsController.java
@@ -14,9 +14,6 @@
*/
package org.apache.geode.management.internal.web.controllers;
-import java.io.IOException;
-import java.util.concurrent.Callable;
-
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
@@ -30,6 +27,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
+import java.io.IOException;
+import java.util.concurrent.Callable;
+
/**
* The ConfigCommandsController class implements GemFire Management REST API web service endpoints
* for the Gfsh Config Commands.
@@ -184,12 +184,12 @@ public class ConfigCommandsController extends AbstractMultiPartCommandsControlle
if (hasValue(groups)) {
command.addOption(CliStrings.EXPORT_CONFIG__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.EXPORT_CONFIG__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
if (hasValue(directory)) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DataCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DataCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DataCommandsController.java
index 3a8ed82..ce2ed54 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DataCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DataCommandsController.java
@@ -215,12 +215,12 @@ public class DataCommandsController extends AbstractCommandsController {
if (hasValue(includedRegions)) {
command.addOption(CliStrings.REBALANCE__INCLUDEREGION,
- StringUtils.concat(includedRegions, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(includedRegions, StringUtils.COMMA_DELIMITER));
}
if (hasValue(excludedRegions)) {
command.addOption(CliStrings.REBALANCE__EXCLUDEREGION,
- StringUtils.concat(excludedRegions, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(excludedRegions, StringUtils.COMMA_DELIMITER));
}
command.addOption(CliStrings.REBALANCE__SIMULATE, String.valueOf(simulate));
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DeployCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DeployCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DeployCommandsController.java
index fe5be62..35f57ef 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DeployCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DeployCommandsController.java
@@ -14,13 +14,10 @@
*/
package org.apache.geode.management.internal.web.controllers;
-import java.io.IOException;
-
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
import org.apache.geode.management.internal.web.util.ConvertUtils;
-
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -28,6 +25,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
+import java.io.IOException;
+
/**
* The DeployCommandsController class implements the GemFire Management REST API web service
* endpoints for the Gfsh Deploy Commands.
@@ -55,7 +54,7 @@ public class DeployCommandsController extends AbstractMultiPartCommandsControlle
if (hasValue(groups)) {
command.addOption(CliStrings.LIST_DEPLOYED__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -75,7 +74,7 @@ public class DeployCommandsController extends AbstractMultiPartCommandsControlle
if (hasValue(groups)) {
command.addOption(CliStrings.DEPLOY__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(jarFileName)) {
@@ -101,12 +100,12 @@ public class DeployCommandsController extends AbstractMultiPartCommandsControlle
if (hasValue(groups)) {
command.addOption(CliStrings.UNDEPLOY__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(jarFileNames)) {
command.addOption(CliStrings.UNDEPLOY__JAR,
- StringUtils.concat(jarFileNames, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(jarFileNames, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DiskStoreCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DiskStoreCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DiskStoreCommandsController.java
index 661340c..fa074c3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DiskStoreCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DiskStoreCommandsController.java
@@ -14,8 +14,6 @@
*/
package org.apache.geode.management.internal.web.controllers;
-import java.util.concurrent.Callable;
-
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
@@ -27,6 +25,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
+import java.util.concurrent.Callable;
+
/**
* The DiskStoreCommandsController class implements GemFire Management REST API web service
* endpoints for the Gfsh Disk Store Commands.
@@ -80,7 +80,7 @@ public class DiskStoreCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.COMPACT_DISK_STORE__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return getProcessCommandCallable(command.toString());
@@ -115,8 +115,10 @@ public class DiskStoreCommandsController extends AbstractCommandsController {
CommandStringBuilder command = new CommandStringBuilder(CliStrings.CREATE_DISK_STORE);
command.addOption(CliStrings.CREATE_DISK_STORE__NAME, diskStoreNameId);
- command.addOption(CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE,
- StringUtils.concat(directoryAndSizes, StringUtils.COMMA_DELIMITER));
+ if (hasValue(directoryAndSizes)) {
+ command.addOption(CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE,
+ StringUtils.join(directoryAndSizes, StringUtils.COMMA_DELIMITER));
+ }
command.addOption(CliStrings.CREATE_DISK_STORE__ALLOW_FORCE_COMPACTION,
String.valueOf(Boolean.TRUE.equals(allowForceCompaction)));
command.addOption(CliStrings.CREATE_DISK_STORE__AUTO_COMPACT,
@@ -135,7 +137,7 @@ public class DiskStoreCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.CREATE_DISK_STORE__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -163,7 +165,7 @@ public class DiskStoreCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.DESTROY_DISK_STORE__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DurableClientCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DurableClientCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DurableClientCommandsController.java
index 1d718b4..8f31f7a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DurableClientCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DurableClientCommandsController.java
@@ -19,7 +19,11 @@ import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
+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;
/**
* The DurableClientCommandsController class implements GemFire Management REST API web service
@@ -59,7 +63,7 @@ public class DurableClientCommandsController extends AbstractCommandsController
if (hasValue(groups)) {
command.addOption(CliStrings.LIST_DURABLE_CQS__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -109,7 +113,7 @@ public class DurableClientCommandsController extends AbstractCommandsController
if (hasValue(groups)) {
command.addOption(CliStrings.COUNT_DURABLE_CQ_EVENTS__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -134,7 +138,7 @@ public class DurableClientCommandsController extends AbstractCommandsController
if (hasValue(groups)) {
command.addOption(CliStrings.CLOSE_DURABLE_CLIENTS__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -161,7 +165,7 @@ public class DurableClientCommandsController extends AbstractCommandsController
if (hasValue(groups)) {
command.addOption(CliStrings.CLOSE_DURABLE_CQS__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ExportLogController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ExportLogController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ExportLogController.java
index 604bdee..a369c6e 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ExportLogController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ExportLogController.java
@@ -64,7 +64,7 @@ public class ExportLogController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.EXPORT_LOGS__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(memberNameId)) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/FunctionCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/FunctionCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/FunctionCommandsController.java
index 77cfb40..508c335 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/FunctionCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/FunctionCommandsController.java
@@ -14,8 +14,6 @@
*/
package org.apache.geode.management.internal.web.controllers;
-import java.util.concurrent.Callable;
-
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
@@ -27,6 +25,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
+import java.util.concurrent.Callable;
+
/**
* The FunctionCommandsController class implements GemFire Management REST API web service endpoints
* for the Gfsh Function Commands.
@@ -60,12 +60,12 @@ public class FunctionCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.LIST_FUNCTION__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.LIST_FUNCTION__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
if (hasValue(matches)) {
@@ -108,7 +108,7 @@ public class FunctionCommandsController extends AbstractCommandsController {
if (hasValue(arguments)) {
command.addOption(CliStrings.EXECUTE_FUNCTION__ARGUMENTS,
- StringUtils.concat(arguments, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(arguments, StringUtils.COMMA_DELIMITER));
}
if (hasValue(filter)) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/MiscellaneousCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/MiscellaneousCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/MiscellaneousCommandsController.java
index d19aee1..9b13b5f 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/MiscellaneousCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/MiscellaneousCommandsController.java
@@ -85,7 +85,7 @@ public class MiscellaneousCommandsController extends AbstractCommandsController
if (hasValue(groups)) {
command.addOption(CliStrings.GC__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -175,7 +175,7 @@ public class MiscellaneousCommandsController extends AbstractCommandsController
if (hasValue(categories)) {
command.addOption(CliStrings.SHOW_METRICS__CATEGORY,
- StringUtils.concat(categories, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(categories, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/PdxCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/PdxCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/PdxCommandsController.java
index c68ee35..c757fd3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/PdxCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/PdxCommandsController.java
@@ -17,7 +17,6 @@ package org.apache.geode.management.internal.web.controllers;
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
-
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -72,12 +71,12 @@ public class PdxCommandsController extends AbstractCommandsController {
if (hasValue(autoSerializerClasses)) {
command.addOption(CliStrings.CONFIGURE_PDX__AUTO__SERIALIZER__CLASSES,
- StringUtils.concat(autoSerializerClasses, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(autoSerializerClasses, StringUtils.COMMA_DELIMITER));
}
if (hasValue(portableAutoSerializerClasses)) {
command.addOption(CliStrings.CONFIGURE_PDX__PORTABLE__AUTO__SERIALIZER__CLASSES,
- StringUtils.concat(portableAutoSerializerClasses, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(portableAutoSerializerClasses, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -97,7 +96,7 @@ public class PdxCommandsController extends AbstractCommandsController {
if (hasValue(diskDirs)) {
command.addOption(CliStrings.PDX_DISKDIR,
- StringUtils.concat(diskDirs, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(diskDirs, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -118,7 +117,7 @@ public class PdxCommandsController extends AbstractCommandsController {
if (hasValue(diskDirs)) {
command.addOption(CliStrings.PDX_DISKDIR,
- StringUtils.concat(diskDirs, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(diskDirs, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/QueueCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/QueueCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/QueueCommandsController.java
index 396726e..df49e49 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/QueueCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/QueueCommandsController.java
@@ -17,7 +17,6 @@ package org.apache.geode.management.internal.web.controllers;
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
-
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -88,12 +87,12 @@ public class QueueCommandsController extends AbstractCommandsController {
if (hasValue(listenerParametersValues)) {
command.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__LISTENER_PARAM_AND_VALUE,
- StringUtils.concat(listenerParametersValues, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(listenerParametersValues, StringUtils.COMMA_DELIMITER));
}
if (hasValue(groups)) {
command.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
command.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__PARALLEL,
@@ -138,7 +137,7 @@ public class QueueCommandsController extends AbstractCommandsController {
if (hasValue(gatewayEventFilters)) {
command.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__GATEWAYEVENTFILTER,
- StringUtils.concat(gatewayEventFilters, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(gatewayEventFilters, StringUtils.COMMA_DELIMITER));
}
if (hasValue(gatewaySubstitutionFilter)) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/RegionCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/RegionCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/RegionCommandsController.java
index e503e56..baf24e5 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/RegionCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/RegionCommandsController.java
@@ -17,7 +17,6 @@ package org.apache.geode.management.internal.web.controllers;
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
-
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -116,7 +115,7 @@ public class RegionCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.ALTER_REGION__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
addCommandOption(request, command, CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIME,
@@ -243,7 +242,7 @@ public class RegionCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.CREATE_REGION__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
command.addOption(CliStrings.CREATE_REGION__SKIPIFEXISTS,
@@ -323,7 +322,7 @@ public class RegionCommandsController extends AbstractCommandsController {
if (hasValue(cacheListeners)) {
command.addOption(CliStrings.CREATE_REGION__CACHELISTENER,
- StringUtils.concat(cacheListeners, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(cacheListeners, StringUtils.COMMA_DELIMITER));
}
if (hasValue(cacheLoader)) {
@@ -336,12 +335,12 @@ public class RegionCommandsController extends AbstractCommandsController {
if (hasValue(asyncEventQueueIds)) {
command.addOption(CliStrings.CREATE_REGION__ASYNCEVENTQUEUEID,
- StringUtils.concat(asyncEventQueueIds, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(asyncEventQueueIds, StringUtils.COMMA_DELIMITER));
}
if (hasValue(gatewaySenderIds)) {
command.addOption(CliStrings.CREATE_REGION__GATEWAYSENDERID,
- StringUtils.concat(gatewaySenderIds, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(gatewaySenderIds, StringUtils.COMMA_DELIMITER));
}
if (Boolean.TRUE.equals(enableConcurrencyChecks)) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ShellCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ShellCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ShellCommandsController.java
index 0ecb77f..e983f2a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ShellCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ShellCommandsController.java
@@ -14,14 +14,15 @@
*/
package org.apache.geode.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 org.apache.commons.lang.ArrayUtils;
+import org.apache.geode.internal.GemFireVersion;
+import org.apache.geode.internal.lang.ObjectUtils;
+import org.apache.geode.internal.util.IOUtils;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.web.domain.Link;
+import org.apache.geode.management.internal.web.domain.LinkIndex;
+import org.apache.geode.management.internal.web.domain.QueryParameterSource;
+import org.apache.geode.management.internal.web.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -32,15 +33,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
-import org.apache.geode.internal.GemFireVersion;
-import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.util.IOUtils;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.web.domain.Link;
-import org.apache.geode.management.internal.web.domain.LinkIndex;
-import org.apache.geode.management.internal.web.domain.QueryParameterSource;
-import org.apache.geode.management.internal.web.http.HttpMethod;
+import java.io.IOException;
+import java.util.Set;
+import javax.management.AttributeNotFoundException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
/**
* The ShellCommandsController class implements GemFire REST API calls for Gfsh Shell Commands.
@@ -97,7 +95,7 @@ public class ShellCommandsController extends AbstractCommandsController {
@RequestParam("operationName") final String operationName,
@RequestParam(value = "signature", required = false) String[] signature,
@RequestParam(value = "parameters", required = false) Object[] parameters) {
- signature = (signature != null ? signature : StringUtils.EMPTY_STRING_ARRAY);
+ signature = (signature != null ? signature : ArrayUtils.EMPTY_STRING_ARRAY);
parameters = (parameters != null ? parameters : ObjectUtils.EMPTY_OBJECT_ARRAY);
try {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/WanCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/WanCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/WanCommandsController.java
index fa5aa57..4fd4b96 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/WanCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/WanCommandsController.java
@@ -18,7 +18,6 @@ package org.apache.geode.management.internal.web.controllers;
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
-
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -54,12 +53,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.LIST_GATEWAY__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.LIST_GATEWAY__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -90,7 +89,7 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.CREATE_GATEWAYRECEIVER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(manualStart)) {
@@ -100,7 +99,7 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(members)) {
command.addOption(CliStrings.CREATE_GATEWAYRECEIVER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
if (hasValue(startPort)) {
@@ -127,7 +126,7 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(gatewayTransportFilters)) {
command.addOption(CliStrings.CREATE_GATEWAYRECEIVER__GATEWAYTRANSPORTFILTER,
- StringUtils.concat(gatewayTransportFilters, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(gatewayTransportFilters, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -182,12 +181,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.CREATE_GATEWAYSENDER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.CREATE_GATEWAYSENDER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
if (hasValue(parallel)) {
@@ -257,12 +256,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(gatewayEventFilters)) {
command.addOption(CliStrings.CREATE_GATEWAYSENDER__GATEWAYEVENTFILTER,
- StringUtils.concat(gatewayEventFilters, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(gatewayEventFilters, StringUtils.COMMA_DELIMITER));
}
if (hasValue(gatewayTransportFilters)) {
command.addOption(CliStrings.CREATE_GATEWAYSENDER__GATEWAYTRANSPORTFILTER,
- StringUtils.concat(gatewayTransportFilters, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(gatewayTransportFilters, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -281,12 +280,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.CREATE_GATEWAYSENDER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.CREATE_GATEWAYSENDER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
}
@@ -318,12 +317,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.PAUSE_GATEWAYSENDER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.PAUSE_GATEWAYSENDER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -344,12 +343,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.RESUME_GATEWAYSENDER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.RESUME_GATEWAYSENDER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -367,12 +366,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.START_GATEWAYRECEIVER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.START_GATEWAYRECEIVER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -393,12 +392,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.START_GATEWAYSENDER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.START_GATEWAYSENDER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -415,12 +414,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.STATUS_GATEWAYRECEIVER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.STATUS_GATEWAYRECEIVER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -439,12 +438,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.STATUS_GATEWAYSENDER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.STATUS_GATEWAYSENDER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -461,12 +460,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.STOP_GATEWAYRECEIVER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.STOP_GATEWAYRECEIVER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -485,12 +484,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.STOP_GATEWAYSENDER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.STOP_GATEWAYSENDER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
index cef8cab..3ec04c7 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
@@ -14,16 +14,16 @@
*/
package org.apache.geode.management.internal.web.domain;
-import java.io.Serializable;
-import java.net.URI;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlType;
-
import org.apache.geode.internal.lang.ObjectUtils;
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.web.http.HttpMethod;
import org.apache.geode.management.internal.web.util.UriUtils;
+import java.io.Serializable;
+import java.net.URI;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
/**
* The Link class models hypermedia controls/link relations.
* <p/>
@@ -97,7 +97,7 @@ public class Link implements Comparable<Link>, Serializable {
}
public final void setRelation(final String relation) {
- assert !StringUtils.isBlank(relation) : "The Link relation (rel) must be specified!";
+ assert StringUtils.isNotBlank(relation) : "The Link relation (rel) must be specified!";
this.relation = relation;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/LinkIndex.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/LinkIndex.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/LinkIndex.java
index 7d5bb37..2a99e82 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/LinkIndex.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/LinkIndex.java
@@ -14,6 +14,8 @@
*/
package org.apache.geode.management.internal.web.domain;
+import org.apache.commons.lang.StringUtils;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -26,8 +28,6 @@ import java.util.TreeSet;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.geode.internal.lang.StringUtils;
-
/**
* The LinkIndex class is abstraction for modeling an index of Links.
* <p/>
@@ -127,7 +127,7 @@ public class LinkIndex implements Iterable<Link> {
int count = 0;
for (final Link link : this) {
- buffer.append(count++ > 0 ? ", " : StringUtils.EMPTY_STRING).append(link);
+ buffer.append(count++ > 0 ? ", " : StringUtils.EMPTY).append(link);
}
buffer.append("]");
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/http/HttpHeader.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/http/HttpHeader.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/http/HttpHeader.java
index ee7e932..74836bc 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/http/HttpHeader.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/http/HttpHeader.java
@@ -14,7 +14,7 @@
*/
package org.apache.geode.management.internal.web.http;
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
/**
* The HttpHeader enum is an enumeration of all HTTP request/response header names.
@@ -78,7 +78,7 @@ public enum HttpHeader {
private final String name;
HttpHeader(final String name) {
- assert !StringUtils.isBlank(name) : "The name of the HTTP request header must be specified!";
+ assert StringUtils.isNotBlank(name) : "The name of the HTTP request header must be specified!";
this.name = name;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvoker.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvoker.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvoker.java
index eeedf40..13fd42c 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvoker.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvoker.java
@@ -15,9 +15,9 @@
package org.apache.geode.management.internal.web.shell;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.internal.lang.Filter;
import org.apache.geode.internal.lang.Initable;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.util.CollectionUtils;
import org.apache.geode.management.internal.cli.CommandRequest;
@@ -447,7 +447,7 @@ public class RestHttpOperationInvoker extends AbstractHttpOperationInvoker imple
@Override
public boolean accept(final Map.Entry<String, String> entry) {
- return !StringUtils.isBlank(entry.getValue());
+ return StringUtils.isNotBlank(entry.getValue());
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/util/ConvertUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/util/ConvertUtils.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/util/ConvertUtils.java
index f3b092d..0b6fbe3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/util/ConvertUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/util/ConvertUtils.java
@@ -14,19 +14,18 @@
*/
package org.apache.geode.management.internal.web.util;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.internal.util.IOUtils;
import org.apache.geode.management.internal.cli.CliUtil;
import org.apache.geode.management.internal.web.io.MultipartFileResourceAdapter;
-
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;
import org.springframework.web.multipart.MultipartFile;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* The ConvertUtils class is a support class for performing conversions used by the GemFire web
* application and REST interface.
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/util/UriUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/util/UriUtils.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/util/UriUtils.java
index b83064e..a22ee13 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/util/UriUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/util/UriUtils.java
@@ -19,8 +19,6 @@ import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Map;
-import org.apache.geode.internal.lang.StringUtils;
-
/**
* The UriUtils is a utility class for processing URIs and URLs.
* <p/>
@@ -32,7 +30,7 @@ import org.apache.geode.internal.lang.StringUtils;
@SuppressWarnings("unused")
public abstract class UriUtils {
- public static final String DEFAULT_ENCODING = StringUtils.UTF_8;
+ public static final String DEFAULT_ENCODING = "UTF-8";
/**
* Decodes the encoded String value using the default encoding, UTF-8. It is assumed the String
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/cache/client/internal/LocatorTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/client/internal/LocatorTestBase.java b/geode-core/src/test/java/org/apache/geode/cache/client/internal/LocatorTestBase.java
index c3b349a..7c168dc 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/client/internal/LocatorTestBase.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/client/internal/LocatorTestBase.java
@@ -14,10 +14,20 @@
*/
package org.apache.geode.cache.client.internal;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-
-import org.apache.geode.cache.*;
+import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION;
+import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.START_LOCATOR;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.cache.AttributesFactory;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.Scope;
import org.apache.geode.cache.client.Pool;
import org.apache.geode.cache.client.PoolManager;
import org.apache.geode.cache.server.CacheServer;
@@ -25,16 +35,26 @@ import org.apache.geode.cache.server.ServerLoadProbe;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.distributed.Locator;
import org.apache.geode.internal.cache.PoolFactoryImpl;
-import org.apache.geode.test.dunit.*;
+import org.apache.geode.test.dunit.Assert;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.Invoke;
+import org.apache.geode.test.dunit.LogWriterUtils;
+import org.apache.geode.test.dunit.NetworkUtils;
+import org.apache.geode.test.dunit.SerializableCallable;
+import org.apache.geode.test.dunit.SerializableRunnable;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
-import java.util.*;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
/**
*
@@ -198,8 +218,8 @@ public abstract class LocatorTestBase extends JUnit4DistributedTestCase {
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, locators);
- if (useGroupsProperty) {
- props.setProperty(GROUPS, StringUtils.concat(groups, ","));
+ if (useGroupsProperty && groups != null) {
+ props.setProperty(GROUPS, StringUtils.join(groups, ","));
}
DistributedSystem ds = getSystem(props);
Cache cache = CacheFactory.create(ds);
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherIntegrationTestCase.java b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherIntegrationTestCase.java
index 09fa09e..bf6a854 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherIntegrationTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherIntegrationTestCase.java
@@ -17,9 +17,9 @@ package org.apache.geode.distributed;
import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
import static org.junit.Assert.assertTrue;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.process.PidUnavailableException;
import org.apache.geode.internal.process.ProcessStreamReader.InputListener;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
index 62d4bdd..416b459 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
@@ -14,10 +14,14 @@
*/
package org.apache.geode.distributed;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import org.apache.geode.internal.lang.StringUtils;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.test.junit.categories.UnitTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -108,11 +112,11 @@ public class AbstractLauncherTest {
assertNotNull(distributedSystemProperties);
assertFalse(distributedSystemProperties.containsKey(NAME));
- launcher = createAbstractLauncher(StringUtils.EMPTY_STRING, "333");
+ launcher = createAbstractLauncher(StringUtils.EMPTY, "333");
assertNotNull(launcher);
assertEquals("333", launcher.getMemberId());
- assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberName());
+ assertEquals(StringUtils.EMPTY, launcher.getMemberName());
distributedSystemProperties = launcher.getDistributedSystemProperties();
@@ -166,11 +170,11 @@ public class AbstractLauncherTest {
assertNull(launcher.getMemberName());
assertEquals("123", launcher.getMember());
- launcher = createAbstractLauncher(StringUtils.EMPTY_STRING, "123");
+ launcher = createAbstractLauncher(StringUtils.EMPTY, "123");
assertNotNull(launcher);
assertEquals("123", launcher.getMemberId());
- assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberName());
+ assertEquals(StringUtils.EMPTY, launcher.getMemberName());
assertEquals("123", launcher.getMember());
launcher = createAbstractLauncher(" ", "123");
@@ -180,10 +184,10 @@ public class AbstractLauncherTest {
assertEquals(" ", launcher.getMemberName());
assertEquals("123", launcher.getMember());
- launcher = createAbstractLauncher(null, StringUtils.EMPTY_STRING);
+ launcher = createAbstractLauncher(null, StringUtils.EMPTY);
assertNotNull(launcher);
- assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberId());
+ assertEquals(StringUtils.EMPTY, launcher.getMemberId());
assertNull(launcher.getMemberName());
assertNull(launcher.getMember());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherIntegrationTest.java
index 5b53c6a..b856361 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherIntegrationTest.java
@@ -14,6 +14,12 @@
*/
package org.apache.geode.distributed;
+import static com.googlecode.catchexception.apis.BDDCatchException.caughtException;
+import static com.googlecode.catchexception.apis.BDDCatchException.when;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.assertj.core.api.BDDAssertions.assertThat;
+import static org.assertj.core.api.BDDAssertions.then;
+
import org.apache.geode.distributed.LocatorLauncher.Builder;
import org.apache.geode.distributed.LocatorLauncher.Command;
import org.apache.geode.distributed.internal.DistributionConfig;
@@ -33,12 +39,6 @@ import java.io.IOException;
import java.net.InetAddress;
import java.util.Properties;
-import static com.googlecode.catchexception.apis.BDDCatchException.caughtException;
-import static com.googlecode.catchexception.apis.BDDCatchException.when;
-import static org.assertj.core.api.BDDAssertions.assertThat;
-import static org.assertj.core.api.BDDAssertions.then;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
/**
* Integration tests for LocatorLauncher. These tests require file system I/O.
*/
@@ -110,7 +110,7 @@ public class LocatorLauncherIntegrationTest {
gemfireProperties);
// when: starting with null MemberName
- LocatorLauncher launcher = new Builder().setCommand(Command.START).setMemberName(null).build();
+ LocatorLauncher launcher = new Builder().setCommand(Command.START).build();
// then: name in gemfire.properties file should be used for MemberName
assertThat(launcher).isNotNull();
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
index 06d6054..50cea4d 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
@@ -14,13 +14,22 @@
*/
package org.apache.geode.distributed;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
import org.apache.geode.distributed.LocatorLauncher.Builder;
import org.apache.geode.distributed.LocatorLauncher.Command;
import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.test.junit.categories.FlakyTest;
import org.apache.geode.test.junit.categories.UnitTest;
-import joptsimple.OptionException;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.RestoreSystemProperties;
@@ -29,9 +38,8 @@ import org.junit.rules.TestName;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import joptsimple.OptionException;
-import static org.junit.Assert.*;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
/**
* The LocatorLauncherTest class is a test suite of test cases for testing the contract and
@@ -53,6 +61,11 @@ public class LocatorLauncherTest {
@Rule
public final TestName testName = new TestName();
+ @Before
+ public void setup() {
+ DistributedSystem.removeSystem(InternalDistributedSystem.getConnectedInstance());
+ }
+
@Test(expected = IllegalArgumentException.class)
public void testBuilderParseArgumentsWithNonNumericPort() {
try {
@@ -154,8 +167,6 @@ public class LocatorLauncherTest {
assertNull(builder.getHostnameForClients());
assertSame(builder, builder.setHostnameForClients("Pegasus"));
assertEquals("Pegasus", builder.getHostnameForClients());
- assertSame(builder, builder.setHostnameForClients(null));
- assertNull(builder.getHostnameForClients());
}
@Test(expected = IllegalArgumentException.class)
@@ -184,6 +195,19 @@ public class LocatorLauncherTest {
}
}
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetHostnameForClientsWithNullString() {
+ try {
+ new Builder().setHostnameForClients(null);
+ } catch (IllegalArgumentException expected) {
+ assertEquals(
+ LocalizedStrings.LocatorLauncher_Builder_INVALID_HOSTNAME_FOR_CLIENTS_ERROR_MESSAGE
+ .toLocalizedString(),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
@Test
public void testSetAndGetMemberName() {
Builder builder = new Builder();
@@ -191,8 +215,6 @@ public class LocatorLauncherTest {
assertNull(builder.getMemberName());
assertSame(builder, builder.setMemberName("locatorOne"));
assertEquals("locatorOne", builder.getMemberName());
- assertSame(builder, builder.setMemberName(null));
- assertNull(builder.getMemberName());
}
@Test(expected = IllegalArgumentException.class)
@@ -219,6 +241,18 @@ public class LocatorLauncherTest {
}
}
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMemberNameWithNullString() {
+ try {
+ new Builder().setMemberName(null);
+ } catch (IllegalArgumentException expected) {
+ assertEquals(
+ LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE.toLocalizedString("Locator"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
@Test
public void testSetAndGetPid() {
Builder builder = new Builder();
@@ -299,7 +333,7 @@ public class LocatorLauncherTest {
.setHostnameForClients("beanstock.vmware.com").setMemberName("Beanstock").setPort(8192)
.build();
- assertNotNull(launcher);
+ assertThat(launcher).isNotNull();
assertEquals(builder.getCommand(), launcher.getCommand());
assertTrue(launcher.isDebugging());
assertEquals(builder.getHostnameForClients(), launcher.getHostnameForClients());
@@ -312,10 +346,10 @@ public class LocatorLauncherTest {
@Test
public void testBuildWithMemberNameSetInApiPropertiesOnStart() {
- LocatorLauncher launcher = new Builder().setCommand(LocatorLauncher.Command.START)
- .setMemberName(null).set(NAME, "locatorABC").build();
+ LocatorLauncher launcher =
+ new Builder().setCommand(LocatorLauncher.Command.START).set(NAME, "locatorABC").build();
- assertNotNull(launcher);
+ assertThat(launcher).isNotNull();
assertEquals(LocatorLauncher.Command.START, launcher.getCommand());
assertNull(launcher.getMemberName());
assertEquals("locatorABC", launcher.getProperties().getProperty(NAME));
@@ -325,10 +359,9 @@ public class LocatorLauncherTest {
public void testBuildWithMemberNameSetInSystemPropertiesOnStart() {
System.setProperty(DistributionConfig.GEMFIRE_PREFIX + NAME, "locatorXYZ");
- LocatorLauncher launcher =
- new Builder().setCommand(LocatorLauncher.Command.START).setMemberName(null).build();
+ LocatorLauncher launcher = new Builder().setCommand(LocatorLauncher.Command.START).build();
- assertNotNull(launcher);
+ assertThat(launcher).isNotNull();
assertEquals(LocatorLauncher.Command.START, launcher.getCommand());
assertNull(launcher.getMemberName());
}
[06/14] geode git commit: GEODE-1994: Overhaul of
internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
index bd6d810..c63b10b 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
@@ -14,6 +14,30 @@
*/
package org.apache.geode.management.internal.cli;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.execute.Execution;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.cache.execute.ResultCollector;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.internal.ClassPathLoader;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.execute.AbstractExecution;
+import org.apache.geode.internal.cache.tier.sockets.CacheClientProxy;
+import org.apache.geode.internal.util.IOUtils;
+import org.apache.geode.management.DistributedSystemMXBean;
+import org.apache.geode.management.ManagementService;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.functions.MembersForRegionFunction;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResultException;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.shell.Gfsh;
+
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileFilter;
@@ -42,30 +66,6 @@ import java.util.zip.DataFormatException;
import java.util.zip.Deflater;
import java.util.zip.Inflater;
-import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.execute.Execution;
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.internal.ClassPathLoader;
-import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.cache.execute.AbstractExecution;
-import org.apache.geode.internal.cache.tier.sockets.CacheClientProxy;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.util.IOUtils;
-import org.apache.geode.management.DistributedSystemMXBean;
-import org.apache.geode.management.ManagementService;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.functions.MembersForRegionFunction;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.CommandResultException;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
-import org.apache.geode.management.internal.cli.shell.Gfsh;
-
/**
* This class contains utility methods used by classes used to build the Command Line Interface
* (CLI).
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupport.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupport.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupport.java
index ae44e24..26b903b 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupport.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupport.java
@@ -14,13 +14,7 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.springframework.shell.core.CommandMarker;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.execute.Execution;
import org.apache.geode.cache.execute.Function;
@@ -29,13 +23,18 @@ import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.ClusterConfigurationService;
import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.management.cli.CliMetaData;
import org.apache.geode.management.cli.Result;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.shell.Gfsh;
import org.apache.geode.management.internal.cli.util.MemberNotFoundException;
+import org.springframework.shell.core.CommandMarker;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.HashSet;
+import java.util.Set;
/**
* The AbstractCommandsSupport class is an abstract base class encapsulating common functionality
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConfigCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConfigCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConfigCommands.java
index 5dfc1b8..ca2de76 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConfigCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConfigCommands.java
@@ -23,6 +23,7 @@ import org.apache.geode.cache.execute.FunctionInvocationTargetException;
import org.apache.geode.cache.execute.ResultCollector;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.internal.cache.xmlcache.CacheXml;
+import org.apache.geode.internal.logging.log4j.LogLevel;
import org.apache.geode.management.cli.CliMetaData;
import org.apache.geode.management.cli.ConverterHint;
import org.apache.geode.management.cli.Result;
@@ -42,7 +43,6 @@ import org.apache.geode.management.internal.cli.result.ErrorResultData;
import org.apache.geode.management.internal.cli.result.InfoResultData;
import org.apache.geode.management.internal.cli.result.ResultBuilder;
import org.apache.geode.management.internal.cli.result.TabularResultData;
-import org.apache.geode.internal.logging.log4j.LogLevel;
import org.apache.geode.management.internal.configuration.domain.XmlEntity;
import org.apache.geode.management.internal.security.ResourceOperation;
import org.apache.geode.security.ResourcePermission.Operation;
@@ -56,8 +56,6 @@ import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -76,7 +74,7 @@ public class ConfigCommands extends AbstractCommandsSupport {
new AlterRuntimeConfigFunction();
@CliCommand(value = {CliStrings.DESCRIBE_CONFIG}, help = CliStrings.DESCRIBE_CONFIG__HELP)
- @CliMetaData(shellOnly = false, relatedTopic = {CliStrings.TOPIC_GEODE_CONFIG})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_CONFIG})
@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
public Result describeConfig(@CliOption(key = CliStrings.DESCRIBE_CONFIG__MEMBER,
optionContext = ConverterHint.ALL_MEMBER_IDNAME,
@@ -131,10 +129,7 @@ public class ConfigCommands extends AbstractCommandsSupport {
SectionResultData cacheServerSection = crd.addSection();
cacheServerSection.setHeader("Cache-server attributes");
- Iterator<Map<String, String>> iters = cacheServerAttributesList.iterator();
-
- while (iters.hasNext()) {
- Map<String, String> cacheServerAttributes = iters.next();
+ for (Map<String, String> cacheServerAttributes : cacheServerAttributesList) {
addSubSection(cacheServerSection, cacheServerAttributes, "");
}
}
@@ -164,7 +159,7 @@ public class ConfigCommands extends AbstractCommandsSupport {
SectionResultData section = crd.addSection();
section.setHeader(headerText);
section.addSeparator('.');
- Set<String> attributes = new TreeSet<String>(attrMap.keySet());
+ Set<String> attributes = new TreeSet<>(attrMap.keySet());
for (String attribute : attributes) {
String attributeValue = attrMap.get(attribute);
@@ -177,7 +172,7 @@ public class ConfigCommands extends AbstractCommandsSupport {
String headerText) {
if (!attrMap.isEmpty()) {
SectionResultData subSection = section.addSection();
- Set<String> attributes = new TreeSet<String>(attrMap.keySet());
+ Set<String> attributes = new TreeSet<>(attrMap.keySet());
subSection.setHeader(headerText);
for (String attribute : attributes) {
@@ -262,16 +257,12 @@ public class ConfigCommands extends AbstractCommandsSupport {
optionContext = ConverterHint.MEMBERGROUP,
help = CliStrings.ALTER_RUNTIME_CONFIG__MEMBER__HELP) String group,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__ARCHIVE__DISK__SPACE__LIMIT},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__ARCHIVE__DISK__SPACE__LIMIT__HELP) Integer archiveDiskSpaceLimit,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__ARCHIVE__FILE__SIZE__LIMIT},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__ARCHIVE__FILE__SIZE__LIMIT__HELP) Integer archiveFileSizeLimit,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__LOG__DISK__SPACE__LIMIT},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__LOG__DISK__SPACE__LIMIT__HELP) Integer logDiskSpaceLimit,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__LOG__FILE__SIZE__LIMIT},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__LOG__FILE__SIZE__LIMIT__HELP) Integer logFileSizeLimit,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__LOG__LEVEL},
optionContext = ConverterHint.LOG_LEVEL,
@@ -279,31 +270,24 @@ public class ConfigCommands extends AbstractCommandsSupport {
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__ARCHIVE__FILE},
help = CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__ARCHIVE__FILE__HELP) String statisticArchiveFile,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLE__RATE},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLE__RATE__HELP) Integer statisticSampleRate,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLING__ENABLED},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLING__ENABLED__HELP) Boolean statisticSamplingEnabled,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__COPY__ON__READ},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
specifiedDefaultValue = "false",
help = CliStrings.ALTER_RUNTIME_CONFIG__COPY__ON__READ__HELP) Boolean setCopyOnRead,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__LOCK__LEASE},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__LOCK__LEASE__HELP) Integer lockLease,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__LOCK__TIMEOUT},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__LOCK__TIMEOUT__HELP) Integer lockTimeout,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__MESSAGE__SYNC__INTERVAL},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__MESSAGE__SYNC__INTERVAL__HELP) Integer messageSyncInterval,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__SEARCH__TIMEOUT},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__SEARCH__TIMEOUT__HELP) Integer searchTimeout) {
- Map<String, String> runTimeDistributionConfigAttributes = new HashMap<String, String>();
- Map<String, String> rumTimeCacheAttributes = new HashMap<String, String>();
- Set<DistributedMember> targetMembers = new HashSet<DistributedMember>();
+ Map<String, String> runTimeDistributionConfigAttributes = new HashMap<>();
+ Map<String, String> rumTimeCacheAttributes = new HashMap<>();
+ Set<DistributedMember> targetMembers;
try {
@@ -381,7 +365,7 @@ public class ConfigCommands extends AbstractCommandsSupport {
}
if (!runTimeDistributionConfigAttributes.isEmpty() || !rumTimeCacheAttributes.isEmpty()) {
- Map<String, String> allRunTimeAttributes = new HashMap<String, String>();
+ Map<String, String> allRunTimeAttributes = new HashMap<>();
allRunTimeAttributes.putAll(runTimeDistributionConfigAttributes);
allRunTimeAttributes.putAll(rumTimeCacheAttributes);
@@ -390,8 +374,8 @@ public class ConfigCommands extends AbstractCommandsSupport {
List<CliFunctionResult> results = CliFunctionResult.cleanResults((List<?>) rc.getResult());
CompositeResultData crd = ResultBuilder.createCompositeResultData();
TabularResultData tabularData = crd.addSection().addTable();
- Set<String> successfulMembers = new TreeSet<String>();
- Set<String> errorMessages = new TreeSet<String>();
+ Set<String> successfulMembers = new TreeSet<>();
+ Set<String> errorMessages = new TreeSet<>();
for (CliFunctionResult result : results) {
@@ -459,7 +443,7 @@ public class ConfigCommands extends AbstractCommandsSupport {
Map<String, String> arguments = parseResult.getParamValueStrings();
// validate log level
String logLevel = arguments.get("log-level");
- if (!StringUtils.isBlank(logLevel) && (LogLevel.getLevel(logLevel) == null)) {
+ if (StringUtils.isNotBlank(logLevel) && (LogLevel.getLevel(logLevel) == null)) {
return ResultBuilder.createUserErrorResult("Invalid log level: " + logLevel);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
index 5b0651e..b8ebc49 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
@@ -14,28 +14,7 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.regex.Pattern;
-
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.LogWriter;
import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.ExpirationAttributes;
@@ -52,7 +31,6 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.security.IntegratedSecurityService;
import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.management.DistributedRegionMXBean;
@@ -83,14 +61,33 @@ import org.apache.geode.management.internal.configuration.domain.XmlEntity;
import org.apache.geode.management.internal.security.ResourceOperation;
import org.apache.geode.security.ResourcePermission.Operation;
import org.apache.geode.security.ResourcePermission.Resource;
+import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.regex.Pattern;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
/**
* @since GemFire 7.0
*/
public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
- public static final Set<RegionShortcut> PERSISTENT_OVERFLOW_SHORTCUTS =
- new TreeSet<RegionShortcut>();
+ public static final Set<RegionShortcut> PERSISTENT_OVERFLOW_SHORTCUTS = new TreeSet<>();
private SecurityService securityService = IntegratedSecurityService.getSecurityService();
@@ -117,17 +114,13 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
@ResourceOperation(resource = Resource.DATA, operation = Operation.MANAGE)
public Result createRegion(
@CliOption(key = CliStrings.CREATE_REGION__REGION, mandatory = true,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__REGION__HELP) String regionPath,
- @CliOption(key = CliStrings.CREATE_REGION__REGIONSHORTCUT, mandatory = false,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
+ @CliOption(key = CliStrings.CREATE_REGION__REGIONSHORTCUT,
help = CliStrings.CREATE_REGION__REGIONSHORTCUT__HELP) RegionShortcut regionShortcut,
@CliOption(key = CliStrings.CREATE_REGION__USEATTRIBUTESFROM,
optionContext = ConverterHint.REGION_PATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__USEATTRIBUTESFROM__HELP) String useAttributesFrom,
@CliOption(key = CliStrings.CREATE_REGION__GROUP, optionContext = ConverterHint.MEMBERGROUP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__GROUP__HELP) String[] groups,
@CliOption(key = CliStrings.CREATE_REGION__SKIPIFEXISTS, unspecifiedDefaultValue = "true",
specifiedDefaultValue = "true",
@@ -145,44 +138,32 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
help = CliStrings.CREATE_REGION__CACHEWRITER__HELP) String cacheWriter,
@CliOption(key = CliStrings.CREATE_REGION__COLOCATEDWITH,
optionContext = ConverterHint.REGION_PATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__COLOCATEDWITH__HELP) String prColocatedWith,
@CliOption(key = CliStrings.CREATE_REGION__COMPRESSOR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__COMPRESSOR__HELP) String compressor,
@CliOption(key = CliStrings.CREATE_REGION__CONCURRENCYLEVEL,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__CONCURRENCYLEVEL__HELP) Integer concurrencyLevel,
@CliOption(key = CliStrings.CREATE_REGION__DISKSTORE,
help = CliStrings.CREATE_REGION__DISKSTORE__HELP) String diskStore,
@CliOption(key = CliStrings.CREATE_REGION__ENABLEASYNCCONFLATION,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__ENABLEASYNCCONFLATION__HELP) Boolean enableAsyncConflation,
@CliOption(key = CliStrings.CREATE_REGION__CLONINGENABLED,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__CLONINGENABLED__HELP) Boolean cloningEnabled,
@CliOption(key = CliStrings.CREATE_REGION__CONCURRENCYCHECKSENABLED,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__CONCURRENCYCHECKSENABLED__HELP) Boolean concurrencyChecksEnabled,
@CliOption(key = CliStrings.CREATE_REGION__MULTICASTENABLED,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__MULTICASTENABLED__HELP) Boolean mcastEnabled,
@CliOption(key = CliStrings.CREATE_REGION__STATISTICSENABLED,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__STATISTICSENABLED__HELP) Boolean statisticsEnabled,
@CliOption(key = CliStrings.CREATE_REGION__ENABLESUBSCRIPTIONCONFLATION,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__ENABLESUBSCRIPTIONCONFLATION__HELP) Boolean enableSubscriptionConflation,
@CliOption(key = CliStrings.CREATE_REGION__DISKSYNCHRONOUS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__DISKSYNCHRONOUS__HELP) Boolean diskSynchronous,
@CliOption(key = CliStrings.CREATE_REGION__ENTRYEXPIRATIONIDLETIME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__ENTRYEXPIRATIONIDLETIME__HELP) Integer entryExpirationIdleTime,
@CliOption(key = CliStrings.CREATE_REGION__ENTRYEXPIRATIONIDLETIMEACTION,
help = CliStrings.CREATE_REGION__ENTRYEXPIRATIONIDLETIMEACTION__HELP) String entryExpirationIdleTimeAction,
@CliOption(key = CliStrings.CREATE_REGION__ENTRYEXPIRATIONTIMETOLIVE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__ENTRYEXPIRATIONTIMETOLIVE__HELP) Integer entryExpirationTTL,
@CliOption(key = CliStrings.CREATE_REGION__ENTRYEXPIRATIONTTLACTION,
help = CliStrings.CREATE_REGION__ENTRYEXPIRATIONTTLACTION__HELP) String entryExpirationTTLAction,
@@ -191,45 +172,34 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
@CliOption(key = CliStrings.CREATE_REGION__KEYCONSTRAINT,
help = CliStrings.CREATE_REGION__KEYCONSTRAINT__HELP) String keyConstraint,
@CliOption(key = CliStrings.CREATE_REGION__LOCALMAXMEMORY,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__LOCALMAXMEMORY__HELP) Integer prLocalMaxMemory,
- @CliOption(key = CliStrings.CREATE_REGION__OFF_HEAP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
- specifiedDefaultValue = "true",
+ @CliOption(key = CliStrings.CREATE_REGION__OFF_HEAP, specifiedDefaultValue = "true",
help = CliStrings.CREATE_REGION__OFF_HEAP__HELP) Boolean offHeap,
@CliOption(key = CliStrings.CREATE_REGION__PARTITION_RESOLVER,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__PARTITION_RESOLVER__HELP) String partitionResolver,
@CliOption(key = CliStrings.CREATE_REGION__REGIONEXPIRATIONIDLETIME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__REGIONEXPIRATIONIDLETIME__HELP) Integer regionExpirationIdleTime,
@CliOption(key = CliStrings.CREATE_REGION__REGIONEXPIRATIONIDLETIMEACTION,
help = CliStrings.CREATE_REGION__REGIONEXPIRATIONIDLETIMEACTION__HELP) String regionExpirationIdleTimeAction,
@CliOption(key = CliStrings.CREATE_REGION__REGIONEXPIRATIONTTL,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__REGIONEXPIRATIONTTL__HELP) Integer regionExpirationTTL,
@CliOption(key = CliStrings.CREATE_REGION__REGIONEXPIRATIONTTLACTION,
help = CliStrings.CREATE_REGION__REGIONEXPIRATIONTTLACTION__HELP) String regionExpirationTTLAction,
@CliOption(key = CliStrings.CREATE_REGION__RECOVERYDELAY,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__RECOVERYDELAY__HELP) Long prRecoveryDelay,
@CliOption(key = CliStrings.CREATE_REGION__REDUNDANTCOPIES,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__REDUNDANTCOPIES__HELP) Integer prRedundantCopies,
@CliOption(key = CliStrings.CREATE_REGION__STARTUPRECOVERYDDELAY,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__STARTUPRECOVERYDDELAY__HELP) Long prStartupRecoveryDelay,
@CliOption(key = CliStrings.CREATE_REGION__TOTALMAXMEMORY,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__TOTALMAXMEMORY__HELP) Long prTotalMaxMemory,
@CliOption(key = CliStrings.CREATE_REGION__TOTALNUMBUCKETS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__TOTALNUMBUCKETS__HELP) Integer prTotalNumBuckets,
@CliOption(key = CliStrings.CREATE_REGION__VALUECONSTRAINT,
help = CliStrings.CREATE_REGION__VALUECONSTRAINT__HELP) String valueConstraint
// NOTICE: keep the region attributes params in alphabetical order
) {
- Result result = null;
+ Result result;
AtomicReference<XmlEntity> xmlEntity = new AtomicReference<>();
try {
@@ -271,7 +241,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
regionExpirationTTLAction);
}
- RegionFunctionArgs regionFunctionArgs = null;
+ RegionFunctionArgs regionFunctionArgs;
if (useAttributesFrom != null) {
if (!regionExists(cache, useAttributesFrom)) {
throw new IllegalArgumentException(CliStrings.format(
@@ -330,7 +300,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
validateRegionFunctionArgs(cache, regionFunctionArgs);
- Set<DistributedMember> membersToCreateRegionOn = null;
+ Set<DistributedMember> membersToCreateRegionOn;
if (groups != null && groups.length != 0) {
membersToCreateRegionOn = CliUtil.getDistributedMembersByGroup(cache, groups);
// have only normal members from the group
@@ -370,10 +340,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
result = ResultBuilder.buildResult(tabularResultData);
verifyDistributedRegionMbean(cache, regionPath);
- } catch (IllegalArgumentException e) {
- LogWrapper.getInstance().info(e.getMessage());
- result = ResultBuilder.createUserErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException | IllegalStateException e) {
LogWrapper.getInstance().info(e.getMessage());
result = ResultBuilder.createUserErrorResult(e.getMessage());
} catch (RuntimeException e) {
@@ -406,8 +373,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
} else {
Thread.sleep(2);
}
- } catch (Exception ex) {
- continue;
+ } catch (Exception ignored) {
}
}
return false;
@@ -417,64 +383,47 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
@CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_REGION)
public Result alterRegion(
@CliOption(key = CliStrings.ALTER_REGION__REGION, mandatory = true,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_REGION__REGION__HELP) String regionPath,
@CliOption(key = CliStrings.ALTER_REGION__GROUP, optionContext = ConverterHint.MEMBERGROUP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_REGION__GROUP__HELP) String[] groups,
@CliOption(key = CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "-1",
+ specifiedDefaultValue = "-1",
help = CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIME__HELP) Integer entryExpirationIdleTime,
@CliOption(key = CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIMEACTION,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
specifiedDefaultValue = "INVALIDATE",
help = CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIMEACTION__HELP) String entryExpirationIdleTimeAction,
@CliOption(key = CliStrings.ALTER_REGION__ENTRYEXPIRATIONTIMETOLIVE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "-1",
+ specifiedDefaultValue = "-1",
help = CliStrings.ALTER_REGION__ENTRYEXPIRATIONTIMETOLIVE__HELP) Integer entryExpirationTTL,
@CliOption(key = CliStrings.ALTER_REGION__ENTRYEXPIRATIONTTLACTION,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
specifiedDefaultValue = "INVALIDATE",
help = CliStrings.ALTER_REGION__ENTRYEXPIRATIONTTLACTION__HELP) String entryExpirationTTLAction,
@CliOption(key = CliStrings.ALTER_REGION__REGIONEXPIRATIONIDLETIME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "-1",
+ specifiedDefaultValue = "-1",
help = CliStrings.ALTER_REGION__REGIONEXPIRATIONIDLETIME__HELP) Integer regionExpirationIdleTime,
@CliOption(key = CliStrings.ALTER_REGION__REGIONEXPIRATIONIDLETIMEACTION,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
specifiedDefaultValue = "INVALIDATE",
help = CliStrings.ALTER_REGION__REGIONEXPIRATIONIDLETIMEACTION__HELP) String regionExpirationIdleTimeAction,
- @CliOption(key = CliStrings.ALTER_REGION__REGIONEXPIRATIONTTL,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "-1",
+ @CliOption(key = CliStrings.ALTER_REGION__REGIONEXPIRATIONTTL, specifiedDefaultValue = "-1",
help = CliStrings.ALTER_REGION__REGIONEXPIRATIONTTL__HELP) Integer regionExpirationTTL,
@CliOption(key = CliStrings.ALTER_REGION__REGIONEXPIRATIONTTLACTION,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
specifiedDefaultValue = "INVALIDATE",
help = CliStrings.ALTER_REGION__REGIONEXPIRATIONTTLACTION__HELP) String regionExpirationTTLAction,
- @CliOption(key = CliStrings.ALTER_REGION__CACHELISTENER,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "",
+ @CliOption(key = CliStrings.ALTER_REGION__CACHELISTENER, specifiedDefaultValue = "",
help = CliStrings.ALTER_REGION__CACHELISTENER__HELP) String[] cacheListeners,
- @CliOption(key = CliStrings.ALTER_REGION__CACHELOADER,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
- specifiedDefaultValue = "null",
+ @CliOption(key = CliStrings.ALTER_REGION__CACHELOADER, specifiedDefaultValue = "null",
help = CliStrings.ALTER_REGION__CACHELOADER__HELP) String cacheLoader,
- @CliOption(key = CliStrings.ALTER_REGION__CACHEWRITER,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
- specifiedDefaultValue = "null",
+ @CliOption(key = CliStrings.ALTER_REGION__CACHEWRITER, specifiedDefaultValue = "null",
help = CliStrings.ALTER_REGION__CACHEWRITER__HELP) String cacheWriter,
- @CliOption(key = CliStrings.ALTER_REGION__ASYNCEVENTQUEUEID,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "",
+ @CliOption(key = CliStrings.ALTER_REGION__ASYNCEVENTQUEUEID, specifiedDefaultValue = "",
help = CliStrings.ALTER_REGION__ASYNCEVENTQUEUEID__HELP) String[] asyncEventQueueIds,
- @CliOption(key = CliStrings.ALTER_REGION__GATEWAYSENDERID,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "",
+ @CliOption(key = CliStrings.ALTER_REGION__GATEWAYSENDERID, specifiedDefaultValue = "",
help = CliStrings.ALTER_REGION__GATEWAYSENDERID__HELP) String[] gatewaySenderIds,
- @CliOption(key = CliStrings.ALTER_REGION__CLONINGENABLED,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
- specifiedDefaultValue = "false",
+ @CliOption(key = CliStrings.ALTER_REGION__CLONINGENABLED, specifiedDefaultValue = "false",
help = CliStrings.ALTER_REGION__CLONINGENABLED__HELP) Boolean cloningEnabled,
- @CliOption(key = CliStrings.ALTER_REGION__EVICTIONMAX,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "0",
+ @CliOption(key = CliStrings.ALTER_REGION__EVICTIONMAX, specifiedDefaultValue = "0",
help = CliStrings.ALTER_REGION__EVICTIONMAX__HELP) Integer evictionMax) {
- Result result = null;
+ Result result;
AtomicReference<XmlEntity> xmlEntity = new AtomicReference<>();
this.securityService.authorizeRegionManage(regionPath);
@@ -535,10 +484,10 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
regionExpirationTTLAction);
}
- cacheLoader = convertDefaultValue(cacheLoader, StringUtils.EMPTY_STRING);
- cacheWriter = convertDefaultValue(cacheWriter, StringUtils.EMPTY_STRING);
+ cacheLoader = convertDefaultValue(cacheLoader, StringUtils.EMPTY);
+ cacheWriter = convertDefaultValue(cacheWriter, StringUtils.EMPTY);
- RegionFunctionArgs regionFunctionArgs = null;
+ RegionFunctionArgs regionFunctionArgs;
regionFunctionArgs = new RegionFunctionArgs(regionPath, null, null, false, null, null, null,
entryIdle, entryTTL, regionIdle, regionTTL, null, null, null, null, cacheListeners,
cacheLoader, cacheWriter, asyncEventQueueIds, gatewaySenderIds, null, cloningEnabled,
@@ -599,10 +548,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
}
}
result = ResultBuilder.buildResult(tabularResultData);
- } catch (IllegalArgumentException e) {
- LogWrapper.getInstance().info(e.getMessage());
- result = ResultBuilder.createUserErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException | IllegalStateException e) {
LogWrapper.getInstance().info(e.getMessage());
result = ResultBuilder.createUserErrorResult(e.getMessage());
} catch (RuntimeException e) {
@@ -624,8 +570,8 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
DistributedSystemMXBean dsMBean = managementService.getDistributedSystemMXBean();
String[] allRegionPaths = dsMBean.listAllRegionPaths();
- for (int i = 0; i < allRegionPaths.length; i++) {
- if (allRegionPaths[i].equals(regionPath)) {
+ for (String allRegionPath : allRegionPaths) {
+ if (allRegionPath.equals(regionPath)) {
regionFound = true;
break;
}
@@ -635,7 +581,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
}
private void validateRegionPathAndParent(InternalCache cache, String regionPath) {
- if (regionPath == null || "".equals(regionPath)) {
+ if (StringUtils.isEmpty(regionPath)) {
throw new IllegalArgumentException(CliStrings.CREATE_REGION__MSG__SPECIFY_VALID_REGION_PATH);
}
// If a region path indicates a sub-region, check whether the parent region exists
@@ -652,13 +598,13 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
private void validateGroups(InternalCache cache, String[] groups) {
if (groups != null && groups.length != 0) {
- Set<String> existingGroups = new HashSet<String>();
+ Set<String> existingGroups = new HashSet<>();
Set<DistributedMember> members = CliUtil.getAllNormalMembers(cache);
for (DistributedMember distributedMember : members) {
List<String> memberGroups = distributedMember.getGroups();
existingGroups.addAll(memberGroups);
}
- List<String> groupsList = new ArrayList<String>(Arrays.asList(groups));
+ List<String> groupsList = new ArrayList<>(Arrays.asList(groups));
groupsList.removeAll(existingGroups);
if (!groupsList.isEmpty()) {
@@ -800,8 +746,8 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
throw new IllegalArgumentException(
CliStrings.CREATE_REGION__MSG__NO_GATEWAYSENDERS_IN_THE_SYSTEM);
} else {
- List<String> gatewaySendersList = new ArrayList<String>(Arrays.asList(gatewaySenders));
- gatewaySenderIds = new HashSet<String>(gatewaySenderIds);
+ List<String> gatewaySendersList = new ArrayList<>(Arrays.asList(gatewaySenders));
+ gatewaySenderIds = new HashSet<>(gatewaySenderIds);
gatewaySenderIds.removeAll(gatewaySendersList);
if (!gatewaySenderIds.isEmpty()) {
throw new IllegalArgumentException(CliStrings.format(
@@ -874,14 +820,9 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
String compressorClassName = regionFunctionArgs.getCompressor();
Object compressor = null;
try {
- Class<?> compressorClass =
- (Class<?>) ClassPathLoader.getLatest().forName(compressorClassName);
+ Class<?> compressorClass = ClassPathLoader.getLatest().forName(compressorClassName);
compressor = compressorClass.newInstance();
- } catch (InstantiationException e) {
- compressorFailure = true;
- } catch (IllegalAccessException e) {
- compressorFailure = true;
- } catch (ClassNotFoundException e) {
+ } catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) {
compressorFailure = true;
}
@@ -954,8 +895,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
List<?> resultsList = (List<?>) resultCollector.getResult();
if (resultsList != null && !resultsList.isEmpty()) {
- for (int i = 0; i < resultsList.size(); i++) {
- Object object = resultsList.get(i);
+ for (Object object : resultsList) {
if (object instanceof IllegalArgumentException) {
throw (IllegalArgumentException) object;
} else if (object instanceof Throwable) {
@@ -1024,7 +964,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
}
@CliCommand(value = {CliStrings.DESTROY_REGION}, help = CliStrings.DESTROY_REGION__HELP)
- @CliMetaData(shellOnly = false, relatedTopic = CliStrings.TOPIC_GEODE_REGION)
+ @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_REGION)
@ResourceOperation(resource = Resource.DATA, operation = Operation.MANAGE)
public Result destroyRegion(
@CliOption(key = CliStrings.DESTROY_REGION__REGION, optionContext = ConverterHint.REGION_PATH,
@@ -1035,15 +975,14 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
.createInfoResult(CliStrings.DESTROY_REGION__MSG__SPECIFY_REGIONPATH_TO_DESTROY);
}
- if (regionPath.trim().isEmpty() || regionPath.equals(Region.SEPARATOR)) {
+ if (StringUtils.isBlank(regionPath) || regionPath.equals(Region.SEPARATOR)) {
return ResultBuilder.createInfoResult(CliStrings.format(
CliStrings.DESTROY_REGION__MSG__REGIONPATH_0_NOT_VALID, new Object[] {regionPath}));
}
- Result result = null;
+ Result result;
AtomicReference<XmlEntity> xmlEntity = new AtomicReference<>();
try {
- String message = "";
InternalCache cache = getCache();
ManagementService managementService = ManagementService.getExistingManagementService(cache);
String regionPathToUse = regionPath;
@@ -1061,18 +1000,18 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
new Object[] {regionPath, "jmx-manager-update-rate milliseconds"}));
}
- CliFunctionResult destroyRegionResult = null;
+ CliFunctionResult destroyRegionResult;
ResultCollector<?, ?> resultCollector =
CliUtil.executeFunction(RegionDestroyFunction.INSTANCE, regionPath, regionMembersList);
List<CliFunctionResult> resultsList = (List<CliFunctionResult>) resultCollector.getResult();
- message = CliStrings.format(CliStrings.DESTROY_REGION__MSG__REGION_0_1_DESTROYED,
+ String message = CliStrings.format(CliStrings.DESTROY_REGION__MSG__REGION_0_1_DESTROYED,
new Object[] {regionPath, ""});
// Only if there is an error is this set to false
boolean isRegionDestroyed = true;
- for (int i = 0; i < resultsList.size(); i++) {
- destroyRegionResult = resultsList.get(i);
+ for (CliFunctionResult aResultsList : resultsList) {
+ destroyRegionResult = aResultsList;
if (destroyRegionResult.isSuccessful()) {
xmlEntity.set(destroyRegionResult.getXmlEntity());
} else if (destroyRegionResult.getThrowable() != null) {
@@ -1175,7 +1114,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
private Set<DistributedMember> getMembersByIds(InternalCache cache, Set<String> memberIds) {
Set<DistributedMember> foundMembers = Collections.emptySet();
if (memberIds != null && !memberIds.isEmpty()) {
- foundMembers = new HashSet<DistributedMember>();
+ foundMembers = new HashSet<>();
Set<DistributedMember> allNormalMembers = CliUtil.getAllNormalMembers(cache);
for (String memberId : memberIds) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportImportClusterConfigurationCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportImportClusterConfigurationCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportImportClusterConfigurationCommands.java
index dfd20a9..ea10182 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportImportClusterConfigurationCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportImportClusterConfigurationCommands.java
@@ -14,30 +14,16 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import static java.util.stream.Collectors.*;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import static java.util.stream.Collectors.joining;
+import static java.util.stream.Collectors.toSet;
import org.apache.commons.io.FileUtils;
-import org.apache.logging.log4j.Logger;
-import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.execute.ResultCollector;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.ClusterConfigurationService;
import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.management.cli.CliMetaData;
import org.apache.geode.management.cli.Result;
@@ -58,6 +44,20 @@ import org.apache.geode.management.internal.configuration.utils.ZipUtils;
import org.apache.geode.management.internal.security.ResourceOperation;
import org.apache.geode.security.ResourcePermission.Operation;
import org.apache.geode.security.ResourcePermission.Resource;
+import org.apache.logging.log4j.Logger;
+import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* Commands for the cluster configuration
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/IndexCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/IndexCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/IndexCommands.java
index 9110a1a..a4ba64c 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/IndexCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/IndexCommands.java
@@ -145,11 +145,12 @@ public class IndexCommands extends AbstractCommandsSupport {
final TabularResultData indexData = ResultBuilder.createTabularResultData();
for (final IndexDetails indexDetails : indexDetailsList) {
- indexData.accumulate("Member Name", StringUtils.valueOf(indexDetails.getMemberName(), ""));
+ indexData.accumulate("Member Name",
+ StringUtils.defaultString(indexDetails.getMemberName()));
indexData.accumulate("Member ID", indexDetails.getMemberId());
indexData.accumulate("Region Path", indexDetails.getRegionPath());
indexData.accumulate("Name", indexDetails.getIndexName());
- indexData.accumulate("Type", StringUtils.valueOf(indexDetails.getIndexType(), ""));
+ indexData.accumulate("Type", StringUtils.defaultString(indexDetails.getIndexType()));
indexData.accumulate("Indexed Expression", indexDetails.getIndexedExpression());
indexData.accumulate("From Clause", indexDetails.getFromClause());
@@ -355,7 +356,7 @@ public class IndexCommands extends AbstractCommandsSupport {
// If a regionName is specified, then authorize data manage on the regionName, otherwise, it
// requires data manage permission on all regions
- if (!StringUtils.isBlank(regionPath)) {
+ if (StringUtils.isNotBlank(regionPath)) {
regionName = regionPath.startsWith("/") ? regionPath.substring(1) : regionPath;
this.securityService.authorizeRegionManage(regionName);
} else {
@@ -405,15 +406,15 @@ public class IndexCommands extends AbstractCommandsSupport {
if (!successfulMembers.isEmpty()) {
InfoResultData infoResult = ResultBuilder.createInfoResultData();
- if (!StringUtils.isBlank(indexName)) {
- if (!StringUtils.isBlank(regionPath)) {
+ if (StringUtils.isNotBlank(indexName)) {
+ if (StringUtils.isNotBlank(regionPath)) {
infoResult.addLine(CliStrings.format(CliStrings.DESTROY_INDEX__ON__REGION__SUCCESS__MSG,
indexName, regionPath));
} else {
infoResult.addLine(CliStrings.format(CliStrings.DESTROY_INDEX__SUCCESS__MSG, indexName));
}
} else {
- if (!StringUtils.isBlank(regionPath)) {
+ if (StringUtils.isNotBlank(regionPath)) {
infoResult.addLine(CliStrings
.format(CliStrings.DESTROY_INDEX__ON__REGION__ONLY__SUCCESS__MSG, regionPath));
} else {
@@ -431,7 +432,7 @@ public class IndexCommands extends AbstractCommandsSupport {
} else {
ErrorResultData erd = ResultBuilder.createErrorResultData();
- if (!StringUtils.isBlank(indexName)) {
+ if (StringUtils.isNotBlank(indexName)) {
erd.addLine(CliStrings.format(CliStrings.DESTROY_INDEX__FAILURE__MSG, indexName));
} else {
erd.addLine("Indexes could not be destroyed for following reasons");
@@ -668,27 +669,27 @@ public class IndexCommands extends AbstractCommandsSupport {
public String getNumberOfKeys() {
return (getIndexStatisticsDetails() != null
- ? StringUtils.valueOf(getIndexStatisticsDetails().getNumberOfKeys(), "") : "");
+ ? StringUtils.defaultString(getIndexStatisticsDetails().getNumberOfKeys()) : "");
}
public String getNumberOfUpdates() {
return (getIndexStatisticsDetails() != null
- ? StringUtils.valueOf(getIndexStatisticsDetails().getNumberOfUpdates(), "") : "");
+ ? StringUtils.defaultString(getIndexStatisticsDetails().getNumberOfUpdates()) : "");
}
public String getNumberOfValues() {
return (getIndexStatisticsDetails() != null
- ? StringUtils.valueOf(getIndexStatisticsDetails().getNumberOfValues(), "") : "");
+ ? StringUtils.defaultString(getIndexStatisticsDetails().getNumberOfValues()) : "");
}
public String getTotalUpdateTime() {
return (getIndexStatisticsDetails() != null
- ? StringUtils.valueOf(getIndexStatisticsDetails().getTotalUpdateTime(), "") : "");
+ ? StringUtils.defaultString(getIndexStatisticsDetails().getTotalUpdateTime()) : "");
}
public String getTotalUses() {
return (getIndexStatisticsDetails() != null
- ? StringUtils.valueOf(getIndexStatisticsDetails().getTotalUses(), "") : "");
+ ? StringUtils.defaultString(getIndexStatisticsDetails().getTotalUses()) : "");
}
}
[12/14] geode git commit: GEODE-2929: remove superfluous final from
methods
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeap.java
index 6071836..3364a6e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VersionedThinRegionEntryHeap extends VersionedThinRegionEntry {
+
public VersionedThinRegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VersionedThinRegionEntryHeap extends VersionedThinRegionEn
}
private static class VersionedThinRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VersionedThinRegionEntryHeap extends VersionedThinRegionEn
return new VersionedThinRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeap.java
index 21c1806..f225bac 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedThinRegionEntryOffHeap extends VersionedThinRegionEntry
implements OffHeapRegionEntry {
+
public VersionedThinRegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedThinRegionEntryOffHeap extends VersionedThinRegio
}
private static class VersionedThinRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedThinRegionEntryOffHeap extends VersionedThinRegio
return new VersionedThinRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java
index da0c190..1f328ff 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java
@@ -436,7 +436,7 @@ public class ResourceAdvisor extends DistributionAdvisor {
});
}
- public final boolean isHeapCritical(final InternalDistributedMember member) {
+ public boolean isHeapCritical(final InternalDistributedMember member) {
ResourceManagerProfile rmp = (ResourceManagerProfile) getProfile(member);
return rmp != null ? rmp.getHeapState().isCritical() : false;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXLockIdImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXLockIdImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXLockIdImpl.java
index 0fd607c..b1e5bab 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXLockIdImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXLockIdImpl.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache.locks;
import org.apache.geode.internal.DataSerializableFixedID;
@@ -25,11 +24,11 @@ import org.apache.geode.distributed.internal.membership.*;
/**
* Identifies a group of transaction locks.
- *
*/
public class TXLockIdImpl implements TXLockId, DataSerializableFixedID {
private static final long serialVersionUID = 8579214625084490134L;
+
/** DistributionManager id for this member */
private InternalDistributedMember memberId;
@@ -122,7 +121,7 @@ public class TXLockIdImpl implements TXLockId, DataSerializableFixedID {
out.writeInt(this.id);
}
- public static final TXLockIdImpl createFromData(DataInput in)
+ public static TXLockIdImpl createFromData(DataInput in)
throws IOException, ClassNotFoundException {
TXLockIdImpl result = new TXLockIdImpl();
result.fromData(in);
@@ -131,7 +130,6 @@ public class TXLockIdImpl implements TXLockId, DataSerializableFixedID {
@Override
public Version[] getSerializationVersions() {
- // TODO Auto-generated method stub
return null;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUAlgorithm.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUAlgorithm.java b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUAlgorithm.java
index 9b69c7e..b07a124 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUAlgorithm.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUAlgorithm.java
@@ -16,13 +16,16 @@ package org.apache.geode.internal.cache.lru;
import org.apache.geode.InternalGemFireException;
import org.apache.geode.StatisticsFactory;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.CacheCallback;
+import org.apache.geode.cache.EvictionAction;
+import org.apache.geode.cache.Region;
import org.apache.geode.internal.cache.BucketRegion;
import org.apache.geode.internal.cache.PlaceHolderDiskRegion;
import org.apache.geode.internal.i18n.LocalizedStrings;
-import java.io.*;
-import java.util.*;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Properties;
/**
* Eviction controllers that extend this class evict the least recently used (LRU) entry in the
@@ -67,8 +70,6 @@ public abstract class LRUAlgorithm implements CacheCallback, Serializable, Clone
*/
public static final String EVICTION_ACTION = "eviction-action";
- //////////////////////// Instance Fields ///////////////////////
-
/** What to do upon eviction */
protected EvictionAction evictionAction;
@@ -79,7 +80,6 @@ public abstract class LRUAlgorithm implements CacheCallback, Serializable, Clone
private transient EnableLRU helper;
protected BucketRegion bucketRegion;
- ///////////////////////// Constructors /////////////////////////
/**
* Creates a new <code>LRUAlgorithm</code> with the given {@linkplain EvictionAction eviction
@@ -91,8 +91,6 @@ public abstract class LRUAlgorithm implements CacheCallback, Serializable, Clone
this.helper = createLRUHelper();
}
- /////////////////////// Instance Methods ///////////////////////
-
/**
* Used to hook up a bucketRegion late during disk recover.
*/
@@ -131,7 +129,7 @@ public abstract class LRUAlgorithm implements CacheCallback, Serializable, Clone
* For internal use only. Returns a helper object used internally by the GemFire cache
* implementation.
*/
- public final EnableLRU getLRUHelper() {
+ public EnableLRU getLRUHelper() {
synchronized (this) {
// Synchronize with readObject/writeObject to avoid race
// conditions with copy sharing. See bug 31047.
@@ -154,24 +152,6 @@ public abstract class LRUAlgorithm implements CacheCallback, Serializable, Clone
}
}
- // public void writeExternal(ObjectOutput out)
- // throws IOException {
- // out.writeObject(this.evictionAction);
- // }
-
- // public void readExternal(ObjectInput in)
- // throws IOException, ClassNotFoundException {
- // String evictionAction = (String) in.readObject();
- // this.setEvictionAction(evictionAction);
- // }
-
- // protected Object readResolve() throws ObjectStreamException {
- // if (this.helper == null) {
- // this.helper = createLRUHelper();
- // }
- // return this;
- // }
-
/**
* Creates a new <code>LRUHelper</code> tailed for this LRU algorithm implementation.
*/
@@ -241,11 +221,7 @@ public abstract class LRUAlgorithm implements CacheCallback, Serializable, Clone
return true;
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- *
+ /**
* Note that we just need to make sure that equal objects return equal hashcodes; nothing really
* elaborate is done here.
*/
@@ -262,8 +238,6 @@ public abstract class LRUAlgorithm implements CacheCallback, Serializable, Clone
@Override
public abstract String toString();
- ////////////////////// Inner Classes //////////////////////
-
/**
* A partial implementation of the <code>EnableLRU</code> interface that contains code common to
* all <code>LRUAlgorithm</code>s.
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessage.java
index 8d164c8..c4a3fbd 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessage.java
@@ -44,7 +44,7 @@ public class BucketBackupMessage extends PartitionMessage {
private int bucketId;
/**
- * Empty contstructor provided for {@link org.apache.geode.DataSerializer}
+ * Empty constructor provided for {@link org.apache.geode.DataSerializer}
*/
public BucketBackupMessage() {
super();
@@ -73,7 +73,7 @@ public class BucketBackupMessage extends PartitionMessage {
* of the initialization
*/
@Override
- protected final boolean failIfRegionMissing() {
+ protected boolean failIfRegionMissing() {
return false;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
index f1633bd..c9d7d70 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
@@ -98,8 +98,8 @@ public class DeposePrimaryBucketMessage extends PartitionMessage {
}
@Override
- protected final boolean operateOnPartitionedRegion(DistributionManager dm,
- PartitionedRegion region, long startTime) throws ForceReattemptException {
+ protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion region,
+ long startTime) throws ForceReattemptException {
BucketAdvisor bucketAdvisor = region.getRegionAdvisor().getBucketAdvisor(this.bucketId);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
index 664ebe7..1072576 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache.partitioned;
import java.io.DataInput;
@@ -85,7 +84,6 @@ public class FetchEntryMessage extends PartitionMessage {
* @param recipient the member that the getEntry message is sent to
* @param r the PartitionedRegion for which getEntry was performed upon
* @param key the object to which the value should be feteched
- * @param access
* @return the processor used to fetch the returned value associated with the key
* @throws ForceReattemptException if the peer is no longer available
*/
@@ -109,11 +107,6 @@ public class FetchEntryMessage extends PartitionMessage {
fromData(in);
}
- // final public int getProcessorType()
- // {
- // return DistributionManager.PARTITIONED_REGION_EXECUTOR;
- // }
-
@Override
public boolean isSevereAlertCompatible() {
// allow forced-disconnect processing for all cache op messages
@@ -121,7 +114,7 @@ public class FetchEntryMessage extends PartitionMessage {
}
@Override
- protected final boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion r,
+ protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion r,
long startTime) throws ForceReattemptException {
// FetchEntryMessage is used in refreshing client caches during interest list recovery,
// so don't be too verbose or hydra tasks may time out
@@ -209,7 +202,7 @@ public class FetchEntryMessage extends PartitionMessage {
return s;
}
- public final void setKey(Object key) {
+ public void setKey(Object key) {
this.key = key;
}
@@ -322,9 +315,7 @@ public class FetchEntryMessage extends PartitionMessage {
}
/**
- * A processor to capture the value returned by
- * {@link org.apache.geode.internal.cache.partitioned.FetchEntryMessage.FetchEntryReplyMessage}
- *
+ * A processor to capture the value returned by {@link FetchEntryMessage.FetchEntryReplyMessage}
*/
public static class FetchEntryResponse extends PartitionResponse {
private volatile EntrySnapshot returnValue;
@@ -356,13 +347,10 @@ public class FetchEntryMessage extends PartitionMessage {
/**
* @return Object associated with the key that was sent in the get message
- * @throws EntryNotFoundException
* @throws ForceReattemptException if the peer is no longer available
- * @throws EntryNotFoundException
*/
public EntrySnapshot waitForResponse() throws EntryNotFoundException, ForceReattemptException {
try {
- // waitForRepliesUninterruptibly();
waitForCacheException();
} catch (ForceReattemptException e) {
e.checkKey(key);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
index 21dfa8d..523186d 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
@@ -99,8 +99,8 @@ public class FetchPartitionDetailsMessage extends PartitionMessage {
}
@Override
- protected final boolean operateOnPartitionedRegion(DistributionManager dm,
- PartitionedRegion region, long startTime) throws ForceReattemptException {
+ protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion region,
+ long startTime) throws ForceReattemptException {
PartitionMemberInfoImpl details = (PartitionMemberInfoImpl) region.getRedundancyProvider()
.buildPartitionMemberDetails(this.internal, this.loadProbe);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
index 6f18013..2d2b3c4 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
@@ -47,7 +47,6 @@ import org.apache.geode.internal.logging.log4j.LogMarker;
* Usage: MoveBucketResponse response = MoveBucketMessage.send( InternalDistributedMember,
* PartitionedRegion, int bucketId); if (response != null && response.waitForResponse()) { // bucket
* was moved }
- *
*/
public class MoveBucketMessage extends PartitionMessage {
private static final Logger logger = LogService.getLogger();
@@ -106,8 +105,8 @@ public class MoveBucketMessage extends PartitionMessage {
}
@Override
- protected final boolean operateOnPartitionedRegion(DistributionManager dm,
- PartitionedRegion region, long startTime) throws ForceReattemptException {
+ protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion region,
+ long startTime) throws ForceReattemptException {
PartitionedRegionDataStore dataStore = region.getDataStore();
boolean moved = dataStore.moveBucket(this.bucketId, this.source, true);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
index 6b59f51..8c27107 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
@@ -184,24 +184,17 @@ public abstract class PartitionMessage extends DistributionMessage
this.isTransactionDistributed = other.isTransactionDistributed;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TransactionMessage#getTXOriginatorClient()
- */
public InternalDistributedMember getTXOriginatorClient() {
return txMemberId;
}
- public final InternalDistributedMember getMemberToMasqueradeAs() {
+ public InternalDistributedMember getMemberToMasqueradeAs() {
if (txMemberId == null) {
return getSender();
}
return txMemberId;
}
-
-
/**
* Severe alert processing enables suspect processing at the ack-wait-threshold and issuing of a
* severe alert at the end of the ack-severe-alert-threshold. Some messages should not support
@@ -669,11 +662,6 @@ public abstract class PartitionMessage extends DistributionMessage
// subclasses that support routing to clients should reimplement this method
}
- /*
- * public void appendOldValueToMessage(EntryEventImpl event) {
- *
- * }
- */
/**
* @return the txUniqId
*/
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
index 7ee54d8..1898461 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
@@ -342,7 +342,6 @@ public class RemoveAllPRMessage extends PartitionMessageWithDirectReply {
@Override
protected Object clone() throws CloneNotSupportedException {
- // TODO Auto-generated method stub
return super.clone();
}
@@ -629,9 +628,8 @@ public class RemoveAllPRMessage extends PartitionMessageWithDirectReply {
RemoveAllReplyMessage.send(member, procId, getReplySender(dm), this.result, this.versions, ex);
}
-
@Override
- protected final void appendFields(StringBuilder buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; removeAllPRDataSize=").append(removeAllPRDataSize).append("; bucketId=")
.append(bucketId);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
index a8ff068..6650549 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
@@ -45,7 +45,6 @@ import org.apache.geode.internal.logging.log4j.LogMarker;
* Usage: RemoveBucketResponse response = RemoveBucketMessage.send( InternalDistributedMember,
* PartitionedRegion, int bucketId); if (response != null && response.waitForResponse()) { // bucket
* was removed }
- *
*/
public class RemoveBucketMessage extends PartitionMessage {
private static final Logger logger = LogService.getLogger();
@@ -53,7 +52,6 @@ public class RemoveBucketMessage extends PartitionMessage {
private int bucketId;
private boolean forceRemovePrimary;
-
/**
* Empty constructor to satisfy {@link DataSerializer} requirements
*/
@@ -103,8 +101,8 @@ public class RemoveBucketMessage extends PartitionMessage {
}
@Override
- protected final boolean operateOnPartitionedRegion(DistributionManager dm,
- PartitionedRegion region, long startTime) throws ForceReattemptException {
+ protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion region,
+ long startTime) throws ForceReattemptException {
PartitionedRegionDataStore dataStore = region.getDataStore();
boolean removed = dataStore.removeBucket(this.bucketId, this.forceRemovePrimary);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
index 0c6aea8..a6c9707 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
@@ -110,7 +110,7 @@ public class SizeMessage extends PartitionMessage {
* of the initialization
*/
@Override
- protected final boolean failIfRegionMissing() {
+ protected boolean failIfRegionMissing() {
return false;
}
@@ -154,10 +154,6 @@ public class SizeMessage extends PartitionMessage {
sizes = ds.getSizeForLocalBuckets();
}
}
- // if (logger.isTraceEnabled(LogMarker.DM)) {
- // l.fine(getClass().getName() + " send sizes back using processorId: "
- // + getProcessorId());
- // }
r.getPrStats().endPartitionMessagesProcessing(startTime);
SizeReplyMessage.send(getSender(), getProcessorId(), dm, sizes);
} // datastore exists
@@ -270,7 +266,7 @@ public class SizeMessage extends PartitionMessage {
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
- this.bucketSizes = (Map<Integer, SizeEntry>) DataSerializer.readObject(in);
+ this.bucketSizes = DataSerializer.readObject(in);
}
@Override
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientUpdater.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientUpdater.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientUpdater.java
index 728abf7..291db65 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientUpdater.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientUpdater.java
@@ -1872,11 +1872,11 @@ public class CacheClientUpdater extends Thread implements ClientUpdater, Disconn
this.stats.close();
}
- public final void incReceivedBytes(long v) {
+ public void incReceivedBytes(long v) {
this.stats.incLong(receivedBytesId, v);
}
- public final void incSentBytes(long v) {
+ public void incSentBytes(long v) {
// noop since we never send messages
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Part.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Part.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Part.java
index 889980f..cfe812c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Part.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Part.java
@@ -34,14 +34,15 @@ import org.apache.geode.internal.offheap.StoredObject;
* to edge requests
*
* @see Message
- *
* @since GemFire 2.0.2
*/
public class Part {
+
private static final byte BYTE_CODE = 0;
private static final byte OBJECT_CODE = 1;
private Version version;
+
/**
* Used to represent and empty byte array for bug 36279
*
@@ -68,7 +69,6 @@ public class Part {
this.typeCode = tc;
}
-
public void clear() {
if (this.part != null) {
if (this.part instanceof HeapDataOutputStream) {
@@ -249,7 +249,6 @@ public class Part {
| ((((long) bytes[6]) << 8) & 0x000000000000FF00l) | (bytes[7] & 0x00000000000000FFl);
}
-
public byte[] getSerializedForm() {
if (this.part == null) {
return null;
@@ -291,7 +290,7 @@ public class Part {
*
* @param buf the buffer to use if any data needs to be copied to one
*/
- public final void writeTo(OutputStream out, ByteBuffer buf) throws IOException {
+ public void writeTo(OutputStream out, ByteBuffer buf) throws IOException {
if (getLength() > 0) {
if (this.part instanceof byte[]) {
byte[] bytes = (byte[]) this.part;
@@ -436,19 +435,6 @@ public class Part {
sb.append("partCode=");
sb.append(typeCodeToString(this.typeCode));
sb.append(" partLength=" + getLength());
- // sb.append(" partBytes=");
- // byte[] b = getSerializedForm();
- // if (b == null) {
- // sb.append("null");
- // }
- // else {
- // sb.append("(");
- // for (int i = 0; i < b.length; i ++) {
- // sb.append(Integer.toString(b[i]));
- // sb.append(" ");
- // }
- // sb.append(")");
- // }
return sb.toString();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
index 39f30d6..f8771f7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
@@ -904,28 +904,6 @@ public class ParallelGatewaySenderQueue implements RegionQueue {
throw new UnsupportedOperationException();
}
- /**
- * TODO: Optimization needed. We are creating 1 array list for each peek!!
- *
- * @return BucketRegionQueue
- */
- private final BucketRegionQueue getRandomBucketRegionQueue() {
- PartitionedRegion prQ = getRandomShadowPR();
- if (prQ != null) {
- final PartitionedRegionDataStore ds = prQ.getDataStore();
- final List<Integer> buckets = new ArrayList<Integer>(ds.getAllLocalPrimaryBucketIds());
- if (buckets.isEmpty())
- return null;
- final int index = new Random().nextInt(buckets.size());
- final int brqId = buckets.get(index);
- final BucketRegionQueue brq = (BucketRegionQueue) ds.getLocalBucketById(brqId);
- if (brq.isReadyForPeek()) {
- return brq;
- }
- }
- return null;
- }
-
protected boolean areLocalBucketQueueRegionsPresent() {
boolean bucketsAvailable = false;
for (PartitionedRegion prQ : this.userRegionNameToshadowPRMap.values()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/BatchDestroyOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/BatchDestroyOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/BatchDestroyOperation.java
index d38b2c7..b23615a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/BatchDestroyOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/BatchDestroyOperation.java
@@ -126,13 +126,6 @@ public class BatchDestroyOperation extends DistributedCacheOperation {
}
}
}
- // Non-optimized way
- // for (Long k : (Set<Long>)rgn.keys()) {
- // if (k > this.tailKey) {
- // continue;
- // }
- // rgn.localDestroy(k, RegionQueue.WAN_QUEUE_TOKEN);
- // }
this.appliedOperation = true;
} catch (CacheWriterException e) {
throw new Error(
@@ -147,8 +140,7 @@ public class BatchDestroyOperation extends DistributedCacheOperation {
@Override
@Retained
- protected final InternalCacheEvent createEvent(DistributedRegion rgn)
- throws EntryNotFoundException {
+ protected InternalCacheEvent createEvent(DistributedRegion rgn) throws EntryNotFoundException {
EntryEventImpl ev = createEntryEvent(rgn);
boolean evReturned = false;
try {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreation.java
index 9501666..9eb6dfe 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreation.java
@@ -28,24 +28,20 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
/**
* Represents a {@link CacheTransactionManager} that is created declaratively.
*
- *
* @since GemFire 4.0
*/
public class CacheTransactionManagerCreation implements CacheTransactionManager {
- /////////////////////// Instance Fields ///////////////////////
-
/** The TransactionListener instance set using the cache's CacheTransactionManager */
private final ArrayList txListeners = new ArrayList();
+
private TransactionWriter writer = null;
- /////////////////////// Constructors ///////////////////////
/**
* Creates a new <code>CacheTransactionManagerCreation</code>
*/
public CacheTransactionManagerCreation() {}
- ////////////////////// Instance Methods //////////////////////
public TransactionListener setListener(TransactionListener newListener) {
TransactionListener result = getListener();
this.txListeners.clear();
@@ -78,7 +74,7 @@ public class CacheTransactionManagerCreation implements CacheTransactionManager
return result;
}
- public final TransactionListener getListener() {
+ public TransactionListener getListener() {
if (this.txListeners.isEmpty()) {
return null;
} else if (this.txListeners.size() == 1) {
@@ -120,7 +116,7 @@ public class CacheTransactionManagerCreation implements CacheTransactionManager
.toLocalizedString());
}
- public final void setWriter(TransactionWriter writer) {
+ public void setWriter(TransactionWriter writer) {
this.writer = writer;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlVersion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlVersion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlVersion.java
index 413fc4a..460f107 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlVersion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlVersion.java
@@ -19,12 +19,13 @@ import java.util.HashMap;
/**
* {@link Enum} for Cache XML versions. Resolves issues with old String based comparisons. Under the
* old String comparison version "8.1" was older than "8_0" and "10.0" was older than "9.0".
- *
+ * <p>
+ * TODO future - replace constants in CacheXml with this Enum completely
*
* @since GemFire 8.1
*/
-// TODO future - replace constants in CacheXml with this Enum completely
public enum CacheXmlVersion {
+
GEMFIRE_3_0(CacheXml.VERSION_3_0, CacheXml.PUBLIC_ID_3_0, CacheXml.SYSTEM_ID_3_0, null, null),
GEMFIRE_4_0(CacheXml.VERSION_4_0, CacheXml.PUBLIC_ID_4_0, CacheXml.SYSTEM_ID_4_0, null, null),
GEMFIRE_4_1(CacheXml.VERSION_4_1, CacheXml.PUBLIC_ID_4_1, CacheXml.SYSTEM_ID_4_1, null, null),
@@ -132,7 +133,7 @@ public enum CacheXmlVersion {
* @throws IllegalArgumentException if version does not exist.
* @since GemFire 8.1
*/
- public static final CacheXmlVersion valueForVersion(final String version) {
+ public static CacheXmlVersion valueForVersion(final String version) {
final CacheXmlVersion cacheXmlVersion = valuesForVersion.get(version);
if (null == cacheXmlVersion) {
throw new IllegalArgumentException("No enum constant "
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2.java
index 728cab4..410ca0c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache.xmlcache;
import java.io.IOException;
@@ -26,12 +25,12 @@ import org.apache.geode.internal.ClassPathLoader;
/**
* Default behavior for EntityResolver2 implementations.
- *
+ * <p>
+ * UnitTest PivotalEntityResolverJUnitTest and DefaultEntityResolver2Test
*
* @since GemFire 8.1
*/
-// UnitTest PivotalEntityResolverJUnitTest
-abstract public class DefaultEntityResolver2 implements EntityResolver2 {
+public abstract class DefaultEntityResolver2 implements EntityResolver2 {
@Override
public InputSource resolveEntity(final String publicId, final String systemId)
@@ -58,7 +57,7 @@ abstract public class DefaultEntityResolver2 implements EntityResolver2 {
* @return InputSource if resource found, otherwise null.
* @since GemFire 8.1
*/
- protected final InputSource getClassPathInputSource(final String publicId, final String systemId,
+ protected InputSource getClassPathInputSource(final String publicId, final String systemId,
final String path) {
final InputStream stream = ClassPathLoader.getLatest().getResourceAsStream(getClass(), path);
if (null == stream) {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveWriter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveWriter.java b/geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveWriter.java
index 3d375ad..71f491c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveWriter.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveWriter.java
@@ -140,7 +140,7 @@ public class StatArchiveWriter implements StatArchiveFormat, SampleHandler {
*
* @throws GemFireIOException if the archive file could not be closed.
*/
- public final void close() {
+ public void close() {
try {
this.dataOut.flush();
if (this.trace) {
@@ -176,7 +176,7 @@ public class StatArchiveWriter implements StatArchiveFormat, SampleHandler {
* Returns the number of bytes written so far to this archive. This does not take compression into
* account.
*/
- public final long bytesWritten() {
+ public long bytesWritten() {
return this.dataOut.getBytesWritten();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
index e59821d..4e450c7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
@@ -14,52 +14,82 @@
*/
package org.apache.geode.internal.tcp;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_PEER_AUTH_INIT;
+
import org.apache.geode.CancelException;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.DistributedSystemDisconnectedException;
-import org.apache.geode.distributed.internal.*;
+import org.apache.geode.distributed.internal.ConflationKey;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DMStats;
+import org.apache.geode.distributed.internal.DirectReplyProcessor;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.DistributionConfigImpl;
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.distributed.internal.DistributionStats;
+import org.apache.geode.distributed.internal.ReplyException;
+import org.apache.geode.distributed.internal.ReplyMessage;
+import org.apache.geode.distributed.internal.ReplyProcessor21;
+import org.apache.geode.distributed.internal.ReplySender;
import org.apache.geode.distributed.internal.direct.DirectChannel;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.distributed.internal.membership.MembershipManager;
import org.apache.geode.i18n.StringId;
-import org.apache.geode.internal.*;
+import org.apache.geode.internal.Assert;
+import org.apache.geode.internal.ByteArrayDataInput;
+import org.apache.geode.internal.DSFIDFactory;
+import org.apache.geode.internal.InternalDataSerializer;
+import org.apache.geode.internal.SystemTimer;
import org.apache.geode.internal.SystemTimer.SystemTimerTask;
+import org.apache.geode.internal.Version;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.LoggingThreadGroup;
import org.apache.geode.internal.logging.log4j.AlertAppender;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-import org.apache.geode.internal.net.*;
+import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.tcp.MsgReader.Header;
import org.apache.geode.internal.util.concurrent.ReentrantSemaphore;
import org.apache.logging.log4j.Logger;
-import java.io.*;
-import java.net.*;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InterruptedIOException;
+import java.io.OutputStream;
+import java.net.ConnectException;
+import java.net.Inet6Address;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketException;
+import java.net.SocketTimeoutException;
import java.nio.ByteBuffer;
import java.nio.channels.CancelledKeyException;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.ClosedSelectorException;
import java.nio.channels.SocketChannel;
-import java.util.*;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
/**
- * <p>
* Connection is a socket holder that sends and receives serialized message objects. A Connection
* may be closed to preserve system resources and will automatically be reopened when it's needed.
- * </p>
- *
+ *
* @since GemFire 2.0
- *
*/
-
public class Connection implements Runnable {
private static final Logger logger = LogService.getLogger();
@@ -153,6 +183,7 @@ public class Connection implements Runnable {
*/
private static final boolean DOMINO_THREAD_OWNED_SOCKETS =
Boolean.getBoolean("p2p.ENABLE_DOMINO_THREAD_OWNED_SOCKETS");
+
private final static ThreadLocal isDominoThread = new ThreadLocal();
// return true if this thread is a reader thread
@@ -214,22 +245,13 @@ public class Connection implements Runnable {
}
};
- // /**
- // * name of sender thread thread. Useful in finding out why a reader
- // * thread was created. Add sending of the name in handshakes and
- // * add it to the name of the reader thread (the code is there but commented out)
- // */
- // private String senderName = null;
-
- // If we are a sender then we want to know if the receiver on the
- // other end is willing to have its messages queued. The following
- // four "async" inst vars come from his handshake response.
/**
* How long to wait if receiver will not accept a message before we go into queue mode.
*
* @since GemFire 4.2.2
*/
private int asyncDistributionTimeout = 0;
+
/**
* How long to wait, with the receiver not accepting any messages, before kicking the receiver out
* of the distributed system. Ignored if asyncDistributionTimeout is zero.
@@ -237,6 +259,7 @@ public class Connection implements Runnable {
* @since GemFire 4.2.2
*/
private int asyncQueueTimeout = 0;
+
/**
* How much queued data we can have, with the receiver not accepting any messages, before kicking
* the receiver out of the distributed system. Ignored if asyncDistributionTimeout is zero.
@@ -245,6 +268,7 @@ public class Connection implements Runnable {
* @since GemFire 4.2.2
*/
private long asyncMaxQueueSize = 0;
+
/**
* True if an async queue is already being filled.
*/
@@ -256,9 +280,6 @@ public class Connection implements Runnable {
*/
private final Map conflatedKeys = new HashMap();
- // private final Queue outgoingQueue = new LinkedBlockingQueue();
-
-
// NOTE: LinkedBlockingQueue has a bug in which removes from the queue
// cause future offer to increase the size without adding anything to the queue.
// So I've changed from this backport class to a java.util.LinkedList
@@ -298,13 +319,6 @@ public class Connection implements Runnable {
/** message reader thread */
private volatile Thread readerThread;
- // /**
- // * When a thread owns the outLock and is writing to the socket, it must
- // * be placed in this variable so that it can be interrupted should the
- // * socket need to be closed.
- // */
- // private volatile Thread writerThread;
-
/** whether the reader thread is, or should be, running */
volatile boolean stopped = true;
@@ -330,9 +344,6 @@ public class Connection implements Runnable {
*/
private SystemTimer.SystemTimerTask ackTimeoutTask;
- // State for ackTimeoutTask: transmissionStartTime, ackWaitTimeout, ackSATimeout,
- // ackConnectionGroup, ackThreadName
-
/**
* millisecond clock at the time message transmission started, if doing forced-disconnect
* processing
@@ -354,7 +365,6 @@ public class Connection implements Runnable {
/** name of thread that we're currently performing an operation in (may be null) */
String ackThreadName;
-
/** the buffer used for NIO message receipt */
ByteBuffer nioInputBuffer;
@@ -514,7 +524,6 @@ public class Connection implements Runnable {
}
}
c.waitForHandshake();
- // sendHandshakeReplyOK();
c.finishedConnecting = true;
return c;
}
@@ -540,8 +549,6 @@ public class Connection implements Runnable {
try {
socket.setTcpNoDelay(true);
socket.setKeepAlive(true);
- // socket.setSoLinger(true, (Integer.valueOf(System.getProperty("p2p.lingerTime",
- // "5000"))).intValue());
setSendBufferSize(socket, SMALL_BUFFER_SIZE);
setReceiveBufferSize(socket);
} catch (SocketException e) {
@@ -922,17 +929,6 @@ public class Connection implements Runnable {
os.writeLong(this.uniqueId);
Version.CURRENT.writeOrdinal(os, true);
os.writeInt(dominoCount.get() + 1);
- // this writes the sending member + thread name that is stored in senderName
- // on the receiver to show the cause of reader thread creation
- // if (dominoCount.get() > 0) {
- // os.writeUTF(Thread.currentThread().getName());
- // } else {
- // String name = owner.getDM().getConfig().getName();
- // if (name == null) {
- // name = "pid="+OSProcess.getId();
- // }
- // os.writeUTF("["+name+"] "+Thread.currentThread().getName());
- // }
os.flush();
byte[] msg = baos.toByteArray();
@@ -1268,8 +1264,6 @@ public class Connection implements Runnable {
this.socket = channel.socket();
} else {
if (TCPConduit.useSSL) {
- // socket = javax.net.ssl.SSLSocketFactory.getDefault()
- // .createSocket(remoteAddr.getInetAddress(), remoteAddr.getPort());
int socketBufferSize =
sharedResource ? SMALL_BUFFER_SIZE : this.owner.getConduit().tcpBufferSize;
this.socket = owner.getConduit().getSocketCreator().connectForServer(
@@ -3283,7 +3277,7 @@ public class Connection implements Runnable {
* @param forceAsync true if we need to force a blocking async write.
* @throws ConnectionException if the conduit has stopped
*/
- protected final void nioWriteFully(SocketChannel channel, ByteBuffer buffer, boolean forceAsync,
+ protected void nioWriteFully(SocketChannel channel, ByteBuffer buffer, boolean forceAsync,
DistributionMessage msg) throws IOException, ConnectionException {
final DMStats stats = this.owner.getConduit().stats;
if (!this.sharedResource) {
@@ -3356,7 +3350,6 @@ public class Connection implements Runnable {
protected static final byte STATE_RECEIVED_ACK = 4;
/** the connection is in use and is reading a message */
protected static final byte STATE_READING = 5;
-
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/** set to true if we exceeded the ack-wait-threshold waiting for a response */
@@ -3378,7 +3371,6 @@ public class Connection implements Runnable {
this.connectionState = STATE_READING_ACK;
}
-
boolean origSocketInUse = this.socketInUse;
this.socketInUse = true;
MsgReader msgReader = null;
@@ -3474,7 +3466,6 @@ public class Connection implements Runnable {
}
}
-
/**
* processes the current NIO buffer. If there are complete messages in the buffer, they are
* deserialized and passed to TCPConduit for further processing
@@ -3916,14 +3907,10 @@ public class Connection implements Runnable {
}
private void setThreadName(int dominoNumber) {
- Thread.currentThread().setName(
- // (!this.sharedResource && this.senderName != null? ("<"+this.senderName+"> ->
- // ") : "") +
- // "[" + name + "] "+
- "P2P message reader for " + this.remoteAddr + " " + (this.sharedResource ? "" : "un")
- + "shared" + " " + (this.preserveOrder ? "" : "un") + "ordered" + " uid="
- + this.uniqueId + (dominoNumber > 0 ? (" dom #" + dominoNumber) : "") + " port="
- + this.socket.getPort());
+ Thread.currentThread().setName("P2P message reader for " + this.remoteAddr + " "
+ + (this.sharedResource ? "" : "un") + "shared" + " " + (this.preserveOrder ? "" : "un")
+ + "ordered" + " uid=" + this.uniqueId + (dominoNumber > 0 ? (" dom #" + dominoNumber) : "")
+ + " port=" + this.socket.getPort());
}
private void compactOrResizeBuffer(int messageLength) {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/management/internal/IdentityConverter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/IdentityConverter.java b/geode-core/src/main/java/org/apache/geode/management/internal/IdentityConverter.java
index ce5ba45..4063457 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/IdentityConverter.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/IdentityConverter.java
@@ -21,10 +21,9 @@ import javax.management.openmbean.OpenType;
/**
* Converter for classes where the open data is identical to the original data. This is true for any
* of the SimpleType types, and for an any-dimension array of those
- *
- *
*/
public class IdentityConverter extends OpenTypeConverter {
+
IdentityConverter(Type targetType, OpenType openType, Class openClass) {
super(targetType, openType, openClass);
}
@@ -33,7 +32,7 @@ public class IdentityConverter extends OpenTypeConverter {
return true;
}
- final Object toNonNullOpenValue(Object value) {
+ Object toNonNullOpenValue(Object value) {
return value;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/management/internal/OpenTypeConverter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/OpenTypeConverter.java b/geode-core/src/main/java/org/apache/geode/management/internal/OpenTypeConverter.java
index 4fdf291..0fb2b39 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/OpenTypeConverter.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/OpenTypeConverter.java
@@ -76,13 +76,12 @@ import org.apache.geode.management.ManagementException;
*
* Apart from simple types, arrays, and collections, Java types are converted through introspection
* into CompositeType
- *
- *
*/
public abstract class OpenTypeConverter {
private final Type targetType;
- /*
+
+ /**
* The Java class corresponding to getOpenType(). This is the class named by
* getOpenType().getClassName(), except that it may be a primitive type or an array of primitive
* type.
@@ -113,9 +112,7 @@ public abstract class OpenTypeConverter {
/**
* Convert an instance of openClass into an instance of targetType.
*
- * @param value
* @return the java type object
- * @throws InvalidObjectException
*/
public Object fromOpenValue(Object value) throws InvalidObjectException {
if (value == null)
@@ -129,8 +126,6 @@ public abstract class OpenTypeConverter {
/**
* Throw an appropriate InvalidObjectException if we will not be able to convert back from the
* open data to the original Java object.
- *
- * @throws InvalidObjectException
*/
void checkReconstructible() throws InvalidObjectException {
// subclasses can override
@@ -139,9 +134,7 @@ public abstract class OpenTypeConverter {
/**
* Convert an instance of targetType into an instance of openClass.
*
- * @param value
* @return open class object
- * @throws OpenDataException
*/
Object toOpenValue(Object value) throws OpenDataException {
if (value == null)
@@ -153,7 +146,6 @@ public abstract class OpenTypeConverter {
abstract Object toNonNullOpenValue(Object value) throws OpenDataException;
/**
- *
* @return True if and only if this OpenTypeConverter's toOpenValue and fromOpenValue methods are
* the identity function.
*/
@@ -174,8 +166,6 @@ public abstract class OpenTypeConverter {
}
/**
- *
- * @param type
* @return a converter corresponding to a type
*/
private static synchronized OpenTypeConverter getConverter(Type type) {
@@ -192,9 +182,6 @@ public abstract class OpenTypeConverter {
/**
* Put the converter in the map to avoid future creation
- *
- * @param type
- * @param conv
*/
private static synchronized void putConverter(Type type, OpenTypeConverter conv) {
WeakReference<OpenTypeConverter> wr = new WeakReference<OpenTypeConverter>(conv);
@@ -206,7 +193,7 @@ public abstract class OpenTypeConverter {
preDefinedConverters.add(conv);
}
- /**
+ /*
* Static block to initialize pre defined convertor
*/
static {
@@ -250,10 +237,7 @@ public abstract class OpenTypeConverter {
}
/**
- *
- * @param objType
* @return the converter for the given Java type, creating it if necessary
- * @throws OpenDataException
*/
public static synchronized OpenTypeConverter toConverter(Type objType) throws OpenDataException {
@@ -281,10 +265,7 @@ public abstract class OpenTypeConverter {
}
/**
- *
- * @param objType
- * @return the open type converrter for a given type
- * @throws OpenDataException
+ * @return the open type converter for a given type
*/
private static OpenTypeConverter makeConverter(Type objType) throws OpenDataException {
@@ -346,6 +327,7 @@ public abstract class OpenTypeConverter {
}
protected static final String[] keyArray = {"key"};
+
protected static final String[] keyValueArray = {"key", "value"};
private static OpenTypeConverter makeTabularConverter(Type objType, boolean sortedMap,
@@ -363,16 +345,14 @@ public abstract class OpenTypeConverter {
}
/**
- * Supprted types are List<E>, Set<E>, SortedSet<E>, Map<K,V>, SortedMap<K,V>.
+ * Supported types are List<E>, Set<E>, SortedSet<E>, Map<K,V>, SortedMap<K,V>.
*
* Subclasses of the above types wont be supported as deserialize info wont be there.
*
* Queue<E> won't be supported as Queue is more of a functional data structure rather than a data
* holder
*
- * @param objType
- * @return the open type converrter for a given type
- * @throws OpenDataException
+ * @return the open type converter for a given type
*/
private static OpenTypeConverter makeParameterizedConverter(ParameterizedType objType)
throws OpenDataException {
@@ -402,10 +382,7 @@ public abstract class OpenTypeConverter {
}
/**
- *
- * @param c
* @return the open type converrter for a given type
- * @throws OpenDataException
*/
private static OpenTypeConverter makeCompositeConverter(Class c) throws OpenDataException {
@@ -456,8 +433,6 @@ public abstract class OpenTypeConverter {
/**
* Converts from a CompositeData to an instance of the targetClass Various subclasses override its
* functionality.
- *
- *
*/
protected static abstract class CompositeBuilder {
CompositeBuilder(Class targetClass, String[] itemNames) {
@@ -477,10 +452,8 @@ public abstract class OpenTypeConverter {
* If the subclass should be appropriate but there is a problem, then the method throws
* InvalidObjectException.
*
- * @param getters
* @return If the subclass is appropriate for targetClass, then the method returns null. If the
* subclass is not appropriate, then the method returns an explanation of why not.
- * @throws InvalidObjectException
*/
abstract String applicable(Method[] getters) throws InvalidObjectException;
@@ -493,12 +466,7 @@ public abstract class OpenTypeConverter {
}
/**
- *
- * @param cd
- * @param itemNames
- * @param converters
* @return Actual java types from the composite type
- * @throws InvalidObjectException
*/
abstract Object fromCompositeData(CompositeData cd, String[] itemNames,
OpenTypeConverter[] converters) throws InvalidObjectException;
@@ -509,8 +477,6 @@ public abstract class OpenTypeConverter {
/**
* Builder if the target class has a method "public static from(CompositeData)"
- *
- *
*/
protected static class CompositeBuilderViaFrom extends CompositeBuilder {
@@ -545,8 +511,8 @@ public abstract class OpenTypeConverter {
}
}
- final Object fromCompositeData(CompositeData cd, String[] itemNames,
- OpenTypeConverter[] converters) throws InvalidObjectException {
+ Object fromCompositeData(CompositeData cd, String[] itemNames, OpenTypeConverter[] converters)
+ throws InvalidObjectException {
try {
return fromMethod.invoke(null, cd);
} catch (Exception e) {
@@ -566,8 +532,6 @@ public abstract class OpenTypeConverter {
* are candidate builders. Instead, the "applicable" method will return an explanatory string, and
* the other builders will be skipped. If all the getters are OK, then the "applicable" method
* will return an empty string and the other builders will be tried.
- *
- *
*/
protected static class CompositeBuilderCheckGetters extends CompositeBuilder {
CompositeBuilderCheckGetters(Class targetClass, String[] itemNames,
@@ -604,8 +568,6 @@ public abstract class OpenTypeConverter {
/**
* Builder if the target class has a setter for every getter
- *
- *
*/
protected static class CompositeBuilderViaSetters extends CompositeBuilder {
@@ -664,8 +626,6 @@ public abstract class OpenTypeConverter {
/**
* Builder if the target class has a constructor that is annotated with @ConstructorProperties so
* we can derive the corresponding getters.
- *
- *
*/
protected static class CompositeBuilderViaConstructor extends CompositeBuilder {
@@ -848,8 +808,6 @@ public abstract class OpenTypeConverter {
* Builder if the target class is an interface and contains no methods other than getters. Then we
* can make an instance using a dynamic proxy that forwards the getters to the source
* CompositeData
- *
- *
*/
protected static class CompositeBuilderViaProxy extends CompositeBuilder {
@@ -882,8 +840,7 @@ public abstract class OpenTypeConverter {
return null;
}
- final Object fromCompositeData(CompositeData cd, String[] itemNames,
- OpenTypeConverter[] converters) {
+ Object fromCompositeData(CompositeData cd, String[] itemNames, OpenTypeConverter[] converters) {
final Class targetClass = getTargetClass();
return Proxy.newProxyInstance(targetClass.getClassLoader(), new Class[] {targetClass},
new CompositeDataInvocationHandler(cd));
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/management/internal/cli/json/TypedJson.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/json/TypedJson.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/json/TypedJson.java
index fd9461f..107ac0b 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/json/TypedJson.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/json/TypedJson.java
@@ -42,8 +42,6 @@ import org.apache.geode.pdx.PdxInstance;
*
* Although it has limited functionality,still a simple use of add() method should suffice for most
* of the simple JSON use cases.
- *
- *
*/
public class TypedJson {
@@ -137,7 +135,6 @@ public class TypedJson {
}
}
-
}
}
}
@@ -150,9 +147,7 @@ public class TypedJson {
}
}
-
/**
- *
* User can build on this object by adding Objects against a key.
*
* TypedJson result = new TypedJson(); result.add(KEY,object); If users add more objects against
@@ -218,7 +213,6 @@ public class TypedJson {
commanate = false;
addComma = true;
}
-
}
writer.write('}');
@@ -312,7 +306,7 @@ public class TypedJson {
return false;
}
- final void writeVal(Writer w, Object value) throws IOException {
+ void writeVal(Writer w, Object value) throws IOException {
w.write('{');
addVal(w, value);
w.write('}');
@@ -325,7 +319,6 @@ public class TypedJson {
if (shouldVisitChildren(object)) {
visitChildrens(w, object, true);
}
-
}
void writeKeyValue(Writer w, Object key, Object value, Class type) throws IOException {
@@ -379,7 +372,6 @@ public class TypedJson {
}
void writeArray(Writer w, Object object) throws IOException {
-
if (commanate) {
w.write(",");
}
@@ -419,7 +411,6 @@ public class TypedJson {
for (int i = 0; i < length && elements < queryCollectionsDepth; i += 1) {
Object item = Array.get(object, i);
items.add(item);
-
}
return items;
}
@@ -463,7 +454,6 @@ public class TypedJson {
endType(w, rootClazz);
} catch (IOException e) {
}
-
}
void startKey(Writer writer, String key) throws IOException {
@@ -478,7 +468,6 @@ public class TypedJson {
if (key != null) {
writer.write('}');
}
-
}
List<Object> visitSpecialObjects(Writer w, Object object, boolean write) throws IOException {
@@ -563,8 +552,6 @@ public class TypedJson {
} else {
elements.add(fieldValue);
}
-
-
}
if (write)
w.write('}');
@@ -593,7 +580,6 @@ public class TypedJson {
return elements;
}
-
if (object instanceof Region.Entry) {
Region.Entry entry = (Region.Entry) object;
Object key = entry.getKey();
@@ -608,11 +594,9 @@ public class TypedJson {
elements.add(value);
}
-
return elements;
}
-
return elements;
}
@@ -627,7 +611,6 @@ public class TypedJson {
/**
* Handle some special GemFire classes. We don't want to expose some of the internal classes.
* Hence corresponding interface or external classes should be shown.
- *
*/
String internalToExternal(Class clazz, Object value) {
if (value != null && value instanceof Region.Entry) {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
index 3ec04c7..0dbd5f3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
@@ -77,7 +77,7 @@ public class Link implements Comparable<Link>, Serializable {
return href;
}
- public final void setHref(final URI href) {
+ public void setHref(final URI href) {
assert href != null : "The Link href URI cannot be null!";
this.href = href;
}
@@ -87,7 +87,7 @@ public class Link implements Comparable<Link>, Serializable {
return method;
}
- public final void setMethod(final HttpMethod method) {
+ public void setMethod(final HttpMethod method) {
this.method = ObjectUtils.defaultIfNull(method, DEFAULT_HTTP_METHOD);
}
@@ -96,7 +96,7 @@ public class Link implements Comparable<Link>, Serializable {
return relation;
}
- public final void setRelation(final String relation) {
+ public void setRelation(final String relation) {
assert StringUtils.isNotBlank(relation) : "The Link relation (rel) must be specified!";
this.relation = relation;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/management/internal/web/http/ClientHttpRequest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/http/ClientHttpRequest.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/http/ClientHttpRequest.java
index ea9c81c..43657b9 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/http/ClientHttpRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/http/ClientHttpRequest.java
@@ -117,7 +117,7 @@ public class ClientHttpRequest implements HttpRequest {
* @return the Link encapsulating the URI and method for the client's HTTP request.
* @see org.apache.geode.management.internal.web.domain.Link
*/
- public final Link getLink() {
+ public Link getLink() {
return link;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java
index 0eb6dca..716c3f4 100755
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java
@@ -20,7 +20,6 @@ import java.util.regex.Pattern;
import org.apache.geode.redis.internal.org.apache.hadoop.fs.GlobPattern;
-
public abstract class AbstractScanExecutor extends AbstractExecutor {
protected final String ERROR_CURSOR = "Invalid cursor";
@@ -39,9 +38,10 @@ public abstract class AbstractScanExecutor extends AbstractExecutor {
* @param pattern A glob pattern.
* @return A regex pattern to recognize the given glob pattern.
*/
- protected final Pattern convertGlobToRegex(String pattern) {
- if (pattern == null)
+ protected Pattern convertGlobToRegex(String pattern) {
+ if (pattern == null) {
return null;
+ }
return GlobPattern.compile(pattern);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/DataSerializerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/DataSerializerTest.java b/geode-core/src/test/java/org/apache/geode/DataSerializerTest.java
new file mode 100644
index 0000000..e550981
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/DataSerializerTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.EventID;
+import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DataSerializerTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DataSerializer mockDataSerializer = mock(DataSerializer.class);
+ EventID mockEventID = mock(EventID.class);
+ ClientProxyMembershipID mockClientProxyMembershipID = mock(ClientProxyMembershipID.class);
+
+ when(mockDataSerializer.getEventId()).thenReturn(mockEventID);
+ when(mockDataSerializer.getContext()).thenReturn(mockClientProxyMembershipID);
+
+ mockDataSerializer.setEventId(mockEventID);
+ mockDataSerializer.setContext(mockClientProxyMembershipID);
+
+ verify(mockDataSerializer, times(1)).setEventId(mockEventID);
+ verify(mockDataSerializer, times(1)).setContext(mockClientProxyMembershipID);
+
+ assertThat(mockDataSerializer.getEventId()).isSameAs(mockEventID);
+ assertThat(mockDataSerializer.getContext()).isSameAs(mockClientProxyMembershipID);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/InstantiatorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/InstantiatorTest.java b/geode-core/src/test/java/org/apache/geode/InstantiatorTest.java
new file mode 100644
index 0000000..6a20872
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/InstantiatorTest.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.EventID;
+import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class InstantiatorTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ Instantiator mockInstantiator = mock(Instantiator.class);
+ EventID mockEventID = mock(EventID.class);
+ ClientProxyMembershipID mockClientProxyMembershipID = mock(ClientProxyMembershipID.class);
+
+ when(mockInstantiator.getInstantiatedClass()).thenReturn(null);
+ when(mockInstantiator.getId()).thenReturn(0);
+ when(mockInstantiator.getEventId()).thenReturn(mockEventID);
+ when(mockInstantiator.getContext()).thenReturn(mockClientProxyMembershipID);
+
+ mockInstantiator.setEventId(mockEventID);
+ mockInstantiator.setContext(mockClientProxyMembershipID);
+
+ verify(mockInstantiator, times(1)).setEventId(mockEventID);
+ verify(mockInstantiator, times(1)).setContext(mockClientProxyMembershipID);
+
+ assertThat(mockInstantiator.getEventId()).isSameAs(mockEventID);
+ assertThat(mockInstantiator.getContext()).isSameAs(mockClientProxyMembershipID);
+ assertThat(mockInstantiator.getInstantiatedClass()).isNull();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/admin/RegionSubRegionSnapshotTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/admin/RegionSubRegionSnapshotTest.java b/geode-core/src/test/java/org/apache/geode/admin/RegionSubRegionSnapshotTest.java
new file mode 100644
index 0000000..10c0beb
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/admin/RegionSubRegionSnapshotTest.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.admin;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.Collections;
+
+@Category(UnitTest.class)
+public class RegionSubRegionSnapshotTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RegionSubRegionSnapshot mockRegionSubRegionSnapshot = mock(RegionSubRegionSnapshot.class);
+ RegionSubRegionSnapshot mockRegionSubRegionSnapshotParent = mock(RegionSubRegionSnapshot.class);
+
+ when(mockRegionSubRegionSnapshot.getEntryCount()).thenReturn(0);
+ when(mockRegionSubRegionSnapshot.getName()).thenReturn("name");
+ when(mockRegionSubRegionSnapshot.getSubRegionSnapshots()).thenReturn(Collections.emptySet());
+ when(mockRegionSubRegionSnapshot.getParent()).thenReturn(mockRegionSubRegionSnapshotParent);
+
+ mockRegionSubRegionSnapshot.setEntryCount(1);
+ mockRegionSubRegionSnapshot.setName("NAME");
+ mockRegionSubRegionSnapshot.setSubRegionSnapshots(null);
+ mockRegionSubRegionSnapshot.setParent(null);
+
+ verify(mockRegionSubRegionSnapshot, times(1)).setEntryCount(1);
+ verify(mockRegionSubRegionSnapshot, times(1)).setName("NAME");
+ verify(mockRegionSubRegionSnapshot, times(1)).setSubRegionSnapshots(null);
+ verify(mockRegionSubRegionSnapshot, times(1)).setParent(null);
+
+ assertThat(mockRegionSubRegionSnapshot.getEntryCount()).isEqualTo(0);
+ assertThat(mockRegionSubRegionSnapshot.getName()).isEqualTo("name");
+ assertThat(mockRegionSubRegionSnapshot.getSubRegionSnapshots())
+ .isEqualTo(Collections.emptySet());
+ assertThat(mockRegionSubRegionSnapshot.getParent()).isSameAs(mockRegionSubRegionSnapshotParent);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/cache/ConnectionPoolFactoryJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/ConnectionPoolFactoryJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/ConnectionPoolFactoryJUnitTest.java
index 18af019..b81c08f 100755
--- a/geode-core/src/test/java/org/apache/geode/cache/ConnectionPoolFactoryJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/ConnectionPoolFactoryJUnitTest.java
@@ -106,7 +106,7 @@ public class ConnectionPoolFactoryJUnitTest {
}
@Test
- public final void testCreateDefaultAndInvalidAndLegitAttributes() {
+ public void testCreateDefaultAndInvalidAndLegitAttributes() {
PoolFactory cpf = PoolManager.createFactory();
((PoolFactoryImpl) cpf).setStartDisabled(true);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/cache/DiskAccessExceptionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/DiskAccessExceptionTest.java b/geode-core/src/test/java/org/apache/geode/cache/DiskAccessExceptionTest.java
new file mode 100644
index 0000000..31019f7
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/cache/DiskAccessExceptionTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DiskAccessExceptionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DiskAccessException mockDiskAccessException = mock(DiskAccessException.class);
+ when(mockDiskAccessException.isRemote()).thenReturn(true);
+ assertThat(mockDiskAccessException.isRemote()).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/cache/client/internal/AbstractOpTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/client/internal/AbstractOpTest.java b/geode-core/src/test/java/org/apache/geode/cache/client/internal/AbstractOpTest.java
new file mode 100644
index 0000000..ef1f514
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/cache/client/internal/AbstractOpTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.cache.client.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.tier.sockets.Message;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractOpTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractOp mockAbstractOp = mock(AbstractOp.class);
+ Object mockObject = mock(Object.class);
+ when(mockAbstractOp.processObjResponse(any(), anyString())).thenReturn(mockObject);
+ assertThat(mockAbstractOp.processObjResponse(mock(Message.class), "string"))
+ .isEqualTo(mockObject);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/cache/execute/FunctionExceptionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/execute/FunctionExceptionTest.java b/geode-core/src/test/java/org/apache/geode/cache/execute/FunctionExceptionTest.java
new file mode 100644
index 0000000..daa90ba
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/cache/execute/FunctionExceptionTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.cache.execute;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+@Category(UnitTest.class)
+public class FunctionExceptionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ FunctionException mockFunctionException = mock(FunctionException.class);
+ Exception cause = new Exception();
+ List<Exception> exceptions = new ArrayList<>();
+ exceptions.add(cause);
+
+ when(mockFunctionException.getExceptions()).thenReturn(Collections.emptyList());
+
+ mockFunctionException.addException(cause);
+ mockFunctionException.addExceptions(exceptions);
+
+ verify(mockFunctionException, times(1)).addException(cause);
+ verify(mockFunctionException, times(1)).addExceptions(exceptions);
+
+ assertThat(mockFunctionException.getExceptions()).isEmpty();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/cache/query/functional/PdxOrderByJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/functional/PdxOrderByJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/functional/PdxOrderByJUnitTest.java
index 9655ab4..7a106b5 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/functional/PdxOrderByJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/functional/PdxOrderByJUnitTest.java
@@ -195,7 +195,7 @@ public class PdxOrderByJUnitTest {
}
- final public Region createRegion(String name, String rootName, RegionAttributes attrs)
+ public Region createRegion(String name, String rootName, RegionAttributes attrs)
throws CacheException {
Region root = getRootRegion(rootName);
if (root == null) {
@@ -220,11 +220,11 @@ public class PdxOrderByJUnitTest {
return root.createSubregion(name, attrs);
}
- public final Region getRootRegion(String rootName) {
+ public Region getRootRegion(String rootName) {
return CacheUtils.getRegion(rootName);
}
- public final Region createRootRegion(String rootName, RegionAttributes attrs)
+ public Region createRootRegion(String rootName, RegionAttributes attrs)
throws RegionExistsException, TimeoutException {
return ((GemFireCacheImpl) CacheUtils.getCache()).createRegion(rootName, attrs);
}
[10/14] geode git commit: GEODE-2929: remove superfluous final from
methods
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/NonLocalRegionEntryTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/NonLocalRegionEntryTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/NonLocalRegionEntryTest.java
new file mode 100644
index 0000000..1f99dac
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/NonLocalRegionEntryTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class NonLocalRegionEntryTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ NonLocalRegionEntry mockNonLocalRegionEntry = mock(NonLocalRegionEntry.class);
+ RegionEntryContext mockRegionEntryContext = mock(RegionEntryContext.class);
+ LocalRegion mockLocalRegion = mock(LocalRegion.class);
+ Object valueInVM = new Object();
+ Object valueOnDisk = new Object();
+
+ when(mockNonLocalRegionEntry.getValueInVM(eq(mockRegionEntryContext))).thenReturn(valueInVM);
+ when(mockNonLocalRegionEntry.getValueInVMOrDiskWithoutFaultIn(eq(mockLocalRegion)))
+ .thenReturn(valueOnDisk);
+
+ assertThat(mockNonLocalRegionEntry.getValueInVM(mockRegionEntryContext)).isSameAs(valueInVM);
+ assertThat(mockNonLocalRegionEntry.getValueInVMOrDiskWithoutFaultIn(mockLocalRegion))
+ .isSameAs(valueOnDisk);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
index ed23f2a..1e56d00 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
@@ -487,7 +487,7 @@ public class PartitionedRegionBucketCreationDistributionDUnitTest
* <p>
* Added specifically to test scenario of defect #47181.
*/
- private final Cache createLonerCacheWithEnforceUniqueHost() {
+ private Cache createLonerCacheWithEnforceUniqueHost() {
Cache myCache = null;
try {
System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE",
@@ -519,7 +519,7 @@ public class PartitionedRegionBucketCreationDistributionDUnitTest
* <p>
* Added specifically to test scenario of defect #47181.
*/
- private final InternalDistributedSystem getLonerSystemWithEnforceUniqueHost() {
+ private InternalDistributedSystem getLonerSystemWithEnforceUniqueHost() {
Properties props = getDistributedSystemProperties();
props.put(MCAST_PORT, "0");
props.put(LOCATORS, "");
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/PlaceHolderDiskRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PlaceHolderDiskRegionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PlaceHolderDiskRegionTest.java
new file mode 100644
index 0000000..a638b14
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PlaceHolderDiskRegionTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class PlaceHolderDiskRegionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ PlaceHolderDiskRegion mockPlaceHolderDiskRegion = mock(PlaceHolderDiskRegion.class);
+ when(mockPlaceHolderDiskRegion.getName()).thenReturn("NAME");
+ assertThat(mockPlaceHolderDiskRegion.getName()).isEqualTo("NAME");
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/ProxyBucketRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ProxyBucketRegionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ProxyBucketRegionTest.java
new file mode 100644
index 0000000..115a1d9
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ProxyBucketRegionTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class ProxyBucketRegionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ ProxyBucketRegion mockProxyBucketRegion = mock(ProxyBucketRegion.class);
+ BucketAdvisor mockBucketAdvisor = mock(BucketAdvisor.class);
+
+ when(mockProxyBucketRegion.getBucketAdvisor()).thenReturn(mockBucketAdvisor);
+
+ assertThat(mockProxyBucketRegion.getBucketAdvisor()).isSameAs(mockBucketAdvisor);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteFetchEntryMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteFetchEntryMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteFetchEntryMessageTest.java
new file mode 100644
index 0000000..f02da45
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteFetchEntryMessageTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class RemoteFetchEntryMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RemoteFetchEntryMessage mockRemoteFetchEntryMessage = mock(RemoteFetchEntryMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ LocalRegion mockLocalRegion = mock(LocalRegion.class);
+ long startTime = System.currentTimeMillis();
+
+ when(mockRemoteFetchEntryMessage.operateOnRegion(eq(mockDistributionManager),
+ eq(mockLocalRegion), eq(startTime))).thenReturn(true);
+
+ assertThat(mockRemoteFetchEntryMessage.operateOnRegion(mockDistributionManager, mockLocalRegion,
+ startTime)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/RemotePutAllMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RemotePutAllMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/RemotePutAllMessageTest.java
new file mode 100644
index 0000000..29c5a78
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RemotePutAllMessageTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.DataInput;
+
+@Category(UnitTest.class)
+public class RemotePutAllMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RemotePutAllMessage mockRemotePutAllMessage = mock(RemotePutAllMessage.class);
+ DataInput mockDataInput = mock(DataInput.class);
+
+ mockRemotePutAllMessage.fromData(mockDataInput);
+
+ verify(mockRemotePutAllMessage, times(1)).fromData(mockDataInput);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteRemoveAllMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteRemoveAllMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteRemoveAllMessageTest.java
new file mode 100644
index 0000000..1205c9a
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteRemoveAllMessageTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.DataInput;
+
+@Category(UnitTest.class)
+public class RemoteRemoveAllMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RemoteRemoveAllMessage mockRemoteRemoveAllMessage = mock(RemoteRemoveAllMessage.class);
+ DataInput mockDataInput = mock(DataInput.class);
+
+ mockRemoteRemoveAllMessage.fromData(mockDataInput);
+
+ verify(mockRemoteRemoveAllMessage, times(1)).fromData(mockDataInput);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/RequestFilterInfoMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RequestFilterInfoMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/RequestFilterInfoMessageTest.java
new file mode 100644
index 0000000..96c312f
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RequestFilterInfoMessageTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.InitialImageOperation.RequestFilterInfoMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class RequestFilterInfoMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RequestFilterInfoMessage mockRequestFilterInfoMessage = mock(RequestFilterInfoMessage.class);
+ when(mockRequestFilterInfoMessage.getProcessorType()).thenReturn(1);
+ assertThat(mockRequestFilterInfoMessage.getProcessorType()).isEqualTo(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/RequestImageMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RequestImageMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/RequestImageMessageTest.java
new file mode 100644
index 0000000..11f633a
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RequestImageMessageTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.InitialImageOperation.RequestImageMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class RequestImageMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RequestImageMessage mockRequestImageMessage = mock(RequestImageMessage.class);
+ when(mockRequestImageMessage.getProcessorType()).thenReturn(1);
+ assertThat(mockRequestImageMessage.getProcessorType()).isEqualTo(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/RequestRVVMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RequestRVVMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/RequestRVVMessageTest.java
new file mode 100644
index 0000000..8355e5c
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RequestRVVMessageTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.InitialImageOperation.RequestRVVMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class RequestRVVMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RequestRVVMessage mockRequestRVVMessage = mock(RequestRVVMessage.class);
+ when(mockRequestRVVMessage.getProcessorType()).thenReturn(1);
+ assertThat(mockRequestRVVMessage.getProcessorType()).isEqualTo(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/StateMarkerMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/StateMarkerMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/StateMarkerMessageTest.java
new file mode 100644
index 0000000..761064f
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/StateMarkerMessageTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.StateFlushOperation.StateMarkerMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class StateMarkerMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ StateMarkerMessage mockStateMarkerMessage = mock(StateMarkerMessage.class);
+ when(mockStateMarkerMessage.getProcessorType()).thenReturn(1);
+ assertThat(mockStateMarkerMessage.getProcessorType()).isEqualTo(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/TXEventTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/TXEventTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/TXEventTest.java
new file mode 100644
index 0000000..052d174
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/TXEventTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class TXEventTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ TXEvent mockTXEvent = mock(TXEvent.class);
+ Cache mockCache = mock(Cache.class);
+ when(mockTXEvent.getCache()).thenReturn(mockCache);
+ assertThat(mockTXEvent.getCache()).isSameAs(mockCache);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/TXMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/TXMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/TXMessageTest.java
new file mode 100644
index 0000000..76c1e79
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/TXMessageTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class TXMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ TXMessage mockTXMessage = mock(TXMessage.class);
+ InternalDistributedMember mockInternalDistributedMember = mock(InternalDistributedMember.class);
+ when(mockTXMessage.getMemberToMasqueradeAs()).thenReturn(mockInternalDistributedMember);
+ assertThat(mockTXMessage.getMemberToMasqueradeAs()).isSameAs(mockInternalDistributedMember);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateStubTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateStubTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateStubTest.java
new file mode 100644
index 0000000..6c5a349
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateStubTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.tx.TXRegionStub;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class TXStateStubTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ TXStateStub mockTXStateStub = mock(TXStateStub.class);
+ TXRegionStub mockTXRegionStub = mock(TXRegionStub.class);
+ LocalRegion mockLocalRegion = mock(LocalRegion.class);
+ when(mockTXStateStub.getTXRegionStub(eq(mockLocalRegion))).thenReturn(mockTXRegionStub);
+ assertThat(mockTXStateStub.getTXRegionStub(mockLocalRegion)).isSameAs(mockTXRegionStub);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/UnzipUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/UnzipUtil.java b/geode-core/src/test/java/org/apache/geode/internal/cache/UnzipUtil.java
index f6558c0..77f3867 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/UnzipUtil.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/UnzipUtil.java
@@ -32,7 +32,7 @@ import java.util.zip.ZipInputStream;
*/
public class UnzipUtil {
- public static final void unzip(InputStream input, String targetDir) throws IOException {
+ public static void unzip(InputStream input, String targetDir) throws IOException {
File dir = new File(targetDir);
if (!dir.exists() && !dir.mkdir()) {
@@ -62,7 +62,7 @@ public class UnzipUtil {
zipInput.close();
}
- public static final void copyInputStream(InputStream in, OutputStream out) throws IOException {
+ public static void copyInputStream(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024];
int len;
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/control/ResourceAdvisorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/control/ResourceAdvisorTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/control/ResourceAdvisorTest.java
new file mode 100644
index 0000000..324c121
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/control/ResourceAdvisorTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.control;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class ResourceAdvisorTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ ResourceAdvisor mockResourceAdvisor = mock(ResourceAdvisor.class);
+ InternalDistributedMember mockInternalDistributedMember = mock(InternalDistributedMember.class);
+ when(mockResourceAdvisor.isHeapCritical(eq((mockInternalDistributedMember)))).thenReturn(true);
+ assertThat(mockResourceAdvisor.isHeapCritical(mockInternalDistributedMember)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/ha/ConflatableObject.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/ConflatableObject.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/ConflatableObject.java
index 438d938..915cddf 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/ConflatableObject.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/ConflatableObject.java
@@ -121,70 +121,70 @@ public class ConflatableObject implements Conflatable, Serializable {
/**
* @return Returns the conflate.
*/
- final boolean isConflate() {
+ boolean isConflate() {
return conflate;
}
/**
* @param conflate The conflate to set.
*/
- final void setConflate(boolean conflate) {
+ void setConflate(boolean conflate) {
this.conflate = conflate;
}
/**
* @return Returns the id.
*/
- final EventID getId() {
+ EventID getId() {
return id;
}
/**
* @param id The id to set.
*/
- final void setId(EventID id) {
+ void setId(EventID id) {
this.id = id;
}
/**
* @return Returns the key.
*/
- final Object getKey() {
+ Object getKey() {
return key;
}
/**
* @param key The key to set.
*/
- final void setKey(Object key) {
+ void setKey(Object key) {
this.key = key;
}
/**
* @return Returns the regionname.
*/
- final String getRegionname() {
+ String getRegionname() {
return regionname;
}
/**
* @param regionname The regionname to set.
*/
- final void setRegionname(String regionname) {
+ void setRegionname(String regionname) {
this.regionname = regionname;
}
/**
* @return Returns the value.
*/
- final Object getValue() {
+ Object getValue() {
return value;
}
/**
* @param value The value to set.
*/
- final void setValue(Object value) {
+ void setValue(Object value) {
this.value = value;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/lru/LRUAlgorithmTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/lru/LRUAlgorithmTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/lru/LRUAlgorithmTest.java
new file mode 100644
index 0000000..3341083
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/lru/LRUAlgorithmTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.lru;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class LRUAlgorithmTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ LRUAlgorithm mockLRUAlgorithm = mock(LRUAlgorithm.class);
+ EnableLRU mockEnableLRU = mock(EnableLRU.class);
+ when(mockLRUAlgorithm.getLRUHelper()).thenReturn(mockEnableLRU);
+ assertThat(mockLRUAlgorithm.getLRUHelper()).isEqualTo(mockEnableLRU);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessageTest.java
new file mode 100644
index 0000000..9dd1cd8
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessageTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class BucketBackupMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ BucketBackupMessage mockBucketBackupMessage = mock(BucketBackupMessage.class);
+ when(mockBucketBackupMessage.failIfRegionMissing()).thenReturn(true);
+ assertThat(mockBucketBackupMessage.failIfRegionMissing()).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ColocatedRegionDetailsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ColocatedRegionDetailsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ColocatedRegionDetailsJUnitTest.java
index b95e11a..c5fea71 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ColocatedRegionDetailsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ColocatedRegionDetailsJUnitTest.java
@@ -15,43 +15,26 @@
package org.apache.geode.internal.cache.partitioned;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
-import java.io.IOException;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.test.junit.categories.UnitTest;
@Category(UnitTest.class)
public class ColocatedRegionDetailsJUnitTest {
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {}
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {}
-
- /**
- * Test method for
- * {@link org.apache.geode.internal.cache.partitioned.ColocatedRegionDetails#ColocatedRegionDetails(java.lang.String, java.lang.String, java.lang.String, java.lang.String)}.
- */
@Test
- public final void testColocatedRegionDetailsConstructor() {
+ public void testColocatedRegionDetailsConstructor() {
ColocatedRegionDetails crd =
new ColocatedRegionDetails("host", "member name", "parent region", "child region");
assertNotNull(crd);
@@ -61,12 +44,8 @@ public class ColocatedRegionDetailsJUnitTest {
assertEquals("child region", crd.getChild());
}
- /**
- * Test method for
- * {@link org.apache.geode.internal.cache.partitioned.ColocatedRegionDetails#ColocatedRegionDetails()}.
- */
@Test
- public final void testColocatedRegion0ArgConstructor() {
+ public void testColocatedRegion0ArgConstructor() {
ColocatedRegionDetails crd = new ColocatedRegionDetails();
assertNotNull(crd);
assertNull(crd.getHost());
@@ -77,7 +56,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testContructingWithNulls() {
+ public void testConstructingWithNulls() {
ColocatedRegionDetails crd1 =
new ColocatedRegionDetails(null, "member name", "parent region", "child region");
ColocatedRegionDetails crd2 =
@@ -93,15 +72,8 @@ public class ColocatedRegionDetailsJUnitTest {
assertNotNull(crd4);
}
- /**
- * Test method for
- * {@link org.apache.geode.internal.cache.partitioned.ColocatedRegionDetails#toData(java.io.DataOutput)}.
- *
- * @throws IOException
- * @throws ClassNotFoundException
- */
@Test
- public final void testSerialization() throws IOException, ClassNotFoundException {
+ public void testSerialization() throws Exception {
ColocatedRegionDetails crd =
new ColocatedRegionDetails("host", "member name", "parent region", "child region");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -114,8 +86,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testSerializationOfEmptyColocatedRegionDetails()
- throws IOException, ClassNotFoundException {
+ public void testSerializationOfEmptyColocatedRegionDetails() throws Exception {
ColocatedRegionDetails crd = new ColocatedRegionDetails();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutput out = new DataOutputStream(baos);
@@ -127,7 +98,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testHostNotEquals() {
+ public void testHostNotEquals() {
ColocatedRegionDetails crd1 = new ColocatedRegionDetails();
ColocatedRegionDetails crd2 =
new ColocatedRegionDetails("host1", "member name", "parent region", "child region");
@@ -139,7 +110,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testMemberNotEquals() {
+ public void testMemberNotEquals() {
ColocatedRegionDetails crd1 =
new ColocatedRegionDetails("host", null, "parent region", "child region");
ColocatedRegionDetails crd2 =
@@ -152,7 +123,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testParentNotEquals() {
+ public void testParentNotEquals() {
ColocatedRegionDetails crd1 =
new ColocatedRegionDetails("host", "member1", null, "child region");
ColocatedRegionDetails crd2 =
@@ -165,7 +136,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testChildNotEquals() {
+ public void testChildNotEquals() {
ColocatedRegionDetails crd1 =
new ColocatedRegionDetails("host", "member1", "parent region", null);
ColocatedRegionDetails crd2 =
@@ -178,7 +149,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testClassInequality() {
+ public void testClassInequality() {
ColocatedRegionDetails crd1 =
new ColocatedRegionDetails("host", "member1", "parent region", null);
String crd2 = crd1.toString();
@@ -187,7 +158,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void nullColocatedRegionDetailsEqualsTests() {
+ public void nullColocatedRegionDetailsEqualsTests() {
ColocatedRegionDetails crd1 = null;
ColocatedRegionDetails crd2 =
new ColocatedRegionDetails("host", "member1", "parent region", "child1");
@@ -198,7 +169,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testToString() {
+ public void testToString() {
ColocatedRegionDetails crd =
new ColocatedRegionDetails("host1", "member name", "parent region", "child region");
assertEquals("[host:host1, member:member name, parent:parent region, child:child region]",
@@ -206,13 +177,13 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testToStringOfEmptyColocatedRegionDetails() {
+ public void testToStringOfEmptyColocatedRegionDetails() {
ColocatedRegionDetails crd = new ColocatedRegionDetails();
assertEquals("[,,,]", crd.toString());
}
@Test
- public final void testHashCode() {
+ public void testHashCode() {
ColocatedRegionDetails crd1 = new ColocatedRegionDetails();
ColocatedRegionDetails crd2 =
new ColocatedRegionDetails("host1", "member name", "parent region", "child region");
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessageTest.java
new file mode 100644
index 0000000..f1847f4
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessageTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DeposePrimaryBucketMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DeposePrimaryBucketMessage mockDeposePrimaryBucketMessage =
+ mock(DeposePrimaryBucketMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ PartitionedRegion mockPartitionedRegion = mock(PartitionedRegion.class);
+ long startTime = System.currentTimeMillis();
+ when(mockDeposePrimaryBucketMessage.operateOnPartitionedRegion(eq(mockDistributionManager),
+ eq(mockPartitionedRegion), eq(startTime))).thenReturn(true);
+ assertThat(mockDeposePrimaryBucketMessage.operateOnPartitionedRegion(mockDistributionManager,
+ mockPartitionedRegion, startTime)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessageTest.java
new file mode 100644
index 0000000..4cf44e4
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessageTest.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class FetchEntryMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ FetchEntryMessage mockFetchEntryMessage = mock(FetchEntryMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ PartitionedRegion mockPartitionedRegion = mock(PartitionedRegion.class);
+ long startTime = System.currentTimeMillis();
+ Object key = new Object();
+
+ when(mockFetchEntryMessage.operateOnPartitionedRegion(eq(mockDistributionManager),
+ eq(mockPartitionedRegion), eq(startTime))).thenReturn(true);
+
+ mockFetchEntryMessage.setKey(key);
+
+ verify(mockFetchEntryMessage, times(1)).setKey(key);
+
+ assertThat(mockFetchEntryMessage.operateOnPartitionedRegion(mockDistributionManager,
+ mockPartitionedRegion, startTime)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessageTest.java
new file mode 100644
index 0000000..921017a
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessageTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class FetchPartitionDetailsMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ FetchPartitionDetailsMessage mockFetchPartitionDetailsMessage =
+ mock(FetchPartitionDetailsMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ PartitionedRegion mockPartitionedRegion = mock(PartitionedRegion.class);
+ long startTime = System.currentTimeMillis();
+ Object key = new Object();
+
+ when(mockFetchPartitionDetailsMessage.operateOnPartitionedRegion(eq(mockDistributionManager),
+ eq(mockPartitionedRegion), eq(startTime))).thenReturn(true);
+
+ assertThat(mockFetchPartitionDetailsMessage.operateOnPartitionedRegion(mockDistributionManager,
+ mockPartitionedRegion, startTime)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessageTest.java
new file mode 100644
index 0000000..2c37cc8
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessageTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class MoveBucketMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ MoveBucketMessage mockMoveBucketMessage = mock(MoveBucketMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ PartitionedRegion mockPartitionedRegion = mock(PartitionedRegion.class);
+ long startTime = System.currentTimeMillis();
+ Object key = new Object();
+
+ when(mockMoveBucketMessage.operateOnPartitionedRegion(eq(mockDistributionManager),
+ eq(mockPartitionedRegion), eq(startTime))).thenReturn(true);
+
+ assertThat(mockMoveBucketMessage.operateOnPartitionedRegion(mockDistributionManager,
+ mockPartitionedRegion, startTime)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PartitionMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PartitionMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PartitionMessageTest.java
index b3bb02b..01099d3 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PartitionMessageTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PartitionMessageTest.java
@@ -14,18 +14,17 @@
*/
package org.apache.geode.internal.cache.partitioned;
-import static org.mockito.Mockito.*;
-
-import java.io.IOException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.mockito.internal.stubbing.answers.CallsRealMethods;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import org.apache.geode.cache.CacheException;
import org.apache.geode.cache.query.QueryException;
import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.DataLocationException;
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.PartitionedRegion;
@@ -34,7 +33,12 @@ import org.apache.geode.internal.cache.TXStateProxy;
import org.apache.geode.internal.cache.TXStateProxyImpl;
import org.apache.geode.test.fake.Fakes;
import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.mockito.internal.stubbing.answers.CallsRealMethods;
+import java.io.IOException;
@Category(UnitTest.class)
public class PartitionMessageTest {
@@ -67,6 +71,17 @@ public class PartitionMessageTest {
}
@Test
+ public void shouldBeMockable() throws Exception {
+ PartitionMessage mockPartitionMessage = mock(PartitionMessage.class);
+ InternalDistributedMember mockInternalDistributedMember = mock(InternalDistributedMember.class);
+
+ when(mockPartitionMessage.getMemberToMasqueradeAs()).thenReturn(mockInternalDistributedMember);
+
+ assertThat(mockPartitionMessage.getMemberToMasqueradeAs())
+ .isSameAs(mockInternalDistributedMember);
+ }
+
+ @Test
public void messageWithNoTXPerformsOnRegion() throws InterruptedException, CacheException,
QueryException, DataLocationException, IOException {
when(txMgr.masqueradeAs(msg)).thenReturn(null);
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessageTest.java
new file mode 100644
index 0000000..92b1d2d
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessageTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class RemoveAllPRMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RemoveAllPRMessage mockRemoveAllPRMessage = mock(RemoveAllPRMessage.class);
+ StringBuilder stringBuilder = new StringBuilder();
+
+ mockRemoveAllPRMessage.appendFields(stringBuilder);
+
+ verify(mockRemoveAllPRMessage, times(1)).appendFields(stringBuilder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessageTest.java
new file mode 100644
index 0000000..3b18079
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessageTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class RemoveBucketMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RemoveBucketMessage mockRemoveBucketMessage = mock(RemoveBucketMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ PartitionedRegion mockPartitionedRegion = mock(PartitionedRegion.class);
+ long startTime = System.currentTimeMillis();
+ Object key = new Object();
+
+ when(mockRemoveBucketMessage.operateOnPartitionedRegion(eq(mockDistributionManager),
+ eq(mockPartitionedRegion), eq(startTime))).thenReturn(true);
+
+ assertThat(mockRemoveBucketMessage.operateOnPartitionedRegion(mockDistributionManager,
+ mockPartitionedRegion, startTime)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/SizeMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/SizeMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/SizeMessageTest.java
new file mode 100644
index 0000000..da3b94b
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/SizeMessageTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class SizeMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ SizeMessage mockSizeMessage = mock(SizeMessage.class);
+ when(mockSizeMessage.failIfRegionMissing()).thenReturn(true);
+ assertThat(mockSizeMessage.failIfRegionMissing()).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/CCUStatsTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/CCUStatsTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/CCUStatsTest.java
new file mode 100644
index 0000000..e7d918d
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/CCUStatsTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.tier.sockets;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.internal.cache.tier.sockets.CacheClientUpdater.CCUStats;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class CCUStatsTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ CCUStats mockCCUStats = mock(CCUStats.class);
+
+ mockCCUStats.incReceivedBytes(1L);
+ mockCCUStats.incSentBytes(1L);
+
+ verify(mockCCUStats, times(1)).incReceivedBytes(1L);
+ verify(mockCCUStats, times(1)).incSentBytes(1L);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/PartTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/PartTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/PartTest.java
new file mode 100644
index 0000000..5720357
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/PartTest.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.tier.sockets;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+
+@Category(UnitTest.class)
+public class PartTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ Part mockPart = mock(Part.class);
+ OutputStream mockOutputStream = mock(OutputStream.class);
+ ByteBuffer mockByteBuffer = mock(ByteBuffer.class);
+
+ mockPart.writeTo(mockOutputStream, mockByteBuffer);
+
+ verify(mockPart, times(1)).writeTo(mockOutputStream, mockByteBuffer);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionHolderJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionHolderJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionHolderJUnitTest.java
index 0514e19..24b53f0 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionHolderJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionHolderJUnitTest.java
@@ -49,7 +49,7 @@ public class RegionVersionHolderJUnitTest {
RegionVersionHolder.BIT_SET_WIDTH = originalBitSetWidth;
}
- protected final InternalDistributedMember member() {
+ protected InternalDistributedMember member() {
return member;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/versions/TombstoneDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/versions/TombstoneDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/versions/TombstoneDUnitTest.java
index e178708..cb03cbe 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/versions/TombstoneDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/versions/TombstoneDUnitTest.java
@@ -84,7 +84,7 @@ public class TombstoneDUnitTest extends JUnit4CacheTestCase {
}
}
- private final void createRegion(String regionName, boolean persistent) {
+ private void createRegion(String regionName, boolean persistent) {
if (persistent) {
getCache().createRegionFactory(RegionShortcut.REPLICATE_PERSISTENT).create(regionName);
} else {
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/wan/AsyncEventQueueTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/AsyncEventQueueTestBase.java b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/AsyncEventQueueTestBase.java
index 5d4fd98..6fe7ee9 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/AsyncEventQueueTestBase.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/AsyncEventQueueTestBase.java
@@ -1580,7 +1580,7 @@ public class AsyncEventQueueTestBase extends JUnit4DistributedTestCase {
}
@Override
- public final Properties getDistributedSystemProperties() {
+ public Properties getDistributedSystemProperties() {
// For now all WANTestBase tests allocate off-heap memory even though
// many of them never use it.
// The problem is that WANTestBase has static methods that create instances
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/wan/asyncqueue/AsyncEventQueueValidationsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/asyncqueue/AsyncEventQueueValidationsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/asyncqueue/AsyncEventQueueValidationsJUnitTest.java
index 049513b..b21ca90 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/asyncqueue/AsyncEventQueueValidationsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/asyncqueue/AsyncEventQueueValidationsJUnitTest.java
@@ -118,7 +118,7 @@ public class AsyncEventQueueValidationsJUnitTest {
.until(() -> filter.getAfterAcknowledgementInvocations() == numPuts);
}
- private final Object[] getCacheXmlFileBaseNames() {
+ private Object[] getCacheXmlFileBaseNames() {
return $(new Object[] {"testSerialAsyncEventQueueConfiguredFromXmlUsesFilter"},
new Object[] {"testParallelAsyncEventQueueConfiguredFromXmlUsesFilter"});
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/wan/serial/DestroyMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/serial/DestroyMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/serial/DestroyMessageTest.java
new file mode 100644
index 0000000..2d52783
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/serial/DestroyMessageTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.wan.serial;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.internal.cache.DistributedRegion;
+import org.apache.geode.internal.cache.InternalCacheEvent;
+import org.apache.geode.internal.cache.wan.serial.BatchDestroyOperation.DestroyMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DestroyMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DestroyMessage mockDestroyMessageX = mock(DestroyMessage.class);
+ InternalCacheEvent mockInternalCacheEvent = mock(InternalCacheEvent.class);
+ DistributedRegion mockDistributedRegion = mock(DistributedRegion.class);
+
+ when(mockDestroyMessageX.createEvent(eq(mockDistributedRegion)))
+ .thenReturn(mockInternalCacheEvent);
+
+ assertThat(mockDestroyMessageX.createEvent(mockDistributedRegion))
+ .isSameAs(mockInternalCacheEvent);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreationTest.java
new file mode 100644
index 0000000..f89622b
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreationTest.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.xmlcache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.cache.TransactionListener;
+import org.apache.geode.cache.TransactionWriter;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class CacheTransactionManagerCreationTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ CacheTransactionManagerCreation mockCacheTransactionManagerCreation =
+ mock(CacheTransactionManagerCreation.class);
+ TransactionListener mockTransactionListener = mock(TransactionListener.class);
+ TransactionWriter mockTransactionWriter = mock(TransactionWriter.class);
+
+ when(mockCacheTransactionManagerCreation.getListener()).thenReturn(mockTransactionListener);
+
+ mockCacheTransactionManagerCreation.setWriter(mockTransactionWriter);
+
+ verify(mockCacheTransactionManagerCreation, times(1)).setWriter(mockTransactionWriter);
+
+ assertThat(mockCacheTransactionManagerCreation.getListener()).isSameAs(mockTransactionListener);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2Test.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2Test.java b/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2Test.java
new file mode 100644
index 0000000..8142949
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2Test.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.xmlcache;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.xml.sax.InputSource;
+
+@Category(UnitTest.class)
+public class DefaultEntityResolver2Test {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DefaultEntityResolver2 mockDefaultEntityResolver2 = mock(DefaultEntityResolver2.class);
+ InputSource inputSource = new InputSource();
+
+ when(mockDefaultEntityResolver2.getClassPathInputSource(eq("publicId"), eq("systemId"),
+ eq("path"))).thenReturn(inputSource);
+
+ assertThat(mockDefaultEntityResolver2.getClassPathInputSource("publicId", "systemId", "path"))
+ .isSameAs(inputSource);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/jta/functional/CacheJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/jta/functional/CacheJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/jta/functional/CacheJUnitTest.java
index 66d72d8..67d12de 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/jta/functional/CacheJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/jta/functional/CacheJUnitTest.java
@@ -1170,7 +1170,7 @@ public class CacheJUnitTest {
this.tableName = str;
}
- public final Object load(LoaderHelper helper) throws CacheLoaderException {
+ public Object load(LoaderHelper helper) throws CacheLoaderException {
System.out.println("In Loader.load for" + helper.getKey());
return loadFromDatabase(helper.getKey());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/jta/functional/TestXACacheLoader.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/jta/functional/TestXACacheLoader.java b/geode-core/src/test/java/org/apache/geode/internal/jta/functional/TestXACacheLoader.java
index 1585486..351c642 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/jta/functional/TestXACacheLoader.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/jta/functional/TestXACacheLoader.java
@@ -34,7 +34,7 @@ public class TestXACacheLoader implements CacheLoader {
public static String tableName = "";
- public final Object load(LoaderHelper helper) throws CacheLoaderException {
+ public Object load(LoaderHelper helper) throws CacheLoaderException {
System.out.println("In Loader.load for" + helper.getKey());
return loadFromDatabase(helper.getKey());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/logging/LogServiceJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/logging/LogServiceJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/logging/LogServiceJUnitTest.java
index 5c7ccaa..7238664 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/logging/LogServiceJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/logging/LogServiceJUnitTest.java
@@ -101,7 +101,7 @@ public class LogServiceJUnitTest {
}
@SuppressWarnings("unused")
- private static final Object[] getToLevelParameters() {
+ private static Object[] getToLevelParameters() {
return $(new Object[] {0, Level.OFF}, new Object[] {100, Level.FATAL},
new Object[] {200, Level.ERROR}, new Object[] {300, Level.WARN},
new Object[] {400, Level.INFO}, new Object[] {500, Level.DEBUG},
http://git-wip-us.apache.org/repos/asf/geode/blob/b688c9c3/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/AlertAppenderJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/AlertAppenderJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/AlertAppenderJUnitTest.java
index 5717253..faf1f6a 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/AlertAppenderJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/AlertAppenderJUnitTest.java
@@ -70,7 +70,7 @@ public class AlertAppenderJUnitTest {
* Verify that adding/removing/replacing listeners works correctly.
*/
@Test
- public final void testListenerHandling() throws Exception {
+ public void testListenerHandling() throws Exception {
DistributedMember member1 = createTestDistributedMember("Member1");
DistributedMember member2 = createTestDistributedMember("Member2");
DistributedMember member3 = createTestDistributedMember("Member3");
@@ -146,7 +146,7 @@ public class AlertAppenderJUnitTest {
* when the configuration is changed the appender is still there.
*/
@Test
- public final void testAppenderToConfigHandling() throws Exception {
+ public void testAppenderToConfigHandling() throws Exception {
LogService.setBaseLogLevel(Level.WARN);
final String appenderName = AlertAppender.getInstance().getName();
[02/14] geode git commit: GEODE-2662: Gfsh displays field value on
wrong line when receiving objects with missing fields
Posted by kl...@apache.org.
GEODE-2662: Gfsh displays field value on wrong line when receiving objects with missing fields
* DataCommandResult.buildTable refactored to scan for all necessary fields and build rows, padding with MISSING_VALUE as necessary.
* ServerStarterRule adjusted to build .withPDXPersistent() rather than take it as input to .startServer()
* Refactored a great deal for readability.
* this closes #500
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/9af854aa
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/9af854aa
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/9af854aa
Branch: refs/heads/feature/GEODE-2929-1
Commit: 9af854aa4ec1b32b4668c4faa2f225f267590239
Parents: da6c28c
Author: Patrick Rhomberg <pr...@pivotal.io>
Authored: Tue May 2 11:09:35 2017 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Fri May 19 08:09:57 2017 -0700
----------------------------------------------------------------------
geode-core/build.gradle | 4 +-
.../internal/cli/commands/DataCommands.java | 484 ++++++++--------
.../internal/cli/domain/DataCommandResult.java | 554 ++++++++++---------
.../cli/functions/DataCommandFunction.java | 533 +++++++++---------
.../internal/cli/result/TabularResultData.java | 74 +--
.../dunit/QueryDataInconsistencyDUnitTest.java | 18 +-
.../commands/GemfireDataCommandsDUnitTest.java | 28 +-
.../DataCommandFunctionWithPDXJUnitTest.java | 220 ++++++++
.../test/dunit/rules/ServerStarterRule.java | 13 +-
9 files changed, 1060 insertions(+), 868 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/build.gradle
----------------------------------------------------------------------
diff --git a/geode-core/build.gradle b/geode-core/build.gradle
index f07444a..0297146 100755
--- a/geode-core/build.gradle
+++ b/geode-core/build.gradle
@@ -113,8 +113,7 @@ dependencies {
compile 'commons-beanutils:commons-beanutils:' + project.'commons-beanutils.version'
// https://mvnrepository.com/artifact/io.github.lukehutch/fast-classpath-scanner
- compile 'io.github.lukehutch:fast-classpath-scanner:' + project.'fast-classpath-scanner.version'
-
+ compile 'io.github.lukehutch:fast-classpath-scanner:' + project.'fast-classpath-scanner.version'
compile project(':geode-common')
@@ -127,7 +126,6 @@ dependencies {
// Test Dependencies
// External
- testCompile 'com.google.guava:guava:' + project.'guava.version'
testCompile 'com.jayway.jsonpath:json-path-assert:' + project.'json-path-assert.version'
testCompile 'org.apache.bcel:bcel:' + project.'bcel.version'
testRuntime 'org.apache.derby:derby:' + project.'derby.version'
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DataCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DataCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DataCommands.java
index 89db5d1..a38e545 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DataCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DataCommands.java
@@ -14,27 +14,9 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import org.apache.shiro.subject.Subject;
-import org.springframework.shell.core.CommandMarker;
-import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.LogWriter;
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.CacheFactory;
@@ -79,6 +61,26 @@ import org.apache.geode.management.internal.cli.shell.Gfsh;
import org.apache.geode.management.internal.security.ResourceOperation;
import org.apache.geode.security.ResourcePermission.Operation;
import org.apache.geode.security.ResourcePermission.Resource;
+import org.apache.shiro.subject.Subject;
+import org.springframework.shell.core.CommandMarker;
+import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
/**
* @since GemFire 7.0
@@ -118,8 +120,8 @@ public class DataCommands implements CommandMarker {
help = CliStrings.REBALANCE__SIMULATE__HELP) boolean simulate) {
ExecutorService commandExecutors = Executors.newSingleThreadExecutor();
- List<Future<Result>> commandResult = new ArrayList<Future<Result>>();
- Result result = null;
+ List<Future<Result>> commandResult = new ArrayList<>();
+ Result result;
try {
commandResult.add(commandExecutors
.submit(new ExecuteRebalanceWithTimeout(includeRegions, excludeRegions, simulate)));
@@ -165,16 +167,16 @@ public class DataCommands implements CommandMarker {
Result result = null;
try {
- RebalanceOperation op = null;
+ RebalanceOperation op;
- if (includeRegions != null && includeRegions.length > 0) {
- CompositeResultData rebalanceResulteData = ResultBuilder.createCompositeResultData();
+ if (ArrayUtils.isNotEmpty(includeRegions)) {
+ CompositeResultData rebalanceResultData = ResultBuilder.createCompositeResultData();
int index = 0;
for (String regionName : includeRegions) {
// To be removed after region Name specification with "/" is fixed
- regionName = regionName.startsWith("/") == true ? regionName : ("/" + regionName);
+ regionName = regionName.startsWith("/") ? regionName : ("/" + regionName);
Region region = cache.getRegion(regionName);
if (region == null) {
@@ -189,21 +191,18 @@ public class DataCommands implements CommandMarker {
Function rebalanceFunction = new RebalanceFunction();
Object[] functionArgs = new Object[3];
functionArgs[0] = simulate ? "true" : "false";
- Set<String> setRegionName = new HashSet<String>();
+ Set<String> setRegionName = new HashSet<>();
setRegionName.add(regionName);
functionArgs[1] = setRegionName;
- Set<String> excludeRegionSet = new HashSet<String>();
- if (excludeRegions != null && excludeRegions.length > 0) {
-
- for (String str : excludeRegions) {
- excludeRegionSet.add(str);
- }
+ Set<String> excludeRegionSet = new HashSet<>();
+ if (ArrayUtils.isNotEmpty(excludeRegions)) {
+ Collections.addAll(excludeRegionSet, excludeRegions);
}
functionArgs[2] = excludeRegionSet;
- if (simulate == true) {
- List resultList = null;
+ if (simulate) {
+ List resultList;
try {
resultList = (ArrayList) CliUtil
.executeFunction(rebalanceFunction, functionArgs, member).getResult();
@@ -212,24 +211,24 @@ public class DataCommands implements CommandMarker {
.info(CliStrings.format(
CliStrings.REBALANCE__MSG__EXCEPTION_IN_REBALANCE_FOR_MEMBER_0_Exception_1,
member.getId(), ex.getMessage()), ex);
- rebalanceResulteData.addSection()
+ rebalanceResultData.addSection()
.addData(CliStrings.format(
CliStrings.REBALANCE__MSG__EXCEPTION_IN_REBALANCE_FOR_MEMBER_0_Exception,
member.getId()), ex.getMessage());
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ result = ResultBuilder.buildResult(rebalanceResultData);
continue;
}
- if (checkResultList(rebalanceResulteData, resultList, member) == true) {
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ if (checkResultList(rebalanceResultData, resultList, member)) {
+ result = ResultBuilder.buildResult(rebalanceResultData);
continue;
}
List<String> rstList = tokenize((String) resultList.get(0), ",");
- result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResulteData,
- (ArrayList) rstList, index, simulate, cache));
+ result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResultData,
+ (ArrayList) rstList, index, true, cache));
} else {
- List resultList = null;
+ List resultList;
try {
resultList = (ArrayList) CliUtil
.executeFunction(rebalanceFunction, functionArgs, member).getResult();
@@ -238,47 +237,47 @@ public class DataCommands implements CommandMarker {
.info(CliStrings.format(
CliStrings.REBALANCE__MSG__EXCEPTION_IN_REBALANCE_FOR_MEMBER_0_Exception_1,
member.getId(), ex.getMessage()), ex);
- rebalanceResulteData.addSection()
+ rebalanceResultData.addSection()
.addData(CliStrings.format(
CliStrings.REBALANCE__MSG__EXCEPTION_IN_REBALANCE_FOR_MEMBER_0_Exception,
member.getId()), ex.getMessage());
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ result = ResultBuilder.buildResult(rebalanceResultData);
continue;
}
- if (checkResultList(rebalanceResulteData, resultList, member) == true) {
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ if (checkResultList(rebalanceResultData, resultList, member)) {
+ result = ResultBuilder.buildResult(rebalanceResultData);
continue;
}
List<String> rstList = tokenize((String) resultList.get(0), ",");
- result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResulteData,
- (ArrayList) rstList, index, simulate, cache));
+ result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResultData,
+ (ArrayList) rstList, index, false, cache));
}
} else {
+
ResourceManager manager = cache.getResourceManager();
RebalanceFactory rbFactory = manager.createRebalanceFactory();
- Set<String> excludeRegionSet = new HashSet<String>();
+ Set<String> excludeRegionSet = new HashSet<>();
if (excludeRegions != null) {
- for (String excludeRegion : excludeRegions)
- excludeRegionSet.add(excludeRegion);
+ Collections.addAll(excludeRegionSet, excludeRegions);
}
rbFactory.excludeRegions(excludeRegionSet);
- Set<String> includeRegionSet = new HashSet<String>();
+ Set<String> includeRegionSet = new HashSet<>();
includeRegionSet.add(regionName);
rbFactory.includeRegions(includeRegionSet);
- if (simulate == true) {
+ if (simulate) {
op = manager.createRebalanceFactory().simulate();
- result = ResultBuilder.buildResult(buildResultForRebalance(rebalanceResulteData,
- op.getResults(), index, simulate, cache));
+ result = ResultBuilder.buildResult(buildResultForRebalance(rebalanceResultData,
+ op.getResults(), index, true, cache));
} else {
op = manager.createRebalanceFactory().start();
// Wait until the rebalance is complete and then get the results
- result = ResultBuilder.buildResult(buildResultForRebalance(rebalanceResulteData,
- op.getResults(), index, simulate, cache));
+ result = ResultBuilder.buildResult(buildResultForRebalance(rebalanceResultData,
+ op.getResults(), index, false, cache));
}
}
index++;
@@ -297,9 +296,9 @@ public class DataCommands implements CommandMarker {
}
}
- List<String> tokenize(String str, String separator) {
+ private List<String> tokenize(String str, String separator) {
StringTokenizer st = new StringTokenizer(str, separator);
- List<String> rstList = new ArrayList<String>();
+ List<String> rstList = new ArrayList<>();
while (st.hasMoreTokens()) {
rstList.add(st.nextToken());
@@ -308,16 +307,15 @@ public class DataCommands implements CommandMarker {
return rstList;
}
- boolean checkResultList(CompositeResultData rebalanceResulteData, List resultList,
+ private boolean checkResultList(CompositeResultData rebalanceResultData, List resultList,
DistributedMember member) {
boolean toContinueForOtherMembers = false;
- if (resultList != null && !resultList.isEmpty()) {
- for (int i = 0; i < resultList.size(); i++) {
- Object object = resultList.get(i);
+ if (CollectionUtils.isNotEmpty(resultList)) {
+ for (Object object : resultList) {
if (object instanceof Exception) {
- rebalanceResulteData.addSection().addData(
+ rebalanceResultData.addSection().addData(
CliStrings.format(CliStrings.REBALANCE__MSG__NO_EXECUTION, member.getId()),
((Exception) object).getMessage());
@@ -327,7 +325,7 @@ public class DataCommands implements CommandMarker {
toContinueForOtherMembers = true;
break;
} else if (object instanceof Throwable) {
- rebalanceResulteData.addSection().addData(
+ rebalanceResultData.addSection().addData(
CliStrings.format(CliStrings.REBALANCE__MSG__NO_EXECUTION, member.getId()),
((Throwable) object).getMessage());
@@ -341,7 +339,7 @@ public class DataCommands implements CommandMarker {
} else {
LogWrapper.getInstance().info(
"Rebalancing for member=" + member.getId() + ", resultList is either null or empty");
- rebalanceResulteData.addSection().addData("Rebalancing for member=" + member.getId(),
+ rebalanceResultData.addSection().addData("Rebalancing for member=" + member.getId(),
", resultList is either null or empty");
toContinueForOtherMembers = true;
}
@@ -349,15 +347,14 @@ public class DataCommands implements CommandMarker {
return toContinueForOtherMembers;
}
- Result executeRebalanceOnDS(InternalCache cache, String simulate, String[] excludeRegionsList) {
+ private Result executeRebalanceOnDS(InternalCache cache, String simulate,
+ String[] excludeRegionsList) {
Result result = null;
int index = 1;
- CompositeResultData rebalanceResulteData = ResultBuilder.createCompositeResultData();
- List<String> listExcludedRegion = new ArrayList<String>();
+ CompositeResultData rebalanceResultData = ResultBuilder.createCompositeResultData();
+ List<String> listExcludedRegion = new ArrayList<>();
if (excludeRegionsList != null) {
- for (String str : excludeRegionsList) {
- listExcludedRegion.add(str);
- }
+ Collections.addAll(listExcludedRegion, excludeRegionsList);
}
List<MemberPRInfo> listMemberRegion = getMemberRegionList(cache, listExcludedRegion);
@@ -377,29 +374,26 @@ public class DataCommands implements CommandMarker {
}
}
- if (flagToContinueWithRebalance == false) {
+ if (!flagToContinueWithRebalance) {
return ResultBuilder
.createInfoResult(CliStrings.REBALANCE__MSG__NO_REBALANCING_REGIONS_ON_DS);
}
- Iterator<MemberPRInfo> it1 = listMemberRegion.iterator();
- while (it1.hasNext() && flagToContinueWithRebalance) {
+ for (MemberPRInfo memberPR : listMemberRegion) {
try {
- MemberPRInfo memberPR = (MemberPRInfo) it1.next();
- // check if there are more than one members associated with region for
- // rebalancing
+ // check if there are more than one members associated with region for rebalancing
if (memberPR.dsMemberList.size() > 1) {
for (int i = 0; i < memberPR.dsMemberList.size(); i++) {
DistributedMember dsMember = memberPR.dsMemberList.get(i);
Function rebalanceFunction = new RebalanceFunction();
Object[] functionArgs = new Object[3];
functionArgs[0] = simulate;
- Set<String> regionSet = new HashSet<String>();
+ Set<String> regionSet = new HashSet<>();
regionSet.add(memberPR.region);
functionArgs[1] = regionSet;
- Set<String> excludeRegionSet = new HashSet<String>();
+ Set<String> excludeRegionSet = new HashSet<>();
functionArgs[2] = excludeRegionSet;
List resultList = null;
@@ -409,52 +403,51 @@ public class DataCommands implements CommandMarker {
resultList = (ArrayList) CliUtil
.executeFunction(rebalanceFunction, functionArgs, dsMember).getResult();
- if (checkResultList(rebalanceResulteData, resultList, dsMember) == true) {
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ if (checkResultList(rebalanceResultData, resultList, dsMember)) {
+ result = ResultBuilder.buildResult(rebalanceResultData);
continue;
}
List<String> rstList = tokenize((String) resultList.get(0), ",");
- result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResulteData,
- (ArrayList) rstList, index, simulate.equals("true") ? true : false, cache));
+ result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResultData,
+ (ArrayList) rstList, index, simulate.equals("true"), cache));
index++;
- // Rebalancing for region is done so break and continue with
- // other region
+ // Rebalancing for region is done so break and continue with other region
break;
} else {
if (i == memberPR.dsMemberList.size() - 1) {
- rebalanceResulteData.addSection().addData(
+ rebalanceResultData.addSection().addData(
CliStrings.format(
CliStrings.REBALANCE__MSG__NO_EXECUTION_FOR_REGION_0_ON_MEMBERS_1,
memberPR.region, listOfAllMembers(memberPR.dsMemberList)),
CliStrings.REBALANCE__MSG__MEMBERS_MIGHT_BE_DEPARTED);
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ result = ResultBuilder.buildResult(rebalanceResultData);
} else {
continue;
}
}
} catch (Exception ex) {
if (i == memberPR.dsMemberList.size() - 1) {
- rebalanceResulteData.addSection().addData(
+ rebalanceResultData.addSection().addData(
CliStrings.format(
CliStrings.REBALANCE__MSG__NO_EXECUTION_FOR_REGION_0_ON_MEMBERS_1,
memberPR.region, listOfAllMembers(memberPR.dsMemberList)),
CliStrings.REBALANCE__MSG__REASON + ex.getMessage());
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ result = ResultBuilder.buildResult(rebalanceResultData);
} else {
continue;
}
}
- if (checkResultList(rebalanceResulteData, resultList, dsMember) == true) {
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ if (checkResultList(rebalanceResultData, resultList, dsMember)) {
+ result = ResultBuilder.buildResult(rebalanceResultData);
continue;
}
List<String> rstList = tokenize((String) resultList.get(0), ",");
- result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResulteData,
- (ArrayList) rstList, index, simulate.equals("true") ? true : false, cache));
+ result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResultData,
+ (ArrayList) rstList, index, simulate.equals("true"), cache));
index++;
}
}
@@ -487,65 +480,59 @@ public class DataCommands implements CommandMarker {
ArrayList<String> rstlist, int index, boolean simulate, InternalCache cache) {
// add only if there are any valid regions in results
- if (rstlist.size() > resultItemCount && rstlist.get(resultItemCount) != null
- && rstlist.get(resultItemCount).length() > 0) {
+ if (rstlist.size() > resultItemCount && StringUtils.isNotEmpty(rstlist.get(resultItemCount))) {
TabularResultData table1 = rebalanceResulteData.addSection().addTable("Table" + index);
String newLine = System.getProperty("line.separator");
StringBuilder resultStr = new StringBuilder();
resultStr.append(newLine);
table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES);
table1.accumulate("Value", rstlist.get(0));
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES + " = " + rstlist.get(0));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES).append(" = ")
+ .append(rstlist.get(0)).append(newLine);
table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM);
table1.accumulate("Value", rstlist.get(1));
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM + " = " + rstlist.get(1));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM).append(" = ")
+ .append(rstlist.get(1)).append(newLine);
table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED);
table1.accumulate("Value", rstlist.get(2));
- resultStr
- .append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED + " = " + rstlist.get(2));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED).append(" = ")
+ .append(rstlist.get(2)).append(newLine);
table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES);
table1.accumulate("Value", rstlist.get(3));
- resultStr
- .append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES + " = " + rstlist.get(3));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES).append(" = ")
+ .append(rstlist.get(3)).append(newLine);
table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERTIME);
table1.accumulate("Value", rstlist.get(4));
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERTIME + " = " + rstlist.get(4));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERTIME).append(" = ")
+ .append(rstlist.get(4)).append(newLine);
table1.accumulate("Rebalanced Stats",
CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERSCOMPLETED);
table1.accumulate("Value", rstlist.get(5));
- resultStr.append(
- CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERSCOMPLETED + " = " + rstlist.get(5));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERSCOMPLETED).append(" = ")
+ .append(rstlist.get(5)).append(newLine);
table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERTIME);
table1.accumulate("Value", rstlist.get(6));
- resultStr
- .append(CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERTIME + " = " + rstlist.get(6));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERTIME).append(" = ")
+ .append(rstlist.get(6)).append(newLine);
table1.accumulate("Rebalanced Stats",
CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERSCOMPLETED);
table1.accumulate("Value", rstlist.get(7));
- resultStr.append(
- CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERSCOMPLETED + " = " + rstlist.get(7));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERSCOMPLETED).append(" = ")
+ .append(rstlist.get(7)).append(newLine);
table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALTIME);
table1.accumulate("Value", rstlist.get(8));
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALTIME + " = " + rstlist.get(8));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALTIME).append(" = ").append(rstlist.get(8))
+ .append(newLine);
- String headerText = null;
+ String headerText;
if (simulate) {
headerText = "Simulated partition regions ";
} else {
@@ -560,81 +547,73 @@ public class DataCommands implements CommandMarker {
return rebalanceResulteData;
}
- CompositeResultData buildResultForRebalance(CompositeResultData rebalanceResulteData,
+ private CompositeResultData buildResultForRebalance(CompositeResultData rebalanceResultData,
RebalanceResults results, int index, boolean simulate, InternalCache cache) {
Set<PartitionRebalanceInfo> regions = results.getPartitionRebalanceDetails();
Iterator iterator = regions.iterator();
// add only if there are valid number of regions
- if (regions.size() > 0 && ((PartitionRebalanceInfo) iterator.next()).getRegionPath() != null
- && ((PartitionRebalanceInfo) iterator.next()).getRegionPath().length() > 0) {
+ if (regions.size() > 0
+ && StringUtils.isNotEmpty(((PartitionRebalanceInfo) iterator.next()).getRegionPath())) {
final TabularResultData resultData =
- rebalanceResulteData.addSection().addTable("Table" + index);
+ rebalanceResultData.addSection().addTable("Table" + index);
String newLine = System.getProperty("line.separator");
StringBuilder resultStr = new StringBuilder();
resultStr.append(newLine);
resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES);
resultData.accumulate("Value", results.getTotalBucketCreateBytes());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES + " = "
- + results.getTotalBucketCreateBytes());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES).append(" = ")
+ .append(results.getTotalBucketCreateBytes()).append(newLine);
resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM);
resultData.accumulate("Value", results.getTotalBucketCreateTime());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM + " = "
- + results.getTotalBucketCreateTime());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM).append(" = ")
+ .append(results.getTotalBucketCreateTime()).append(newLine);
resultData.accumulate("Rebalanced Stats",
CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED);
resultData.accumulate("Value", results.getTotalBucketCreatesCompleted());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED + " = "
- + results.getTotalBucketCreatesCompleted());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED).append(" = ")
+ .append(results.getTotalBucketCreatesCompleted()).append(newLine);
resultData.accumulate("Rebalanced Stats",
CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES);
resultData.accumulate("Value", results.getTotalBucketTransferBytes());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES + " = "
- + results.getTotalBucketTransferBytes());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES).append(" = ")
+ .append(results.getTotalBucketTransferBytes()).append(newLine);
resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERTIME);
resultData.accumulate("Value", results.getTotalBucketTransferTime());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERTIME + " = "
- + results.getTotalBucketTransferTime());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERTIME).append(" = ")
+ .append(results.getTotalBucketTransferTime()).append(newLine);
resultData.accumulate("Rebalanced Stats",
CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERSCOMPLETED);
resultData.accumulate("Value", results.getTotalBucketTransfersCompleted());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERSCOMPLETED + " = "
- + results.getTotalBucketTransfersCompleted());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERSCOMPLETED).append(" = ")
+ .append(results.getTotalBucketTransfersCompleted()).append(newLine);
resultData.accumulate("Rebalanced Stats",
CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERTIME);
resultData.accumulate("Value", results.getTotalPrimaryTransferTime());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERTIME + " = "
- + results.getTotalPrimaryTransferTime());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERTIME).append(" = ")
+ .append(results.getTotalPrimaryTransferTime()).append(newLine);
resultData.accumulate("Rebalanced Stats",
CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERSCOMPLETED);
resultData.accumulate("Value", results.getTotalPrimaryTransfersCompleted());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERSCOMPLETED + " = "
- + results.getTotalPrimaryTransfersCompleted());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERSCOMPLETED).append(" = ")
+ .append(results.getTotalPrimaryTransfersCompleted()).append(newLine);
resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALTIME);
resultData.accumulate("Value", results.getTotalTime());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALTIME + " = " + results.getTotalTime());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALTIME).append(" = ")
+ .append(results.getTotalTime()).append(newLine);
Iterator<PartitionRebalanceInfo> it = regions.iterator();
- String headerText = null;
+ String headerText;
if (simulate) {
headerText = "Simulated partition regions ";
@@ -650,7 +629,7 @@ public class DataCommands implements CommandMarker {
cache.getLogger().info(headerText + resultStr);
}
- return rebalanceResulteData;
+ return rebalanceResultData;
}
public DistributedMember getAssociatedMembers(String region, final InternalCache cache) {
@@ -660,7 +639,7 @@ public class DataCommands implements CommandMarker {
DistributedMember member = null;
if (bean == null) {
- return member;
+ return null;
}
String[] membersName = bean.getMembers();
@@ -670,7 +649,7 @@ public class DataCommands implements CommandMarker {
boolean matchFound = false;
if (membersName.length > 1) {
- while (it.hasNext() && matchFound == false) {
+ while (it.hasNext() && !matchFound) {
DistributedMember dsmember = (DistributedMember) it.next();
for (String memberName : membersName) {
if (MBeanJMXAdapter.getMemberNameOrId(dsmember).equals(memberName)) {
@@ -684,8 +663,9 @@ public class DataCommands implements CommandMarker {
return member;
}
- List<MemberPRInfo> getMemberRegionList(InternalCache cache, List<String> listExcludedRegion) {
- List<MemberPRInfo> listMemberPRInfo = new ArrayList<MemberPRInfo>();
+ private List<MemberPRInfo> getMemberRegionList(InternalCache cache,
+ List<String> listExcludedRegion) {
+ List<MemberPRInfo> listMemberPRInfo = new ArrayList<>();
String[] listDSRegions =
ManagementService.getManagementService(cache).getDistributedSystemMXBean().listRegions();
final Set<DistributedMember> dsMembers = CliUtil.getAllMembers(cache);
@@ -693,11 +673,10 @@ public class DataCommands implements CommandMarker {
for (String regionName : listDSRegions) {
// check for excluded regions
boolean excludedRegionMatch = false;
- Iterator<String> it = listExcludedRegion.iterator();
- while (it.hasNext()) {
+ for (String aListExcludedRegion : listExcludedRegion) {
// this is needed since region name may start with / or without it
// also
- String excludedRegion = it.next().trim();
+ String excludedRegion = aListExcludedRegion.trim();
if (regionName.startsWith("/")) {
if (!excludedRegion.startsWith("/")) {
excludedRegion = "/" + excludedRegion;
@@ -715,7 +694,7 @@ public class DataCommands implements CommandMarker {
}
}
- if (excludedRegionMatch == true) {
+ if (excludedRegionMatch) {
// ignore this region
continue;
}
@@ -773,7 +752,7 @@ public class DataCommands implements CommandMarker {
this.securityService.authorizeRegionRead(regionName);
final DistributedMember targetMember = CliUtil.getDistributedMemberByNameOrId(memberNameOrId);
- Result result = null;
+ Result result;
if (!filePath.endsWith(CliStrings.GEODE_DATA_FILE_EXTENSION)) {
return ResultBuilder.createUserErrorResult(CliStrings
@@ -826,13 +805,12 @@ public class DataCommands implements CommandMarker {
unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
optionContext = ConverterHint.MEMBERIDNAME,
help = CliStrings.IMPORT_DATA__MEMBER__HELP) String memberNameOrId,
- @CliOption(key = CliStrings.IMPORT_DATA__INVOKE_CALLBACKS, mandatory = false,
- unspecifiedDefaultValue = "false",
+ @CliOption(key = CliStrings.IMPORT_DATA__INVOKE_CALLBACKS, unspecifiedDefaultValue = "false",
help = CliStrings.IMPORT_DATA__INVOKE_CALLBACKS__HELP) boolean invokeCallbacks) {
this.securityService.authorizeRegionWrite(regionName);
- Result result = null;
+ Result result;
try {
final DistributedMember targetMember = CliUtil.getDistributedMemberByNameOrId(memberNameOrId);
@@ -874,8 +852,7 @@ public class DataCommands implements CommandMarker {
return result;
}
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
@CliCommand(value = {CliStrings.PUT}, help = CliStrings.PUT__HELP)
public Result put(
@CliOption(key = {CliStrings.PUT__KEY}, mandatory = true,
@@ -894,26 +871,28 @@ public class DataCommands implements CommandMarker {
this.securityService.authorizeRegionWrite(regionPath);
InternalCache cache = getCache();
- DataCommandResult dataResult = null;
- if (regionPath == null || regionPath.isEmpty()) {
+ DataCommandResult dataResult;
+ if (StringUtils.isEmpty(regionPath)) {
return makePresentationResult(DataCommandResult.createPutResult(key, null, null,
CliStrings.PUT__MSG__REGIONNAME_EMPTY, false));
}
- if (key == null || key.isEmpty())
- return makePresentationResult(dataResult = DataCommandResult.createPutResult(key, null, null,
+ if (StringUtils.isEmpty(key)) {
+ return makePresentationResult(DataCommandResult.createPutResult(key, null, null,
CliStrings.PUT__MSG__KEY_EMPTY, false));
+ }
- if (value == null || value.isEmpty())
- return makePresentationResult(dataResult = DataCommandResult.createPutResult(value, null,
- null, CliStrings.PUT__MSG__VALUE_EMPTY, false));
+ if (StringUtils.isEmpty(value)) {
+ return makePresentationResult(DataCommandResult.createPutResult(value, null, null,
+ CliStrings.PUT__MSG__VALUE_EMPTY, false));
+ }
@SuppressWarnings("rawtypes")
Region region = cache.getRegion(regionPath);
DataCommandFunction putfn = new DataCommandFunction();
if (region == null) {
Set<DistributedMember> memberList = getRegionAssociatedMembers(regionPath, getCache(), false);
- if (memberList != null && memberList.size() > 0) {
+ if (CollectionUtils.isNotEmpty(memberList)) {
DataCommandRequest request = new DataCommandRequest();
request.setCommand(CliStrings.PUT);
request.setValue(value);
@@ -923,28 +902,30 @@ public class DataCommands implements CommandMarker {
request.setValueClass(valueClass);
request.setPutIfAbsent(putIfAbsent);
dataResult = callFunctionForRegion(request, putfn, memberList);
- } else
+ } else {
dataResult = DataCommandResult.createPutInfoResult(key, value, null,
CliStrings.format(CliStrings.PUT__MSG__REGION_NOT_FOUND_ON_ALL_MEMBERS, regionPath),
false);
+ }
} else {
dataResult = putfn.put(key, value, putIfAbsent, keyClass, valueClass, regionPath);
}
dataResult.setKeyClass(keyClass);
- if (valueClass != null)
+ if (valueClass != null) {
dataResult.setValueClass(valueClass);
+ }
return makePresentationResult(dataResult);
}
private Result makePresentationResult(DataCommandResult dataResult) {
- if (dataResult != null)
+ if (dataResult != null) {
return dataResult.toCommandResult();
- else
+ } else {
return ResultBuilder.createGemFireErrorResult("Error executing data command");
+ }
}
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
@CliCommand(value = {CliStrings.GET}, help = CliStrings.GET__HELP)
public Result get(
@CliOption(key = {CliStrings.GET__KEY}, mandatory = true,
@@ -962,23 +943,24 @@ public class DataCommands implements CommandMarker {
this.securityService.authorizeRegionRead(regionPath, key);
InternalCache cache = getCache();
- DataCommandResult dataResult = null;
+ DataCommandResult dataResult;
- if (regionPath == null || regionPath.isEmpty()) {
- return makePresentationResult(dataResult = DataCommandResult.createGetResult(key, null, null,
+ if (StringUtils.isEmpty(regionPath)) {
+ return makePresentationResult(DataCommandResult.createGetResult(key, null, null,
CliStrings.GET__MSG__REGIONNAME_EMPTY, false));
}
- if (key == null || key.isEmpty())
- return makePresentationResult(dataResult = DataCommandResult.createGetResult(key, null, null,
+ if (StringUtils.isEmpty(key)) {
+ return makePresentationResult(DataCommandResult.createGetResult(key, null, null,
CliStrings.GET__MSG__KEY_EMPTY, false));
+ }
@SuppressWarnings("rawtypes")
Region region = cache.getRegion(regionPath);
DataCommandFunction getfn = new DataCommandFunction();
if (region == null) {
Set<DistributedMember> memberList = getRegionAssociatedMembers(regionPath, getCache(), false);
- if (memberList != null && memberList.size() > 0) {
+ if (CollectionUtils.isNotEmpty(memberList)) {
DataCommandRequest request = new DataCommandRequest();
request.setCommand(CliStrings.GET);
request.setKey(key);
@@ -988,25 +970,26 @@ public class DataCommands implements CommandMarker {
request.setLoadOnCacheMiss(loadOnCacheMiss);
Subject subject = this.securityService.getSubject();
if (subject != null) {
- request.setPrincipal((Serializable) subject.getPrincipal());
+ request.setPrincipal(subject.getPrincipal());
}
dataResult = callFunctionForRegion(request, getfn, memberList);
- } else
+ } else {
dataResult = DataCommandResult.createGetInfoResult(key, null, null,
CliStrings.format(CliStrings.GET__MSG__REGION_NOT_FOUND_ON_ALL_MEMBERS, regionPath),
false);
+ }
} else {
dataResult = getfn.get(null, key, keyClass, valueClass, regionPath, loadOnCacheMiss);
}
dataResult.setKeyClass(keyClass);
- if (valueClass != null)
+ if (valueClass != null) {
dataResult.setValueClass(valueClass);
+ }
return makePresentationResult(dataResult);
}
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
@CliCommand(value = {CliStrings.LOCATE_ENTRY}, help = CliStrings.LOCATE_ENTRY__HELP)
public Result locateEntry(
@CliOption(key = {CliStrings.LOCATE_ENTRY__KEY}, mandatory = true,
@@ -1024,20 +1007,21 @@ public class DataCommands implements CommandMarker {
this.securityService.authorizeRegionRead(regionPath, key);
- DataCommandResult dataResult = null;
+ DataCommandResult dataResult;
- if (regionPath == null || regionPath.isEmpty()) {
- return makePresentationResult(dataResult = DataCommandResult.createLocateEntryResult(key,
- null, null, CliStrings.LOCATE_ENTRY__MSG__REGIONNAME_EMPTY, false));
+ if (StringUtils.isEmpty(regionPath)) {
+ return makePresentationResult(DataCommandResult.createLocateEntryResult(key, null, null,
+ CliStrings.LOCATE_ENTRY__MSG__REGIONNAME_EMPTY, false));
}
- if (key == null || key.isEmpty())
- return makePresentationResult(dataResult = DataCommandResult.createLocateEntryResult(key,
- null, null, CliStrings.LOCATE_ENTRY__MSG__KEY_EMPTY, false));
+ if (StringUtils.isEmpty(key)) {
+ return makePresentationResult(DataCommandResult.createLocateEntryResult(key, null, null,
+ CliStrings.LOCATE_ENTRY__MSG__KEY_EMPTY, false));
+ }
DataCommandFunction locateEntry = new DataCommandFunction();
Set<DistributedMember> memberList = getRegionAssociatedMembers(regionPath, getCache(), true);
- if (memberList != null && memberList.size() > 0) {
+ if (CollectionUtils.isNotEmpty(memberList)) {
DataCommandRequest request = new DataCommandRequest();
request.setCommand(CliStrings.LOCATE_ENTRY);
request.setKey(key);
@@ -1046,18 +1030,19 @@ public class DataCommands implements CommandMarker {
request.setValueClass(valueClass);
request.setRecursive(recursive);
dataResult = callFunctionForRegion(request, locateEntry, memberList);
- } else
+ } else {
dataResult = DataCommandResult.createLocateEntryInfoResult(key, null, null, CliStrings.format(
CliStrings.LOCATE_ENTRY__MSG__REGION_NOT_FOUND_ON_ALL_MEMBERS, regionPath), false);
+ }
dataResult.setKeyClass(keyClass);
- if (valueClass != null)
+ if (valueClass != null) {
dataResult.setValueClass(valueClass);
+ }
return makePresentationResult(dataResult);
}
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
@CliCommand(value = {CliStrings.REMOVE}, help = CliStrings.REMOVE__HELP)
public Result remove(
@CliOption(key = {CliStrings.REMOVE__KEY}, help = CliStrings.REMOVE__KEY__HELP,
@@ -1070,16 +1055,16 @@ public class DataCommands implements CommandMarker {
@CliOption(key = {CliStrings.REMOVE__KEYCLASS},
help = CliStrings.REMOVE__KEYCLASS__HELP) String keyClass) {
InternalCache cache = getCache();
- DataCommandResult dataResult = null;
+ DataCommandResult dataResult;
- if (regionPath == null || regionPath.isEmpty()) {
- return makePresentationResult(dataResult = DataCommandResult.createRemoveResult(key, null,
- null, CliStrings.REMOVE__MSG__REGIONNAME_EMPTY, false));
+ if (StringUtils.isEmpty(regionPath)) {
+ return makePresentationResult(DataCommandResult.createRemoveResult(key, null, null,
+ CliStrings.REMOVE__MSG__REGIONNAME_EMPTY, false));
}
if (!removeAllKeys && (key == null)) {
- return makePresentationResult(dataResult = DataCommandResult.createRemoveResult(key, null,
- null, CliStrings.REMOVE__MSG__KEY_EMPTY, false));
+ return makePresentationResult(DataCommandResult.createRemoveResult(null, null, null,
+ CliStrings.REMOVE__MSG__KEY_EMPTY, false));
}
if (removeAllKeys) {
@@ -1093,7 +1078,7 @@ public class DataCommands implements CommandMarker {
DataCommandFunction removefn = new DataCommandFunction();
if (region == null) {
Set<DistributedMember> memberList = getRegionAssociatedMembers(regionPath, getCache(), false);
- if (memberList != null && memberList.size() > 0) {
+ if (CollectionUtils.isNotEmpty(memberList)) {
DataCommandRequest request = new DataCommandRequest();
request.setCommand(CliStrings.REMOVE);
request.setKey(key);
@@ -1101,10 +1086,11 @@ public class DataCommands implements CommandMarker {
request.setRemoveAllKeys(removeAllKeys ? "ALL" : null);
request.setRegionName(regionPath);
dataResult = callFunctionForRegion(request, removefn, memberList);
- } else
+ } else {
dataResult = DataCommandResult.createRemoveInfoResult(key, null, null,
CliStrings.format(CliStrings.REMOVE__MSG__REGION_NOT_FOUND_ON_ALL_MEMBERS, regionPath),
false);
+ }
} else {
dataResult = removefn.remove(key, keyClass, regionPath, removeAllKeys ? "ALL" : null);
@@ -1114,17 +1100,15 @@ public class DataCommands implements CommandMarker {
return makePresentationResult(dataResult);
}
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
@MultiStepCommand
@CliCommand(value = {CliStrings.QUERY}, help = CliStrings.QUERY__HELP)
public Object query(
@CliOption(key = CliStrings.QUERY__QUERY, help = CliStrings.QUERY__QUERY__HELP,
mandatory = true) final String query,
- @CliOption(key = CliStrings.QUERY__STEPNAME, mandatory = false, help = "Step name",
+ @CliOption(key = CliStrings.QUERY__STEPNAME, help = "Step name",
unspecifiedDefaultValue = CliStrings.QUERY__STEPNAME__DEFAULTVALUE) String stepName,
- @CliOption(key = CliStrings.QUERY__INTERACTIVE, mandatory = false,
- help = CliStrings.QUERY__INTERACTIVE__HELP,
+ @CliOption(key = CliStrings.QUERY__INTERACTIVE, help = CliStrings.QUERY__INTERACTIVE__HELP,
unspecifiedDefaultValue = "true") final boolean interactive) {
if (!CliUtil.isGfshVM() && stepName.equals(CliStrings.QUERY__STEPNAME__DEFAULTVALUE)) {
@@ -1156,18 +1140,12 @@ public class DataCommands implements CommandMarker {
public String region;
public MemberPRInfo() {
- region = new String();
- dsMemberList = new ArrayList<DistributedMember>();
+ region = "";
+ dsMemberList = new ArrayList<>();
}
public boolean equals(Object o2) {
- if (o2 == null) {
- return false;
- }
- if (this.region.equals(((MemberPRInfo) o2).region)) {
- return true;
- }
- return false;
+ return o2 != null && this.region.equals(((MemberPRInfo) o2).region);
}
}
@@ -1196,8 +1174,7 @@ public class DataCommands implements CommandMarker {
FunctionService.onMembers(members).setArguments(request).execute(putfn);
List list = (List) collector.getResult();
DataCommandResult result = null;
- for (int i = 0; i < list.size(); i++) {
- Object object = list.get(i);
+ for (Object object : list) {
if (object instanceof Throwable) {
Throwable error = (Throwable) object;
result = new DataCommandResult();
@@ -1220,42 +1197,45 @@ public class DataCommands implements CommandMarker {
public static Set<DistributedMember> getQueryRegionsAssociatedMembers(Set<String> regions,
final InternalCache cache, boolean returnAll) {
LogWriter logger = cache.getLogger();
- Set<DistributedMember> members = null;
+ Set<DistributedMember> members;
Set<DistributedMember> newMembers = null;
Iterator<String> iterator = regions.iterator();
- String region = (String) iterator.next();
+ String region = iterator.next();
members = getRegionAssociatedMembers(region, cache, true);
- if (logger.fineEnabled())
+ if (logger.fineEnabled()) {
logger.fine("Members for region " + region + " Members " + members);
- List<String> regionAndingList = new ArrayList<String>();
+ }
+ List<String> regionAndingList = new ArrayList<>();
regionAndingList.add(region);
if (regions.size() == 1) {
newMembers = members;
} else {
- if (members != null && !members.isEmpty()) {
+ if (CollectionUtils.isNotEmpty(members)) {
while (iterator.hasNext()) {
region = iterator.next();
newMembers = getRegionAssociatedMembers(region, cache, true);
if (newMembers == null) {
- newMembers = new HashSet<DistributedMember>();
+ newMembers = new HashSet<>();
}
- if (logger.fineEnabled())
+ if (logger.fineEnabled()) {
logger.fine("Members for region " + region + " Members " + newMembers);
+ }
regionAndingList.add(region);
newMembers.retainAll(members);
members = newMembers;
- if (logger.fineEnabled())
+ if (logger.fineEnabled()) {
logger.fine(
"Members after anding for regions " + regionAndingList + " List : " + newMembers);
+ }
}
}
}
- members = new HashSet<DistributedMember>();
- if (newMembers == null)
+ members = new HashSet<>();
+ if (newMembers == null) {
return members;
- Iterator<DistributedMember> memberIterator = newMembers.iterator();
- while (memberIterator.hasNext()) {
- members.add(memberIterator.next());
+ }
+ for (DistributedMember newMember : newMembers) {
+ members.add(newMember);
if (!returnAll) {
return members;
}
@@ -1267,17 +1247,20 @@ public class DataCommands implements CommandMarker {
public static Set<DistributedMember> getRegionAssociatedMembers(String region,
final InternalCache cache, boolean returnAll) {
- DistributedMember member = null;
+ DistributedMember member;
- if (region == null || region.isEmpty())
+ if (StringUtils.isEmpty(region)) {
return null;
+ }
DistributedRegionMXBean bean =
ManagementService.getManagementService(cache).getDistributedRegionMXBean(region);
- if (bean == null)// try with slash ahead
+ if (bean == null) {
+ // try with slash ahead
bean = ManagementService.getManagementService(cache)
.getDistributedRegionMXBean(Region.SEPARATOR + region);
+ }
if (bean == null) {
return null;
@@ -1285,11 +1268,11 @@ public class DataCommands implements CommandMarker {
String[] membersName = bean.getMembers();
Set<DistributedMember> dsMembers = cache.getMembers();
- Set<DistributedMember> dsMembersWithThisMember = new HashSet<DistributedMember>();
+ Set<DistributedMember> dsMembersWithThisMember = new HashSet<>();
dsMembersWithThisMember.addAll(dsMembers);
dsMembersWithThisMember.add(cache.getDistributedSystem().getDistributedMember());
Iterator it = dsMembersWithThisMember.iterator();
- Set<DistributedMember> matchedMembers = new HashSet<DistributedMember>();
+ Set<DistributedMember> matchedMembers = new HashSet<>();
if (membersName.length > 0) {
while (it.hasNext()) {
@@ -1321,11 +1304,13 @@ public class DataCommands implements CommandMarker {
int replacedVars = 0;
while (!done) {
int index1 = query.indexOf("${", startIndex);
- if (index1 == -1)
+ if (index1 == -1) {
break;
+ }
int index2 = query.indexOf("}", index1);
- if (index2 == -1)
+ if (index2 == -1) {
break;
+ }
String var = query.substring(index1 + 2, index2);
String value = gfshEnvVarMap.get(var);
if (value != null) {
@@ -1333,8 +1318,9 @@ public class DataCommands implements CommandMarker {
replacedVars++;
}
startIndex = index2 + 1;
- if (startIndex >= query.length())
+ if (startIndex >= query.length()) {
done = true;
+ }
}
return new Object[] {replacedVars, query};
}
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DataCommandResult.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DataCommandResult.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DataCommandResult.java
index 423d781..fe88fc9 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DataCommandResult.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DataCommandResult.java
@@ -17,14 +17,7 @@ package org.apache.geode.management.internal.cli.domain;
import static org.apache.geode.management.internal.cli.multistep.CLIMultiStepHelper.createBannerResult;
import static org.apache.geode.management.internal.cli.multistep.CLIMultiStepHelper.createPageResult;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.DataSerializer;
import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.management.cli.Result;
@@ -38,20 +31,28 @@ import org.apache.geode.management.internal.cli.result.CompositeResultData.Secti
import org.apache.geode.management.internal.cli.result.ResultBuilder;
import org.apache.geode.management.internal.cli.result.TabularResultData;
import org.apache.geode.management.internal.cli.util.JsonUtil;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.json.JSONObject;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
/**
- * Domain object used for Data Commands Functions
- *
- * TODO : Implement DataSerializable
- *
+ * Domain object used for Data Commands Functions TODO : Implement DataSerializable
*/
public class DataCommandResult implements /* Data */ Serializable {
- /**
- *
- */
+ private static Logger logger = LogManager.getLogger();
+
private static final long serialVersionUID = 1L;
private String command;
private Object putResult;
@@ -66,7 +67,9 @@ public class DataCommandResult implements /* Data */ Serializable {
public static final String RESULT_FLAG = "Result";
public static final String NUM_ROWS = "Rows";
- // Aggreagated Data.
+ public static final String MISSING_VALUE = "<NULL>";
+
+ // Aggregated Data.
private List<KeyInfo> locateEntryLocations;
private KeyInfo locateEntryResult;
private boolean hasResultForAggregation;
@@ -91,21 +94,24 @@ public class DataCommandResult implements /* Data */ Serializable {
if (isGet()) {
sb.append(" Type : Get").append(NEW_LINE);
sb.append(" Key : ").append(inputKey).append(NEW_LINE);
- if (getResult != null)
+ if (getResult != null) {
sb.append(" ReturnValue Class : ").append(getResult.getClass()).append(NEW_LINE);
+ }
sb.append(" ReturnValue : ").append(getResult).append(NEW_LINE);
} else if (isPut()) {
sb.append(" Type : Put");
sb.append(" Key : ").append(inputKey).append(NEW_LINE);
- if (putResult != null)
+ if (putResult != null) {
sb.append(" ReturnValue Class : ").append(putResult.getClass()).append(NEW_LINE);
+ }
sb.append(" ReturnValue : ").append(putResult).append(NEW_LINE);
sb.append(" Value : ").append(inputValue).append(NEW_LINE);
} else if (isRemove()) {
sb.append(" Type : Remove");
sb.append(" Key : ").append(inputKey).append(NEW_LINE);
- if (removeResult != null)
+ if (removeResult != null) {
sb.append(" ReturnValue Class : ").append(removeResult.getClass()).append(NEW_LINE);
+ }
sb.append(" ReturnValue : ").append(removeResult).append(NEW_LINE);
} else if (isLocateEntry()) {
sb.append(" Type : Locate Entry");
@@ -114,45 +120,31 @@ public class DataCommandResult implements /* Data */ Serializable {
sb.append(" Results : ").append(locateEntryResult).append(NEW_LINE);
sb.append(" Locations : ").append(locateEntryLocations).append(NEW_LINE);
}
- if (errorString != null)
+ if (errorString != null) {
sb.append(" ERROR ").append(errorString);
+ }
return sb.toString();
}
public boolean isGet() {
- if (CliStrings.GET.equals(command))
- return true;
- else
- return false;
+ return CliStrings.GET.equals(command);
}
public boolean isPut() {
- if (CliStrings.PUT.equals(command))
- return true;
- else
- return false;
+ return CliStrings.PUT.equals(command);
}
public boolean isRemove() {
- if (CliStrings.REMOVE.equals(command))
- return true;
- else
- return false;
+ return CliStrings.REMOVE.equals(command);
}
public boolean isLocateEntry() {
- if (CliStrings.LOCATE_ENTRY.equals(command))
- return true;
- else
- return false;
+ return CliStrings.LOCATE_ENTRY.equals(command);
}
public boolean isSelect() {
- if (CliStrings.QUERY.equals(command))
- return true;
- else
- return false;
+ return CliStrings.QUERY.equals(command);
}
public List<SelectResultRow> getSelectResult() {
@@ -393,11 +385,13 @@ public class DataCommandResult implements /* Data */ Serializable {
public Result toCommandResult() {
- if (keyClass == null || keyClass.isEmpty())
+ if (StringUtils.isEmpty(keyClass)) {
keyClass = "java.lang.String";
+ }
- if (valueClass == null || valueClass.isEmpty())
+ if (StringUtils.isEmpty(valueClass)) {
valueClass = "java.lang.String";
+ }
if (errorString != null) {
// return ResultBuilder.createGemFireErrorResult(errorString);
@@ -406,124 +400,140 @@ public class DataCommandResult implements /* Data */ Serializable {
section.addData("Message", errorString);
section.addData(RESULT_FLAG, operationCompletedSuccessfully);
return ResultBuilder.buildResult(data);
+ }
+
+ CompositeResultData data = ResultBuilder.createCompositeResultData();
+ SectionResultData section = data.addSection();
+ TabularResultData table = section.addTable();
+
+ section.addData(RESULT_FLAG, operationCompletedSuccessfully);
+ if (infoString != null) {
+ section.addData("Message", infoString);
+ }
+
+ if (isGet()) {
+ toCommandResult_isGet(section, table);
+ } else if (isLocateEntry()) {
+ toCommandResult_isLocate(section, table);
+ } else if (isPut()) {
+ toCommandResult_isPut(section, table);
+ } else if (isRemove()) {
+ toCommandResult_isRemove(section, table);
+ } else if (isSelect()) {
+ // its moved to its separate method
+ }
+ return ResultBuilder.buildResult(data);
+ }
+
+ private void toCommandResult_isGet(SectionResultData section, TabularResultData table) {
+ section.addData("Key Class", getKeyClass());
+ if (!isDeclaredPrimitive(keyClass)) {
+ addJSONStringToTable(table, inputKey);
} else {
- CompositeResultData data = ResultBuilder.createCompositeResultData();
- SectionResultData section = data.addSection();
- TabularResultData table = section.addTable();
+ section.addData("Key", inputKey);
+ }
- section.addData(RESULT_FLAG, operationCompletedSuccessfully);
- if (infoString != null)
- section.addData("Message", infoString);
+ section.addData("Value Class", getValueClass());
+ if (!isDeclaredPrimitive(valueClass)) {
+ addJSONStringToTable(table, getResult);
+ } else {
+ section.addData("Value", getResult);
+ }
+ }
- if (isGet()) {
-
- section.addData("Key Class", getKeyClass());
- if (!isDeclaredPrimitive(keyClass))
- addJSONStringToTable(table, inputKey);
- else
- section.addData("Key", inputKey);
-
- section.addData("Value Class", getValueClass());
- if (!isDeclaredPrimitive(valueClass))
- addJSONStringToTable(table, getResult);
- else
- section.addData("Value", getResult);
-
-
- } else if (isLocateEntry()) {
-
- section.addData("Key Class", getKeyClass());
- if (!isDeclaredPrimitive(keyClass))
- addJSONStringToTable(table, inputKey);
- else
- section.addData("Key", inputKey);
-
- if (locateEntryLocations != null) {
- TabularResultData locationTable = section.addTable();
-
- int totalLocations = 0;
-
- for (KeyInfo info : locateEntryLocations) {
- List<Object[]> locations = info.getLocations();
-
- if (locations != null) {
- if (locations.size() == 1) {
- Object array[] = locations.get(0);
- // String regionPath = (String)array[0];
- boolean found = (Boolean) array[1];
- if (found) {
- totalLocations++;
- boolean primary = (Boolean) array[3];
- String bucketId = (String) array[4];
- locationTable.accumulate("MemberName", info.getMemberName());
- locationTable.accumulate("MemberId", info.getMemberId());
- if (bucketId != null) {// PR
- if (primary)
- locationTable.accumulate("Primary", "*Primary PR*");
- else
- locationTable.accumulate("Primary", "No");
- locationTable.accumulate("BucketId", bucketId);
- }
+ private void toCommandResult_isLocate(SectionResultData section, TabularResultData table) {
+
+ section.addData("Key Class", getKeyClass());
+ if (!isDeclaredPrimitive(keyClass)) {
+ addJSONStringToTable(table, inputKey);
+ } else {
+ section.addData("Key", inputKey);
+ }
+
+ if (locateEntryLocations != null) {
+ TabularResultData locationTable = section.addTable();
+
+ int totalLocations = 0;
+
+ for (KeyInfo info : locateEntryLocations) {
+ List<Object[]> locations = info.getLocations();
+
+ if (locations != null) {
+ if (locations.size() == 1) {
+ Object array[] = locations.get(0);
+ // String regionPath = (String)array[0];
+ boolean found = (Boolean) array[1];
+ if (found) {
+ totalLocations++;
+ boolean primary = (Boolean) array[3];
+ String bucketId = (String) array[4];
+ locationTable.accumulate("MemberName", info.getMemberName());
+ locationTable.accumulate("MemberId", info.getMemberId());
+ if (bucketId != null) {// PR
+ if (primary) {
+ locationTable.accumulate("Primary", "*Primary PR*");
+ } else {
+ locationTable.accumulate("Primary", "No");
}
- } else {
- for (Object[] array : locations) {
- String regionPath = (String) array[0];
- boolean found = (Boolean) array[1];
- if (found) {
- totalLocations++;
- boolean primary = (Boolean) array[3];
- String bucketId = (String) array[4];
- locationTable.accumulate("MemberName", info.getMemberName());
- locationTable.accumulate("MemberId", info.getMemberId());
- locationTable.accumulate("RegionPath", regionPath);
- if (bucketId != null) {// PR
- if (primary)
- locationTable.accumulate("Primary", "*Primary PR*");
- else
- locationTable.accumulate("Primary", "No");
- locationTable.accumulate("BucketId", bucketId);
- }
+ locationTable.accumulate("BucketId", bucketId);
+ }
+ }
+ } else {
+ for (Object[] array : locations) {
+ String regionPath = (String) array[0];
+ boolean found = (Boolean) array[1];
+ if (found) {
+ totalLocations++;
+ boolean primary = (Boolean) array[3];
+ String bucketId = (String) array[4];
+ locationTable.accumulate("MemberName", info.getMemberName());
+ locationTable.accumulate("MemberId", info.getMemberId());
+ locationTable.accumulate("RegionPath", regionPath);
+ if (bucketId != null) {// PR
+ if (primary) {
+ locationTable.accumulate("Primary", "*Primary PR*");
+ } else {
+ locationTable.accumulate("Primary", "No");
}
+ locationTable.accumulate("BucketId", bucketId);
}
}
}
}
- section.addData("Locations Found", totalLocations);
- } else {
- section.addData("Location Info ", "Could not find location information");
}
+ }
+ section.addData("Locations Found", totalLocations);
+ } else {
+ section.addData("Location Info ", "Could not find location information");
+ }
+ }
- } else if (isPut()) {
- section.addData("Key Class", getKeyClass());
-
- if (!isDeclaredPrimitive(keyClass)) {
- addJSONStringToTable(table, inputKey);
- } else
- section.addData("Key", inputKey);
-
- section.addData("Value Class", getValueClass());
- if (!isDeclaredPrimitive(valueClass)) {
- addJSONStringToTable(table, putResult);
- } else
- section.addData("Old Value", putResult);
-
- } else if (isRemove()) {
- if (inputKey != null) {// avoids printing key when remove ALL is called
- section.addData("Key Class", getKeyClass());
- if (!isDeclaredPrimitive(keyClass))
- addJSONStringToTable(table, inputKey);
- else
- section.addData("Key", inputKey);
- }
- /*
- * if(valueClass!=null && !valueClass.isEmpty()){ section.addData("Value Class",
- * getValueClass()); addJSONStringToTable(table,removeResult); }else
- * section.addData("Value", removeResult);
- */
- } else if (isSelect()) {
- // its moved to its separate method
+ private void toCommandResult_isPut(SectionResultData section, TabularResultData table) {
+ section.addData("Key Class", getKeyClass());
+
+ if (!isDeclaredPrimitive(keyClass)) {
+ addJSONStringToTable(table, inputKey);
+ } else {
+ section.addData("Key", inputKey);
+ }
+
+ section.addData("Value Class", getValueClass());
+ if (!isDeclaredPrimitive(valueClass)) {
+ addJSONStringToTable(table, putResult);
+ } else {
+ section.addData("Old Value", putResult);
+ }
+
+ }
+
+ private void toCommandResult_isRemove(SectionResultData section, TabularResultData table) {
+ if (inputKey != null) {// avoids printing key when remove ALL is called
+ section.addData("Key Class", getKeyClass());
+ if (!isDeclaredPrimitive(keyClass)) {
+ addJSONStringToTable(table, inputKey);
+ } else {
+ section.addData("Key", inputKey);
}
- return ResultBuilder.buildResult(data);
}
}
@@ -555,8 +565,9 @@ public class DataCommandResult implements /* Data */ Serializable {
}
if (this.selectResult != null) {
section.addData(NUM_ROWS, this.selectResult.size());
- if (this.queryTraceString != null)
+ if (this.queryTraceString != null) {
section.addData("Query Trace", this.queryTraceString);
+ }
buildTable(table, 0, selectResult.size());
}
}
@@ -570,7 +581,7 @@ public class DataCommandResult implements /* Data */ Serializable {
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public Result pageResult(int startCount, int endCount, String step) {
- List<String> fields = new ArrayList<String>();
+ List<String> fields = new ArrayList<>();
List values = new ArrayList<String>();
fields.add(RESULT_FLAG);
values.add(operationCompletedSuccessfully);
@@ -592,8 +603,8 @@ public class DataCommandResult implements /* Data */ Serializable {
if (selectResult != null) {
try {
TabularResultData table = ResultBuilder.createTabularResultData();
- String[] headers = null;
- Object[][] rows = null;
+ String[] headers;
+ Object[][] rows;
int rowCount = buildTable(table, startCount, endCount);
GfJsonArray array = table.getHeaders();
headers = new String[array.size()];
@@ -619,36 +630,70 @@ public class DataCommandResult implements /* Data */ Serializable {
Object valuesArray[] = {startCount, endCount};
return createPageResult(fieldsArray, valuesArray, step, headers, rows);
}
- } else
+ } else {
return createBannerResult(fields, values, step);
+ }
}
}
private int buildTable(TabularResultData table, int startCount, int endCount) {
- int rowCount = 0;
- // Introspect first using tabular data
- for (int i = startCount; i <= endCount; i++) {
- if (i >= selectResult.size())
- break;
- else
- rowCount++;
-
- SelectResultRow row = selectResult.get(i);
- switch (row.type) {
- case ROW_TYPE_BEAN:
- addJSONStringToTable(table, row.value);
- break;
- case ROW_TYPE_STRUCT_RESULT:
- addJSONStringToTable(table, row.value);
- break;
- case ROW_TYPE_PRIMITIVE:
- table.accumulate(RESULT_FLAG, row.value);
- break;
+ // Three steps:
+ // 1a. Convert each row object to a Json object.
+ // 1b. Build a list of keys that are used for each object
+ // 2. Pad MISSING_VALUE into Json objects for those data that are missing any particular key
+ // 3. Build the table from these Json objects.
+
+ // 1.
+ int lastRowExclusive = Math.min(selectResult.size(), endCount + 1);
+ List<SelectResultRow> paginatedRows = selectResult.subList(startCount, lastRowExclusive);
+
+ List<GfJsonObject> tableRows = new ArrayList<>();
+ List<GfJsonObject> rowsWithRealJsonObjects = new ArrayList<>();
+ Set<String> columns = new HashSet<>();
+
+ for (SelectResultRow row : paginatedRows) {
+ GfJsonObject object = new GfJsonObject();
+ try {
+ if (row.value == null || MISSING_VALUE.equals(row.value)) {
+ object.put("Value", MISSING_VALUE);
+ } else if (row.type == ROW_TYPE_PRIMITIVE) {
+ object.put(RESULT_FLAG, row.value);
+ } else {
+ object = buildGfJsonFromRawObject(row.value);
+ rowsWithRealJsonObjects.add(object);
+ object.keys().forEachRemaining(columns::add);
+ }
+ tableRows.add(object);
+ } catch (GfJsonException e) {
+ JSONObject errJson =
+ new JSONObject().put("Value", "Error getting bean properties " + e.getMessage());
+ tableRows.add(new GfJsonObject(errJson, false));
}
}
- return rowCount;
+
+ // 2.
+ for (GfJsonObject tableRow : rowsWithRealJsonObjects) {
+ for (String key : columns) {
+ if (!tableRow.has(key)) {
+ try {
+ tableRow.put(key, MISSING_VALUE);
+ } catch (GfJsonException e) {
+ // TODO: Address this unlikely possibility.
+ logger.warn("Ignored GfJsonException:", e);
+ }
+ }
+ }
+ }
+
+ // 3.
+ for (GfJsonObject jsonObject : tableRows) {
+ addJSONObjectToTable(table, jsonObject);
+ }
+
+ return paginatedRows.size();
}
+
private boolean isDeclaredPrimitive(String keyClass2) {
try {
Class klass = ClassPathLoader.getLatest().forName(keyClass2);
@@ -658,45 +703,6 @@ public class DataCommandResult implements /* Data */ Serializable {
}
}
- private void addJSONStringToTable(TabularResultData table, Object object) {
- if (object == null || "<NULL>".equals(object)) {
- table.accumulate("Value", "<NULL>");
- } else {
- try {
- Class klass = object.getClass();
- GfJsonObject jsonObject = null;
- if (String.class.equals(klass)) {
- // InputString in JSON Form but with round brackets
- String json = (String) object;
- String newString = json.replaceAll("'", "\"");
- if (newString.charAt(0) == '(') {
- int len = newString.length();
- StringBuilder sb = new StringBuilder();
- sb.append("{").append(newString.substring(1, len - 1)).append("}");
- newString = sb.toString();
- }
- jsonObject = new GfJsonObject(newString);
- } else {
- jsonObject = new GfJsonObject(object, true);
- }
-
- Iterator<String> keys = jsonObject.keys();
- while (keys.hasNext()) {
- String k = keys.next();
- // filter out meta-field type-class used to identify java class of json obbject
- if (!"type-class".equals(k)) {
- Object value = jsonObject.get(k);
- if (value != null) {
- table.accumulate(k, getDomainValue(value));
- }
- }
- }
- } catch (Exception e) {
- table.accumulate("Value", "Error getting bean properties " + e.getMessage());
- }
- }
- }
-
private Object getDomainValue(Object value) {
if (value instanceof String) {
@@ -708,8 +714,9 @@ public class DataCommandResult implements /* Data */ Serializable {
} catch (Exception e) {
return str;
}
- } else
+ } else {
return str;
+ }
}
return value;
}
@@ -722,7 +729,6 @@ public class DataCommandResult implements /* Data */ Serializable {
this.inputQuery = inputQuery;
}
-
public static class KeyInfo implements /* Data */ Serializable {
private String memberId;
@@ -734,8 +740,9 @@ public class DataCommandResult implements /* Data */ Serializable {
private ArrayList<Object[]> locations = null;
public void addLocation(Object[] locationArray) {
- if (this.locations == null)
- locations = new ArrayList<Object[]>();
+ if (this.locations == null) {
+ locations = new ArrayList<>();
+ }
locations.add(locationArray);
}
@@ -790,13 +797,14 @@ public class DataCommandResult implements /* Data */ Serializable {
}
public boolean hasLocation() {
- if (locations == null)
+ if (locations == null) {
return false;
- else {
+ } else {
for (Object[] array : locations) {
boolean found = (Boolean) array[1];
- if (found)
+ if (found) {
return true;
+ }
}
}
return false;
@@ -823,7 +831,6 @@ public class DataCommandResult implements /* Data */ Serializable {
}
}
-
public static final int ROW_TYPE_STRUCT_RESULT = 100;
public static final int ROW_TYPE_BEAN = 200;
public static final int ROW_TYPE_PRIMITIVE = 300;
@@ -856,45 +863,98 @@ public class DataCommandResult implements /* Data */ Serializable {
}
+
public void aggregate(DataCommandResult result) {
- if (isLocateEntry()) {
- /* Right now only called for LocateEntry */
+ /* Right now only called for LocateEntry */
+ if (!isLocateEntry()) {
+ return;
+ }
- if (this.locateEntryLocations == null) {
- locateEntryLocations = new ArrayList<KeyInfo>();
- }
+ if (this.locateEntryLocations == null) {
+ locateEntryLocations = new ArrayList<>();
+ }
- if (result == null) {// self-transform result from single to aggregate when numMember==1
- if (this.locateEntryResult != null) {
- locateEntryLocations.add(locateEntryResult);
- // TODO : Decide whether to show value or not this.getResult =
- // locateEntryResult.getValue();
- }
- return;
+ if (result == null) {// self-transform result from single to aggregate when numMember==1
+ if (this.locateEntryResult != null) {
+ locateEntryLocations.add(locateEntryResult);
+ // TODO : Decide whether to show value or not this.getResult = locateEntryResult.getValue();
}
+ return;
+ }
+
+ if (result.errorString != null && !result.errorString.equals(errorString)) {
+ // append errorString only if differs
+ errorString = result.errorString + " " + errorString;
+ }
+
+ // append message only when it differs for negative results
+ if (!operationCompletedSuccessfully && result.infoString != null
+ && !result.infoString.equals(infoString)) {
+ infoString = result.infoString;
+ }
- if (result.errorString != null && !result.errorString.equals(errorString)) {
- // append errorString only if differs
- String newString = result.errorString + " " + errorString;
- errorString = newString;
+ if (result.hasResultForAggregation) {
+ this.operationCompletedSuccessfully = true;
+ infoString = result.infoString;
+ if (result.locateEntryResult != null) {
+ locateEntryLocations.add(result.locateEntryResult);
}
+ }
+ }
- // append messsage only when it differs for negative results
- if (!operationCompletedSuccessfully && result.infoString != null
- && !result.infoString.equals(infoString)) {
- infoString = result.infoString;
+
+ private void addJSONObjectToTable(TabularResultData table, GfJsonObject object) {
+ Iterator<String> keys;
+
+ keys = object.keys();
+ while (keys.hasNext()) {
+ String k = keys.next();
+ // filter out meta-field type-class used to identify java class of json object
+ if (!"type-class".equals(k)) {
+ Object value = object.get(k);
+
+ if (value != null) {
+ table.accumulate(k, getDomainValue(value));
+ }
}
+ }
+ }
+
+ private GfJsonObject buildGfJsonFromRawObject(Object object) throws GfJsonException {
+ GfJsonObject jsonObject;
+ if (String.class.equals(object.getClass())) {
+ jsonObject = new GfJsonObject(sanitizeJsonString((String) object));
+ } else {
+ jsonObject = new GfJsonObject(object, true);
+ }
+
+ return jsonObject;
+ }
+
+ private String sanitizeJsonString(String s) {
+ // InputString in JSON Form but with round brackets
+ String newString = s.replaceAll("'", "\"");
+ if (newString.charAt(0) == '(') {
+ int len = newString.length();
+ newString = "{" + newString.substring(1, len - 1) + "}";
+ }
+ return newString;
+ }
- if (result.hasResultForAggregation /* && result.errorString==null */) {
- this.operationCompletedSuccessfully = true;// override this
- // result.operationCompletedSuccessfully
- infoString = result.infoString;
- if (result.locateEntryResult != null)
- locateEntryLocations.add(result.locateEntryResult);
+ private void addJSONStringToTable(TabularResultData table, Object object) {
+ if (object == null || MISSING_VALUE.equals(object)) {
+ table.accumulate("Value", MISSING_VALUE);
+ } else {
+ try {
+ GfJsonObject jsonObject = buildGfJsonFromRawObject(object);
+ addJSONObjectToTable(table, jsonObject);
+ } catch (Exception e) {
+ table.accumulate("Value", "Error getting bean properties " + e.getMessage());
}
}
}
+
// @Override
public void toData(DataOutput out) throws IOException {
DataSerializer.writeString(command, out);
@@ -935,5 +995,3 @@ public class DataCommandResult implements /* Data */ Serializable {
}
}
-
-
[05/14] geode git commit: GEODE-1994: Overhaul of
internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
index 7a2d33d..b6c11c4 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
@@ -41,6 +41,7 @@ import static org.apache.geode.distributed.ConfigurationProperties.STATISTIC_ARC
import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION;
import static org.apache.geode.management.internal.cli.i18n.CliStrings.START_SERVER__PASSWORD;
+import org.apache.commons.lang.ArrayUtils;
import org.apache.geode.GemFireException;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.server.CacheServer;
@@ -188,62 +189,46 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
@CliMetaData(shellOnly = true,
relatedTopic = {CliStrings.TOPIC_GEODE_LOCATOR, CliStrings.TOPIC_GEODE_LIFECYCLE})
public Result startLocator(
- @CliOption(key = CliStrings.START_LOCATOR__MEMBER_NAME, mandatory = false,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
+ @CliOption(key = CliStrings.START_LOCATOR__MEMBER_NAME,
help = CliStrings.START_LOCATOR__MEMBER_NAME__HELP) String memberName,
@CliOption(key = CliStrings.START_LOCATOR__BIND_ADDRESS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__BIND_ADDRESS__HELP) final String bindAddress,
@CliOption(key = CliStrings.START_LOCATOR__CLASSPATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__CLASSPATH__HELP) final String classpath,
@CliOption(key = CliStrings.START_LOCATOR__FORCE, unspecifiedDefaultValue = "false",
specifiedDefaultValue = "true",
help = CliStrings.START_LOCATOR__FORCE__HELP) final Boolean force,
@CliOption(key = CliStrings.START_LOCATOR__GROUP, optionContext = ConverterHint.MEMBERGROUP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__GROUP__HELP) final String group,
@CliOption(key = CliStrings.START_LOCATOR__HOSTNAME_FOR_CLIENTS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__HOSTNAME_FOR_CLIENTS__HELP) final String hostnameForClients,
@CliOption(key = CliStrings.START_LOCATOR__INCLUDE_SYSTEM_CLASSPATH,
specifiedDefaultValue = "true", unspecifiedDefaultValue = "false",
help = CliStrings.START_LOCATOR__INCLUDE_SYSTEM_CLASSPATH__HELP) final Boolean includeSystemClasspath,
@CliOption(key = CliStrings.START_LOCATOR__LOCATORS,
optionContext = ConverterHint.LOCATOR_DISCOVERY_CONFIG,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__LOCATORS__HELP) final String locators,
@CliOption(key = CliStrings.START_LOCATOR__LOG_LEVEL, optionContext = ConverterHint.LOG_LEVEL,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__LOG_LEVEL__HELP) final String logLevel,
@CliOption(key = CliStrings.START_LOCATOR__MCAST_ADDRESS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__MCAST_ADDRESS__HELP) final String mcastBindAddress,
@CliOption(key = CliStrings.START_LOCATOR__MCAST_PORT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__MCAST_PORT__HELP) final Integer mcastPort,
@CliOption(key = CliStrings.START_LOCATOR__PORT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__PORT__HELP) final Integer port,
@CliOption(key = CliStrings.START_LOCATOR__DIR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__DIR__HELP) String workingDirectory,
@CliOption(key = CliStrings.START_LOCATOR__PROPERTIES,
optionContext = ConverterHint.FILE_PATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__PROPERTIES__HELP) String gemfirePropertiesPathname,
@CliOption(key = CliStrings.START_LOCATOR__SECURITY_PROPERTIES,
optionContext = ConverterHint.FILE_PATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__SECURITY_PROPERTIES__HELP) String gemfireSecurityPropertiesPathname,
@CliOption(key = CliStrings.START_LOCATOR__INITIALHEAP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__INITIALHEAP__HELP) final String initialHeap,
@CliOption(key = CliStrings.START_LOCATOR__MAXHEAP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__MAXHEAP__HELP) final String maxHeap,
@CliOption(key = CliStrings.START_LOCATOR__J,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__J__HELP) final String[] jvmArgsOpts,
@CliOption(key = CliStrings.START_LOCATOR__CONNECT, unspecifiedDefaultValue = "true",
specifiedDefaultValue = "true",
@@ -257,10 +242,8 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
@CliOption(key = CliStrings.START_LOCATOR__CLUSTER__CONFIG__DIR, unspecifiedDefaultValue = "",
help = CliStrings.START_LOCATOR__CLUSTER__CONFIG__DIR__HELP) final String clusterConfigDir,
@CliOption(key = CliStrings.START_LOCATOR__HTTP_SERVICE_PORT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__HTTP_SERVICE_PORT__HELP) final Integer httpServicePort,
@CliOption(key = CliStrings.START_LOCATOR__HTTP_SERVICE_BIND_ADDRESS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__HTTP_SERVICE_BIND_ADDRESS__HELP) final String httpServiceBindAddress) {
try {
if (StringUtils.isBlank(memberName)) {
@@ -272,17 +255,17 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
gemfirePropertiesPathname = CliUtil.resolvePathname(gemfirePropertiesPathname);
- if (!StringUtils.isBlank(gemfirePropertiesPathname)
+ if (StringUtils.isNotBlank(gemfirePropertiesPathname)
&& !IOUtils.isExistingPathname(gemfirePropertiesPathname)) {
return ResultBuilder.createUserErrorResult(
- CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE,
- StringUtils.EMPTY_STRING, gemfirePropertiesPathname));
+ CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, StringUtils.EMPTY,
+ gemfirePropertiesPathname));
}
gemfireSecurityPropertiesPathname =
CliUtil.resolvePathname(gemfireSecurityPropertiesPathname);
- if (!StringUtils.isBlank(gemfireSecurityPropertiesPathname)
+ if (StringUtils.isNotBlank(gemfireSecurityPropertiesPathname)
&& !IOUtils.isExistingPathname(gemfireSecurityPropertiesPathname)) {
return ResultBuilder.createUserErrorResult(
CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, "Security ",
@@ -295,42 +278,41 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
Properties gemfireProperties = new Properties();
- gemfireProperties.setProperty(GROUPS, StringUtils.valueOf(group, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(LOCATORS,
- StringUtils.valueOf(locators, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(LOG_LEVEL,
- StringUtils.valueOf(logLevel, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(MCAST_ADDRESS,
- StringUtils.valueOf(mcastBindAddress, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(MCAST_PORT,
- StringUtils.valueOf(mcastPort, StringUtils.EMPTY_STRING));
+ gemfireProperties.setProperty(GROUPS, StringUtils.defaultString(group));
+ gemfireProperties.setProperty(LOCATORS, StringUtils.defaultString(locators));
+ gemfireProperties.setProperty(LOG_LEVEL, StringUtils.defaultString(logLevel));
+ gemfireProperties.setProperty(MCAST_ADDRESS, StringUtils.defaultString(mcastBindAddress));
+ gemfireProperties.setProperty(MCAST_PORT, StringUtils.defaultString(mcastPort));
gemfireProperties.setProperty(ENABLE_CLUSTER_CONFIGURATION,
- StringUtils.valueOf(enableSharedConfiguration, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(enableSharedConfiguration));
gemfireProperties.setProperty(LOAD_CLUSTER_CONFIGURATION_FROM_DIR,
- StringUtils.valueOf(loadSharedConfigurationFromDirectory, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(loadSharedConfigurationFromDirectory));
gemfireProperties.setProperty(CLUSTER_CONFIGURATION_DIR,
- StringUtils.valueOf(clusterConfigDir, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(HTTP_SERVICE_PORT,
- StringUtils.valueOf(httpServicePort, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(clusterConfigDir));
+ gemfireProperties.setProperty(HTTP_SERVICE_PORT, StringUtils.defaultString(httpServicePort));
gemfireProperties.setProperty(HTTP_SERVICE_BIND_ADDRESS,
- StringUtils.valueOf(httpServiceBindAddress, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(httpServiceBindAddress));
// read the OSProcess enable redirect system property here -- TODO: replace with new GFSH
// argument
final boolean redirectOutput =
Boolean.getBoolean(OSProcess.ENABLE_OUTPUT_REDIRECTION_PROPERTY);
- LocatorLauncher locatorLauncher =
- new LocatorLauncher.Builder().setBindAddress(bindAddress).setForce(force)
- .setHostnameForClients(hostnameForClients).setMemberName(memberName).setPort(port)
- .setRedirectOutput(redirectOutput).setWorkingDirectory(workingDirectory).build();
+ LocatorLauncher.Builder locatorLauncherBuilder =
+ new LocatorLauncher.Builder().setBindAddress(bindAddress).setForce(force).setPort(port)
+ .setRedirectOutput(redirectOutput).setWorkingDirectory(workingDirectory);
+ if (hostnameForClients != null) {
+ locatorLauncherBuilder.setHostnameForClients(hostnameForClients);
+ }
+ if (memberName != null) {
+ locatorLauncherBuilder.setMemberName(memberName);
+ }
+ LocatorLauncher locatorLauncher = locatorLauncherBuilder.build();
String[] locatorCommandLine = createStartLocatorCommandLine(locatorLauncher,
gemfirePropertiesPathname, gemfireSecurityPropertiesPathname, gemfireProperties,
classpath, includeSystemClasspath, jvmArgsOpts, initialHeap, maxHeap);
- // getGfsh().logInfo(StringUtils.concat(locatorCommandLine, " "), null);
-
final Process locatorProcess = new ProcessBuilder(locatorCommandLine)
.directory(new File(locatorLauncher.getWorkingDirectory())).start();
@@ -502,7 +484,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
commandLine.add(LocatorLauncher.class.getName());
commandLine.add(LocatorLauncher.Command.START.getName());
- if (!StringUtils.isBlank(launcher.getMemberName())) {
+ if (StringUtils.isNotBlank(launcher.getMemberName())) {
commandLine.add(launcher.getMemberName());
}
@@ -518,7 +500,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
commandLine.add("--force");
}
- if (!StringUtils.isBlank(launcher.getHostnameForClients())) {
+ if (StringUtils.isNotBlank(launcher.getHostnameForClients())) {
commandLine.add("--hostname-for-clients=" + launcher.getHostnameForClients());
}
@@ -615,7 +597,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
jmxManagerSslEnabled, infoResultData);
}
- if (!StringUtils.isBlank(responseFailureMessage)) {
+ if (StringUtils.isNotBlank(responseFailureMessage)) {
infoResultData.addLine("\n");
infoResultData.addLine(responseFailureMessage);
}
@@ -639,7 +621,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
message.append("Authentication");
}
if (jmxManagerSslEnabled) {
- message.append(jmxManagerAuthEnabled ? " and " : StringUtils.EMPTY_STRING)
+ message.append(jmxManagerAuthEnabled ? " and " : StringUtils.EMPTY)
.append("SSL configuration");
}
if (jmxManagerAuthEnabled || jmxManagerSslEnabled) {
@@ -657,7 +639,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
private Map<String, String> loadConfigurationProperties(
final String configurationPropertiesPathname, Map<String, String> configurationProperties) {
configurationProperties =
- (configurationProperties != null ? configurationProperties : new HashMap<String, String>());
+ (configurationProperties != null ? configurationProperties : new HashMap<>());
if (IOUtils.isExistingPathname(configurationPropertiesPathname)) {
try {
@@ -763,22 +745,17 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
public Result statusLocator(
@CliOption(key = CliStrings.STATUS_LOCATOR__MEMBER,
optionContext = ConverterHint.LOCATOR_MEMBER_IDNAME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_LOCATOR__MEMBER__HELP) final String member,
@CliOption(key = CliStrings.STATUS_LOCATOR__HOST,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_LOCATOR__HOST__HELP) final String locatorHost,
@CliOption(key = CliStrings.STATUS_LOCATOR__PORT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_LOCATOR__PORT__HELP) final Integer locatorPort,
@CliOption(key = CliStrings.STATUS_LOCATOR__PID,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_LOCATOR__PID__HELP) final Integer pid,
@CliOption(key = CliStrings.STATUS_LOCATOR__DIR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_LOCATOR__DIR__HELP) final String workingDirectory) {
try {
- if (!StringUtils.isBlank(member)) {
+ if (StringUtils.isNotBlank(member)) {
if (isConnectedAndReady()) {
final MemberMXBean locatorProxy = getMemberMXBean(member);
@@ -802,9 +779,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
final LocatorState state = locatorLauncher.status();
return createStatusLocatorResult(state);
}
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createUserErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException | IllegalStateException e) {
return ResultBuilder.createUserErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
@@ -824,18 +799,15 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
public Result stopLocator(
@CliOption(key = CliStrings.STOP_LOCATOR__MEMBER,
optionContext = ConverterHint.LOCATOR_MEMBER_IDNAME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STOP_LOCATOR__MEMBER__HELP) final String member,
@CliOption(key = CliStrings.STOP_LOCATOR__PID,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STOP_LOCATOR__PID__HELP) final Integer pid,
@CliOption(key = CliStrings.STOP_LOCATOR__DIR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STOP_LOCATOR__DIR__HELP) final String workingDirectory) {
LocatorState locatorState;
try {
- if (!StringUtils.isBlank(member)) {
+ if (StringUtils.isNotBlank(member)) {
if (isConnectedAndReady()) {
final MemberMXBean locatorProxy = getMemberMXBean(member);
@@ -887,13 +859,11 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
}
}
- return ResultBuilder.createInfoResult(StringUtils.EMPTY_STRING);
+ return ResultBuilder.createInfoResult(StringUtils.EMPTY);
} else {
return ResultBuilder.createUserErrorResult(locatorState.toString());
}
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createUserErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException | IllegalStateException e) {
return ResultBuilder.createUserErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
@@ -917,7 +887,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
if (StringUtils.isBlank(gemfireProperties.getProperty(LOCATORS))) {
String currentLocators = getCurrentLocators();
- if (!StringUtils.isBlank(currentLocators)) {
+ if (StringUtils.isNotBlank(currentLocators)) {
commandLine.add("-D".concat(ProcessLauncherContext.OVERRIDDEN_DEFAULTS_PREFIX)
.concat(LOCATORS).concat("=").concat(currentLocators));
}
@@ -934,14 +904,14 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
protected void addGemFirePropertyFile(final List<String> commandLine,
final String gemfirePropertiesPathname) {
- if (!StringUtils.isBlank(gemfirePropertiesPathname)) {
+ if (StringUtils.isNotBlank(gemfirePropertiesPathname)) {
commandLine.add("-DgemfirePropertyFile=" + gemfirePropertiesPathname);
}
}
protected void addGemFireSecurityPropertyFile(final List<String> commandLine,
final String gemfireSecurityPropertiesPathname) {
- if (!StringUtils.isBlank(gemfireSecurityPropertiesPathname)) {
+ if (StringUtils.isNotBlank(gemfireSecurityPropertiesPathname)) {
commandLine.add("-DgemfireSecurityPropertyFile=" + gemfireSecurityPropertiesPathname);
}
}
@@ -951,7 +921,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
for (final Object property : gemfireProperties.keySet()) {
final String propertyName = property.toString();
final String propertyValue = gemfireProperties.getProperty(propertyName);
- if (!StringUtils.isBlank(propertyValue)) {
+ if (StringUtils.isNotBlank(propertyValue)) {
commandLine.add(
"-D" + DistributionConfig.GEMFIRE_PREFIX + "" + propertyName + "=" + propertyValue);
}
@@ -959,7 +929,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
}
protected void addInitialHeap(final List<String> commandLine, final String initialHeap) {
- if (!StringUtils.isBlank(initialHeap)) {
+ if (StringUtils.isNotBlank(initialHeap)) {
commandLine.add("-Xms" + initialHeap);
}
}
@@ -997,7 +967,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
}
protected void addMaxHeap(final List<String> commandLine, final String maxHeap) {
- if (!StringUtils.isBlank(maxHeap)) {
+ if (StringUtils.isNotBlank(maxHeap)) {
commandLine.add("-Xmx" + maxHeap);
commandLine.add("-XX:+UseConcMarkSweepGC");
commandLine.add("-XX:CMSInitiatingOccupancyFraction=" + CMS_INITIAL_OCCUPANCY_FRACTION);
@@ -1053,8 +1023,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
try {
fileReader = new BufferedReader(new FileReader(pidFile));
return Integer.parseInt(fileReader.readLine());
- } catch (IOException ignore) {
- } catch (NumberFormatException ignore) {
+ } catch (IOException | NumberFormatException ignore) {
} finally {
IOUtils.close(fileReader);
}
@@ -1094,7 +1063,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
protected String getClasspath(final String userClasspath) {
String classpath = getSystemClasspath();
- if (!StringUtils.isBlank(userClasspath)) {
+ if (StringUtils.isNotBlank(userClasspath)) {
classpath += (File.pathSeparator + userClasspath);
}
@@ -1124,9 +1093,9 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
String toClasspath(final boolean includeSystemClasspath, String[] jarFilePathnames,
String... userClasspaths) {
// gemfire jar must absolutely be the first JAR file on the CLASSPATH!!!
- String classpath = getGemFireJarPath();
+ StringBuilder classpath = new StringBuilder(getGemFireJarPath());
- userClasspaths = (userClasspaths != null ? userClasspaths : StringUtils.EMPTY_STRING_ARRAY);
+ userClasspaths = (userClasspaths != null ? userClasspaths : ArrayUtils.EMPTY_STRING_ARRAY);
// Then, include user-specified classes on CLASSPATH to enable the user to override GemFire JAR
// dependencies
@@ -1137,30 +1106,30 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
// System CLASSPATH environment variable setting, which is consistent with the Java platform
// behavior...
for (String userClasspath : userClasspaths) {
- if (!StringUtils.isBlank(userClasspath)) {
- classpath += (classpath.isEmpty() ? StringUtils.EMPTY_STRING : File.pathSeparator);
- classpath += userClasspath;
+ if (StringUtils.isNotBlank(userClasspath)) {
+ classpath.append((classpath.length() == 0) ? StringUtils.EMPTY : File.pathSeparator);
+ classpath.append(userClasspath);
}
}
// Now, include any System-specified CLASSPATH environment variable setting...
if (includeSystemClasspath) {
- classpath += File.pathSeparator;
- classpath += getSystemClasspath();
+ classpath.append(File.pathSeparator);
+ classpath.append(getSystemClasspath());
}
jarFilePathnames =
- (jarFilePathnames != null ? jarFilePathnames : StringUtils.EMPTY_STRING_ARRAY);
+ (jarFilePathnames != null ? jarFilePathnames : ArrayUtils.EMPTY_STRING_ARRAY);
// And finally, include all GemFire dependencies on the CLASSPATH...
for (String jarFilePathname : jarFilePathnames) {
- if (!StringUtils.isBlank(jarFilePathname)) {
- classpath += (classpath.isEmpty() ? StringUtils.EMPTY_STRING : File.pathSeparator);
- classpath += jarFilePathname;
+ if (StringUtils.isNotBlank(jarFilePathname)) {
+ classpath.append((classpath.length() == 0) ? StringUtils.EMPTY : File.pathSeparator);
+ classpath.append(jarFilePathname);
}
}
- return classpath;
+ return classpath.toString();
}
protected String getGemFireJarPath() {
@@ -1194,7 +1163,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
protected String getLocatorId(final String host, final Integer port) {
final String locatorHost = (host != null ? host : getLocalHost());
final String locatorPort =
- StringUtils.valueOf(port, String.valueOf(DistributionLocator.DEFAULT_LOCATOR_PORT));
+ StringUtils.defaultString(port, String.valueOf(DistributionLocator.DEFAULT_LOCATOR_PORT));
return locatorHost.concat("[").concat(locatorPort).concat("]");
}
@@ -1238,7 +1207,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
try {
String objectNamePattern = ManagementConstants.OBJECTNAME__PREFIX;
- objectNamePattern += (StringUtils.isBlank(serviceName) ? StringUtils.EMPTY_STRING
+ objectNamePattern += (StringUtils.isBlank(serviceName) ? StringUtils.EMPTY
: "service=" + serviceName + StringUtils.COMMA_DELIMITER);
objectNamePattern += "type=Member,*";
@@ -1266,7 +1235,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
protected String getServerId(final String host, final Integer port) {
String serverHost = (host != null ? host : getLocalHost());
- String serverPort = StringUtils.valueOf(port, String.valueOf(CacheServer.DEFAULT_PORT));
+ String serverPort = StringUtils.defaultString(port, String.valueOf(CacheServer.DEFAULT_PORT));
return serverHost.concat("[").concat(serverPort).concat("]");
}
@@ -1287,31 +1256,24 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
@CliMetaData(shellOnly = true,
relatedTopic = {CliStrings.TOPIC_GEODE_SERVER, CliStrings.TOPIC_GEODE_LIFECYCLE})
public Result startServer(
- @CliOption(key = CliStrings.START_SERVER__NAME, mandatory = false,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
+ @CliOption(key = CliStrings.START_SERVER__NAME,
help = CliStrings.START_SERVER__NAME__HELP) String memberName,
@CliOption(key = CliStrings.START_SERVER__ASSIGN_BUCKETS, unspecifiedDefaultValue = "false",
specifiedDefaultValue = "true",
help = CliStrings.START_SERVER__ASSIGN_BUCKETS__HELP) final Boolean assignBuckets,
@CliOption(key = CliStrings.START_SERVER__BIND_ADDRESS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__BIND_ADDRESS__HELP) final String bindAddress,
@CliOption(key = CliStrings.START_SERVER__CACHE_XML_FILE,
optionContext = ConverterHint.FILE_PATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__CACHE_XML_FILE__HELP) String cacheXmlPathname,
@CliOption(key = CliStrings.START_SERVER__CLASSPATH,
/* optionContext = ConverterHint.FILE_PATH, // there's an issue with TAB here */
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__CLASSPATH__HELP) final String classpath,
@CliOption(key = CliStrings.START_SERVER__CRITICAL__HEAP__PERCENTAGE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__CRITICAL__HEAP__HELP) final Float criticalHeapPercentage,
@CliOption(key = CliStrings.START_SERVER__CRITICAL_OFF_HEAP_PERCENTAGE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__CRITICAL_OFF_HEAP__HELP) final Float criticalOffHeapPercentage,
@CliOption(key = CliStrings.START_SERVER__DIR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__DIR__HELP) String workingDirectory,
@CliOption(key = CliStrings.START_SERVER__DISABLE_DEFAULT_SERVER,
unspecifiedDefaultValue = "false", specifiedDefaultValue = "true",
@@ -1320,98 +1282,70 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
unspecifiedDefaultValue = "false", specifiedDefaultValue = "true",
help = CliStrings.START_SERVER__DISABLE_EXIT_WHEN_OUT_OF_MEMORY_HELP) final Boolean disableExitWhenOutOfMemory,
@CliOption(key = CliStrings.START_SERVER__ENABLE_TIME_STATISTICS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
specifiedDefaultValue = "true",
help = CliStrings.START_SERVER__ENABLE_TIME_STATISTICS__HELP) final Boolean enableTimeStatistics,
@CliOption(key = CliStrings.START_SERVER__EVICTION__HEAP__PERCENTAGE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__EVICTION__HEAP__PERCENTAGE__HELP) final Float evictionHeapPercentage,
@CliOption(key = CliStrings.START_SERVER__EVICTION_OFF_HEAP_PERCENTAGE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__EVICTION_OFF_HEAP_PERCENTAGE__HELP) final Float evictionOffHeapPercentage,
@CliOption(key = CliStrings.START_SERVER__FORCE, unspecifiedDefaultValue = "false",
specifiedDefaultValue = "true",
help = CliStrings.START_SERVER__FORCE__HELP) final Boolean force,
@CliOption(key = CliStrings.START_SERVER__GROUP, optionContext = ConverterHint.MEMBERGROUP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__GROUP__HELP) final String group,
@CliOption(key = CliStrings.START_SERVER__HOSTNAME__FOR__CLIENTS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__HOSTNAME__FOR__CLIENTS__HELP) final String hostNameForClients,
@CliOption(key = CliStrings.START_SERVER__INCLUDE_SYSTEM_CLASSPATH,
specifiedDefaultValue = "true", unspecifiedDefaultValue = "false",
help = CliStrings.START_SERVER__INCLUDE_SYSTEM_CLASSPATH__HELP) final Boolean includeSystemClasspath,
@CliOption(key = CliStrings.START_SERVER__INITIAL_HEAP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__INITIAL_HEAP__HELP) final String initialHeap,
@CliOption(key = CliStrings.START_SERVER__J,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__J__HELP) final String[] jvmArgsOpts,
@CliOption(key = CliStrings.START_SERVER__LOCATORS,
optionContext = ConverterHint.LOCATOR_DISCOVERY_CONFIG,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__LOCATORS__HELP) final String locators,
@CliOption(key = CliStrings.START_SERVER__LOCATOR_WAIT_TIME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__LOCATOR_WAIT_TIME_HELP) final Integer locatorWaitTime,
- @CliOption(key = CliStrings.START_SERVER__LOCK_MEMORY,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
- specifiedDefaultValue = "true",
+ @CliOption(key = CliStrings.START_SERVER__LOCK_MEMORY, specifiedDefaultValue = "true",
help = CliStrings.START_SERVER__LOCK_MEMORY__HELP) final Boolean lockMemory,
@CliOption(key = CliStrings.START_SERVER__LOG_LEVEL, optionContext = ConverterHint.LOG_LEVEL,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__LOG_LEVEL__HELP) final String logLevel,
@CliOption(key = CliStrings.START_SERVER__MAX__CONNECTIONS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MAX__CONNECTIONS__HELP) final Integer maxConnections,
@CliOption(key = CliStrings.START_SERVER__MAXHEAP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MAXHEAP__HELP) final String maxHeap,
@CliOption(key = CliStrings.START_SERVER__MAX__MESSAGE__COUNT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MAX__MESSAGE__COUNT__HELP) final Integer maxMessageCount,
@CliOption(key = CliStrings.START_SERVER__MAX__THREADS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MAX__THREADS__HELP) final Integer maxThreads,
@CliOption(key = CliStrings.START_SERVER__MCAST_ADDRESS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MCAST_ADDRESS__HELP) final String mcastBindAddress,
@CliOption(key = CliStrings.START_SERVER__MCAST_PORT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MCAST_PORT__HELP) final Integer mcastPort,
@CliOption(key = CliStrings.START_SERVER__MEMCACHED_PORT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MEMCACHED_PORT__HELP) final Integer memcachedPort,
@CliOption(key = CliStrings.START_SERVER__MEMCACHED_PROTOCOL,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MEMCACHED_PROTOCOL__HELP) final String memcachedProtocol,
@CliOption(key = CliStrings.START_SERVER__MEMCACHED_BIND_ADDRESS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MEMCACHED_BIND_ADDRESS__HELP) final String memcachedBindAddress,
@CliOption(key = CliStrings.START_SERVER__REDIS_PORT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__REDIS_PORT__HELP) final Integer redisPort,
@CliOption(key = CliStrings.START_SERVER__REDIS_BIND_ADDRESS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__REDIS_BIND_ADDRESS__HELP) final String redisBindAddress,
@CliOption(key = CliStrings.START_SERVER__REDIS_PASSWORD,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__REDIS_PASSWORD__HELP) final String redisPassword,
@CliOption(key = CliStrings.START_SERVER__MESSAGE__TIME__TO__LIVE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MESSAGE__TIME__TO__LIVE__HELP) final Integer messageTimeToLive,
@CliOption(key = CliStrings.START_SERVER__OFF_HEAP_MEMORY_SIZE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__OFF_HEAP_MEMORY_SIZE__HELP) final String offHeapMemorySize,
@CliOption(key = CliStrings.START_SERVER__PROPERTIES, optionContext = ConverterHint.FILE_PATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__PROPERTIES__HELP) String gemfirePropertiesPathname,
@CliOption(key = CliStrings.START_SERVER__REBALANCE, unspecifiedDefaultValue = "false",
specifiedDefaultValue = "true",
help = CliStrings.START_SERVER__REBALANCE__HELP) final Boolean rebalance,
@CliOption(key = CliStrings.START_SERVER__SECURITY_PROPERTIES,
optionContext = ConverterHint.FILE_PATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__SECURITY_PROPERTIES__HELP) String gemfireSecurityPropertiesPathname,
@CliOption(key = CliStrings.START_SERVER__SERVER_BIND_ADDRESS,
unspecifiedDefaultValue = CacheServer.DEFAULT_BIND_ADDRESS,
@@ -1420,13 +1354,10 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
unspecifiedDefaultValue = ("" + CacheServer.DEFAULT_PORT),
help = CliStrings.START_SERVER__SERVER_PORT__HELP) final Integer serverPort,
@CliOption(key = CliStrings.START_SERVER__SOCKET__BUFFER__SIZE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__SOCKET__BUFFER__SIZE__HELP) final Integer socketBufferSize,
@CliOption(key = CliStrings.START_SERVER__SPRING_XML_LOCATION,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__SPRING_XML_LOCATION_HELP) final String springXmlLocation,
@CliOption(key = CliStrings.START_SERVER__STATISTIC_ARCHIVE_FILE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__STATISTIC_ARCHIVE_FILE__HELP) final String statisticsArchivePathname,
@CliOption(key = CliStrings.START_SERVER__USE_CLUSTER_CONFIGURATION,
unspecifiedDefaultValue = "true", specifiedDefaultValue = "true",
@@ -1452,7 +1383,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
}
// prompt for password is username is specified in the command
- if (!StringUtils.isBlank(userName)) {
+ if (StringUtils.isNotBlank(userName)) {
if (StringUtils.isBlank(passwordToUse)) {
passwordToUse = getGfsh().readPassword(START_SERVER__PASSWORD + ": ");
}
@@ -1466,24 +1397,25 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
cacheXmlPathname = CliUtil.resolvePathname(cacheXmlPathname);
- if (!StringUtils.isBlank(cacheXmlPathname) && !IOUtils.isExistingPathname(cacheXmlPathname)) {
+ if (StringUtils.isNotBlank(cacheXmlPathname)
+ && !IOUtils.isExistingPathname(cacheXmlPathname)) {
return ResultBuilder.createUserErrorResult(
CliStrings.format(CliStrings.CACHE_XML_NOT_FOUND_MESSAGE, cacheXmlPathname));
}
gemfirePropertiesPathname = CliUtil.resolvePathname(gemfirePropertiesPathname);
- if (!StringUtils.isBlank(gemfirePropertiesPathname)
+ if (StringUtils.isNotBlank(gemfirePropertiesPathname)
&& !IOUtils.isExistingPathname(gemfirePropertiesPathname)) {
return ResultBuilder.createUserErrorResult(
- CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE,
- StringUtils.EMPTY_STRING, gemfirePropertiesPathname));
+ CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, StringUtils.EMPTY,
+ gemfirePropertiesPathname));
}
gemfireSecurityPropertiesPathname =
CliUtil.resolvePathname(gemfireSecurityPropertiesPathname);
- if (!StringUtils.isBlank(gemfireSecurityPropertiesPathname)
+ if (StringUtils.isNotBlank(gemfireSecurityPropertiesPathname)
&& !IOUtils.isExistingPathname(gemfireSecurityPropertiesPathname)) {
return ResultBuilder.createUserErrorResult(
CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, "Security ",
@@ -1496,52 +1428,39 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
Properties gemfireProperties = new Properties();
- gemfireProperties.setProperty(BIND_ADDRESS,
- StringUtils.valueOf(bindAddress, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(CACHE_XML_FILE,
- StringUtils.valueOf(cacheXmlPathname, StringUtils.EMPTY_STRING));
+ gemfireProperties.setProperty(BIND_ADDRESS, StringUtils.defaultString(bindAddress));
+ gemfireProperties.setProperty(CACHE_XML_FILE, StringUtils.defaultString(cacheXmlPathname));
gemfireProperties.setProperty(ENABLE_TIME_STATISTICS,
- StringUtils.valueOf(enableTimeStatistics, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(GROUPS, StringUtils.valueOf(group, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(LOCATORS,
- StringUtils.valueOf(locators, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(LOCATOR_WAIT_TIME,
- StringUtils.valueOf(locatorWaitTime, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(LOG_LEVEL,
- StringUtils.valueOf(logLevel, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(MCAST_ADDRESS,
- StringUtils.valueOf(mcastBindAddress, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(MCAST_PORT,
- StringUtils.valueOf(mcastPort, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(MEMCACHED_PORT,
- StringUtils.valueOf(memcachedPort, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(enableTimeStatistics));
+ gemfireProperties.setProperty(GROUPS, StringUtils.defaultString(group));
+ gemfireProperties.setProperty(LOCATORS, StringUtils.defaultString(locators));
+ gemfireProperties.setProperty(LOCATOR_WAIT_TIME, StringUtils.defaultString(locatorWaitTime));
+ gemfireProperties.setProperty(LOG_LEVEL, StringUtils.defaultString(logLevel));
+ gemfireProperties.setProperty(MCAST_ADDRESS, StringUtils.defaultString(mcastBindAddress));
+ gemfireProperties.setProperty(MCAST_PORT, StringUtils.defaultString(mcastPort));
+ gemfireProperties.setProperty(MEMCACHED_PORT, StringUtils.defaultString(memcachedPort));
gemfireProperties.setProperty(MEMCACHED_PROTOCOL,
- StringUtils.valueOf(memcachedProtocol, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(memcachedProtocol));
gemfireProperties.setProperty(MEMCACHED_BIND_ADDRESS,
- StringUtils.valueOf(memcachedBindAddress, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(REDIS_PORT,
- StringUtils.valueOf(redisPort, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(memcachedBindAddress));
+ gemfireProperties.setProperty(REDIS_PORT, StringUtils.defaultString(redisPort));
gemfireProperties.setProperty(REDIS_BIND_ADDRESS,
- StringUtils.valueOf(redisBindAddress, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(REDIS_PASSWORD,
- StringUtils.valueOf(redisPassword, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(redisBindAddress));
+ gemfireProperties.setProperty(REDIS_PASSWORD, StringUtils.defaultString(redisPassword));
gemfireProperties.setProperty(STATISTIC_ARCHIVE_FILE,
- StringUtils.valueOf(statisticsArchivePathname, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(statisticsArchivePathname));
gemfireProperties.setProperty(USE_CLUSTER_CONFIGURATION,
- StringUtils.valueOf(requestSharedConfiguration, Boolean.TRUE.toString()));
- gemfireProperties.setProperty(LOCK_MEMORY,
- StringUtils.valueOf(lockMemory, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(requestSharedConfiguration, Boolean.TRUE.toString()));
+ gemfireProperties.setProperty(LOCK_MEMORY, StringUtils.defaultString(lockMemory));
gemfireProperties.setProperty(OFF_HEAP_MEMORY_SIZE,
- StringUtils.valueOf(offHeapMemorySize, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(START_DEV_REST_API,
- StringUtils.valueOf(startRestApi, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(HTTP_SERVICE_PORT,
- StringUtils.valueOf(httpServicePort, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(offHeapMemorySize));
+ gemfireProperties.setProperty(START_DEV_REST_API, StringUtils.defaultString(startRestApi));
+ gemfireProperties.setProperty(HTTP_SERVICE_PORT, StringUtils.defaultString(httpServicePort));
gemfireProperties.setProperty(HTTP_SERVICE_BIND_ADDRESS,
- StringUtils.valueOf(httpServiceBindAddress, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(httpServiceBindAddress));
// if username is specified in the command line, it will overwrite what's set in the
// properties file
- if (!StringUtils.isBlank(userName)) {
+ if (StringUtils.isNotBlank(userName)) {
gemfireProperties.setProperty(ResourceConstants.USER_NAME, userName);
gemfireProperties.setProperty(ResourceConstants.PASSWORD, passwordToUse);
}
@@ -1552,9 +1471,9 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
final boolean redirectOutput =
Boolean.getBoolean(OSProcess.ENABLE_OUTPUT_REDIRECTION_PROPERTY);
- ServerLauncher serverLauncher = new ServerLauncher.Builder().setAssignBuckets(assignBuckets)
- .setDisableDefaultServer(disableDefaultServer).setForce(force).setMemberName(memberName)
- .setRebalance(rebalance).setRedirectOutput(redirectOutput)
+ ServerLauncher.Builder serverLauncherBuilder = new ServerLauncher.Builder()
+ .setAssignBuckets(assignBuckets).setDisableDefaultServer(disableDefaultServer)
+ .setForce(force).setRebalance(rebalance).setRedirectOutput(redirectOutput)
.setServerBindAddress(serverBindAddress).setServerPort(serverPort)
.setSpringXmlLocation(springXmlLocation).setWorkingDirectory(workingDirectory)
.setCriticalHeapPercentage(criticalHeapPercentage)
@@ -1562,8 +1481,14 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
.setCriticalOffHeapPercentage(criticalOffHeapPercentage)
.setEvictionOffHeapPercentage(evictionOffHeapPercentage).setMaxConnections(maxConnections)
.setMaxMessageCount(maxMessageCount).setMaxThreads(maxThreads)
- .setMessageTimeToLive(messageTimeToLive).setSocketBufferSize(socketBufferSize)
- .setHostNameForClients(hostNameForClients).build();
+ .setMessageTimeToLive(messageTimeToLive).setSocketBufferSize(socketBufferSize);
+ if (hostNameForClients != null) {
+ serverLauncherBuilder.setHostNameForClients(hostNameForClients);
+ }
+ if (memberName != null) {
+ serverLauncherBuilder.setMemberName(memberName);
+ }
+ ServerLauncher serverLauncher = serverLauncherBuilder.build();
String[] serverCommandLine = createStartServerCommandLine(serverLauncher,
gemfirePropertiesPathname, gemfireSecurityPropertiesPathname, gemfireProperties,
@@ -1571,7 +1496,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
maxHeap);
if (getGfsh().getDebug()) {
- getGfsh().logInfo(StringUtils.concat(serverCommandLine, " "), null);
+ getGfsh().logInfo(StringUtils.join(serverCommandLine, StringUtils.SPACE), null);
}
Process serverProcess = new ProcessBuilder(serverCommandLine)
@@ -1722,7 +1647,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
commandLine.add(ServerLauncher.class.getName());
commandLine.add(ServerLauncher.Command.START.getName());
- if (!StringUtils.isBlank(launcher.getMemberName())) {
+ if (StringUtils.isNotBlank(launcher.getMemberName())) {
commandLine.add(launcher.getMemberName());
}
@@ -1847,16 +1772,13 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
relatedTopic = {CliStrings.TOPIC_GEODE_SERVER, CliStrings.TOPIC_GEODE_LIFECYCLE})
public Result statusServer(
@CliOption(key = CliStrings.STATUS_SERVER__MEMBER, optionContext = ConverterHint.MEMBERIDNAME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_SERVER__MEMBER__HELP) final String member,
@CliOption(key = CliStrings.STATUS_SERVER__PID,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_SERVER__PID__HELP) final Integer pid,
@CliOption(key = CliStrings.STATUS_SERVER__DIR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_SERVER__DIR__HELP) final String workingDirectory) {
try {
- if (!StringUtils.isBlank(member)) {
+ if (StringUtils.isNotBlank(member)) {
if (isConnectedAndReady()) {
final MemberMXBean serverProxy = getMemberMXBean(member);
@@ -1886,9 +1808,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
return ResultBuilder.createInfoResult(status.toString());
}
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createUserErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException | IllegalStateException e) {
return ResultBuilder.createUserErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
@@ -1905,18 +1825,15 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
relatedTopic = {CliStrings.TOPIC_GEODE_SERVER, CliStrings.TOPIC_GEODE_LIFECYCLE})
public Result stopServer(
@CliOption(key = CliStrings.STOP_SERVER__MEMBER, optionContext = ConverterHint.MEMBERIDNAME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STOP_SERVER__MEMBER__HELP) final String member,
@CliOption(key = CliStrings.STOP_SERVER__PID,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STOP_SERVER__PID__HELP) final Integer pid,
@CliOption(key = CliStrings.STOP_SERVER__DIR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STOP_SERVER__DIR__HELP) final String workingDirectory) {
ServerState serverState;
try {
- if (!StringUtils.isBlank(member)) {
+ if (StringUtils.isNotBlank(member)) {
if (isConnectedAndReady()) {
final MemberMXBean serverProxy = getMemberMXBean(member);
@@ -1963,13 +1880,11 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
}
}
- return ResultBuilder.createInfoResult(StringUtils.EMPTY_STRING);
+ return ResultBuilder.createInfoResult(StringUtils.EMPTY);
} else {
return ResultBuilder.createUserErrorResult(serverState.toString());
}
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createUserErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException | IllegalStateException e) {
return ResultBuilder.createUserErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
@@ -1988,10 +1903,8 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
// CliStrings.TOPIC_GEODE_JMX, CliStrings.TOPIC_GEODE_LIFECYCLE})
public Result startManager(
@CliOption(key = CliStrings.START_MANAGER__MEMBERNAME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_MANAGER__MEMBERNAME__HELP) String memberName,
@CliOption(key = CliStrings.START_MANAGER__DIR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_MANAGER__DIR__HELP) String dir,
@CliOption(key = CliStrings.START_MANAGER__PORT, unspecifiedDefaultValue = "1099",
help = CliStrings.START_MANAGER__PORT__HELP) int cacheServerPort,
@@ -1999,19 +1912,14 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
unspecifiedDefaultValue = "localhost",
help = CliStrings.START_MANAGER__BIND_ADDRESS__HELP) String cacheServerHost,
@CliOption(key = CliStrings.START_MANAGER__CLASSPATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_MANAGER__CLASSPATH__HELP) String classpath,
@CliOption(key = CliStrings.START_MANAGER__MAXHEAP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_MANAGER__MAXHEAP__HELP) String maxHeap,
@CliOption(key = CliStrings.START_MANAGER__INITIALHEAP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_MANAGER__INITIALHEAP__HELP) String initialHeap,
@CliOption(key = CliStrings.START_MANAGER__J,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_MANAGER__J__HELP) Map<String, String> systepProps,
@CliOption(key = CliStrings.START_MANAGER__GEODEPROPS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_MANAGER__GEODEPROPS__HELP) Map<String, String> gemfireProps) {
return ResultBuilder.createInfoResult("Not-implemented");
}
@@ -2026,13 +1934,11 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
unspecifiedDefaultValue = "false",
help = CliStrings.START_JCONSOLE__NOTILE__HELP) final boolean notile,
@CliOption(key = CliStrings.START_JCONSOLE__PLUGINPATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_JCONSOLE__PLUGINPATH__HELP) final String pluginpath,
@CliOption(key = CliStrings.START_JCONSOLE__VERSION, specifiedDefaultValue = "true",
unspecifiedDefaultValue = "false",
help = CliStrings.START_JCONSOLE__VERSION__HELP) final boolean version,
@CliOption(key = CliStrings.START_JCONSOLE__J,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_JCONSOLE__J__HELP) final List<String> jvmArgs) {
try {
String[] jconsoleCommandLine =
@@ -2064,18 +1970,14 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
String jconsoleProcessOutput = waitAndCaptureProcessStandardErrorStream(jconsoleProcess);
- if (!StringUtils.isBlank(jconsoleProcessOutput)) {
+ if (StringUtils.isNotBlank(jconsoleProcessOutput)) {
message.append(StringUtils.LINE_SEPARATOR);
message.append(jconsoleProcessOutput);
}
}
return ResultBuilder.createInfoResult(message.toString());
- } catch (GemFireException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (GemFireException | IllegalStateException | IllegalArgumentException e) {
return ResultBuilder.createShellClientErrorResult(e.getMessage());
} catch (IOException e) {
return ResultBuilder
@@ -2106,7 +2008,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
commandLine.add("-notile");
}
- if (!StringUtils.isBlank(pluginpath)) {
+ if (StringUtils.isNotBlank(pluginpath)) {
commandLine.add("-pluginpath " + pluginpath);
}
@@ -2118,7 +2020,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
String jmxServiceUrl = getJmxServiceUrlAsString(member);
- if (!StringUtils.isBlank(jmxServiceUrl)) {
+ if (StringUtils.isNotBlank(jmxServiceUrl)) {
commandLine.add(jmxServiceUrl);
}
}
@@ -2166,20 +2068,18 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
}
protected static String getExecutableSuffix() {
- return SystemUtils.isWindows() ? ".exe" : StringUtils.EMPTY_STRING;
+ return SystemUtils.isWindows() ? ".exe" : StringUtils.EMPTY;
}
protected String getJmxServiceUrlAsString(final String member) {
- if (!StringUtils.isBlank(member)) {
+ if (StringUtils.isNotBlank(member)) {
ConnectionEndpointConverter converter = new ConnectionEndpointConverter();
try {
ConnectionEndpoint connectionEndpoint =
converter.convertFromText(member, ConnectionEndpoint.class, null);
-
- return StringUtils.concat("service:jmx:rmi://", connectionEndpoint.getHost(), ":",
- connectionEndpoint.getPort(), "/jndi/rmi://", connectionEndpoint.getHost(), ":",
- connectionEndpoint.getPort(), "/jmxrmi");
+ String hostAndPort = connectionEndpoint.getHost() + ":" + connectionEndpoint.getPort();
+ return String.format("service:jmx:rmi://%s/jndi/rmi://%s/jmxrmi", hostAndPort, hostAndPort);
} catch (Exception e) {
throw new IllegalArgumentException(
CliStrings.START_JCONSOLE__CONNECT_BY_MEMBER_NAME_ID_ERROR_MESSAGE);
@@ -2201,7 +2101,6 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
@CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GEODE_MANAGER,
CliStrings.TOPIC_GEODE_JMX, CliStrings.TOPIC_GEODE_M_AND_M})
public Result startJVisualVM(@CliOption(key = CliStrings.START_JCONSOLE__J,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_JCONSOLE__J__HELP) final List<String> jvmArgs) {
try {
String[] jvisualvmCommandLine = createJVisualVMCommandLine(jvmArgs);
@@ -2219,17 +2118,13 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
InfoResultData infoResultData = ResultBuilder.createInfoResultData();
- if (!StringUtils.isBlank(jvisualvmProcessOutput)) {
+ if (StringUtils.isNotBlank(jvisualvmProcessOutput)) {
infoResultData.addLine(StringUtils.LINE_SEPARATOR);
infoResultData.addLine(jvisualvmProcessOutput);
}
return ResultBuilder.buildResult(infoResultData);
- } catch (GemFireException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (GemFireException | IllegalStateException | IllegalArgumentException e) {
return ResultBuilder.createShellClientErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
@@ -2285,7 +2180,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
unspecifiedDefaultValue = "http://localhost:7070/pulse",
help = CliStrings.START_PULSE__URL__HELP) final String url) {
try {
- if (!StringUtils.isBlank(url)) {
+ if (StringUtils.isNotBlank(url)) {
browse(URI.create(url));
return ResultBuilder.createInfoResult(CliStrings.START_PULSE__RUN);
} else {
@@ -2298,14 +2193,14 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
String pulseURL =
(String) operationInvoker.getAttribute(managerObjectName.toString(), "PulseURL");
- if (!StringUtils.isBlank(pulseURL)) {
+ if (StringUtils.isNotBlank(pulseURL)) {
browse(URI.create(pulseURL));
return ResultBuilder
.createInfoResult(CliStrings.START_PULSE__RUN + " with URL: " + pulseURL);
} else {
String pulseMessage = (String) operationInvoker
.getAttribute(managerObjectName.toString(), "StatusMessage");
- return (!StringUtils.isBlank(pulseMessage)
+ return (StringUtils.isNotBlank(pulseMessage)
? ResultBuilder.createGemFireErrorResult(pulseMessage)
: ResultBuilder.createGemFireErrorResult(CliStrings.START_PULSE__URL__NOTFOUND));
}
@@ -2314,8 +2209,6 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
.format(CliStrings.GFSH_MUST_BE_CONNECTED_FOR_LAUNCHING_0, "GemFire Pulse"));
}
}
- } catch (GemFireException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
} catch (Exception e) {
return ResultBuilder.createShellClientErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
@@ -2373,7 +2266,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
try {
String geodeHome = System.getenv("GEODE_HOME");
- assertState(!StringUtils.isBlank(geodeHome), CliStrings.GEODE_HOME_NOT_FOUND_ERROR_MESSAGE);
+ assertState(StringUtils.isNotBlank(geodeHome), CliStrings.GEODE_HOME_NOT_FOUND_ERROR_MESSAGE);
assertState(IOUtils.isExistingPathname(getPathToVsd()),
String.format(CliStrings.START_VSD__NOT_FOUND_ERROR_MESSAGE, geodeHome));
@@ -2393,19 +2286,14 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
InfoResultData infoResultData = ResultBuilder.createInfoResultData();
- if (!StringUtils.isBlank(vsdProcessOutput)) {
+ if (StringUtils.isNotBlank(vsdProcessOutput)) {
infoResultData.addLine(StringUtils.LINE_SEPARATOR);
infoResultData.addLine(vsdProcessOutput);
}
return ResultBuilder.buildResult(infoResultData);
- } catch (GemFireException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
- } catch (FileNotFoundException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (GemFireException | IllegalStateException | IllegalArgumentException
+ | FileNotFoundException e) {
return ResultBuilder.createShellClientErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
@@ -2489,7 +2377,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
try {
String geodeHome = System.getenv("GEODE_HOME");
- assertState(!StringUtils.isBlank(geodeHome), CliStrings.GEODE_HOME_NOT_FOUND_ERROR_MESSAGE);
+ assertState(StringUtils.isNotBlank(geodeHome), CliStrings.GEODE_HOME_NOT_FOUND_ERROR_MESSAGE);
if (isConnectedAndReady()
&& (getGfsh().getOperationInvoker() instanceof JmxOperationInvoker)) {
@@ -2518,7 +2406,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
InfoResultData infoResultData = ResultBuilder.createInfoResultData();
- if (!StringUtils.isBlank(dataBrowserProcessOutput)) {
+ if (StringUtils.isNotBlank(dataBrowserProcessOutput)) {
infoResultData.addLine(StringUtils.LINE_SEPARATOR);
infoResultData.addLine(dataBrowserProcessOutput);
}
@@ -2528,9 +2416,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
return ResultBuilder.createUserErrorResult(CliStrings.format(
CliStrings.GFSH_MUST_BE_CONNECTED_VIA_JMX_FOR_LAUNCHING_0, "GemFire DataBrowser"));
}
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createUserErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException | IllegalStateException e) {
return ResultBuilder.createUserErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShellCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShellCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShellCommands.java
index c9e79b0..ad344ff 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShellCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShellCommands.java
@@ -20,11 +20,11 @@ import static org.apache.geode.distributed.ConfigurationProperties.CLUSTER_SSL_P
import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.internal.DSFIDFactory;
import org.apache.geode.internal.lang.Initializer;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.lang.SystemUtils;
import org.apache.geode.internal.util.IOUtils;
import org.apache.geode.internal.util.PasswordUtil;
@@ -181,7 +181,7 @@ public class ShellCommands implements CommandMarker {
if (locatorResponseException != null) {
String locatorResponseExceptionMessage = locatorResponseException.getMessage();
- locatorResponseExceptionMessage = (!StringUtils.isBlank(locatorResponseExceptionMessage)
+ locatorResponseExceptionMessage = (StringUtils.isNotBlank(locatorResponseExceptionMessage)
? locatorResponseExceptionMessage : locatorResponseException.toString());
exceptionMessage = "Exception caused JMX Manager startup to fail because: '"
.concat(locatorResponseExceptionMessage).concat("'");
@@ -560,7 +560,7 @@ public class ShellCommands implements CommandMarker {
try {
KeyManagerFactory keyManagerFactory = null;
- if (!StringUtils.isBlank(keystoreToUse)) {
+ if (StringUtils.isNotBlank(keystoreToUse)) {
KeyStore clientKeys = KeyStore.getInstance("JKS");
keyStoreStream = new FileInputStream(keystoreToUse);
clientKeys.load(keyStoreStream, keystorePasswordToUse.toCharArray());
@@ -572,7 +572,7 @@ public class ShellCommands implements CommandMarker {
// load server public key
TrustManagerFactory trustManagerFactory = null;
- if (!StringUtils.isBlank(truststoreToUse)) {
+ if (StringUtils.isNotBlank(truststoreToUse)) {
KeyStore serverPub = KeyStore.getInstance("JKS");
trustStoreStream = new FileInputStream(truststoreToUse);
serverPub.load(trustStoreStream, truststorePasswordToUse.toCharArray());
@@ -622,7 +622,7 @@ public class ShellCommands implements CommandMarker {
URL gfSecurityPropertiesUrl = null;
// Case 1: User has specified gfSecurity properties file
- if (!StringUtils.isBlank(gfSecurityPropertiesPathToUse)) {
+ if (StringUtils.isNotBlank(gfSecurityPropertiesPathToUse)) {
// User specified gfSecurity properties doesn't exist
if (!IOUtils.isExistingPathname(gfSecurityPropertiesPathToUse)) {
gfshInstance
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/FilePathStringConverter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/FilePathStringConverter.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/FilePathStringConverter.java
index 3fadd96..d1e3f9e 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/FilePathStringConverter.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/FilePathStringConverter.java
@@ -14,7 +14,7 @@
*/
package org.apache.geode.management.internal.cli.converters;
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.management.cli.ConverterHint;
import org.springframework.shell.core.Completion;
import org.springframework.shell.core.Converter;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/GatewaySenderIdConverter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/GatewaySenderIdConverter.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/GatewaySenderIdConverter.java
index 59851da..20b37b3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/GatewaySenderIdConverter.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/GatewaySenderIdConverter.java
@@ -14,20 +14,19 @@
*/
package org.apache.geode.management.internal.cli.converters;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
import org.apache.geode.management.cli.ConverterHint;
import org.apache.geode.management.internal.ManagementConstants;
import org.apache.geode.management.internal.cli.shell.Gfsh;
-
import org.springframework.shell.core.Completion;
import org.springframework.shell.core.Converter;
import org.springframework.shell.core.MethodTarget;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
/**
*
* @since GemFire 7.0
@@ -64,7 +63,7 @@ public class GatewaySenderIdConverter implements Converter<String> {
Gfsh gfsh = Gfsh.getCurrentInstance();
if (gfsh != null && gfsh.isConnectedAndReady()) {
final String[] gatewaySenderIdArray = (String[]) gfsh.getOperationInvoker().invoke(
- ManagementConstants.OBJECTNAME__DISTRIBUTEDSYSTEM_MXBEAN, "listGatwaySenders",
+ ManagementConstants.OBJECTNAME__DISTRIBUTEDSYSTEM_MXBEAN, "listGatewaySenders",
new Object[0], new String[0]);
if (gatewaySenderIdArray != null && gatewaySenderIdArray.length != 0) {
gatewaySenderIds = new TreeSet<String>(Arrays.asList(gatewaySenderIdArray));
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DiskStoreDetails.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DiskStoreDetails.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DiskStoreDetails.java
index b5d1b0c..d1a1107 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DiskStoreDetails.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DiskStoreDetails.java
@@ -15,6 +15,11 @@
package org.apache.geode.management.internal.cli.domain;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.cache.DiskStoreFactory;
+import org.apache.geode.internal.lang.MutableIdentifiable;
+import org.apache.geode.internal.lang.ObjectUtils;
+
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
@@ -23,11 +28,6 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.UUID;
-import org.apache.geode.cache.DiskStoreFactory;
-import org.apache.geode.internal.lang.MutableIdentifiable;
-import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.lang.StringUtils;
-
/**
* The DiskStoreDetails class captures information about a particular disk store for a GemFire
* distributed system member. Each disk store for a member should be captured in separate instance
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/IndexDetails.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/IndexDetails.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/IndexDetails.java
index 64bb512..335302e 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/IndexDetails.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/IndexDetails.java
@@ -15,13 +15,13 @@
package org.apache.geode.management.internal.cli.domain;
-import java.io.Serializable;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.query.Index;
import org.apache.geode.cache.query.IndexStatistics;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.lang.StringUtils;
+
+import java.io.Serializable;
/**
* The IndexDetails class encapsulates information for an Index on a Region in the GemFire Cache.
@@ -91,11 +91,11 @@ public class IndexDetails implements Comparable<IndexDetails>, Serializable {
}
public IndexDetails(final String memberId, final String regionPath, final String indexName) {
- assertValidArgument(!StringUtils.isBlank(memberId),
+ assertValidArgument(StringUtils.isNotBlank(memberId),
"The member having a region with an index must be specified!");
- assertValidArgument(!StringUtils.isBlank(regionPath),
+ assertValidArgument(StringUtils.isNotBlank(regionPath),
"The region in member (%1$s) with an index must be specified!", memberId);
- assertValidArgument(!StringUtils.isBlank(indexName),
+ assertValidArgument(StringUtils.isNotBlank(indexName),
"The name of the index on region (%1$s) of member (%2$s) must be specified!", regionPath,
memberId);
this.memberId = memberId;
@@ -307,7 +307,7 @@ public class IndexDetails implements Comparable<IndexDetails>, Serializable {
}
IndexType(final String description) {
- assertValidArgument(!StringUtils.isBlank(description),
+ assertValidArgument(StringUtils.isNotBlank(description),
"The description for the IndexType must be specified!");
this.description = description;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
----------------------------------------------------------------------
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 4c241d0..68cc2e0 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
@@ -15,11 +15,7 @@
package org.apache.geode.management.internal.cli.functions;
-import java.io.File;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Set;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.DataPolicy;
@@ -35,14 +31,17 @@ import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.internal.InternalEntity;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.util.ArrayUtils;
import org.apache.geode.management.internal.cli.domain.DiskStoreDetails;
import org.apache.geode.management.internal.cli.util.DiskStoreNotFoundException;
-
import org.apache.logging.log4j.Logger;
+import java.io.File;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+
/**
* The DescribeDiskStoreFunction class is an implementation of a GemFire Function used to collect
* information and details about a particular disk store for a particular GemFire distributed system
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchSharedConfigurationStatusFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchSharedConfigurationStatusFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchSharedConfigurationStatusFunction.java
index 57d209b..c688d7a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchSharedConfigurationStatusFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchSharedConfigurationStatusFunction.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.management.internal.cli.functions;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.execute.FunctionAdapter;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.distributed.DistributedMember;
@@ -21,7 +22,6 @@ import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.internal.InternalEntity;
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.configuration.domain.SharedConfigurationStatus;
public class FetchSharedConfigurationStatusFunction extends FunctionAdapter
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java
index c99f84a..0811931 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java
@@ -14,12 +14,7 @@
*/
package org.apache.geode.management.internal.cli.functions;
-import java.util.Set;
-
-import org.apache.geode.internal.ClassPathLoader;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.logging.log4j.Logger;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.CacheListener;
@@ -38,6 +33,7 @@ import org.apache.geode.cache.execute.FunctionAdapter;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.execute.ResultSender;
import org.apache.geode.compression.Compressor;
+import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.internal.InternalEntity;
import org.apache.geode.internal.cache.xmlcache.CacheXml;
import org.apache.geode.internal.i18n.LocalizedStrings;
@@ -48,6 +44,9 @@ import org.apache.geode.management.internal.cli.exceptions.CreateSubregionExcept
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.RegionPath;
import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+import org.apache.logging.log4j.Logger;
+
+import java.util.Set;
/**
*
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/HelpBlock.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/HelpBlock.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/HelpBlock.java
index 4383044..78879d3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/HelpBlock.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/HelpBlock.java
@@ -14,7 +14,7 @@
*/
package org.apache.geode.management.internal.cli.help;
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.management.internal.cli.GfshParser;
import org.apache.geode.management.internal.cli.shell.Gfsh;
@@ -33,7 +33,7 @@ public class HelpBlock {
public HelpBlock() {}
public HelpBlock(String data) {
- if (!StringUtils.isBlank(data)) {
+ if (StringUtils.isNotBlank(data)) {
this.data = data;
this.level = 0;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/Helper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/Helper.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/Helper.java
index 9dbf59c..3525013 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/Helper.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/Helper.java
@@ -231,7 +231,7 @@ public class Helper {
}
// Now comes the turn to display synopsis if any
- if (!StringUtils.isBlank(cliCommand.help())) {
+ if (StringUtils.isNotBlank(cliCommand.help())) {
HelpBlock synopsis = new HelpBlock(SYNOPSIS_NAME);
synopsis.addChild(new HelpBlock(cliCommand.help()));
root.addChild(synopsis);
@@ -259,7 +259,7 @@ public class Helper {
HelpBlock getOptionDetail(CliOption cliOption) {
HelpBlock optionNode = new HelpBlock(getPrimaryKey(cliOption));
String help = cliOption.help();
- optionNode.addChild(new HelpBlock((!StringUtils.isBlank(help) ? help : "")));
+ optionNode.addChild(new HelpBlock((StringUtils.isNotBlank(help) ? help : "")));
if (getSynonyms(cliOption).size() > 0) {
StringBuilder builder = new StringBuilder();
for (String string : getSynonyms(cliOption)) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultBuilder.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultBuilder.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultBuilder.java
index 9bd2bf9..6332540 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultBuilder.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultBuilder.java
@@ -14,15 +14,13 @@
*/
package org.apache.geode.management.internal.cli.result;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
-
import org.apache.geode.management.cli.Result;
import org.apache.geode.management.internal.cli.json.GfJsonException;
import org.apache.geode.management.internal.cli.json.GfJsonObject;
+import java.util.Collection;
+import java.util.List;
+
/**
*
*
@@ -170,7 +168,7 @@ public class ResultBuilder {
}
public static <T extends CliJsonSerializable> ObjectResultData<T> createObjectResultData() {
- return new ObjectResultData<T>();
+ return new ObjectResultData<>();
}
// public static CatalogedResultData createCatalogedResultData() {
@@ -228,13 +226,13 @@ public class ResultBuilder {
* Bad Response.
*/
public static Result fromJson(String json) {
- Result result = null;
+ Result result;
try {
GfJsonObject jsonObject = new GfJsonObject(json);
String contentType = jsonObject.getString("contentType");
GfJsonObject data = jsonObject.getJSONObject("data");
- AbstractResultData resultData = null;
+ AbstractResultData resultData;
if (ResultData.TYPE_TABULAR.equals(contentType)) {
resultData = new TabularResultData(data);
} /*
@@ -247,7 +245,7 @@ public class ResultBuilder {
} else if (ResultData.TYPE_COMPOSITE.equals(contentType)) {
resultData = new CompositeResultData(data);
} else if (ResultData.TYPE_OBJECT.equals(contentType)) {
- resultData = new ObjectResultData<CliJsonSerializable>(data);
+ resultData = new ObjectResultData<>(data);
} else {
ErrorResultData errorResultData = new ErrorResultData();
errorResultData.addLine("Can not detect result type, unknown response format: " + json);
@@ -284,7 +282,7 @@ public class ResultBuilder {
* @return Read only ResultData of the same type
*/
static ResultData getReadOnlyResultData(ResultData resultData) {
- ResultData wrapperResultData = null;
+ ResultData wrapperResultData;
String contentType = resultData.getType();
if (ResultData.TYPE_TABULAR.equals(contentType)) {
wrapperResultData = new TabularResultData(resultData.getGfJsonObject()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TableBuilder.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TableBuilder.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TableBuilder.java
index da3c4ae..ff23512 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TableBuilder.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TableBuilder.java
@@ -53,12 +53,12 @@ package org.apache.geode.management.internal.cli.result;
*
* @since GemFire 7.0
*/
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.management.internal.cli.GfshParser;
+
import java.util.ArrayList;
import java.util.List;
-import org.apache.geode.management.internal.cli.GfshParser;
-import org.apache.geode.management.internal.cli.shell.Gfsh;
-
public class TableBuilder {
public static Table newTable() {
@@ -66,7 +66,7 @@ public class TableBuilder {
}
public static class Table {
- private final List<RowGroup> rowGroups = new ArrayList<RowGroup>();
+ private final List<RowGroup> rowGroups = new ArrayList<>();
private String columnSeparator = " ";
private boolean isTabularResult = false;
@@ -138,7 +138,7 @@ public class TableBuilder {
}
public String buildTable() {
- StringBuffer stringBuffer = new StringBuffer();
+ StringBuilder stringBuffer = new StringBuilder();
for (RowGroup rowGroup : this.rowGroups) {
stringBuffer.append(rowGroup.buildRowGroup(isTabularResult));
}
@@ -147,7 +147,7 @@ public class TableBuilder {
}
public List<String> buildTableList() {
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
for (RowGroup rowGroup : this.rowGroups) {
list.add(rowGroup.buildRowGroup(isTabularResult));
}
@@ -169,7 +169,7 @@ public class TableBuilder {
*/
public static class RowGroup {
private final Table table;
- private final List<Row> rows = new ArrayList<Row>();
+ private final List<Row> rows = new ArrayList<>();
private int[] colSizes;
private String columnSeparator;
@@ -202,11 +202,11 @@ public class TableBuilder {
public String buildRowGroup(boolean isTabularResult) {
this.colSizes = computeColSizes(isTabularResult);
- StringBuffer stringBuffer = new StringBuffer();
+ StringBuilder stringBuffer = new StringBuilder();
for (Row row : rows) {
String builtRow = row.buildRow(isTabularResult);
stringBuffer.append(builtRow);
- if (!builtRow.trim().isEmpty() || row.isBlank) {
+ if (StringUtils.isNotBlank(builtRow) || row.isBlank) {
stringBuffer.append(GfshParser.LINE_SEPARATOR);
}
}
@@ -275,7 +275,7 @@ public class TableBuilder {
public static class Row {
private final RowGroup rowGroup;
private final Character rowSeparator;
- private final List<Column> columns = new ArrayList<Column>();
+ private final List<Column> columns = new ArrayList<>();
boolean isBlank;
private boolean isTablewideSeparator;
@@ -335,7 +335,7 @@ public class TableBuilder {
}
private String buildRow(boolean isTabularResult) {
- StringBuffer stringBuffer = new StringBuffer();
+ StringBuilder stringBuffer = new StringBuilder();
if (this.rowSeparator != null) {
if (isTablewideSeparator) {
int maxColLength = this.rowGroup.getTable().getMaxLength();
@@ -383,8 +383,8 @@ public class TableBuilder {
}
private static enum Align {
- LEFT, RIGHT, CENTER;
- };
+ LEFT, RIGHT, CENTER
+ }
private static class Column {
@@ -411,7 +411,7 @@ public class TableBuilder {
// This can happen because colSizes are re-computed
// to fit the screen width
if (this.stringValue.length() > colWidth) {
- StringBuffer stringBuffer = new StringBuffer();
+ StringBuilder stringBuffer = new StringBuilder();
int endIndex = colWidth - 2;
if (endIndex < 0)
return "";
@@ -422,7 +422,7 @@ public class TableBuilder {
if (trimIt)
numSpaces = 0;
- StringBuffer stringBuffer = new StringBuffer();
+ StringBuilder stringBuffer = new StringBuilder();
switch (align) {
case LEFT: