You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by go...@apache.org on 2017/09/05 19:37:18 UTC
[geode] 01/01: Merge branch 'feature/GEODE-3385' into develop
This is an automated email from the ASF dual-hosted git repository.
gosullivan pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
commit 813e4b81edc44dd82b587d455deb0c423e62b851
Merge: 6575b31 501bd79
Author: Galen O'Sullivan <go...@pivotal.io>
AuthorDate: Tue Sep 5 10:30:32 2017 -0700
Merge branch 'feature/GEODE-3385' into develop
This closes #739
Signed-off-by: Hitesh Khamesra <hk...@pivotal.io>
.../apache/geode/protocol/protobuf/Failure.java | 12 +--
.../geode/protocol/protobuf/OperationContext.java | 7 +-
.../geode/protocol/protobuf/ProtocolErrorCode.java | 1 +
.../org/apache/geode/protocol/protobuf/Result.java | 6 +-
.../apache/geode/protocol/protobuf/Success.java | 6 +-
.../operations/GetAllRequestOperationHandler.java | 75 +++++++++-----
.../operations/PutAllRequestOperationHandler.java | 8 +-
.../utilities/ProtobufResponseUtilities.java | 13 +--
.../protobuf/utilities/ProtobufUtilities.java | 9 +-
geode-protobuf/src/main/proto/basicTypes.proto | 6 +-
geode-protobuf/src/main/proto/clientProtocol.proto | 4 +
geode-protobuf/src/main/proto/region_API.proto | 3 +-
.../RoundTripCacheConnectionJUnitTest.java | 2 +-
.../GetAllRequestOperationHandlerJUnitTest.java | 110 +++++++++++++++------
.../PutAllRequestOperationHandlerJUnitTest.java | 2 +-
15 files changed, 175 insertions(+), 89 deletions(-)
diff --cc geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandler.java
index 72f7f20,4f8ca70..446dbcb
--- 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
@@@ -14,19 -14,18 +14,22 @@@
*/
package org.apache.geode.protocol.protobuf.operations;
- import java.util.HashSet;
++import java.util.List;
+import java.util.Map;
- import java.util.Set;
++import java.util.stream.Collectors;
+
import org.apache.geode.annotations.Experimental;
+ import org.apache.geode.cache.CacheLoaderException;
+ import org.apache.geode.cache.PartitionedRegionStorageException;
import org.apache.geode.cache.Region;
+ import org.apache.geode.cache.TimeoutException;
-import org.apache.geode.internal.cache.tier.sockets.InvalidExecutionContextException;
import org.apache.geode.internal.cache.tier.sockets.MessageExecutionContext;
-import org.apache.geode.protocol.operations.OperationHandler;
+import org.apache.geode.internal.exception.InvalidExecutionContextException;
- import org.apache.geode.protocol.operations.OperationHandler;
import org.apache.geode.internal.protocol.protobuf.BasicTypes;
++import org.apache.geode.internal.protocol.protobuf.RegionAPI;
++import org.apache.geode.protocol.operations.OperationHandler;
import org.apache.geode.protocol.protobuf.Failure;
import org.apache.geode.protocol.protobuf.ProtocolErrorCode;
--import org.apache.geode.internal.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;
diff --cc geode-protobuf/src/test/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandlerJUnitTest.java
index b9d1a76,75e5d40..0850f25
--- 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
@@@ -26,9 -31,10 +31,10 @@@ import org.junit.Before
import org.junit.Test;
import org.junit.experimental.categories.Category;
+ import org.apache.geode.cache.CacheLoaderException;
import org.apache.geode.cache.Region;
-import org.apache.geode.internal.cache.tier.sockets.InvalidExecutionContextException;
import org.apache.geode.internal.cache.tier.sockets.MessageExecutionContext;
+import org.apache.geode.internal.exception.InvalidExecutionContextException;
import org.apache.geode.internal.protocol.protobuf.BasicTypes;
import org.apache.geode.internal.protocol.protobuf.RegionAPI;
import org.apache.geode.protocol.protobuf.Result;
@@@ -79,10 -80,11 +80,11 @@@ public class GetAllRequestOperationHand
public void processReturnsExpectedValuesForValidKeys()
throws CodecAlreadyRegisteredForTypeException, UnsupportedEncodingTypeException,
CodecNotRegisteredForTypeException, InvalidExecutionContextException {
- Result<RegionAPI.GetAllResponse> result = operationHandler.process(serializationServiceStub,
- generateTestRequest(true), new MessageExecutionContext(cacheStub, new NoOpAuthorizer()));
+ Result<RegionAPI.GetAllResponse> result =
+ operationHandler.process(serializationServiceStub, generateTestRequest(true, false),
- new MessageExecutionContext(cacheStub, new NoOpStreamAuthorizer()));
++ new MessageExecutionContext(cacheStub, new NoOpAuthorizer()));
- Assert.assertTrue(result instanceof Success);
+ assertTrue(result instanceof Success);
RegionAPI.GetAllResponse response = result.getMessage();
@@@ -99,17 -101,61 +101,61 @@@
@Test
public void processReturnsNoEntriesForNoKeysRequested() throws UnsupportedEncodingTypeException,
CodecNotRegisteredForTypeException, InvalidExecutionContextException {
- Result<RegionAPI.GetAllResponse> result = operationHandler.process(serializationServiceStub,
- generateTestRequest(false), new MessageExecutionContext(cacheStub, new NoOpAuthorizer()));
+ Result<RegionAPI.GetAllResponse> result =
+ operationHandler.process(serializationServiceStub, generateTestRequest(false, false),
- new MessageExecutionContext(cacheStub, new NoOpStreamAuthorizer()));
++ new MessageExecutionContext(cacheStub, new NoOpAuthorizer()));
- Assert.assertTrue(result instanceof Success);
+ assertTrue(result instanceof Success);
List<BasicTypes.Entry> entriesList = result.getMessage().getEntriesList();
Map<String, String> responseEntries = convertEntryListToMap(entriesList);
- Assert.assertEquals(0, responseEntries.size());
+ assertEquals(0, responseEntries.size());
}
- private RegionAPI.GetAllRequest generateTestRequest(boolean addKeys)
+ @Test
+ public void singeNullKey() throws Exception {
+ HashSet<BasicTypes.EncodedValue> testKeys = new HashSet<>();
+ testKeys.add(ProtobufUtilities.createEncodedValue(serializationServiceStub,
+ NO_VALUE_PRESENT_FOR_THIS_KEY));
+ RegionAPI.GetAllRequest getAllRequest =
+ ProtobufRequestUtilities.createGetAllRequest(TEST_REGION, testKeys);
+ Result<RegionAPI.GetAllResponse> result = operationHandler.process(serializationServiceStub,
- getAllRequest, new MessageExecutionContext(cacheStub, new NoOpStreamAuthorizer()));
++ getAllRequest, new MessageExecutionContext(cacheStub, new NoOpAuthorizer()));
+
+ assertTrue(result instanceof Success);
+ RegionAPI.GetAllResponse message = result.getMessage();
+ assertEquals(1, message.getEntriesCount());
+ assertFalse(message.getEntries(0).hasValue());
+ assertEquals(NO_VALUE_PRESENT_FOR_THIS_KEY, message.getEntries(0).getKey().getStringResult());
+
+ verify(regionStub, times(1)).get(NO_VALUE_PRESENT_FOR_THIS_KEY);
+ }
+
+ @Test
+ public void multipleKeysWhereOneThrows() throws UnsupportedEncodingTypeException,
+ CodecNotRegisteredForTypeException, InvalidExecutionContextException {
+ Result<RegionAPI.GetAllResponse> result =
+ operationHandler.process(serializationServiceStub, generateTestRequest(true, true),
- new MessageExecutionContext(cacheStub, new NoOpStreamAuthorizer()));
++ new MessageExecutionContext(cacheStub, new NoOpAuthorizer()));
+
+ assertTrue(result instanceof Success);
+
+ RegionAPI.GetAllResponse response = result.getMessage();
+
+ assertEquals(3, response.getEntriesCount());
+
+ List<BasicTypes.Entry> entriesList = response.getEntriesList();
+ Map<String, String> responseEntries = convertEntryListToMap(entriesList);
+
+ assertEquals(TEST_VALUE1, responseEntries.get(TEST_KEY1));
+ assertEquals(TEST_VALUE2, responseEntries.get(TEST_KEY2));
+ assertEquals(TEST_VALUE3, responseEntries.get(TEST_KEY3));
+
+ assertEquals(1, response.getFailuresCount());
+ assertEquals(TEST_INVALID_KEY, response.getFailures(0).getKey().getStringResult());
+ }
+
+ private RegionAPI.GetAllRequest generateTestRequest(boolean addKeys, boolean useInvalid)
throws UnsupportedEncodingTypeException, CodecNotRegisteredForTypeException {
HashSet<BasicTypes.EncodedValue> testKeys = new HashSet<>();
if (addKeys) {
--
To stop receiving notification emails like this one, please contact
"commits@geode.apache.org" <co...@geode.apache.org>.