private List<T> parseListResult(final OQLQueryResponse response) { return response.getListResult().getElementList().stream() .map(value -> (T) valueEncoder.decodeValue(value)).collect(Collectors.toList()); }
private void checkResults(final String query, final Object... values) throws InvalidExecutionContextException, ConnectionStateException, EncodingException, DecodingException { ProtobufSerializationService serializer = new ProtobufSerializationService(); final Result<OQLQueryResponse> results = invokeHandler(query, new EncodedValue[] {}, serializer); List<EncodedValue> expected = Arrays.asList(values).stream().map(serializer::encode).collect(Collectors.toList()); assertEquals(expected, results.getMessage().getListResult().getElementList()); }
@Test public void queryForMultipleObjects() throws ConnectionStateException, DecodingException, InvalidExecutionContextException, EncodingException, NameResolutionException, TypeMismatchException, QueryInvocationTargetException, FunctionDomainException { Query query = mock(DefaultQuery.class); when(queryService.newQuery(eq(SELECT_STAR_QUERY))).thenReturn(query); SelectResults results = new ResultsBag(); results.setElementType(new ObjectTypeImpl()); results.add(STRING_RESULT_1); results.add(STRING_RESULT_2); when(query.execute((Object[]) any())).thenReturn(results); final OQLQueryRequest request = OQLQueryRequest.newBuilder().setQuery(SELECT_STAR_QUERY).build(); final Result<OQLQueryResponse> result = operationHandler.process(serializationService, request, TestExecutionContext.getNoAuthCacheExecutionContext(cacheStub)); assertEquals(Arrays.asList(STRING_RESULT_1, STRING_RESULT_2), result.getMessage().getListResult().getElementList().stream() .map(serializationService::decode).collect(Collectors.toList())); }
break; case 2: result = result && getListResult() .equals(other.getListResult()); break; case 3:
@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; }
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; }