/** * <code>.org.apache.geode.internal.protocol.protobuf.v1.KeySetRequest keySetRequest = 28;</code> */ public Builder mergeKeySetRequest(org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest value) { if (keySetRequestBuilder_ == null) { if (messageTypeCase_ == 28 && messageType_ != org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest.getDefaultInstance()) { messageType_ = org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest.newBuilder((org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest) messageType_) .mergeFrom(value).buildPartial(); } else { messageType_ = value; } onChanged(); } else { if (messageTypeCase_ == 28) { keySetRequestBuilder_.mergeFrom(value); } keySetRequestBuilder_.setMessage(value); } messageTypeCase_ = 28; return this; } /**
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest)) { return super.equals(obj); } org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest other = (org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest) obj; boolean result = true; result = result && getRegionName() .equals(other.getRegionName()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + REGIONNAME_FIELD_NUMBER; hash = (53 * hash) + getRegionName().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
case 28: hash = (37 * hash) + KEYSETREQUEST_FIELD_NUMBER; hash = (53 * hash) + getKeySetRequest().hashCode(); break; case 29:
case 28: result = result && getKeySetRequest() .equals(other.getKeySetRequest()); break; case 29:
/** * <code>.org.apache.geode.internal.protocol.protobuf.v1.KeySetRequest keySetRequest = 28;</code> */ private com.google.protobuf.SingleFieldBuilderV3< org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest, org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest.Builder, org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequestOrBuilder> getKeySetRequestFieldBuilder() { if (keySetRequestBuilder_ == null) { if (!(messageTypeCase_ == 28)) { messageType_ = org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest.getDefaultInstance(); } keySetRequestBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest, org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest.Builder, org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequestOrBuilder>( (org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest) messageType_, getParentForChildren(), isClean()); messageType_ = null; } messageTypeCase_ = 28; onChanged();; return keySetRequestBuilder_; }
/** * <code>.org.apache.geode.internal.protocol.protobuf.v1.KeySetRequest keySetRequest = 28;</code> */ public org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest getKeySetRequest() { if (keySetRequestBuilder_ == null) { if (messageTypeCase_ == 28) { return (org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest) messageType_; } return org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest.getDefaultInstance(); } else { if (messageTypeCase_ == 28) { return keySetRequestBuilder_.getMessage(); } return org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest.getDefaultInstance(); } } /**
@Test public void verifyKeySetReturnsExpectedKeys() throws Exception { RegionAPI.KeySetRequest request = RegionAPI.KeySetRequest.newBuilder().setRegionName(TEST_REGION).build(); Result result = operationHandler.process(serializationService, request, TestExecutionContext.getNoAuthCacheExecutionContext(cacheStub)); Assert.assertTrue(result instanceof Success); RegionAPI.KeySetResponse response = (RegionAPI.KeySetResponse) result.getMessage(); List<Object> results = response.getKeysList().stream().map(serializationService::decode) .collect(Collectors.toList()); assertEquals(3, results.size()); assertTrue(results.contains(TEST_KEY1)); assertTrue(results.contains(TEST_KEY2)); assertTrue(results.contains(TEST_KEY3)); } }
/** * <code>.org.apache.geode.internal.protocol.protobuf.v1.KeySetRequest keySetRequest = 28;</code> */ public org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequestOrBuilder getKeySetRequestOrBuilder() { if ((messageTypeCase_ == 28) && (keySetRequestBuilder_ != null)) { return keySetRequestBuilder_.getMessageOrBuilder(); } else { if (messageTypeCase_ == 28) { return (org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest) messageType_; } return org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest.getDefaultInstance(); } } /**
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {
@java.lang.Override public org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest getDefaultInstanceForType() { return org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest.getDefaultInstance(); }
/** * <code>.org.apache.geode.internal.protocol.protobuf.v1.KeySetRequest keySetRequest = 28;</code> */ public org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest getKeySetRequest() { if (messageTypeCase_ == 28) { return (org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest) messageType_; } return org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest.getDefaultInstance(); } /**
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getRegionNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, regionName_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@Override public Set<K> keySet() throws IOException { final Message request = Message.newBuilder() .setKeySetRequest(RegionAPI.KeySetRequest.newBuilder().setRegionName(name)).build(); final Message message = protobufChannel.sendRequest(request, MessageTypeCase.KEYSETRESPONSE); final RegionAPI.KeySetResponse keySetResponse = message.getKeySetResponse(); Set<K> keys = new HashSet<>(keySetResponse.getKeysCount()); for (BasicTypes.EncodedValue value : keySetResponse.getKeysList()) { keys.add((K) valueEncoder.decodeValue(value)); } return keys; } }
@java.lang.Override public org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest buildPartial() { org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest result = new org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest(this); result.regionName_ = regionName_; onBuilt(); return result; }
@java.lang.Override public org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest build() { org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@Override public Result<RegionAPI.KeySetResponse> process(ProtobufSerializationService serializationService, RegionAPI.KeySetRequest request, MessageExecutionContext messageExecutionContext) throws InvalidExecutionContextException, EncodingException, DecodingException { String regionName = request.getRegionName(); Set<Object> keySet = messageExecutionContext.getSecureCache().keySet(regionName); RegionAPI.KeySetResponse.Builder builder = RegionAPI.KeySetResponse.newBuilder(); keySet.stream().map(serializationService::encode).forEach(builder::addKeys); return Success.of(builder.build()); } }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getRegionNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, regionName_); } unknownFields.writeTo(output); }
public Builder mergeFrom(org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest other) { if (other == org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest.getDefaultInstance()) return this; if (!other.getRegionName().isEmpty()) { regionName_ = other.regionName_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
/** * <code>.org.apache.geode.internal.protocol.protobuf.v1.KeySetRequest keySetRequest = 28;</code> */ public org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequestOrBuilder getKeySetRequestOrBuilder() { if (messageTypeCase_ == 28) { return (org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest) messageType_; } return org.apache.geode.internal.protocol.protobuf.v1.RegionAPI.KeySetRequest.getDefaultInstance(); }