GEODE-3386 - Make KeyedErrorResponse & ErrorResponse siblings
Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/bfbe3e56 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/bfbe3e56 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/bfbe3e56 Branch: refs/heads/feature/GEODE-3249 Commit: bfbe3e5649158f45f797efcc389f77de88ddaf5a Parents: d295876 Author: Alexander Murmann <amurm...@pivotal.io> Authored: Wed Aug 9 11:52:17 2017 -0700 Committer: Udo Kohlmeyer <ukohlme...@pivotal.io> Committed: Tue Aug 15 09:03:31 2017 -0700 ---------------------------------------------------------------------- .../GetAllRequestOperationHandler.java | 18 +++++++-------- .../GetAvailableServersOperationHandler.java | 6 ++--- .../GetRegionRequestOperationHandler.java | 8 +++---- .../operations/GetRequestOperationHandler.java | 17 +++++++------- .../PutAllRequestOperationHandler.java | 7 +++--- .../operations/PutRequestOperationHandler.java | 24 ++++++++------------ .../RemoveRequestOperationHandler.java | 5 ++-- .../utilities/ProtobufResponseUtilities.java | 10 ++++++-- geode-protobuf/src/main/proto/basicTypes.proto | 8 +++++-- ...tRegionRequestOperationHandlerJUnitTest.java | 2 +- .../GetRequestOperationHandlerJUnitTest.java | 4 ++-- .../PutRequestOperationHandlerJUnitTest.java | 6 ++--- .../RemoveRequestOperationHandlerJUnitTest.java | 4 ++-- 13 files changed, 62 insertions(+), 57 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode/blob/bfbe3e56/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandler.java ---------------------------------------------------------------------- diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandler.java index 7f2ffe4..607d1d2 100644 --- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandler.java +++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandler.java @@ -28,6 +28,7 @@ import org.apache.geode.protocol.protobuf.ProtocolErrorCode; import org.apache.geode.protocol.protobuf.RegionAPI; import org.apache.geode.protocol.protobuf.Result; import org.apache.geode.protocol.protobuf.Success; +import org.apache.geode.protocol.protobuf.utilities.ProtobufResponseUtilities; import org.apache.geode.protocol.protobuf.utilities.ProtobufUtilities; import org.apache.geode.serialization.SerializationService; import org.apache.geode.serialization.exception.UnsupportedEncodingTypeException; @@ -43,9 +44,8 @@ public class GetAllRequestOperationHandler String regionName = request.getRegionName(); Region region = cache.getRegion(regionName); if (region == null) { - return Failure.of(BasicTypes.ErrorResponse.newBuilder() - .setErrorCode(ProtocolErrorCode.REGION_NOT_FOUND.codeValue).setMessage("Region not found") - .build()); + return Failure.of(ProtobufResponseUtilities + .makeErrorResponse(ProtocolErrorCode.REGION_NOT_FOUND.codeValue, "Region not found")); } try { @@ -61,13 +61,13 @@ public class GetAllRequestOperationHandler } return Success.of(RegionAPI.GetAllResponse.newBuilder().addAllEntries(entries).build()); } catch (UnsupportedEncodingTypeException ex) { - return Failure.of(BasicTypes.ErrorResponse.newBuilder() - .setErrorCode(ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue) - .setMessage("Encoding not supported.").build()); + return Failure.of(ProtobufResponseUtilities.makeErrorResponse( + ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue, "Encoding not supported.")); } catch (CodecNotRegisteredForTypeException ex) { - return Failure.of(BasicTypes.ErrorResponse.newBuilder() - .setErrorCode(ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue) - .setMessage("Codec error in protobuf deserialization.").build()); + return Failure.of(ProtobufResponseUtilities.makeErrorResponse( + ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue, + "Codec error in protobuf deserialization.")); } } + } http://git-wip-us.apache.org/repos/asf/geode/blob/bfbe3e56/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAvailableServersOperationHandler.java ---------------------------------------------------------------------- diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAvailableServersOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAvailableServersOperationHandler.java index e58c8cd..239d9f7 100644 --- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAvailableServersOperationHandler.java +++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAvailableServersOperationHandler.java @@ -40,6 +40,7 @@ import org.apache.geode.protocol.protobuf.ProtocolErrorCode; import org.apache.geode.protocol.protobuf.Result; import org.apache.geode.protocol.protobuf.ServerAPI; import org.apache.geode.protocol.protobuf.Success; +import org.apache.geode.protocol.protobuf.utilities.ProtobufResponseUtilities; import org.apache.geode.serialization.SerializationService; @Experimental @@ -73,9 +74,8 @@ public class GetAvailableServersOperationHandler implements // try the next locator } } - return Failure.of(BasicTypes.ErrorResponse.newBuilder() - .setErrorCode(ProtocolErrorCode.DATA_UNREACHABLE.codeValue) - .setMessage("Unable to find a locator").build()); + return Failure.of(ProtobufResponseUtilities.makeErrorResponse( + ProtocolErrorCode.DATA_UNREACHABLE.codeValue, "Unable to find a locator")); } private Result<ServerAPI.GetAvailableServersResponse> getGetAvailableServersFromLocator( http://git-wip-us.apache.org/repos/asf/geode/blob/bfbe3e56/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 3814bf6..b563a5d 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 @@ -24,6 +24,7 @@ import org.apache.geode.protocol.protobuf.ProtocolErrorCode; import org.apache.geode.protocol.protobuf.RegionAPI; import org.apache.geode.protocol.protobuf.Result; import org.apache.geode.protocol.protobuf.Success; +import org.apache.geode.protocol.protobuf.utilities.ProtobufResponseUtilities; import org.apache.geode.protocol.protobuf.utilities.ProtobufUtilities; import org.apache.geode.serialization.SerializationService; @@ -34,14 +35,13 @@ public class GetRegionRequestOperationHandler @Override public Result<RegionAPI.GetRegionResponse> process(SerializationService serializationService, RegionAPI.GetRegionRequest request, Cache cache) { - String regionName = request.getRegionName(); Region region = cache.getRegion(regionName); if (region == null) { - return Failure.of(BasicTypes.ErrorResponse.newBuilder() - .setErrorCode(ProtocolErrorCode.REGION_NOT_FOUND.codeValue) - .setMessage("No region exists for name: " + regionName).build()); + return Failure.of( + ProtobufResponseUtilities.makeErrorResponse(ProtocolErrorCode.REGION_NOT_FOUND.codeValue, + "No region exists for name: " + regionName)); } BasicTypes.Region protoRegion = ProtobufUtilities.createRegionMessageFromRegion(region); http://git-wip-us.apache.org/repos/asf/geode/blob/bfbe3e56/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 1086bca..96c0282 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 @@ -24,6 +24,7 @@ import org.apache.geode.protocol.protobuf.ProtocolErrorCode; import org.apache.geode.protocol.protobuf.RegionAPI; import org.apache.geode.protocol.protobuf.Result; import org.apache.geode.protocol.protobuf.Success; +import org.apache.geode.protocol.protobuf.utilities.ProtobufResponseUtilities; import org.apache.geode.protocol.protobuf.utilities.ProtobufUtilities; import org.apache.geode.serialization.SerializationService; import org.apache.geode.serialization.exception.UnsupportedEncodingTypeException; @@ -39,9 +40,8 @@ public class GetRequestOperationHandler String regionName = request.getRegionName(); Region region = cache.getRegion(regionName); if (region == null) { - return Failure.of(BasicTypes.ErrorResponse.newBuilder() - .setErrorCode(ProtocolErrorCode.REGION_NOT_FOUND.codeValue).setMessage("Region not found") - .build()); + return Failure.of(ProtobufResponseUtilities + .makeErrorResponse(ProtocolErrorCode.REGION_NOT_FOUND.codeValue, "Region not found")); } try { @@ -56,13 +56,12 @@ public class GetRequestOperationHandler ProtobufUtilities.createEncodedValue(serializationService, resultValue); return Success.of(RegionAPI.GetResponse.newBuilder().setResult(encodedValue).build()); } catch (UnsupportedEncodingTypeException ex) { - return Failure.of(BasicTypes.ErrorResponse.newBuilder() - .setErrorCode(ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue) - .setMessage("Encoding not supported.").build()); + return Failure.of(ProtobufResponseUtilities.makeErrorResponse( + ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue, "Encoding not supported.")); } catch (CodecNotRegisteredForTypeException ex) { - return Failure.of(BasicTypes.ErrorResponse.newBuilder() - .setErrorCode(ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue) - .setMessage("Codec error in protobuf deserialization.").build()); + return Failure.of(ProtobufResponseUtilities.makeErrorResponse( + ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue, + "Codec error in protobuf deserialization.")); } } } http://git-wip-us.apache.org/repos/asf/geode/blob/bfbe3e56/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandler.java ---------------------------------------------------------------------- diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandler.java index 33e3ade..253a95d 100644 --- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandler.java +++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandler.java @@ -82,9 +82,10 @@ public class PutAllRequestOperationHandler private BasicTypes.KeyedErrorResponse buildAndLogKeyedError(BasicTypes.Entry entry, ProtocolErrorCode errorCode, String message, Exception ex) { logger.error(message, ex); - BasicTypes.ErrorResponse errorResponse = BasicTypes.ErrorResponse.newBuilder() - .setErrorCode(errorCode.codeValue).setMessage(message).build(); - return BasicTypes.KeyedErrorResponse.newBuilder().setKey(entry.getKey()).setError(errorResponse) + + return BasicTypes.KeyedErrorResponse.newBuilder().setKey(entry.getKey()) + .setError( + BasicTypes.Error.newBuilder().setErrorCode(errorCode.codeValue).setMessage(message)) .build(); } } http://git-wip-us.apache.org/repos/asf/geode/blob/bfbe3e56/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 637d8f1..c24fb29 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 @@ -24,6 +24,7 @@ import org.apache.geode.protocol.protobuf.ProtocolErrorCode; import org.apache.geode.protocol.protobuf.RegionAPI; import org.apache.geode.protocol.protobuf.Result; import org.apache.geode.protocol.protobuf.Success; +import org.apache.geode.protocol.protobuf.utilities.ProtobufResponseUtilities; import org.apache.geode.protocol.protobuf.utilities.ProtobufUtilities; import org.apache.geode.serialization.SerializationService; import org.apache.geode.serialization.exception.UnsupportedEncodingTypeException; @@ -39,9 +40,9 @@ public class PutRequestOperationHandler String regionName = request.getRegionName(); Region region = cache.getRegion(regionName); if (region == null) { - return Failure.of(BasicTypes.ErrorResponse.newBuilder() - .setErrorCode(ProtocolErrorCode.REGION_NOT_FOUND.codeValue) - .setMessage("Region passed by client did not exist: " + regionName).build()); + return Failure.of( + ProtobufResponseUtilities.makeErrorResponse(ProtocolErrorCode.REGION_NOT_FOUND.codeValue, + "Region passed by client did not exist: " + regionName)); } try { @@ -53,18 +54,13 @@ public class PutRequestOperationHandler region.put(decodedKey, decodedValue); return Success.of(RegionAPI.PutResponse.newBuilder().build()); } catch (ClassCastException ex) { - return Failure.of(BasicTypes.ErrorResponse.newBuilder() - .setErrorCode(ProtocolErrorCode.CONSTRAINT_VIOLATION.codeValue) - .setMessage("invalid key or value type for region " + regionName).build()); + return Failure.of(ProtobufResponseUtilities.makeErrorResponse( + ProtocolErrorCode.CONSTRAINT_VIOLATION.codeValue, + "invalid key or value type for region " + regionName)); } - } catch (UnsupportedEncodingTypeException ex) { - return Failure.of(BasicTypes.ErrorResponse.newBuilder() - .setErrorCode(ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue) - .setMessage(ex.getMessage()).build()); - } catch (CodecNotRegisteredForTypeException ex) { - return Failure.of(BasicTypes.ErrorResponse.newBuilder() - .setErrorCode(ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue) - .setMessage(ex.getMessage()).build()); + } catch (UnsupportedEncodingTypeException | CodecNotRegisteredForTypeException ex) { + return Failure.of(ProtobufResponseUtilities + .makeErrorResponse(ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue, ex.getMessage())); } } } http://git-wip-us.apache.org/repos/asf/geode/blob/bfbe3e56/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 dbc58bf..59236be 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 @@ -45,9 +45,8 @@ public class RemoveRequestOperationHandler String regionName = request.getRegionName(); Region region = cache.getRegion(regionName); if (region == null) { - return Failure.of(BasicTypes.ErrorResponse.newBuilder() - .setErrorCode(ProtocolErrorCode.REGION_NOT_FOUND.codeValue).setMessage("Region not found") - .build()); + return Failure.of(ProtobufResponseUtilities + .makeErrorResponse(ProtocolErrorCode.REGION_NOT_FOUND.codeValue, "Region not found")); } try { http://git-wip-us.apache.org/repos/asf/geode/blob/bfbe3e56/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 7bc766e..cedb11a 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 @@ -24,6 +24,7 @@ import org.apache.geode.protocol.protobuf.BasicTypes; import org.apache.geode.protocol.protobuf.ProtocolErrorCode; import org.apache.geode.protocol.protobuf.RegionAPI; + /** * This class contains helper functions for generating ClientProtocol.Response objects. * <p> @@ -49,8 +50,7 @@ public abstract class ProtobufResponseUtilities { } else { logger.error(errorMessage); } - return BasicTypes.ErrorResponse.newBuilder().setErrorCode(errorCode.codeValue) - .setMessage(errorMessage).build(); + return makeErrorResponse(errorCode.codeValue, errorMessage); } /** @@ -68,4 +68,10 @@ public abstract class ProtobufResponseUtilities { } return builder.build(); } + + public static BasicTypes.ErrorResponse makeErrorResponse(int errorCode, String message) { + return BasicTypes.ErrorResponse.newBuilder() + .setError(BasicTypes.Error.newBuilder().setErrorCode(errorCode).setMessage(message)) + .build(); + } } http://git-wip-us.apache.org/repos/asf/geode/blob/bfbe3e56/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 684e4c8..5f63f6c 100644 --- a/geode-protobuf/src/main/proto/basicTypes.proto +++ b/geode-protobuf/src/main/proto/basicTypes.proto @@ -77,12 +77,16 @@ message Server { int32 port = 2; } -message ErrorResponse { +message Error { int32 errorCode = 1; string message = 2; } +message ErrorResponse { + Error error = 1; +} + message KeyedErrorResponse { EncodedValue key = 1; - ErrorResponse error = 2; + Error error = 2; } http://git-wip-us.apache.org/repos/asf/geode/blob/bfbe3e56/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 a1f67df..5cfa6b3 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 @@ -99,6 +99,6 @@ public class GetRegionRequestOperationHandlerJUnitTest extends OperationHandlerJ MessageUtil.makeGetRegionRequest(unknownRegionName), emptyCache); Assert.assertTrue(result instanceof Failure); Assert.assertEquals(ProtocolErrorCode.REGION_NOT_FOUND.codeValue, - result.getErrorMessage().getErrorCode()); + result.getErrorMessage().getError().getErrorCode()); } } http://git-wip-us.apache.org/repos/asf/geode/blob/bfbe3e56/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 a632532..0213bf7 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 @@ -92,7 +92,7 @@ public class GetRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTe Assert.assertTrue(response instanceof Failure); Assert.assertEquals(ProtocolErrorCode.REGION_NOT_FOUND.codeValue, - response.getErrorMessage().getErrorCode()); + response.getErrorMessage().getError().getErrorCode()); } @Test @@ -137,7 +137,7 @@ public class GetRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTe Assert.assertTrue(response instanceof Failure); Assert.assertEquals(ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue, - response.getErrorMessage().getErrorCode()); + response.getErrorMessage().getError().getErrorCode()); } private RegionAPI.GetRequest generateTestRequest(boolean missingRegion, boolean missingKey, http://git-wip-us.apache.org/repos/asf/geode/blob/bfbe3e56/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 9fdadd8..fc697e4 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 @@ -100,7 +100,7 @@ public class PutRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTe assertTrue(result instanceof Failure); assertEquals(ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue, - result.getErrorMessage().getErrorCode()); + result.getErrorMessage().getError().getErrorCode()); } @Test @@ -113,7 +113,7 @@ public class PutRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTe assertTrue(result instanceof Failure); assertEquals(ProtocolErrorCode.REGION_NOT_FOUND.codeValue, - result.getErrorMessage().getErrorCode()); + result.getErrorMessage().getError().getErrorCode()); } @Test @@ -127,7 +127,7 @@ public class PutRequestOperationHandlerJUnitTest extends OperationHandlerJUnitTe assertTrue(result instanceof Failure); assertEquals(ProtocolErrorCode.CONSTRAINT_VIOLATION.codeValue, - result.getErrorMessage().getErrorCode()); + result.getErrorMessage().getError().getErrorCode()); } private RegionAPI.PutRequest generateTestRequest() http://git-wip-us.apache.org/repos/asf/geode/blob/bfbe3e56/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 797538c..3b917b7 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 @@ -90,7 +90,7 @@ public class RemoveRequestOperationHandlerJUnitTest extends OperationHandlerJUni assertTrue(result instanceof Failure); assertEquals(ProtocolErrorCode.REGION_NOT_FOUND.codeValue, - result.getErrorMessage().getErrorCode()); + result.getErrorMessage().getError().getErrorCode()); } @Test @@ -125,7 +125,7 @@ public class RemoveRequestOperationHandlerJUnitTest extends OperationHandlerJUni assertTrue(result instanceof Failure); assertEquals(ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue, - result.getErrorMessage().getErrorCode()); + result.getErrorMessage().getError().getErrorCode()); } private ClientProtocol.Request generateTestRequest(boolean missingRegion, boolean missingKey)