private List<Object> parseSingleResult(final OQLQueryResponse response) { return Collections.singletonList(valueEncoder.decodeValue(response.getSingleResult())); } }
@Test public void queryForSingleObject() throws ConnectionStateException, DecodingException, InvalidExecutionContextException, EncodingException, NameResolutionException, TypeMismatchException, QueryInvocationTargetException, FunctionDomainException { Query query = mock(DefaultQuery.class); when(queryService.newQuery(eq(SELECT_STAR_QUERY))).thenReturn(query); when(query.execute((Object[]) any())).thenReturn(STRING_RESULT_1); final OQLQueryRequest request = OQLQueryRequest.newBuilder().setQuery(SELECT_STAR_QUERY).build(); final Result<OQLQueryResponse> result = operationHandler.process(serializationService, request, TestExecutionContext.getNoAuthCacheExecutionContext(cacheStub)); assertEquals(serializationService.encode(STRING_RESULT_1), result.getMessage().getSingleResult()); }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); switch (resultCase_) { case 1: hash = (37 * hash) + SINGLERESULT_FIELD_NUMBER; hash = (53 * hash) + getSingleResult().hashCode(); break; case 2: hash = (37 * hash) + LISTRESULT_FIELD_NUMBER; hash = (53 * hash) + getListResult().hashCode(); break; case 3: hash = (37 * hash) + TABLERESULT_FIELD_NUMBER; hash = (53 * hash) + getTableResult().hashCode(); break; case 0: default: } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
switch (resultCase_) { case 1: result = result && getSingleResult() .equals(other.getSingleResult()); break; case 2:
public Builder mergeFrom(org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.OQLQueryResponse other) { if (other == org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.OQLQueryResponse.getDefaultInstance()) return this; switch (other.getResultCase()) { case SINGLERESULT: { mergeSingleResult(other.getSingleResult()); break; } case LISTRESULT: { mergeListResult(other.getListResult()); break; } case TABLERESULT: { mergeTableResult(other.getTableResult()); break; } case RESULT_NOT_SET: { break; } } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
private void checkResults(final String query, final Object value) throws InvalidExecutionContextException, ConnectionStateException, EncodingException, DecodingException { ProtobufSerializationService serializer = new ProtobufSerializationService(); final Result<OQLQueryResponse> results = invokeHandler(query, new EncodedValue[] {}, serializer); assertEquals(serializer.encode(value), results.getMessage().getSingleResult()); }