case 9: hash = (37 * hash) + STRINGRESULT_FIELD_NUMBER; hash = (53 * hash) + getStringResult().hashCode(); break; case 10:
break; case 9: result = result && getStringResult() .equals(other.getStringResult()); break; case 10:
return (short) encodedValue.getShortResult(); case STRINGRESULT: return encodedValue.getStringResult(); case JSONOBJECTRESULT: return JSONWrapper.wrapJSON(encodedValue.getJsonObjectResult());
return (short) encodedValue.getShortResult(); case STRINGRESULT: return encodedValue.getStringResult(); case JSONOBJECTRESULT: return jsonPdxConverter.decode(encodedValue.getJsonObjectResult());
@Test public void multipleKeysWhereOneThrows() throws Exception { Result result = operationHandler.process(serializationService, generateTestRequest(true, true), TestExecutionContext.getNoAuthCacheExecutionContext(cacheStub)); assertTrue(result instanceof Success); RegionAPI.GetAllResponse response = (RegionAPI.GetAllResponse) 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 Map<String, String> convertEntryListToMap(List<BasicTypes.Entry> entriesList) { Map<String, String> result = new HashMap<>(); for (BasicTypes.Entry entry : entriesList) { BasicTypes.EncodedValue encodedKey = entry.getKey(); assertEquals(BasicTypes.EncodedValue.ValueCase.STRINGRESULT, encodedKey.getValueCase()); String key = encodedKey.getStringResult(); BasicTypes.EncodedValue encodedValue = entry.getValue(); assertEquals(BasicTypes.EncodedValue.ValueCase.STRINGRESULT, encodedValue.getValueCase()); String value = encodedValue.getStringResult(); result.put(key, value); } return result; } }
@Test public void singleNullKey() throws Exception { HashSet<BasicTypes.EncodedValue> testKeys = new HashSet<>(); testKeys.add(serializationService.encode(NO_VALUE_PRESENT_FOR_THIS_KEY)); RegionAPI.GetAllRequest getAllRequest = ProtobufRequestUtilities.createGetAllRequest(TEST_REGION, testKeys); Result result = operationHandler.process(serializationService, getAllRequest, TestExecutionContext.getNoAuthCacheExecutionContext(cacheStub)); assertTrue(result instanceof Success); RegionAPI.GetAllResponse message = (RegionAPI.GetAllResponse) result.getMessage(); assertEquals(1, message.getEntriesCount()); assertEquals(null, serializationService.decode(message.getEntries(0).getValue())); assertEquals(NO_VALUE_PRESENT_FOR_THIS_KEY, message.getEntries(0).getKey().getStringResult()); verify(regionStub, times(1)).get(NO_VALUE_PRESENT_FOR_THIS_KEY); }
public static void validateGetResponse(Socket socket, ProtobufProtocolSerializer protobufProtocolSerializer, Object expectedValue) throws InvalidProtocolMessageException, IOException { ClientProtocol.Message response = protobufProtocolSerializer.deserialize(socket.getInputStream()); assertEquals(ClientProtocol.Message.MessageTypeCase.GETRESPONSE, response.getMessageTypeCase()); RegionAPI.GetResponse getResponse = response.getGetResponse(); BasicTypes.EncodedValue result = getResponse.getResult(); assertEquals(BasicTypes.EncodedValue.ValueCase.STRINGRESULT, result.getValueCase()); assertEquals(expectedValue, result.getStringResult()); } }
@Test public void processReturnsTheEncodedValueFromTheRegion() throws Exception { RegionAPI.GetRequest getRequest = generateTestRequest(false, false, false); Result result = operationHandler.process(serializationService, getRequest, TestExecutionContext.getNoAuthCacheExecutionContext(cacheStub)); Assert.assertTrue(result instanceof Success); RegionAPI.GetResponse response = (RegionAPI.GetResponse) result.getMessage(); Assert.assertEquals(BasicTypes.EncodedValue.ValueCase.STRINGRESULT, response.getResult().getValueCase()); String actualValue = response.getResult().getStringResult(); Assert.assertEquals(TEST_VALUE, actualValue); }