You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2017/07/18 17:21:39 UTC

[1/4] geode git commit: GEODE-3141: GetRegion Operation implemented Added OperationHandlerJUnitTest.java as parents class of all OperationHandler tests. General clean up of all `public static final` fields

Repository: geode
Updated Branches:
  refs/heads/develop 0f8fdd128 -> 78900ebb2


GEODE-3141: GetRegion Operation implemented
Added OperationHandlerJUnitTest.java as parents class of all OperationHandler tests.
General clean up of all `public static final` fields


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

Branch: refs/heads/develop
Commit: 527fc76b99d7b576838ba435a470805b11043155
Parents: 0f8fdd1
Author: Udo Kohlmeyer <uk...@pivotal.io>
Authored: Wed Jul 12 17:22:55 2017 -0700
Committer: Udo Kohlmeyer <uk...@pivotal.io>
Committed: Tue Jul 18 10:20:30 2017 -0700

----------------------------------------------------------------------
 .../protocol/operations/OperationHandler.java   |   1 +
 .../protobuf/ProtobufStreamProcessor.java       |  20 +++-
 .../GetRegionNamesRequestOperationHandler.java  |   2 +-
 .../GetRegionRequestOperationHandler.java       |  46 ++++++++
 .../operations/GetRequestOperationHandler.java  |   2 +-
 .../operations/PutRequestOperationHandler.java  |   2 +-
 .../RemoveRequestOperationHandler.java          |   2 +-
 .../utilities/ProtobufResponseUtilities.java    |   9 ++
 .../protobuf/utilities/ProtobufUtilities.java   |  54 ++++++----
 geode-protobuf/src/main/proto/basicTypes.proto  |   7 +-
 .../src/main/proto/clientProtocol.proto         |   3 +
 geode-protobuf/src/main/proto/region_API.proto  |  12 ++-
 .../org/apache/geode/protocol/MessageUtil.java  |  12 +++
 .../RoundTripCacheConnectionJUnitTest.java      |  25 +++++
 .../GetAllRequestOperationHandlerJUnitTest.java |  12 +--
 ...onNamesRequestOperationHandlerJUnitTest.java |  21 ++--
 ...tRegionRequestOperationHandlerJUnitTest.java | 106 +++++++++++++++++++
 .../GetRequestOperationHandlerJUnitTest.java    |  41 +++----
 .../operations/OperationHandlerJUnitTest.java   |  39 +++++++
 .../PutAllRequestOperationHandlerJUnitTest.java |  48 +++++----
 .../PutRequestOperationHandlerJUnitTest.java    |  14 ++-
 .../RemoveRequestOperationHandlerJUnitTest.java |  37 ++++---
 22 files changed, 397 insertions(+), 118 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/main/java/org/apache/geode/protocol/operations/OperationHandler.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/operations/OperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/operations/OperationHandler.java
index 90fe177..8a064a8 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/operations/OperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/operations/OperationHandler.java
@@ -15,6 +15,7 @@
 package org.apache.geode.protocol.operations;
 
 import org.apache.geode.cache.Cache;
+import org.apache.geode.protocol.protobuf.ClientProtocol;
 import org.apache.geode.protocol.protobuf.ProtobufOpsProcessor;
 import org.apache.geode.serialization.SerializationService;
 

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufStreamProcessor.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufStreamProcessor.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufStreamProcessor.java
index 980495a..87bc38f 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufStreamProcessor.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufStreamProcessor.java
@@ -21,7 +21,13 @@ import org.apache.geode.protocol.exception.InvalidProtocolMessageException;
 import org.apache.geode.protocol.operations.registry.OperationsHandlerRegistry;
 import org.apache.geode.protocol.operations.registry.exception.OperationHandlerAlreadyRegisteredException;
 import org.apache.geode.protocol.operations.registry.exception.OperationHandlerNotRegisteredException;
-import org.apache.geode.protocol.protobuf.operations.*;
+import org.apache.geode.protocol.protobuf.operations.GetAllRequestOperationHandler;
+import org.apache.geode.protocol.protobuf.operations.GetRegionNamesRequestOperationHandler;
+import org.apache.geode.protocol.protobuf.operations.GetRegionRequestOperationHandler;
+import org.apache.geode.protocol.protobuf.operations.GetRequestOperationHandler;
+import org.apache.geode.protocol.protobuf.operations.PutAllRequestOperationHandler;
+import org.apache.geode.protocol.protobuf.operations.PutRequestOperationHandler;
+import org.apache.geode.protocol.protobuf.operations.RemoveRequestOperationHandler;
 import org.apache.geode.protocol.protobuf.serializer.ProtobufProtocolSerializer;
 import org.apache.geode.protocol.protobuf.utilities.ProtobufUtilities;
 import org.apache.geode.serialization.registry.exception.CodecAlreadyRegisteredForTypeException;
@@ -37,15 +43,16 @@ import java.io.OutputStream;
  * and then pushes it to the output stream.
  */
 public class ProtobufStreamProcessor implements ClientProtocolMessageHandler {
-  ProtobufProtocolSerializer protobufProtocolSerializer;
-  OperationsHandlerRegistry registry;
-  ProtobufSerializationService protobufSerializationService;
-  ProtobufOpsProcessor protobufOpsProcessor;
+  private ProtobufProtocolSerializer protobufProtocolSerializer;
+  private OperationsHandlerRegistry registry;
+  private ProtobufSerializationService protobufSerializationService;
+  private ProtobufOpsProcessor protobufOpsProcessor;
 
   public ProtobufStreamProcessor()
       throws OperationHandlerAlreadyRegisteredException, CodecAlreadyRegisteredForTypeException {
     protobufProtocolSerializer = new ProtobufProtocolSerializer();
     registry = new OperationsHandlerRegistry();
+
     addOperationHandlers(registry);
     protobufSerializationService = new ProtobufSerializationService();
     protobufOpsProcessor = new ProtobufOpsProcessor(registry, protobufSerializationService);
@@ -71,6 +78,9 @@ public class ProtobufStreamProcessor implements ClientProtocolMessageHandler {
     registry.registerOperationHandlerForOperationId(
         ClientProtocol.Request.RequestAPICase.REMOVEREQUEST.getNumber(),
         new RemoveRequestOperationHandler());
+    registry.registerOperationHandlerForOperationId(
+        ClientProtocol.Request.RequestAPICase.GETREGIONREQUEST.getNumber(),
+        new GetRegionRequestOperationHandler());
   }
 
   public void processOneMessage(InputStream inputStream, OutputStream outputStream, Cache cache)

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandler.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandler.java
index 8befdd7..b48cb80 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandler.java
@@ -27,7 +27,7 @@ public class GetRegionNamesRequestOperationHandler
     implements OperationHandler<ClientProtocol.Request, ClientProtocol.Response> {
   @Override
   public ClientProtocol.Response process(SerializationService serializationService,
-      ClientProtocol.Request request, Cache cache) {
+                                         ClientProtocol.Request request, Cache cache) {
     Set<Region<?, ?>> regions = cache.rootRegions();
     return ProtobufResponseUtilities.createGetRegionNamesResponse(regions);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandler.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandler.java
new file mode 100644
index 0000000..23645bb
--- /dev/null
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandler.java
@@ -0,0 +1,46 @@
+/*
+ * 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.protocol.protobuf.operations;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.Region;
+import org.apache.geode.protocol.operations.OperationHandler;
+import org.apache.geode.protocol.protobuf.BasicTypes;
+import org.apache.geode.protocol.protobuf.ClientProtocol;
+import org.apache.geode.protocol.protobuf.RegionAPI;
+import org.apache.geode.protocol.protobuf.utilities.ProtobufResponseUtilities;
+import org.apache.geode.protocol.protobuf.utilities.ProtobufUtilities;
+import org.apache.geode.serialization.SerializationService;
+
+public class GetRegionRequestOperationHandler
+    implements OperationHandler<ClientProtocol.Request, ClientProtocol.Response> {
+
+  @Override
+  public ClientProtocol.Response process(SerializationService serializationService,
+                                         ClientProtocol.Request request, Cache cache) {
+
+    RegionAPI.GetRegionRequest regionRequest = request.getGetRegionRequest();
+    String regionName = regionRequest.getRegionName();
+
+    Region region = cache.getRegion(regionName);
+    if (region == null) {
+      return ProtobufResponseUtilities.createErrorResponse("No region exists for name: "+regionName);
+    }
+
+    BasicTypes.Region protoRegion = ProtobufUtilities.createRegionMessageFromRegion(region);
+
+    return ProtobufResponseUtilities.createGetRegionResponse(protoRegion);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandler.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandler.java
index d5bcfb9..950baa5 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandler.java
@@ -32,7 +32,7 @@ public class GetRequestOperationHandler
 
   @Override
   public ClientProtocol.Response process(SerializationService serializationService,
-      ClientProtocol.Request request, Cache cache) {
+                                         ClientProtocol.Request request, Cache cache) {
     if (request.getRequestAPICase() != ClientProtocol.Request.RequestAPICase.GETREQUEST) {
       return ProtobufResponseUtilities
           .createAndLogErrorResponse("Improperly formatted get request message.", logger, null);

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutRequestOperationHandler.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutRequestOperationHandler.java
index 195aa7a..da8f74c 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutRequestOperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutRequestOperationHandler.java
@@ -32,7 +32,7 @@ public class PutRequestOperationHandler
 
   @Override
   public ClientProtocol.Response process(SerializationService serializationService,
-      ClientProtocol.Request request, Cache cache) {
+                                         ClientProtocol.Request request, Cache cache) {
     if (request.getRequestAPICase() != ClientProtocol.Request.RequestAPICase.PUTREQUEST) {
       return ProtobufResponseUtilities
           .createAndLogErrorResponse("Improperly formatted put request message.", logger, null);

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandler.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandler.java
index 725a338..16d8374 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandler.java
@@ -33,7 +33,7 @@ public class RemoveRequestOperationHandler
 
   @Override
   public ClientProtocol.Response process(SerializationService serializationService,
-      ClientProtocol.Request request, Cache cache) {
+                                         ClientProtocol.Request request, Cache cache) {
     if (request.getRequestAPICase() != ClientProtocol.Request.RequestAPICase.REMOVEREQUEST) {
       return ProtobufResponseUtilities
           .createAndLogErrorResponse("Improperly formatted get request message.", logger, null);

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufResponseUtilities.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufResponseUtilities.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufResponseUtilities.java
index 9a1a9ce..4347977 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufResponseUtilities.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufResponseUtilities.java
@@ -140,4 +140,13 @@ public abstract class ProtobufResponseUtilities {
     return ClientProtocol.Response.newBuilder()
         .setPutAllResponse(RegionAPI.PutAllResponse.newBuilder()).build();
   }
+
+  /**
+   * This creates a ClientProtocol.Response object containing a RegionAPI.GetRegionResponse
+   *
+   * @return A ClientProtocol.Response object indicating a successful getRegionRequest
+   */
+  public static ClientProtocol.Response createGetRegionResponse(BasicTypes.Region protoRegion) {
+    return ClientProtocol.Response.newBuilder().setGetRegionResponse(RegionAPI.GetRegionResponse.newBuilder().setRegion(protoRegion)).build();
+  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java
index b632037..d5b4908 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java
@@ -15,7 +15,13 @@
 package org.apache.geode.protocol.protobuf.utilities;
 
 import com.google.protobuf.ByteString;
-import org.apache.geode.protocol.protobuf.*;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.protocol.protobuf.BasicTypes;
+import org.apache.geode.protocol.protobuf.ClientProtocol;
+import org.apache.geode.protocol.protobuf.EncodingTypeTranslator;
+import org.apache.geode.protocol.protobuf.ProtobufSerializationService;
 import org.apache.geode.serialization.SerializationService;
 import org.apache.geode.serialization.exception.UnsupportedEncodingTypeException;
 import org.apache.geode.serialization.registry.exception.CodecNotRegisteredForTypeException;
@@ -25,22 +31,21 @@ import org.apache.geode.serialization.registry.exception.CodecNotRegisteredForTy
  * mainly focused on helper functions which can be used in building BasicTypes for use in other
  * messages or those used to create the top level Message objects.
  *
- * Helper functions specific to creating ClientProtocol.Responses can be found at
- * {@link ProtobufResponseUtilities} Helper functions specific to creating ClientProtocol.Requests
- * can be found at {@link ProtobufRequestUtilities}
+ * Helper functions specific to creating ClientProtocol.Responses can be found at {@link
+ * ProtobufResponseUtilities} Helper functions specific to creating ClientProtocol.Requests can be
+ * found at {@link ProtobufRequestUtilities}
  */
 public abstract class ProtobufUtilities {
   /**
    * Creates a object containing the type and value encoding of a piece of data
-   *
    * @param serializationService - object which knows how to encode objects for the protobuf
-   *        protocol {@link ProtobufSerializationService}
+   * protocol {@link ProtobufSerializationService}
    * @param unencodedValue - the value object which is to be encoded
    * @return a protobuf EncodedValue object
    * @throws UnsupportedEncodingTypeException - The object passed doesn't have a corresponding
-   *         SerializationType
+   * SerializationType
    * @throws CodecNotRegisteredForTypeException - There isn't a protobuf codec for the
-   *         SerializationType of the passed object
+   * SerializationType of the passed object
    */
   public static BasicTypes.EncodedValue createEncodedValue(
       SerializationService serializationService, Object unencodedValue)
@@ -60,7 +65,7 @@ public abstract class ProtobufUtilities {
    * @return a protobuf Entry object containing the passed key and value
    */
   public static BasicTypes.Entry createEntry(BasicTypes.EncodedValue key,
-      BasicTypes.EncodedValue value) {
+                                             BasicTypes.EncodedValue value) {
     return BasicTypes.Entry.newBuilder().setKey(key).setValue(value).build();
   }
 
@@ -86,7 +91,6 @@ public abstract class ProtobufUtilities {
 
   /**
    * This creates a protobuf message containing a ClientProtocol.Response
-   *
    * @param messageHeader - The header for the message
    * @param response - The response for the message
    * @return a protobuf Message containing the above parameters
@@ -99,7 +103,6 @@ public abstract class ProtobufUtilities {
 
   /**
    * This creates a protobuf message containing a ClientProtocol.Request
-   *
    * @param messageHeader - The header for the message
    * @param request - The request for the message
    * @return a protobuf Message containing the above parameters
@@ -112,7 +115,6 @@ public abstract class ProtobufUtilities {
 
   /**
    * This builds the MessageHeader for a response which matches an incoming request
-   *
    * @param request - The request message that we're responding to.
    * @return the MessageHeader the response to the passed request
    */
@@ -123,7 +125,6 @@ public abstract class ProtobufUtilities {
 
   /**
    * This creates a MessageHeader
-   *
    * @param correlationId - An identifier used to correlate requests and responses
    * @return a MessageHeader containing the above parameters
    */
@@ -133,21 +134,38 @@ public abstract class ProtobufUtilities {
 
   /**
    * This will return the object encoded in a protobuf EncodedValue
-   *
    * @param serializationService - object which knows how to encode objects for the protobuf
-   *        protocol {@link ProtobufSerializationService}
+   * protocol {@link ProtobufSerializationService}
    * @param encodedValue - The value to be decoded
    * @return the object encoded in the passed encodedValue
    * @throws UnsupportedEncodingTypeException - There isn't a SerializationType matching the
-   *         encodedValues type
+   * encodedValues type
    * @throws CodecNotRegisteredForTypeException - There isn't a protobuf codec for the
-   *         SerializationType matching the encodedValues type
+   * SerializationType matching the encodedValues type
    */
   public static Object decodeValue(SerializationService serializationService,
-      BasicTypes.EncodedValue encodedValue)
+                                   BasicTypes.EncodedValue encodedValue)
       throws UnsupportedEncodingTypeException, CodecNotRegisteredForTypeException {
     BasicTypes.EncodingType encoding = encodedValue.getEncodingType();
     byte[] bytes = encodedValue.getValue().toByteArray();
     return serializationService.decode(encoding, bytes);
   }
+
+  public static BasicTypes.Region createRegionMessageFromRegion(Region region) {
+    RegionAttributes regionAttributes = region.getAttributes();
+    BasicTypes.Region.Builder protoRegionBuilder = BasicTypes.Region.newBuilder();
+
+    protoRegionBuilder.setName(region.getName());
+    protoRegionBuilder.setSize(region.size());
+
+    protoRegionBuilder.setPersisted(regionAttributes.getDataPolicy().withPersistence());
+    protoRegionBuilder.setKeyConstraint(regionAttributes.getKeyConstraint() == null ? ""
+        : regionAttributes.getKeyConstraint().toString());
+    protoRegionBuilder.setValueConstraint(regionAttributes.getValueConstraint() == null ? ""
+        : regionAttributes.getValueConstraint().toString());
+
+    protoRegionBuilder.setScope(regionAttributes.getScope().toString());
+    protoRegionBuilder.setType(regionAttributes.getDataPolicy().toString());
+    return protoRegionBuilder.build();
+  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/main/proto/basicTypes.proto
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/proto/basicTypes.proto b/geode-protobuf/src/main/proto/basicTypes.proto
index 502e28e..987c2ed 100644
--- a/geode-protobuf/src/main/proto/basicTypes.proto
+++ b/geode-protobuf/src/main/proto/basicTypes.proto
@@ -52,7 +52,12 @@ message CallbackArguments {
 
 message Region {
     string name = 1;
-    // TODO: key, value types?
+    string type = 2;
+    string scope = 3;
+    string keyConstraint = 4;
+    string valueConstraint = 5;
+    bool persisted = 6;
+    int64 size = 7;
 }
 
 message Server {

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/main/proto/clientProtocol.proto
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/proto/clientProtocol.proto b/geode-protobuf/src/main/proto/clientProtocol.proto
index 42de37c..2c3bed0 100644
--- a/geode-protobuf/src/main/proto/clientProtocol.proto
+++ b/geode-protobuf/src/main/proto/clientProtocol.proto
@@ -51,6 +51,8 @@ message Request {
         PingRequest pingRequest = 41;
         GetServersRequest getServersRequest = 42;
         GetRegionNamesRequest getRegionNamesRequest = 43;
+        GetRegionRequest getRegionRequest = 44;
+
     }
 }
 
@@ -72,6 +74,7 @@ message Response {
         PingResponse pingResponse = 41;
         GetServersResponse getServersResponse = 42;
         GetRegionNamesResponse getRegionNamesResponse = 43;
+        GetRegionResponse getRegionResponse = 44;
     }
 }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/main/proto/region_API.proto
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/proto/region_API.proto b/geode-protobuf/src/main/proto/region_API.proto
index b8f410d..0cf11dc 100644
--- a/geode-protobuf/src/main/proto/region_API.proto
+++ b/geode-protobuf/src/main/proto/region_API.proto
@@ -102,4 +102,14 @@ message GetRegionNamesRequest {
 
 message GetRegionNamesResponse {
     repeated string regions = 1;
-}
\ No newline at end of file
+}
+
+/* does a region exist? */
+message GetRegionRequest {
+    string regionName = 1;
+}
+
+/* success will be true if the region exists */
+message GetRegionResponse {
+    Region region = 1;
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/test/java/org/apache/geode/protocol/MessageUtil.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/MessageUtil.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/MessageUtil.java
index 174ccfa..20216ad 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/MessageUtil.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/MessageUtil.java
@@ -23,6 +23,18 @@ import org.apache.geode.serialization.registry.exception.CodecAlreadyRegisteredF
 import org.apache.geode.serialization.registry.exception.CodecNotRegisteredForTypeException;
 
 public class MessageUtil {
+
+  public static RegionAPI.GetRegionRequest makeGetRegionRequest(String requestRegion) {
+    return RegionAPI.GetRegionRequest.newBuilder().setRegionName(requestRegion).build();
+  }
+
+  public static ClientProtocol.Message makeGetRegionRequestMessage(String requestRegion,
+                                                                   ClientProtocol.MessageHeader header) {
+    ClientProtocol.Request request =
+        ClientProtocol.Request.newBuilder().setGetRegionRequest(makeGetRegionRequest(requestRegion)).build();
+    return ClientProtocol.Message.newBuilder().setMessageHeader(header).setRequest(request).build();
+  }
+
   public static ClientProtocol.Message createGetRequestMessage() {
     ClientProtocol.Message.Builder messageBuilder = ClientProtocol.Message.newBuilder();
     messageBuilder.setMessageHeader(getMessageHeaderBuilder());

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
index 74c1b0e..b240552 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
@@ -278,6 +278,31 @@ public class RoundTripCacheConnectionJUnitTest {
     testNewProtocolHeaderLeadsToNewProtocolServerConnection();
   }
 
+  @Test
+  public void testNewProtocolGetRegionCallSucceeds() throws Exception {
+    System.setProperty("geode.feature-protobuf-protocol", "true");
+
+    Socket socket = new Socket("localhost", cacheServerPort);
+    Awaitility.await().atMost(5, TimeUnit.SECONDS).until(socket::isConnected);
+    OutputStream outputStream = socket.getOutputStream();
+    outputStream.write(110);
+
+
+    ProtobufProtocolSerializer protobufProtocolSerializer = new ProtobufProtocolSerializer();
+    ClientProtocol.Message getRegionMessage =
+        MessageUtil.makeGetRegionRequestMessage(TEST_REGION, ClientProtocol.MessageHeader.newBuilder().build());
+    protobufProtocolSerializer.serialize(getRegionMessage, outputStream);
+
+    ClientProtocol.Message message =
+        protobufProtocolSerializer.deserialize(socket.getInputStream());
+    assertEquals(ClientProtocol.Message.MessageTypeCase.RESPONSE, message.getMessageTypeCase());
+    ClientProtocol.Response response = message.getResponse();
+    assertEquals(ClientProtocol.Response.ResponseAPICase.GETREGIONRESPONSE,
+        response.getResponseAPICase());
+    response.getGetRegionResponse();
+    //TODO add some assertions for Region data
+  }
+
   private void validatePutResponse(Socket socket,
       ProtobufProtocolSerializer protobufProtocolSerializer) throws Exception {
     ClientProtocol.Message message =

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandlerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandlerJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandlerJUnitTest.java
index 0e716fb..c745ffc 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandlerJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandlerJUnitTest.java
@@ -39,7 +39,7 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 @Category(UnitTest.class)
-public class GetAllRequestOperationHandlerJUnitTest {
+public class GetAllRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTest{
   private static final String TEST_KEY1 = "my key1";
   private static final String TEST_VALUE1 = "my value1";
   private static final String TEST_KEY2 = "my key2";
@@ -47,14 +47,11 @@ public class GetAllRequestOperationHandlerJUnitTest {
   private static final String TEST_KEY3 = "my key3";
   private static final String TEST_VALUE3 = "my value3";
   private static final String TEST_REGION = "test region";
-  private Cache cacheStub;
-  private SerializationService serializationServiceStub;
-  private GetAllRequestOperationHandler operationHandler;
   private StringCodec stringDecoder;
 
   @Before
   public void setUp() throws Exception {
-    serializationServiceStub = mock(SerializationService.class);
+    super.setUp();
     addStringMockEncoding(serializationServiceStub, TEST_KEY1, true, true);
     addStringMockEncoding(serializationServiceStub, TEST_KEY2, true, true);
     addStringMockEncoding(serializationServiceStub, TEST_KEY3, true, true);
@@ -77,7 +74,6 @@ public class GetAllRequestOperationHandlerJUnitTest {
       }
     });
 
-    cacheStub = mock(Cache.class);
     when(cacheStub.getRegion(TEST_REGION)).thenReturn(regionStub);
     operationHandler = new GetAllRequestOperationHandler();
     stringDecoder = new StringCodec();
@@ -101,7 +97,7 @@ public class GetAllRequestOperationHandlerJUnitTest {
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request getRequest = generateTestRequest(true);
     ClientProtocol.Response response =
-        operationHandler.process(serializationServiceStub, getRequest, cacheStub);
+        (ClientProtocol.Response) operationHandler.process(serializationServiceStub, getRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.GETALLRESPONSE,
         response.getResponseAPICase());
@@ -121,7 +117,7 @@ public class GetAllRequestOperationHandlerJUnitTest {
       throws UnsupportedEncodingTypeException, CodecNotRegisteredForTypeException {
     ClientProtocol.Request getRequest = generateTestRequest(false);
     ClientProtocol.Response response =
-        operationHandler.process(serializationServiceStub, getRequest, cacheStub);
+        (ClientProtocol.Response) operationHandler.process(serializationServiceStub, getRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.GETALLRESPONSE,
         response.getResponseAPICase());

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandlerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandlerJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandlerJUnitTest.java
index d8b97da..9798522 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandlerJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandlerJUnitTest.java
@@ -39,17 +39,15 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 @Category(UnitTest.class)
-public class GetRegionNamesRequestOperationHandlerJUnitTest {
-  public static final String TEST_REGION1 = "test region 1";
-  public static final String TEST_REGION2 = "test region 2";
-  public static final String TEST_REGION3 = "test region 3";
-  public Cache cacheStub;
-  public SerializationService serializationServiceStub;
-  private GetRegionNamesRequestOperationHandler operationHandler;
+public class GetRegionNamesRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTest{
+  private final String TEST_REGION1 = "test region 1";
+  private final String TEST_REGION2 = "test region 2";
+  private final String TEST_REGION3 = "test region 3";
 
   @Before
   public void setUp() throws Exception {
-    serializationServiceStub = mock(SerializationService.class);
+    super.setUp();
+
     when(serializationServiceStub.encode(BasicTypes.EncodingType.STRING, TEST_REGION1))
         .thenReturn(TEST_REGION1.getBytes(Charset.forName("UTF-8")));
     when(serializationServiceStub.encode(BasicTypes.EncodingType.STRING, TEST_REGION2))
@@ -64,16 +62,15 @@ public class GetRegionNamesRequestOperationHandlerJUnitTest {
     Region<String, String> region3Stub = mock(Region.class);
     when(region3Stub.getName()).thenReturn(TEST_REGION3);
 
-    cacheStub = mock(Cache.class);
     when(cacheStub.rootRegions()).thenReturn(Collections.unmodifiableSet(
-        new HashSet<Region<String, String>>(Arrays.asList(region1Stub, region2Stub, region3Stub))));
+        new HashSet<>(Arrays.asList(region1Stub, region2Stub, region3Stub))));
     operationHandler = new GetRegionNamesRequestOperationHandler();
   }
 
   @Test
   public void processReturnsCacheRegions() throws CodecAlreadyRegisteredForTypeException,
       UnsupportedEncodingTypeException, CodecNotRegisteredForTypeException {
-    ClientProtocol.Response response = operationHandler.process(serializationServiceStub,
+    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler.process(serializationServiceStub,
         ProtobufRequestUtilities.createGetRegionNamesRequest(), cacheStub);
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.GETREGIONNAMESRESPONSE,
         response.getResponseAPICase());
@@ -98,7 +95,7 @@ public class GetRegionNamesRequestOperationHandlerJUnitTest {
     Cache emptyCache = mock(Cache.class);;
     when(emptyCache.rootRegions())
         .thenReturn(Collections.unmodifiableSet(new HashSet<Region<String, String>>()));
-    ClientProtocol.Response response = operationHandler.process(serializationServiceStub,
+    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler.process(serializationServiceStub,
         ProtobufRequestUtilities.createGetRegionNamesRequest(), emptyCache);
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.GETREGIONNAMESRESPONSE,
         response.getResponseAPICase());

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandlerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandlerJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandlerJUnitTest.java
new file mode 100644
index 0000000..ec9d50b
--- /dev/null
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandlerJUnitTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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.protocol.protobuf.operations;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.Scope;
+import org.apache.geode.protocol.MessageUtil;
+import org.apache.geode.protocol.protobuf.BasicTypes;
+import org.apache.geode.protocol.protobuf.ClientProtocol;
+import org.apache.geode.protocol.protobuf.RegionAPI;
+import org.apache.geode.serialization.exception.UnsupportedEncodingTypeException;
+import org.apache.geode.serialization.registry.exception.CodecAlreadyRegisteredForTypeException;
+import org.apache.geode.serialization.registry.exception.CodecNotRegisteredForTypeException;
+import org.apache.geode.test.dunit.Assert;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.nio.charset.Charset;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+
+@Category(UnitTest.class)
+public class GetRegionRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTest {
+  private final String TEST_REGION1 = "test region 1";
+  private Region region1Stub;
+
+  @Before
+  public void setUp() throws Exception {
+    super.setUp();
+
+    when(serializationServiceStub.encode(BasicTypes.EncodingType.STRING, TEST_REGION1))
+        .thenReturn(TEST_REGION1.getBytes(Charset.forName("UTF-8")));
+
+    region1Stub = mock(Region.class);
+    when(region1Stub.getName()).thenReturn(TEST_REGION1);
+
+    operationHandler = new GetRegionRequestOperationHandler();
+  }
+
+  @Test
+  public void processReturnsCacheRegions() throws CodecAlreadyRegisteredForTypeException,
+      UnsupportedEncodingTypeException, CodecNotRegisteredForTypeException {
+
+    RegionAttributes regionAttributesStub = mock(RegionAttributes.class);
+    when(cacheStub.getRegion(TEST_REGION1)).thenReturn(region1Stub);
+    when(region1Stub.getName()).thenReturn(TEST_REGION1);
+    when(region1Stub.size()).thenReturn(10);
+    when(region1Stub.getAttributes()).thenReturn(regionAttributesStub);
+    when(regionAttributesStub.getDataPolicy()).thenReturn(DataPolicy.PERSISTENT_REPLICATE);
+    when(regionAttributesStub.getKeyConstraint()).thenReturn(String.class);
+    when(regionAttributesStub.getValueConstraint()).thenReturn(Integer.class);
+    when(regionAttributesStub.getScope()).thenReturn(Scope.DISTRIBUTED_ACK);
+
+    ClientProtocol.Response response =
+        (ClientProtocol.Response) operationHandler.process(serializationServiceStub, createRequestMessage(
+            MessageUtil.makeGetRegionRequest(TEST_REGION1)), cacheStub);
+    BasicTypes.Region region = response.getGetRegionResponse().getRegion();
+    Assert.assertEquals(TEST_REGION1, region.getName());
+    Assert.assertEquals(String.class.toString(), region.getKeyConstraint());
+    Assert.assertEquals(Scope.DISTRIBUTED_ACK.toString(), region.getScope());
+    Assert.assertEquals(DataPolicy.PERSISTENT_REPLICATE.toString(), region.getType());
+    Assert.assertEquals(Integer.class.toString(), region.getValueConstraint());
+    Assert.assertEquals(true, region.getPersisted());
+    Assert.assertEquals(10, region.getSize());
+  }
+
+  private ClientProtocol.Request createRequestMessage(RegionAPI.GetRegionRequest getRegionRequest) {
+    return ClientProtocol.Request.newBuilder().setGetRegionRequest(getRegionRequest).build();
+  }
+
+  @Test
+  public void processReturnsNoCacheRegions() throws CodecAlreadyRegisteredForTypeException,
+      UnsupportedEncodingTypeException, CodecNotRegisteredForTypeException {
+    Cache emptyCache = mock(Cache.class);
+    when(emptyCache.rootRegions())
+        .thenReturn(Collections.unmodifiableSet(new HashSet<Region<String, String>>()));
+    String unknownRegionName = "UNKNOWN_REGION";
+    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler.process(serializationServiceStub,
+        createRequestMessage(MessageUtil.makeGetRegionRequest(unknownRegionName)), emptyCache);
+
+    Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.ERRORRESPONSE.getNumber(),
+        response.getResponseAPICase().getNumber());
+    Assert.assertEquals("No region exists for name: " + unknownRegionName,response.getErrorResponse().getMessage());
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandlerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandlerJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandlerJUnitTest.java
index 2f2e47e..a3d9d91 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandlerJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandlerJUnitTest.java
@@ -14,6 +14,9 @@
  */
 package org.apache.geode.protocol.protobuf.operations;
 
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.Region;
 import org.apache.geode.protocol.protobuf.BasicTypes;
@@ -34,25 +37,20 @@ import org.junit.experimental.categories.Category;
 
 import java.nio.charset.Charset;
 
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 @Category(UnitTest.class)
-public class GetRequestOperationHandlerJUnitTest {
-  public static final String TEST_KEY = "my key";
-  public static final String TEST_VALUE = "my value";
-  public static final String TEST_REGION = "test region";
-  public static final String MISSING_REGION = "missing region";
-  public static final String MISSING_KEY = "missing key";
-  public static final String NULLED_KEY = "nulled key";
-  public Cache cacheStub;
-  public SerializationService serializationServiceStub;
-  private GetRequestOperationHandler operationHandler;
+public class GetRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTest {
+  private final String TEST_KEY = "my key";
+  private final String TEST_VALUE = "my value";
+  private final String TEST_REGION = "test region";
+  private final String MISSING_REGION = "missing region";
+  private final String MISSING_KEY = "missing key";
+  private final String NULLED_KEY = "nulled key";
   private StringCodec stringDecoder;
 
   @Before
   public void setUp() throws Exception {
-    serializationServiceStub = mock(SerializationService.class);
+    super.setUp();
+
     when(serializationServiceStub.decode(BasicTypes.EncodingType.STRING,
         TEST_KEY.getBytes(Charset.forName("UTF-8")))).thenReturn(TEST_KEY);
     when(serializationServiceStub.encode(BasicTypes.EncodingType.STRING, TEST_VALUE))
@@ -75,7 +73,6 @@ public class GetRequestOperationHandlerJUnitTest {
     when(regionStub.containsKey(MISSING_KEY)).thenReturn(false);
     when(regionStub.containsKey(NULLED_KEY)).thenReturn(true);
 
-    cacheStub = mock(Cache.class);
     when(cacheStub.getRegion(TEST_REGION)).thenReturn(regionStub);
     when(cacheStub.getRegion(MISSING_REGION)).thenReturn(null);
     operationHandler = new GetRequestOperationHandler();
@@ -88,7 +85,8 @@ public class GetRequestOperationHandlerJUnitTest {
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request getRequest = generateTestRequest(false, false, false);
     ClientProtocol.Response response =
-        operationHandler.process(serializationServiceStub, getRequest, cacheStub);
+        (ClientProtocol.Response) operationHandler
+            .process(serializationServiceStub, getRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.GETRESPONSE,
         response.getResponseAPICase());
@@ -104,7 +102,8 @@ public class GetRequestOperationHandlerJUnitTest {
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request getRequest = generateTestRequest(true, false, false);
     ClientProtocol.Response response =
-        operationHandler.process(serializationServiceStub, getRequest, cacheStub);
+        (ClientProtocol.Response) operationHandler
+            .process(serializationServiceStub, getRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.ERRORRESPONSE,
         response.getResponseAPICase());
@@ -116,7 +115,7 @@ public class GetRequestOperationHandlerJUnitTest {
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request getRequest = generateTestRequest(false, true, false);
     ClientProtocol.Response response =
-        operationHandler.process(serializationServiceStub, getRequest, cacheStub);
+        (ClientProtocol.Response) operationHandler.process(serializationServiceStub, getRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.GETRESPONSE,
         response.getResponseAPICase());
@@ -130,7 +129,8 @@ public class GetRequestOperationHandlerJUnitTest {
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request getRequest = generateTestRequest(false, false, true);
     ClientProtocol.Response response =
-        operationHandler.process(serializationServiceStub, getRequest, cacheStub);
+        (ClientProtocol.Response) operationHandler
+            .process(serializationServiceStub, getRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.GETRESPONSE,
         response.getResponseAPICase());
@@ -149,7 +149,8 @@ public class GetRequestOperationHandlerJUnitTest {
 
     ClientProtocol.Request getRequest = generateTestRequest(false, false, false);
     ClientProtocol.Response response =
-        operationHandler.process(serializationServiceStub, getRequest, cacheStub);
+        (ClientProtocol.Response) operationHandler
+            .process(serializationServiceStub, getRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.ERRORRESPONSE,
         response.getResponseAPICase());

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/OperationHandlerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/OperationHandlerJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/OperationHandlerJUnitTest.java
new file mode 100644
index 0000000..2ff2d13
--- /dev/null
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/OperationHandlerJUnitTest.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.protocol.protobuf.operations;
+
+import static org.mockito.Mockito.mock;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.protocol.operations.OperationHandler;
+import org.apache.geode.serialization.SerializationService;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Before;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class OperationHandlerJUnitTest {
+  protected Cache cacheStub;
+  protected SerializationService serializationServiceStub;
+  protected OperationHandler operationHandler;
+
+  @Before
+  public void setUp() throws Exception {
+    cacheStub = mock(Cache.class);
+    serializationServiceStub = mock(SerializationService.class);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandlerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandlerJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandlerJUnitTest.java
index 1b9648e..bd56af6 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandlerJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandlerJUnitTest.java
@@ -14,6 +14,14 @@
  */
 package org.apache.geode.protocol.protobuf.operations;
 
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.argThat;
+import static org.mockito.Mockito.doThrow;
+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.Region;
 import org.apache.geode.protocol.protobuf.BasicTypes;
@@ -26,9 +34,11 @@ import org.apache.geode.serialization.registry.exception.CodecAlreadyRegisteredF
 import org.apache.geode.serialization.registry.exception.CodecNotRegisteredForTypeException;
 import org.apache.geode.test.dunit.Assert;
 import org.apache.geode.test.junit.categories.UnitTest;
+import org.hamcrest.CoreMatchers;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.mockito.ArgumentMatcher;
 
 import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
@@ -37,27 +47,21 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
-import static org.mockito.Mockito.*;
-import org.hamcrest.CoreMatchers;
-import org.mockito.ArgumentMatcher;
-
 @Category(UnitTest.class)
-public class PutAllRequestOperationHandlerJUnitTest {
-  private static final String TEST_KEY1 = "my key1";
-  private static final String TEST_KEY2 = "my key2";
-  private static final String TEST_KEY3 = "my key3";
-  private static final String TEST_INVALID_KEY = "invalid key";
-  private static final String TEST_VALUE1 = "my value1";
-  private static final String TEST_VALUE2 = "my value2";
-  private static final String TEST_VALUE3 = "my value3";
-  private static final Integer TEST_INVALID_VALUE = 732;
-  private static final String TEST_REGION = "test region";
-  private static final String EXCEPTION_TEXT = "Simulating put failure";
-  private Cache cacheStub;
-  private SerializationService serializationServiceStub;
+public class PutAllRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTest {
+  private final String TEST_KEY1 = "my key1";
+  private final String TEST_KEY2 = "my key2";
+  private final String TEST_KEY3 = "my key3";
+  private final String TEST_INVALID_KEY = "invalid key";
+  private final String TEST_VALUE1 = "my value1";
+  private final String TEST_VALUE2 = "my value2";
+  private final String TEST_VALUE3 = "my value3";
+  private final Integer TEST_INVALID_VALUE = 732;
+  private final String TEST_REGION = "test region";
+  private final String EXCEPTION_TEXT = "Simulating put failure";
   private Region regionMock;
 
-  class isAMapContainingInvalidKey implements ArgumentMatcher<Map> {
+  private class MapContainingInvalidKeyMatcher implements ArgumentMatcher<Map> {
     @Override
     public boolean matches(Map argument) {
       return argument.containsKey(TEST_INVALID_KEY);
@@ -66,7 +70,8 @@ public class PutAllRequestOperationHandlerJUnitTest {
 
   @Before
   public void setUp() throws Exception {
-    serializationServiceStub = mock(SerializationService.class);
+    super.setUp();
+
     addStringStubEncoding(serializationServiceStub, TEST_KEY1);
     addStringStubEncoding(serializationServiceStub, TEST_KEY2);
     addStringStubEncoding(serializationServiceStub, TEST_KEY3);
@@ -78,14 +83,13 @@ public class PutAllRequestOperationHandlerJUnitTest {
         .thenReturn(ByteBuffer.allocate(Integer.BYTES).putInt(TEST_INVALID_VALUE).array());
     when(serializationServiceStub.decode(BasicTypes.EncodingType.INT,
         ByteBuffer.allocate(Integer.BYTES).putInt(TEST_INVALID_VALUE).array()))
-            .thenReturn(TEST_INVALID_VALUE);
+        .thenReturn(TEST_INVALID_VALUE);
 
     regionMock = mock(Region.class);
 
     doThrow(new ClassCastException(EXCEPTION_TEXT)).when(regionMock)
-        .putAll(argThat(new isAMapContainingInvalidKey()));
+        .putAll(argThat(new MapContainingInvalidKeyMatcher()));
 
-    cacheStub = mock(Cache.class);
     when(cacheStub.getRegion(TEST_REGION)).thenReturn(regionMock);
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/PutRequestOperationHandlerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/PutRequestOperationHandlerJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/PutRequestOperationHandlerJUnitTest.java
index 10108ef..a861854 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/PutRequestOperationHandlerJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/PutRequestOperationHandlerJUnitTest.java
@@ -35,17 +35,16 @@ import java.nio.charset.Charset;
 import static org.mockito.Mockito.*;
 
 @Category(UnitTest.class)
-public class PutRequestOperationHandlerJUnitTest {
-  public static final String TEST_KEY = "my key";
-  public static final String TEST_VALUE = "99";
-  public static final String TEST_REGION = "test region";
-  public Cache cacheStub;
-  public SerializationService serializationServiceStub;
+public class PutRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTest {
+  private final String TEST_KEY = "my key";
+  private final String TEST_VALUE = "99";
+  private final String TEST_REGION = "test region";
   private Region regionMock;
 
   @Before
   public void setUp() throws Exception {
-    serializationServiceStub = mock(SerializationService.class);
+    super.setUp();
+
     when(serializationServiceStub.decode(BasicTypes.EncodingType.STRING,
         TEST_KEY.getBytes(Charset.forName("UTF-8")))).thenReturn(TEST_KEY);
     when(serializationServiceStub.decode(BasicTypes.EncodingType.STRING,
@@ -58,7 +57,6 @@ public class PutRequestOperationHandlerJUnitTest {
     regionMock = mock(Region.class);
     when(regionMock.put(TEST_KEY, TEST_VALUE)).thenReturn(1);
 
-    cacheStub = mock(Cache.class);
     when(cacheStub.getRegion(TEST_REGION)).thenReturn(regionMock);
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/527fc76b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandlerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandlerJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandlerJUnitTest.java
index c66d2f2..5c5c6dd 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandlerJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandlerJUnitTest.java
@@ -14,6 +14,10 @@
  */
 package org.apache.geode.protocol.protobuf.operations;
 
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.Region;
 import org.apache.geode.protocol.protobuf.BasicTypes;
@@ -34,26 +38,19 @@ import org.junit.experimental.categories.Category;
 
 import java.nio.charset.Charset;
 
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
 @Category(UnitTest.class)
-public class RemoveRequestOperationHandlerJUnitTest {
-  public static final String TEST_KEY = "my key";
-  public static final String TEST_VALUE = "my value";
-  public static final String TEST_REGION = "test region";
-  public static final String MISSING_REGION = "missing region";
-  public static final String MISSING_KEY = "missing key";
-  public Cache cacheStub;
-  public SerializationService serializationServiceStub;
-  private RemoveRequestOperationHandler operationHandler;
+public class RemoveRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTest {
+  private final String TEST_KEY = "my key";
+  private final String TEST_VALUE = "my value";
+  private final String TEST_REGION = "test region";
+  private final String MISSING_REGION = "missing region";
+  private final String MISSING_KEY = "missing key";
   private StringCodec stringDecoder;
   private Region regionStub;
 
   @Before
   public void setUp() throws Exception {
-    serializationServiceStub = mock(SerializationService.class);
+    super.setUp();
     when(serializationServiceStub.decode(BasicTypes.EncodingType.STRING,
         TEST_KEY.getBytes(Charset.forName("UTF-8")))).thenReturn(TEST_KEY);
     when(serializationServiceStub.encode(BasicTypes.EncodingType.STRING, TEST_VALUE))
@@ -68,7 +65,6 @@ public class RemoveRequestOperationHandlerJUnitTest {
     when(regionStub.containsKey(TEST_KEY)).thenReturn(true);
     when(regionStub.containsKey(MISSING_KEY)).thenReturn(false);
 
-    cacheStub = mock(Cache.class);
     when(cacheStub.getRegion(TEST_REGION)).thenReturn(regionStub);
     when(cacheStub.getRegion(MISSING_REGION)).thenReturn(null);
     operationHandler = new RemoveRequestOperationHandler();
@@ -81,7 +77,8 @@ public class RemoveRequestOperationHandlerJUnitTest {
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request removeRequest = generateTestRequest(false, false);
     ClientProtocol.Response response =
-        operationHandler.process(serializationServiceStub, removeRequest, cacheStub);
+        (ClientProtocol.Response) operationHandler
+            .process(serializationServiceStub, removeRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.REMOVERESPONSE,
         response.getResponseAPICase());
@@ -95,7 +92,8 @@ public class RemoveRequestOperationHandlerJUnitTest {
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request removeRequest = generateTestRequest(true, false);
     ClientProtocol.Response response =
-        operationHandler.process(serializationServiceStub, removeRequest, cacheStub);
+        (ClientProtocol.Response) operationHandler
+            .process(serializationServiceStub, removeRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.ERRORRESPONSE,
         response.getResponseAPICase());
@@ -107,7 +105,8 @@ public class RemoveRequestOperationHandlerJUnitTest {
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request removeRequest = generateTestRequest(false, true);
     ClientProtocol.Response response =
-        operationHandler.process(serializationServiceStub, removeRequest, cacheStub);
+        (ClientProtocol.Response) operationHandler
+            .process(serializationServiceStub, removeRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.REMOVERESPONSE,
         response.getResponseAPICase());
@@ -125,7 +124,7 @@ public class RemoveRequestOperationHandlerJUnitTest {
 
     ClientProtocol.Request removeRequest = generateTestRequest(false, false);
     ClientProtocol.Response response =
-        operationHandler.process(serializationServiceStub, removeRequest, cacheStub);
+        (ClientProtocol.Response) operationHandler.process(serializationServiceStub, removeRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.ERRORRESPONSE,
         response.getResponseAPICase());


[4/4] geode git commit: GEODE-3141: Remove misleading comment. This now closes #630

Posted by ud...@apache.org.
GEODE-3141: Remove misleading comment. This now closes #630


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

Branch: refs/heads/develop
Commit: 78900ebb210762b4285afbd98a0ebddd571ecde7
Parents: 40e70f1
Author: Udo Kohlmeyer <uk...@pivotal.io>
Authored: Mon Jul 17 12:18:54 2017 -0700
Committer: Udo Kohlmeyer <uk...@pivotal.io>
Committed: Tue Jul 18 10:21:21 2017 -0700

----------------------------------------------------------------------
 geode-protobuf/src/main/proto/region_API.proto | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/78900ebb/geode-protobuf/src/main/proto/region_API.proto
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/proto/region_API.proto b/geode-protobuf/src/main/proto/region_API.proto
index 0cf11dc..5d411ba 100644
--- a/geode-protobuf/src/main/proto/region_API.proto
+++ b/geode-protobuf/src/main/proto/region_API.proto
@@ -104,12 +104,10 @@ message GetRegionNamesResponse {
     repeated string regions = 1;
 }
 
-/* does a region exist? */
 message GetRegionRequest {
     string regionName = 1;
 }
 
-/* success will be true if the region exists */
 message GetRegionResponse {
     Region region = 1;
 }


[3/4] geode git commit: GEODE-3141: spotless reformatting

Posted by ud...@apache.org.
GEODE-3141: spotless reformatting


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

Branch: refs/heads/develop
Commit: 40e70f18d3f7233cb7475edc2cc08f423dd9d422
Parents: 66468b1
Author: Udo Kohlmeyer <uk...@pivotal.io>
Authored: Fri Jul 14 13:06:17 2017 -0700
Committer: Udo Kohlmeyer <uk...@pivotal.io>
Committed: Tue Jul 18 10:20:31 2017 -0700

----------------------------------------------------------------------
 .../protobuf/utilities/ProtobufUtilities.java   | 38 ++++++++++++--------
 1 file changed, 23 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/40e70f18/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java
index 02afc88..0f2628c 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java
@@ -31,21 +31,22 @@ import org.apache.geode.serialization.registry.exception.CodecNotRegisteredForTy
  * mainly focused on helper functions which can be used in building BasicTypes for use in other
  * messages or those used to create the top level Message objects.
  *
- * Helper functions specific to creating ClientProtocol.Responses can be found at {@link
- * ProtobufResponseUtilities} Helper functions specific to creating ClientProtocol.Requests can be
- * found at {@link ProtobufRequestUtilities}
+ * Helper functions specific to creating ClientProtocol.Responses can be found at
+ * {@link ProtobufResponseUtilities} Helper functions specific to creating ClientProtocol.Requests
+ * can be found at {@link ProtobufRequestUtilities}
  */
 public abstract class ProtobufUtilities {
   /**
    * Creates a object containing the type and value encoding of a piece of data
+   * 
    * @param serializationService - object which knows how to encode objects for the protobuf
-   * protocol {@link ProtobufSerializationService}
+   *        protocol {@link ProtobufSerializationService}
    * @param unencodedValue - the value object which is to be encoded
    * @return a protobuf EncodedValue object
    * @throws UnsupportedEncodingTypeException - The object passed doesn't have a corresponding
-   * SerializationType
+   *         SerializationType
    * @throws CodecNotRegisteredForTypeException - There isn't a protobuf codec for the
-   * SerializationType of the passed object
+   *         SerializationType of the passed object
    */
   public static BasicTypes.EncodedValue createEncodedValue(
       SerializationService serializationService, Object unencodedValue)
@@ -59,29 +60,31 @@ public abstract class ProtobufUtilities {
 
   /**
    * Creates a protobuf key,value pair from an encoded key and value
+   * 
    * @param key - an EncodedValue containing the key of the entry
    * @param value - an EncodedValue containing the value of the entry
    * @return a protobuf Entry object containing the passed key and value
    */
   public static BasicTypes.Entry createEntry(BasicTypes.EncodedValue key,
-                                             BasicTypes.EncodedValue value) {
+      BasicTypes.EncodedValue value) {
     return BasicTypes.Entry.newBuilder().setKey(key).setValue(value).build();
   }
 
   /**
    * Creates a protobuf key,value pair from unencoded data
+   * 
    * @param serializationService - object which knows how to encode objects for the protobuf
-   * protocol {@link ProtobufSerializationService}
+   *        protocol {@link ProtobufSerializationService}
    * @param unencodedKey - the unencoded key for the entry
    * @param unencodedValue - the unencoded value for the entry
    * @return a protobuf Entry containing the encoded key and value
    * @throws UnsupportedEncodingTypeException - The key or value passed doesn't have a corresponding
-   * SerializationType
+   *         SerializationType
    * @throws CodecNotRegisteredForTypeException - There isn't a protobuf codec for the
-   * SerializationType of the passed key or value
+   *         SerializationType of the passed key or value
    */
   public static BasicTypes.Entry createEntry(SerializationService serializationService,
-                                             Object unencodedKey, Object unencodedValue)
+      Object unencodedKey, Object unencodedValue)
       throws UnsupportedEncodingTypeException, CodecNotRegisteredForTypeException {
     return createEntry(createEncodedValue(serializationService, unencodedKey),
         createEncodedValue(serializationService, unencodedValue));
@@ -89,6 +92,7 @@ public abstract class ProtobufUtilities {
 
   /**
    * This creates a protobuf message containing a ClientProtocol.Response
+   * 
    * @param messageHeader - The header for the message
    * @param response - The response for the message
    * @return a protobuf Message containing the above parameters
@@ -101,6 +105,7 @@ public abstract class ProtobufUtilities {
 
   /**
    * This creates a protobuf message containing a ClientProtocol.Request
+   * 
    * @param messageHeader - The header for the message
    * @param request - The request for the message
    * @return a protobuf Message containing the above parameters
@@ -113,6 +118,7 @@ public abstract class ProtobufUtilities {
 
   /**
    * This builds the MessageHeader for a response which matches an incoming request
+   * 
    * @param request - The request message that we're responding to.
    * @return the MessageHeader the response to the passed request
    */
@@ -123,6 +129,7 @@ public abstract class ProtobufUtilities {
 
   /**
    * This creates a MessageHeader
+   * 
    * @param correlationId - An identifier used to correlate requests and responses
    * @return a MessageHeader containing the above parameters
    */
@@ -132,17 +139,18 @@ public abstract class ProtobufUtilities {
 
   /**
    * This will return the object encoded in a protobuf EncodedValue
+   * 
    * @param serializationService - object which knows how to encode objects for the protobuf
-   * protocol {@link ProtobufSerializationService}
+   *        protocol {@link ProtobufSerializationService}
    * @param encodedValue - The value to be decoded
    * @return the object encoded in the passed encodedValue
    * @throws UnsupportedEncodingTypeException - There isn't a SerializationType matching the
-   * encodedValues type
+   *         encodedValues type
    * @throws CodecNotRegisteredForTypeException - There isn't a protobuf codec for the
-   * SerializationType matching the encodedValues type
+   *         SerializationType matching the encodedValues type
    */
   public static Object decodeValue(SerializationService serializationService,
-                                   BasicTypes.EncodedValue encodedValue)
+      BasicTypes.EncodedValue encodedValue)
       throws UnsupportedEncodingTypeException, CodecNotRegisteredForTypeException {
     BasicTypes.EncodingType encoding = encodedValue.getEncodingType();
     byte[] bytes = encodedValue.getValue().toByteArray();


[2/4] geode git commit: GEODE-3141: Amended due to review feedback. BasicTypes.Region.type renamed to dataPolicy Ran spotless Added assertions to RoundTripCacheConnectionJUnitTest.java Amended ProtobufUtilities.java to not populate key/value constraint f

Posted by ud...@apache.org.
GEODE-3141: Amended due to review feedback.
BasicTypes.Region.type renamed to dataPolicy
Ran spotless
Added assertions to RoundTripCacheConnectionJUnitTest.java
Amended ProtobufUtilities.java to not populate key/value constraint fields
if not set on Geode Region


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

Branch: refs/heads/develop
Commit: 66468b1296e1bca64b88a7286d6fef225de24c74
Parents: 527fc76
Author: Udo Kohlmeyer <uk...@pivotal.io>
Authored: Thu Jul 13 11:29:20 2017 -0700
Committer: Udo Kohlmeyer <uk...@pivotal.io>
Committed: Tue Jul 18 10:20:31 2017 -0700

----------------------------------------------------------------------
 .../GetRegionNamesRequestOperationHandler.java  |  2 +-
 .../GetRegionRequestOperationHandler.java       |  5 +-
 .../operations/GetRequestOperationHandler.java  |  2 +-
 .../operations/PutRequestOperationHandler.java  |  2 +-
 .../RemoveRequestOperationHandler.java          |  2 +-
 .../utilities/ProtobufResponseUtilities.java    |  4 +-
 .../protobuf/utilities/ProtobufUtilities.java   | 27 ++++++----
 geode-protobuf/src/main/proto/basicTypes.proto  |  2 +-
 .../org/apache/geode/protocol/MessageUtil.java  |  6 +--
 .../RoundTripCacheConnectionJUnitTest.java      | 53 ++++++++++++--------
 .../GetAllRequestOperationHandlerJUnitTest.java | 10 ++--
 ...onNamesRequestOperationHandlerJUnitTest.java | 16 +++---
 ...tRegionRequestOperationHandlerJUnitTest.java | 14 +++---
 .../GetRequestOperationHandlerJUnitTest.java    | 24 ++++-----
 .../operations/OperationHandlerJUnitTest.java   | 22 ++++----
 .../PutAllRequestOperationHandlerJUnitTest.java |  2 +-
 .../RemoveRequestOperationHandlerJUnitTest.java | 19 +++----
 17 files changed, 113 insertions(+), 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandler.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandler.java
index b48cb80..8befdd7 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandler.java
@@ -27,7 +27,7 @@ public class GetRegionNamesRequestOperationHandler
     implements OperationHandler<ClientProtocol.Request, ClientProtocol.Response> {
   @Override
   public ClientProtocol.Response process(SerializationService serializationService,
-                                         ClientProtocol.Request request, Cache cache) {
+      ClientProtocol.Request request, Cache cache) {
     Set<Region<?, ?>> regions = cache.rootRegions();
     return ProtobufResponseUtilities.createGetRegionNamesResponse(regions);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandler.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandler.java
index 23645bb..6ac951c 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandler.java
@@ -29,14 +29,15 @@ public class GetRegionRequestOperationHandler
 
   @Override
   public ClientProtocol.Response process(SerializationService serializationService,
-                                         ClientProtocol.Request request, Cache cache) {
+      ClientProtocol.Request request, Cache cache) {
 
     RegionAPI.GetRegionRequest regionRequest = request.getGetRegionRequest();
     String regionName = regionRequest.getRegionName();
 
     Region region = cache.getRegion(regionName);
     if (region == null) {
-      return ProtobufResponseUtilities.createErrorResponse("No region exists for name: "+regionName);
+      return ProtobufResponseUtilities
+          .createErrorResponse("No region exists for name: " + regionName);
     }
 
     BasicTypes.Region protoRegion = ProtobufUtilities.createRegionMessageFromRegion(region);

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandler.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandler.java
index 950baa5..d5bcfb9 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandler.java
@@ -32,7 +32,7 @@ public class GetRequestOperationHandler
 
   @Override
   public ClientProtocol.Response process(SerializationService serializationService,
-                                         ClientProtocol.Request request, Cache cache) {
+      ClientProtocol.Request request, Cache cache) {
     if (request.getRequestAPICase() != ClientProtocol.Request.RequestAPICase.GETREQUEST) {
       return ProtobufResponseUtilities
           .createAndLogErrorResponse("Improperly formatted get request message.", logger, null);

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutRequestOperationHandler.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutRequestOperationHandler.java
index da8f74c..195aa7a 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutRequestOperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutRequestOperationHandler.java
@@ -32,7 +32,7 @@ public class PutRequestOperationHandler
 
   @Override
   public ClientProtocol.Response process(SerializationService serializationService,
-                                         ClientProtocol.Request request, Cache cache) {
+      ClientProtocol.Request request, Cache cache) {
     if (request.getRequestAPICase() != ClientProtocol.Request.RequestAPICase.PUTREQUEST) {
       return ProtobufResponseUtilities
           .createAndLogErrorResponse("Improperly formatted put request message.", logger, null);

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandler.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandler.java
index 16d8374..725a338 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandler.java
@@ -33,7 +33,7 @@ public class RemoveRequestOperationHandler
 
   @Override
   public ClientProtocol.Response process(SerializationService serializationService,
-                                         ClientProtocol.Request request, Cache cache) {
+      ClientProtocol.Request request, Cache cache) {
     if (request.getRequestAPICase() != ClientProtocol.Request.RequestAPICase.REMOVEREQUEST) {
       return ProtobufResponseUtilities
           .createAndLogErrorResponse("Improperly formatted get request message.", logger, null);

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufResponseUtilities.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufResponseUtilities.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufResponseUtilities.java
index 4347977..5e262d0 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufResponseUtilities.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufResponseUtilities.java
@@ -147,6 +147,8 @@ public abstract class ProtobufResponseUtilities {
    * @return A ClientProtocol.Response object indicating a successful getRegionRequest
    */
   public static ClientProtocol.Response createGetRegionResponse(BasicTypes.Region protoRegion) {
-    return ClientProtocol.Response.newBuilder().setGetRegionResponse(RegionAPI.GetRegionResponse.newBuilder().setRegion(protoRegion)).build();
+    return ClientProtocol.Response.newBuilder()
+        .setGetRegionResponse(RegionAPI.GetRegionResponse.newBuilder().setRegion(protoRegion))
+        .build();
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java
index d5b4908..02afc88 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/utilities/ProtobufUtilities.java
@@ -59,7 +59,6 @@ public abstract class ProtobufUtilities {
 
   /**
    * Creates a protobuf key,value pair from an encoded key and value
-   *
    * @param key - an EncodedValue containing the key of the entry
    * @param value - an EncodedValue containing the value of the entry
    * @return a protobuf Entry object containing the passed key and value
@@ -71,19 +70,18 @@ public abstract class ProtobufUtilities {
 
   /**
    * Creates a protobuf key,value pair from unencoded data
-   *
    * @param serializationService - object which knows how to encode objects for the protobuf
-   *        protocol {@link ProtobufSerializationService}
+   * protocol {@link ProtobufSerializationService}
    * @param unencodedKey - the unencoded key for the entry
    * @param unencodedValue - the unencoded value for the entry
    * @return a protobuf Entry containing the encoded key and value
    * @throws UnsupportedEncodingTypeException - The key or value passed doesn't have a corresponding
-   *         SerializationType
+   * SerializationType
    * @throws CodecNotRegisteredForTypeException - There isn't a protobuf codec for the
-   *         SerializationType of the passed key or value
+   * SerializationType of the passed key or value
    */
   public static BasicTypes.Entry createEntry(SerializationService serializationService,
-      Object unencodedKey, Object unencodedValue)
+                                             Object unencodedKey, Object unencodedValue)
       throws UnsupportedEncodingTypeException, CodecNotRegisteredForTypeException {
     return createEntry(createEncodedValue(serializationService, unencodedKey),
         createEncodedValue(serializationService, unencodedValue));
@@ -151,6 +149,11 @@ public abstract class ProtobufUtilities {
     return serializationService.decode(encoding, bytes);
   }
 
+  /**
+   *
+   * @param region
+   * @return a Protobuf BasicTypes.Region message that represents the {@link Region}
+   */
   public static BasicTypes.Region createRegionMessageFromRegion(Region region) {
     RegionAttributes regionAttributes = region.getAttributes();
     BasicTypes.Region.Builder protoRegionBuilder = BasicTypes.Region.newBuilder();
@@ -159,13 +162,15 @@ public abstract class ProtobufUtilities {
     protoRegionBuilder.setSize(region.size());
 
     protoRegionBuilder.setPersisted(regionAttributes.getDataPolicy().withPersistence());
-    protoRegionBuilder.setKeyConstraint(regionAttributes.getKeyConstraint() == null ? ""
-        : regionAttributes.getKeyConstraint().toString());
-    protoRegionBuilder.setValueConstraint(regionAttributes.getValueConstraint() == null ? ""
-        : regionAttributes.getValueConstraint().toString());
+    if (regionAttributes.getKeyConstraint() != null) {
+      protoRegionBuilder.setKeyConstraint(regionAttributes.getKeyConstraint().toString());
+    }
+    if (regionAttributes.getValueConstraint() != null) {
+      protoRegionBuilder.setValueConstraint(regionAttributes.getValueConstraint().toString());
+    }
 
     protoRegionBuilder.setScope(regionAttributes.getScope().toString());
-    protoRegionBuilder.setType(regionAttributes.getDataPolicy().toString());
+    protoRegionBuilder.setDataPolicy(regionAttributes.getDataPolicy().toString());
     return protoRegionBuilder.build();
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/main/proto/basicTypes.proto
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/main/proto/basicTypes.proto b/geode-protobuf/src/main/proto/basicTypes.proto
index 987c2ed..d45d61b 100644
--- a/geode-protobuf/src/main/proto/basicTypes.proto
+++ b/geode-protobuf/src/main/proto/basicTypes.proto
@@ -52,7 +52,7 @@ message CallbackArguments {
 
 message Region {
     string name = 1;
-    string type = 2;
+    string dataPolicy = 2;
     string scope = 3;
     string keyConstraint = 4;
     string valueConstraint = 5;

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/test/java/org/apache/geode/protocol/MessageUtil.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/MessageUtil.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/MessageUtil.java
index 20216ad..b650f3b 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/MessageUtil.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/MessageUtil.java
@@ -29,9 +29,9 @@ public class MessageUtil {
   }
 
   public static ClientProtocol.Message makeGetRegionRequestMessage(String requestRegion,
-                                                                   ClientProtocol.MessageHeader header) {
-    ClientProtocol.Request request =
-        ClientProtocol.Request.newBuilder().setGetRegionRequest(makeGetRegionRequest(requestRegion)).build();
+      ClientProtocol.MessageHeader header) {
+    ClientProtocol.Request request = ClientProtocol.Request.newBuilder()
+        .setGetRegionRequest(makeGetRegionRequest(requestRegion)).build();
     return ClientProtocol.Message.newBuilder().setMessageHeader(header).setRequest(request).build();
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
index b240552..07cde79 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/RoundTripCacheConnectionJUnitTest.java
@@ -17,7 +17,9 @@ package org.apache.geode.protocol;
 
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.DataPolicy;
 import org.apache.geode.cache.RegionFactory;
+import org.apache.geode.cache.Scope;
 import org.apache.geode.cache.server.CacheServer;
 import org.apache.geode.distributed.ConfigurationProperties;
 import org.apache.geode.internal.AvailablePortHelper;
@@ -73,23 +75,23 @@ import static org.junit.Assert.assertFalse;
  */
 @Category(IntegrationTest.class)
 public class RoundTripCacheConnectionJUnitTest {
-  public static final String TEST_KEY = "testKey";
-  public static final String TEST_VALUE = "testValue";
-  public static final String TEST_REGION = "testRegion";
-  public static final int TEST_PUT_CORRELATION_ID = 574;
-  public static final int TEST_GET_CORRELATION_ID = 68451;
-  public static final int TEST_REMOVE_CORRELATION_ID = 51;
-
-  private static final String DEFAULT_STORE = "default.keystore";
-  private static final String SSL_PROTOCOLS = "any";
-  private static final String SSL_CIPHERS = "any";
-
-  public static final String TEST_MULTIOP_KEY1 = "multiopKey1";
-  public static final String TEST_MULTIOP_KEY2 = "multiopKey2";
-  public static final String TEST_MULTIOP_KEY3 = "multiopKey3";
-  public static final String TEST_MULTIOP_VALUE1 = "multiopValue1";
-  public static final String TEST_MULTIOP_VALUE2 = "multiopValue2";
-  public static final String TEST_MULTIOP_VALUE3 = "multiopValue3";
+  private final String TEST_KEY = "testKey";
+  private final String TEST_VALUE = "testValue";
+  private final String TEST_REGION = "testRegion";
+  private final int TEST_PUT_CORRELATION_ID = 574;
+  private final int TEST_GET_CORRELATION_ID = 68451;
+  private final int TEST_REMOVE_CORRELATION_ID = 51;
+
+  private final String DEFAULT_STORE = "default.keystore";
+  private final String SSL_PROTOCOLS = "any";
+  private final String SSL_CIPHERS = "any";
+
+  private final String TEST_MULTIOP_KEY1 = "multiopKey1";
+  private final String TEST_MULTIOP_KEY2 = "multiopKey2";
+  private final String TEST_MULTIOP_KEY3 = "multiopKey3";
+  private final String TEST_MULTIOP_VALUE1 = "multiopValue1";
+  private final String TEST_MULTIOP_VALUE2 = "multiopValue2";
+  private final String TEST_MULTIOP_VALUE3 = "multiopValue3";
 
   private Cache cache;
   private int cacheServerPort;
@@ -289,8 +291,8 @@ public class RoundTripCacheConnectionJUnitTest {
 
 
     ProtobufProtocolSerializer protobufProtocolSerializer = new ProtobufProtocolSerializer();
-    ClientProtocol.Message getRegionMessage =
-        MessageUtil.makeGetRegionRequestMessage(TEST_REGION, ClientProtocol.MessageHeader.newBuilder().build());
+    ClientProtocol.Message getRegionMessage = MessageUtil.makeGetRegionRequestMessage(TEST_REGION,
+        ClientProtocol.MessageHeader.newBuilder().build());
     protobufProtocolSerializer.serialize(getRegionMessage, outputStream);
 
     ClientProtocol.Message message =
@@ -299,8 +301,17 @@ public class RoundTripCacheConnectionJUnitTest {
     ClientProtocol.Response response = message.getResponse();
     assertEquals(ClientProtocol.Response.ResponseAPICase.GETREGIONRESPONSE,
         response.getResponseAPICase());
-    response.getGetRegionResponse();
-    //TODO add some assertions for Region data
+    RegionAPI.GetRegionResponse getRegionResponse = response.getGetRegionResponse();
+    BasicTypes.Region region = getRegionResponse.getRegion();
+
+    assertEquals(TEST_REGION, region.getName());
+    assertEquals(0, region.getSize());
+    assertEquals(false, region.getPersisted());
+    assertEquals(DataPolicy.NORMAL.toString(), region.getDataPolicy());
+    assertEquals("", region.getKeyConstraint());
+    assertEquals("", region.getValueConstraint());
+    assertEquals(Scope.DISTRIBUTED_NO_ACK, Scope.fromString(region.getScope()));
+
   }
 
   private void validatePutResponse(Socket socket,

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandlerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandlerJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandlerJUnitTest.java
index c745ffc..e1c5972 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandlerJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandlerJUnitTest.java
@@ -39,7 +39,7 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 @Category(UnitTest.class)
-public class GetAllRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTest{
+public class GetAllRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTest {
   private static final String TEST_KEY1 = "my key1";
   private static final String TEST_VALUE1 = "my value1";
   private static final String TEST_KEY2 = "my key2";
@@ -96,8 +96,8 @@ public class GetAllRequestOperationHandlerJUnitTest extends OperationHandlerJUni
       throws CodecAlreadyRegisteredForTypeException, UnsupportedEncodingTypeException,
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request getRequest = generateTestRequest(true);
-    ClientProtocol.Response response =
-        (ClientProtocol.Response) operationHandler.process(serializationServiceStub, getRequest, cacheStub);
+    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler
+        .process(serializationServiceStub, getRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.GETALLRESPONSE,
         response.getResponseAPICase());
@@ -116,8 +116,8 @@ public class GetAllRequestOperationHandlerJUnitTest extends OperationHandlerJUni
   public void processReturnsNoEntriesForNoKeysRequested()
       throws UnsupportedEncodingTypeException, CodecNotRegisteredForTypeException {
     ClientProtocol.Request getRequest = generateTestRequest(false);
-    ClientProtocol.Response response =
-        (ClientProtocol.Response) operationHandler.process(serializationServiceStub, getRequest, cacheStub);
+    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler
+        .process(serializationServiceStub, getRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.GETALLRESPONSE,
         response.getResponseAPICase());

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandlerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandlerJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandlerJUnitTest.java
index 9798522..2d9cc72 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandlerJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionNamesRequestOperationHandlerJUnitTest.java
@@ -39,7 +39,7 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 @Category(UnitTest.class)
-public class GetRegionNamesRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTest{
+public class GetRegionNamesRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTest {
   private final String TEST_REGION1 = "test region 1";
   private final String TEST_REGION2 = "test region 2";
   private final String TEST_REGION3 = "test region 3";
@@ -62,16 +62,17 @@ public class GetRegionNamesRequestOperationHandlerJUnitTest extends OperationHan
     Region<String, String> region3Stub = mock(Region.class);
     when(region3Stub.getName()).thenReturn(TEST_REGION3);
 
-    when(cacheStub.rootRegions()).thenReturn(Collections.unmodifiableSet(
-        new HashSet<>(Arrays.asList(region1Stub, region2Stub, region3Stub))));
+    when(cacheStub.rootRegions()).thenReturn(Collections
+        .unmodifiableSet(new HashSet<>(Arrays.asList(region1Stub, region2Stub, region3Stub))));
     operationHandler = new GetRegionNamesRequestOperationHandler();
   }
 
   @Test
   public void processReturnsCacheRegions() throws CodecAlreadyRegisteredForTypeException,
       UnsupportedEncodingTypeException, CodecNotRegisteredForTypeException {
-    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler.process(serializationServiceStub,
-        ProtobufRequestUtilities.createGetRegionNamesRequest(), cacheStub);
+    ClientProtocol.Response response =
+        (ClientProtocol.Response) operationHandler.process(serializationServiceStub,
+            ProtobufRequestUtilities.createGetRegionNamesRequest(), cacheStub);
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.GETREGIONNAMESRESPONSE,
         response.getResponseAPICase());
 
@@ -95,8 +96,9 @@ public class GetRegionNamesRequestOperationHandlerJUnitTest extends OperationHan
     Cache emptyCache = mock(Cache.class);;
     when(emptyCache.rootRegions())
         .thenReturn(Collections.unmodifiableSet(new HashSet<Region<String, String>>()));
-    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler.process(serializationServiceStub,
-        ProtobufRequestUtilities.createGetRegionNamesRequest(), emptyCache);
+    ClientProtocol.Response response =
+        (ClientProtocol.Response) operationHandler.process(serializationServiceStub,
+            ProtobufRequestUtilities.createGetRegionNamesRequest(), emptyCache);
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.GETREGIONNAMESRESPONSE,
         response.getResponseAPICase());
 

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandlerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandlerJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandlerJUnitTest.java
index ec9d50b..24e1215 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandlerJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRegionRequestOperationHandlerJUnitTest.java
@@ -73,13 +73,13 @@ public class GetRegionRequestOperationHandlerJUnitTest extends OperationHandlerJ
     when(regionAttributesStub.getScope()).thenReturn(Scope.DISTRIBUTED_ACK);
 
     ClientProtocol.Response response =
-        (ClientProtocol.Response) operationHandler.process(serializationServiceStub, createRequestMessage(
-            MessageUtil.makeGetRegionRequest(TEST_REGION1)), cacheStub);
+        (ClientProtocol.Response) operationHandler.process(serializationServiceStub,
+            createRequestMessage(MessageUtil.makeGetRegionRequest(TEST_REGION1)), cacheStub);
     BasicTypes.Region region = response.getGetRegionResponse().getRegion();
     Assert.assertEquals(TEST_REGION1, region.getName());
     Assert.assertEquals(String.class.toString(), region.getKeyConstraint());
     Assert.assertEquals(Scope.DISTRIBUTED_ACK.toString(), region.getScope());
-    Assert.assertEquals(DataPolicy.PERSISTENT_REPLICATE.toString(), region.getType());
+    Assert.assertEquals(DataPolicy.PERSISTENT_REPLICATE.toString(), region.getDataPolicy());
     Assert.assertEquals(Integer.class.toString(), region.getValueConstraint());
     Assert.assertEquals(true, region.getPersisted());
     Assert.assertEquals(10, region.getSize());
@@ -96,11 +96,13 @@ public class GetRegionRequestOperationHandlerJUnitTest extends OperationHandlerJ
     when(emptyCache.rootRegions())
         .thenReturn(Collections.unmodifiableSet(new HashSet<Region<String, String>>()));
     String unknownRegionName = "UNKNOWN_REGION";
-    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler.process(serializationServiceStub,
-        createRequestMessage(MessageUtil.makeGetRegionRequest(unknownRegionName)), emptyCache);
+    ClientProtocol.Response response =
+        (ClientProtocol.Response) operationHandler.process(serializationServiceStub,
+            createRequestMessage(MessageUtil.makeGetRegionRequest(unknownRegionName)), emptyCache);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.ERRORRESPONSE.getNumber(),
         response.getResponseAPICase().getNumber());
-    Assert.assertEquals("No region exists for name: " + unknownRegionName,response.getErrorResponse().getMessage());
+    Assert.assertEquals("No region exists for name: " + unknownRegionName,
+        response.getErrorResponse().getMessage());
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandlerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandlerJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandlerJUnitTest.java
index a3d9d91..2d3fbb6 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandlerJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetRequestOperationHandlerJUnitTest.java
@@ -84,9 +84,8 @@ public class GetRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTe
       throws CodecAlreadyRegisteredForTypeException, UnsupportedEncodingTypeException,
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request getRequest = generateTestRequest(false, false, false);
-    ClientProtocol.Response response =
-        (ClientProtocol.Response) operationHandler
-            .process(serializationServiceStub, getRequest, cacheStub);
+    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler
+        .process(serializationServiceStub, getRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.GETRESPONSE,
         response.getResponseAPICase());
@@ -101,9 +100,8 @@ public class GetRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTe
       throws CodecAlreadyRegisteredForTypeException, UnsupportedEncodingTypeException,
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request getRequest = generateTestRequest(true, false, false);
-    ClientProtocol.Response response =
-        (ClientProtocol.Response) operationHandler
-            .process(serializationServiceStub, getRequest, cacheStub);
+    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler
+        .process(serializationServiceStub, getRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.ERRORRESPONSE,
         response.getResponseAPICase());
@@ -114,8 +112,8 @@ public class GetRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTe
       throws CodecAlreadyRegisteredForTypeException, UnsupportedEncodingTypeException,
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request getRequest = generateTestRequest(false, true, false);
-    ClientProtocol.Response response =
-        (ClientProtocol.Response) operationHandler.process(serializationServiceStub, getRequest, cacheStub);
+    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler
+        .process(serializationServiceStub, getRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.GETRESPONSE,
         response.getResponseAPICase());
@@ -128,9 +126,8 @@ public class GetRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTe
       throws CodecAlreadyRegisteredForTypeException, UnsupportedEncodingTypeException,
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request getRequest = generateTestRequest(false, false, true);
-    ClientProtocol.Response response =
-        (ClientProtocol.Response) operationHandler
-            .process(serializationServiceStub, getRequest, cacheStub);
+    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler
+        .process(serializationServiceStub, getRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.GETRESPONSE,
         response.getResponseAPICase());
@@ -148,9 +145,8 @@ public class GetRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTe
         TEST_KEY.getBytes(Charset.forName("UTF-8")))).thenThrow(exception);
 
     ClientProtocol.Request getRequest = generateTestRequest(false, false, false);
-    ClientProtocol.Response response =
-        (ClientProtocol.Response) operationHandler
-            .process(serializationServiceStub, getRequest, cacheStub);
+    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler
+        .process(serializationServiceStub, getRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.ERRORRESPONSE,
         response.getResponseAPICase());

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/OperationHandlerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/OperationHandlerJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/OperationHandlerJUnitTest.java
index 2ff2d13..c739db9 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/OperationHandlerJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/OperationHandlerJUnitTest.java
@@ -1,18 +1,16 @@
 /*
- * 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
+ * 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
+ * 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.
+ * 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.protocol.protobuf.operations;
 

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandlerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandlerJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandlerJUnitTest.java
index bd56af6..ac13bdc 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandlerJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandlerJUnitTest.java
@@ -83,7 +83,7 @@ public class PutAllRequestOperationHandlerJUnitTest extends OperationHandlerJUni
         .thenReturn(ByteBuffer.allocate(Integer.BYTES).putInt(TEST_INVALID_VALUE).array());
     when(serializationServiceStub.decode(BasicTypes.EncodingType.INT,
         ByteBuffer.allocate(Integer.BYTES).putInt(TEST_INVALID_VALUE).array()))
-        .thenReturn(TEST_INVALID_VALUE);
+            .thenReturn(TEST_INVALID_VALUE);
 
     regionMock = mock(Region.class);
 

http://git-wip-us.apache.org/repos/asf/geode/blob/66468b12/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandlerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandlerJUnitTest.java b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandlerJUnitTest.java
index 5c5c6dd..47f9bad 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandlerJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/RemoveRequestOperationHandlerJUnitTest.java
@@ -76,9 +76,8 @@ public class RemoveRequestOperationHandlerJUnitTest extends OperationHandlerJUni
       throws CodecAlreadyRegisteredForTypeException, UnsupportedEncodingTypeException,
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request removeRequest = generateTestRequest(false, false);
-    ClientProtocol.Response response =
-        (ClientProtocol.Response) operationHandler
-            .process(serializationServiceStub, removeRequest, cacheStub);
+    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler
+        .process(serializationServiceStub, removeRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.REMOVERESPONSE,
         response.getResponseAPICase());
@@ -91,9 +90,8 @@ public class RemoveRequestOperationHandlerJUnitTest extends OperationHandlerJUni
       throws CodecAlreadyRegisteredForTypeException, UnsupportedEncodingTypeException,
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request removeRequest = generateTestRequest(true, false);
-    ClientProtocol.Response response =
-        (ClientProtocol.Response) operationHandler
-            .process(serializationServiceStub, removeRequest, cacheStub);
+    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler
+        .process(serializationServiceStub, removeRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.ERRORRESPONSE,
         response.getResponseAPICase());
@@ -104,9 +102,8 @@ public class RemoveRequestOperationHandlerJUnitTest extends OperationHandlerJUni
       throws CodecAlreadyRegisteredForTypeException, UnsupportedEncodingTypeException,
       CodecNotRegisteredForTypeException {
     ClientProtocol.Request removeRequest = generateTestRequest(false, true);
-    ClientProtocol.Response response =
-        (ClientProtocol.Response) operationHandler
-            .process(serializationServiceStub, removeRequest, cacheStub);
+    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler
+        .process(serializationServiceStub, removeRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.REMOVERESPONSE,
         response.getResponseAPICase());
@@ -123,8 +120,8 @@ public class RemoveRequestOperationHandlerJUnitTest extends OperationHandlerJUni
         TEST_KEY.getBytes(Charset.forName("UTF-8")))).thenThrow(exception);
 
     ClientProtocol.Request removeRequest = generateTestRequest(false, false);
-    ClientProtocol.Response response =
-        (ClientProtocol.Response) operationHandler.process(serializationServiceStub, removeRequest, cacheStub);
+    ClientProtocol.Response response = (ClientProtocol.Response) operationHandler
+        .process(serializationServiceStub, removeRequest, cacheStub);
 
     Assert.assertEquals(ClientProtocol.Response.ResponseAPICase.ERRORRESPONSE,
         response.getResponseAPICase());