geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject geode git commit: GEODE-2929: remove superfluous final from methods
Date Wed, 17 May 2017 21:25:51 GMT
Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-2929-1 [created] f28c415c8


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/f28c415c
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/f28c415c
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/f28c415c

Branch: refs/heads/feature/GEODE-2929-1
Commit: f28c415c84f36c5bad8e3d43b95644eff680b159
Parents: 52dadee
Author: Kirk Lund <klund@apache.org>
Authored: Wed May 17 14:25:02 2017 -0700
Committer: Kirk Lund <klund@apache.org>
Committed: Wed May 17 14:25:02 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/geode/CancelCriterion.java  |  4 +-
 .../org/apache/geode/CanonicalInstantiator.java |  6 +-
 .../java/org/apache/geode/DataSerializer.java   | 29 ++++------
 .../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   |  9 ++-
 .../geode/cache/MembershipAttributes.java       | 16 ++++--
 .../geode/cache/client/internal/AbstractOp.java |  2 +-
 .../geode/cache/execute/FunctionException.java  | 10 ++--
 .../org/apache/geode/DataSerializerTest.java    | 52 +++++++++++++++++
 .../java/org/apache/geode/InstantiatorTest.java | 55 ++++++++++++++++++
 .../admin/RegionSubRegionSnapshotTest.java      | 59 ++++++++++++++++++++
 .../geode/cache/DiskAccessExceptionTest.java    | 36 ++++++++++++
 .../cache/client/internal/AbstractOpTest.java   | 40 +++++++++++++
 .../cache/execute/FunctionExceptionTest.java    | 53 ++++++++++++++++++
 20 files changed, 363 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/f28c415c/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/f28c415c/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/f28c415c/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..dd190c6 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,7 +2957,7 @@ public abstract class DataSerializer {
    * @see ObjectInputStream#readObject
    */
   @SuppressWarnings("unchecked")
-  public static final <T> T readObject(final DataInput in)
+  public static <T> T readObject(final DataInput in)
       throws IOException, ClassNotFoundException {
     return (T) InternalDataSerializer.basicReadObject(in);
   }
@@ -2997,12 +2992,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 +3003,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 +3102,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 +3112,7 @@ public abstract class DataSerializer {
    * 
    * @since GemFire 6.5
    */
-  public final Object/* EventID */ getEventId() {
+  public Object/* EventID */ getEventId() {
     return this.eventId;
   }
 
@@ -3130,7 +3121,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 +3130,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/f28c415c/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/f28c415c/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/f28c415c/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/f28c415c/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/f28c415c/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/f28c415c/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/f28c415c/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/f28c415c/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..4b9b8fc 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,7 +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,
+  public static FixedPartitionAttributes createFixedPartition(String name,
       boolean isPrimary) {
     return new FixedPartitionAttributesImpl().setPartitionName(name).isPrimary(isPrimary)
         .setNumBuckets(DEFAULT_NUM_BUCKETS);
@@ -68,7 +67,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 +79,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/f28c415c/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/f28c415c/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/f28c415c/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/f28c415c/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..95f55f9
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/DataSerializerTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode/blob/f28c415c/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..621b8b5
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/InstantiatorTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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();
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode/blob/f28c415c/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..c5f9c61
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/admin/RegionSubRegionSnapshotTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode/blob/f28c415c/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..d52b0b5
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/cache/DiskAccessExceptionTest.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.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();
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode/blob/f28c415c/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..2b41be2
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/cache/client/internal/AbstractOpTest.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.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);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode/blob/f28c415c/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..5b9bb4f
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/cache/execute/FunctionExceptionTest.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.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();
+  }
+}
\ No newline at end of file


Mime
View raw message