Skip to content

Commit

Permalink
GEODE-3995: Moving server_api.proto to locator_api.proto.
Browse files Browse the repository at this point in the history
This closes PR apache#1074
  • Loading branch information
bschuchardt committed Nov 20, 2017
1 parent 6c345cd commit 862c4d2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
import org.apache.geode.internal.protocol.operations.OperationHandler;
import org.apache.geode.internal.protocol.protobuf.v1.BasicTypes;
import org.apache.geode.internal.protocol.protobuf.v1.ClientProtocol;
import org.apache.geode.internal.protocol.protobuf.v1.ServerAPI;
import org.apache.geode.internal.protocol.protobuf.v1.LocatorAPI;
import org.apache.geode.internal.protocol.serialization.SerializationService;

@Experimental
public class GetAvailableServersOperationHandler implements
OperationHandler<ServerAPI.GetAvailableServersRequest, ServerAPI.GetAvailableServersResponse, ClientProtocol.ErrorResponse> {
OperationHandler<LocatorAPI.GetAvailableServersRequest, LocatorAPI.GetAvailableServersResponse, ClientProtocol.ErrorResponse> {

@Override
public Result<ServerAPI.GetAvailableServersResponse, ClientProtocol.ErrorResponse> process(
SerializationService serializationService, ServerAPI.GetAvailableServersRequest request,
public Result<LocatorAPI.GetAvailableServersResponse, ClientProtocol.ErrorResponse> process(
SerializationService serializationService, LocatorAPI.GetAvailableServersRequest request,
MessageExecutionContext messageExecutionContext) throws InvalidExecutionContextException {

InternalLocator internalLocator = (InternalLocator) messageExecutionContext.getLocator();
Expand All @@ -50,8 +50,8 @@ public Result<ServerAPI.GetAvailableServersResponse, ClientProtocol.ErrorRespons
Collection<BasicTypes.Server> servers = (Collection<BasicTypes.Server>) serversFromSnapshot
.stream().map(serverLocation -> getServerProtobufMessage((ServerLocation) serverLocation))
.collect(Collectors.toList());
ServerAPI.GetAvailableServersResponse.Builder builder =
ServerAPI.GetAvailableServersResponse.newBuilder().addAllServers(servers);
LocatorAPI.GetAvailableServersResponse.Builder builder =
LocatorAPI.GetAvailableServersResponse.newBuilder().addAllServers(servers);
return Success.of(builder.build());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import org.apache.geode.annotations.Experimental;
import org.apache.geode.internal.protocol.protobuf.v1.BasicTypes;
import org.apache.geode.internal.protocol.protobuf.v1.ClientProtocol;
import org.apache.geode.internal.protocol.protobuf.v1.LocatorAPI;
import org.apache.geode.internal.protocol.protobuf.v1.RegionAPI;
import org.apache.geode.internal.protocol.protobuf.v1.ServerAPI;

/**
* This class contains helper functions for generating ClientProtocol.Request objects
Expand Down Expand Up @@ -110,9 +110,9 @@ public static ClientProtocol.Request createPutAllRequest(String regionName,
return ClientProtocol.Request.newBuilder().setPutAllRequest(putAllRequestBuilder).build();
}

public static ServerAPI.GetAvailableServersRequest createGetAvailableServersRequest() {
ServerAPI.GetAvailableServersRequest.Builder builder =
ServerAPI.GetAvailableServersRequest.newBuilder();
public static LocatorAPI.GetAvailableServersRequest createGetAvailableServersRequest() {
LocatorAPI.GetAvailableServersRequest.Builder builder =
LocatorAPI.GetAvailableServersRequest.newBuilder();
return builder.build();
}
}
2 changes: 1 addition & 1 deletion geode-protobuf/src/main/proto/v1/clientProtocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package org.apache.geode.internal.protocol.protobuf.v1;

import "google/protobuf/any.proto";
import "v1/region_API.proto";
import "v1/server_API.proto";
import "v1/locator_API.proto";
import "v1/basicTypes.proto";
import "v1/connection_API.proto";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.apache.geode.internal.protocol.protobuf.statistics.ProtobufClientStatisticsImpl;
import org.apache.geode.internal.protocol.protobuf.v1.ClientProtocol;
import org.apache.geode.internal.protocol.protobuf.v1.ConnectionAPI;
import org.apache.geode.internal.protocol.protobuf.v1.ServerAPI;
import org.apache.geode.internal.protocol.protobuf.v1.LocatorAPI;
import org.apache.geode.internal.protocol.protobuf.v1.serializer.ProtobufProtocolSerializer;
import org.apache.geode.internal.protocol.protobuf.v1.utilities.ProtobufRequestUtilities;
import org.apache.geode.internal.protocol.protobuf.v1.utilities.ProtobufUtilities;
Expand Down Expand Up @@ -223,7 +223,7 @@ private void validateGetAvailableServersResponse(
ClientProtocol.Response messageResponse = getAvailableServersResponseMessage.getResponse();
assertEquals(ClientProtocol.Response.ResponseAPICase.GETAVAILABLESERVERSRESPONSE,
messageResponse.getResponseAPICase());
ServerAPI.GetAvailableServersResponse getAvailableServersResponse =
LocatorAPI.GetAvailableServersResponse getAvailableServersResponse =
messageResponse.getGetAvailableServersResponse();
assertEquals(1, getAvailableServersResponse.getServersCount());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
import org.apache.geode.internal.protocol.Success;
import org.apache.geode.internal.protocol.TestExecutionContext;
import org.apache.geode.internal.protocol.protobuf.v1.BasicTypes;
import org.apache.geode.internal.protocol.protobuf.v1.ServerAPI;
import org.apache.geode.internal.protocol.protobuf.v1.ServerAPI.GetAvailableServersResponse;
import org.apache.geode.internal.protocol.protobuf.v1.LocatorAPI;
import org.apache.geode.internal.protocol.protobuf.v1.LocatorAPI.GetAvailableServersResponse;
import org.apache.geode.internal.protocol.protobuf.v1.utilities.ProtobufRequestUtilities;
import org.apache.geode.test.junit.categories.UnitTest;

Expand Down Expand Up @@ -72,7 +72,7 @@ public void testServerReturnedFromHandler() throws Exception {
serverList.add(new ServerLocation(HOSTNAME_2, PORT_2));
when(locatorLoadSnapshot.getServers(null)).thenReturn(serverList);

ServerAPI.GetAvailableServersRequest getAvailableServersRequest =
LocatorAPI.GetAvailableServersRequest getAvailableServersRequest =
ProtobufRequestUtilities.createGetAvailableServersRequest();
Result operationHandlerResult = getOperationHandlerResult(getAvailableServersRequest);
assertTrue(operationHandlerResult instanceof Success);
Expand All @@ -85,7 +85,7 @@ public void testWhenServersFromSnapshotAreNullReturnsEmtpy()
throws InvalidExecutionContextException {
when(locatorLoadSnapshot.getServers(any())).thenReturn(null);

ServerAPI.GetAvailableServersRequest getAvailableServersRequest =
LocatorAPI.GetAvailableServersRequest getAvailableServersRequest =
ProtobufRequestUtilities.createGetAvailableServersRequest();
Result operationHandlerResult = getOperationHandlerResult(getAvailableServersRequest);
assertTrue(operationHandlerResult instanceof Success);
Expand All @@ -95,7 +95,7 @@ public void testWhenServersFromSnapshotAreNullReturnsEmtpy()
}

private Result getOperationHandlerResult(
ServerAPI.GetAvailableServersRequest getAvailableServersRequest)
LocatorAPI.GetAvailableServersRequest getAvailableServersRequest)
throws InvalidExecutionContextException {
return operationHandler.process(serializationServiceStub, getAvailableServersRequest,
TestExecutionContext.getLocatorExecutionContext(internalLocatorMock));
Expand Down

0 comments on commit 862c4d2

Please sign in to comment.