geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [geode] branch develop updated: GEODE-3797: Removal of CorrelationId and MessageHeader from protobuf definitions
Date Thu, 12 Oct 2017 23:29:48 GMT
This is an automated email from the ASF dual-hosted git repository.

udo pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new dbda0f4  GEODE-3797: Removal of CorrelationId and MessageHeader from protobuf definitions
dbda0f4 is described below

commit dbda0f4e6268a0e1ec46592aef54b1183869e5f4
Author: kohlmu-pivotal <ukohlmeyer@pivotal.io>
AuthorDate: Wed Oct 11 10:13:52 2017 -0700

    GEODE-3797: Removal of CorrelationId and MessageHeader from protobuf definitions
---
 .../protocol/protobuf/ProtobufStreamProcessor.java |  8 +--
 .../protobuf/utilities/ProtobufUtilities.java      | 35 ++-----------
 geode-protobuf/src/main/proto/clientProtocol.proto | 15 +-----
 .../geode/internal/protocol/MessageUtil.java       | 20 +++-----
 .../acceptance/CacheConnectionJUnitTest.java       | 28 ++++------
 .../CacheConnectionTimeoutJUnitTest.java           | 15 ++----
 .../acceptance/CacheMaxConnectionJUnitTest.java    | 12 ++---
 .../acceptance/CacheOperationsJUnitTest.java       | 59 +++++++---------------
 .../acceptance/LocatorConnectionDUnitTest.java     | 20 +++-----
 9 files changed, 57 insertions(+), 155 deletions(-)

diff --git a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/ProtobufStreamProcessor.java
b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/ProtobufStreamProcessor.java
index 3571821..89f02e3 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/ProtobufStreamProcessor.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/ProtobufStreamProcessor.java
@@ -21,17 +21,14 @@ import java.io.OutputStream;
 
 import org.apache.logging.log4j.Logger;
 
-import org.apache.geode.StatisticsFactory;
 import org.apache.geode.annotations.Experimental;
 import org.apache.geode.internal.cache.tier.sockets.ClientProtocolMessageHandler;
-import org.apache.geode.internal.cache.tier.sockets.ClientProtocolStatistics;
 import org.apache.geode.internal.cache.tier.sockets.MessageExecutionContext;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.protocol.exception.InvalidProtocolMessageException;
 import org.apache.geode.internal.protocol.protobuf.registry.OperationContextRegistry;
 import org.apache.geode.internal.protocol.protobuf.serializer.ProtobufProtocolSerializer;
 import org.apache.geode.internal.protocol.protobuf.statistics.ProtobufClientStatistics;
-import org.apache.geode.internal.protocol.protobuf.statistics.ProtobufClientStatisticsImpl;
 import org.apache.geode.internal.protocol.protobuf.utilities.ProtobufUtilities;
 
 /**
@@ -75,10 +72,7 @@ public class ProtobufStreamProcessor implements ClientProtocolMessageHandler
{
 
     ClientProtocol.Request request = message.getRequest();
     ClientProtocol.Response response = protobufOpsProcessor.process(request, executionContext);
-    ClientProtocol.MessageHeader responseHeader =
-        ProtobufUtilities.createMessageHeaderForRequest(message);
-    ClientProtocol.Message responseMessage =
-        ProtobufUtilities.createProtobufResponse(responseHeader, response);
+    ClientProtocol.Message responseMessage = ProtobufUtilities.createProtobufResponse(response);
     statistics.messageSent(responseMessage.getSerializedSize());
     protobufProtocolSerializer.serialize(responseMessage, outputStream);
   }
diff --git a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/utilities/ProtobufUtilities.java
b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/utilities/ProtobufUtilities.java
index 3449fb1..a44bf74 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/utilities/ProtobufUtilities.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/utilities/ProtobufUtilities.java
@@ -112,27 +112,21 @@ public abstract class ProtobufUtilities {
   /**
    * This creates a protobuf message containing a ClientProtocol.Response
    *
-   * @param messageHeader - The header for the message
    * @param response - The response for the message
    * @return a protobuf Message containing the above parameters
    */
-  public static ClientProtocol.Message createProtobufResponse(
-      ClientProtocol.MessageHeader messageHeader, ClientProtocol.Response response) {
-    return ClientProtocol.Message.newBuilder().setMessageHeader(messageHeader).setResponse(response)
-        .build();
+  public static ClientProtocol.Message createProtobufResponse(ClientProtocol.Response response)
{
+    return ClientProtocol.Message.newBuilder().setResponse(response).build();
   }
 
   /**
    * This creates a protobuf message containing a ClientProtocol.Request
    *
-   * @param messageHeader - The header for the message
    * @param request - The request for the message
    * @return a protobuf Message containing the above parameters
    */
-  public static ClientProtocol.Message createProtobufMessage(
-      ClientProtocol.MessageHeader messageHeader, ClientProtocol.Request request) {
-    return ClientProtocol.Message.newBuilder().setMessageHeader(messageHeader).setRequest(request)
-        .build();
+  public static ClientProtocol.Message createProtobufMessage(ClientProtocol.Request request)
{
+    return ClientProtocol.Message.newBuilder().setRequest(request).build();
   }
 
   /**
@@ -147,27 +141,6 @@ public abstract class ProtobufUtilities {
   }
 
   /**
-   * This builds the MessageHeader for a response which matches an incoming request
-   *
-   * @param request - The request message that we're responding to.
-   * @return the MessageHeader the response to the passed request
-   */
-  public static ClientProtocol.MessageHeader createMessageHeaderForRequest(
-      ClientProtocol.Message request) {
-    return createMessageHeader(request.getMessageHeader().getCorrelationId());
-  }
-
-  /**
-   * This creates a MessageHeader
-   *
-   * @param correlationId - An identifier used to correlate requests and responses
-   * @return a MessageHeader containing the above parameters
-   */
-  public static ClientProtocol.MessageHeader createMessageHeader(int correlationId) {
-    return ClientProtocol.MessageHeader.newBuilder().setCorrelationId(correlationId).build();
-  }
-
-  /**
    * This will return the object encoded in a protobuf EncodedValue
    *
    * @param serializationService - object which knows how to encode objects for the protobuf
diff --git a/geode-protobuf/src/main/proto/clientProtocol.proto b/geode-protobuf/src/main/proto/clientProtocol.proto
index f91949f..4dce221 100644
--- a/geode-protobuf/src/main/proto/clientProtocol.proto
+++ b/geode-protobuf/src/main/proto/clientProtocol.proto
@@ -27,18 +27,12 @@ import "server_API.proto";
 import "basicTypes.proto";
 
 message Message {
-    MessageHeader messageHeader = 1;
     oneof messageType {
-        Request request = 2;
-        Response response = 3;
+        Request request = 1;
+        Response response = 2;
     }
 }
 
-message MessageHeader {
-    int32 correlationId = 1;
-    MetaData metadata = 2;
-}
-
 message Request {
     CallbackArguments callbackArg = 1;
     oneof requestAPI {
@@ -72,11 +66,6 @@ message Response {
     }
 }
 
-message MetaData {
-    int32 numberOfMetadata = 1;
-    map<int32, google.protobuf.Any> metaDataEntries = 2;
-}
-
 message ErrorResponse {
     Error error = 1;
 }
diff --git a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/MessageUtil.java
b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/MessageUtil.java
index 162825d..9f1e0c6 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/MessageUtil.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/MessageUtil.java
@@ -29,16 +29,14 @@ public class MessageUtil {
     return RegionAPI.GetRegionRequest.newBuilder().setRegionName(requestRegion).build();
   }
 
-  public static ClientProtocol.Message makeGetRegionRequestMessage(String requestRegion,
-      ClientProtocol.MessageHeader header) {
+  public static ClientProtocol.Message makeGetRegionRequestMessage(String requestRegion)
{
     ClientProtocol.Request request = ClientProtocol.Request.newBuilder()
         .setGetRegionRequest(makeGetRegionRequest(requestRegion)).build();
-    return ClientProtocol.Message.newBuilder().setMessageHeader(header).setRequest(request).build();
+    return ClientProtocol.Message.newBuilder().setRequest(request).build();
   }
 
   public static ClientProtocol.Message createGetRequestMessage() {
     ClientProtocol.Message.Builder messageBuilder = ClientProtocol.Message.newBuilder();
-    messageBuilder.setMessageHeader(getMessageHeaderBuilder());
     ClientProtocol.Request.Builder requestBuilder = getRequestBuilder();
     requestBuilder.setGetRequest(getGetRequestBuilder());
     messageBuilder.setRequest(requestBuilder);
@@ -47,7 +45,7 @@ public class MessageUtil {
 
   public static ClientProtocol.Message makePutRequestMessage(
       SerializationService serializationService, String requestKey, String requestValue,
-      String requestRegion, ClientProtocol.MessageHeader header)
+      String requestRegion)
       throws CodecNotRegisteredForTypeException, UnsupportedEncodingTypeException {
     BasicTypes.Entry entry = ProtobufUtilities.createEntry(
         ProtobufUtilities.createEncodedValue(serializationService, requestKey),
@@ -55,15 +53,15 @@ public class MessageUtil {
 
     ClientProtocol.Request request =
         ProtobufRequestUtilities.createPutRequest(requestRegion, entry);
-    return ProtobufUtilities.createProtobufMessage(header, request);
+    return ProtobufUtilities.createProtobufMessage(request);
   }
 
   public static ClientProtocol.Message makeGetRequestMessage(
-      SerializationService serializationService, Object requestKey, String requestRegion,
-      ClientProtocol.MessageHeader header) throws Exception {
+      SerializationService serializationService, Object requestKey, String requestRegion)
+      throws Exception {
     ClientProtocol.Request request = ProtobufRequestUtilities.createGetRequest(requestRegion,
         ProtobufUtilities.createEncodedValue(serializationService, requestKey));
-    return ProtobufUtilities.createProtobufMessage(header, request);
+    return ProtobufUtilities.createProtobufMessage(request);
   }
 
   private static ClientProtocol.Request.Builder getRequestBuilder() {
@@ -73,8 +71,4 @@ public class MessageUtil {
   private static RegionAPI.GetRequest.Builder getGetRequestBuilder() {
     return RegionAPI.GetRequest.newBuilder();
   }
-
-  private static ClientProtocol.MessageHeader.Builder getMessageHeaderBuilder() {
-    return ClientProtocol.MessageHeader.newBuilder();
-  }
 }
diff --git a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheConnectionJUnitTest.java
b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheConnectionJUnitTest.java
index 99b0e1f..cb3e544 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheConnectionJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheConnectionJUnitTest.java
@@ -67,10 +67,7 @@ import org.apache.geode.internal.protocol.protobuf.ProtobufSerializationService;
 import org.apache.geode.internal.protocol.protobuf.RegionAPI;
 import org.apache.geode.internal.protocol.protobuf.serializer.ProtobufProtocolSerializer;
 import org.apache.geode.internal.protocol.protobuf.statistics.ProtobufClientStatistics;
-import org.apache.geode.internal.protocol.protobuf.utilities.ProtobufUtilities;
 import org.apache.geode.internal.serialization.SerializationService;
-import org.apache.geode.internal.serialization.exception.UnsupportedEncodingTypeException;
-import org.apache.geode.internal.serialization.registry.exception.CodecNotRegisteredForTypeException;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.util.test.TestUtil;
 
@@ -83,8 +80,6 @@ public class CacheConnectionJUnitTest {
   private final String TEST_KEY = "testKey";
   private final String TEST_VALUE = "testValue";
   private final String TEST_REGION = "testRegion";
-  private final int TEST_PUT_CORRELATION_ID = 574;
-  private final int TEST_GET_CORRELATION_ID = 68451;
 
   private final String DEFAULT_STORE = "default.keystore";
   private final String SSL_PROTOCOLS = "any";
@@ -161,13 +156,12 @@ public class CacheConnectionJUnitTest {
   public void testBasicMessagesAndStats() throws Exception {
     ProtobufProtocolSerializer protobufProtocolSerializer = new ProtobufProtocolSerializer();
     ClientProtocol.Message putMessage =
-        MessageUtil.makePutRequestMessage(serializationService, TEST_KEY, TEST_VALUE, TEST_REGION,
-            ProtobufUtilities.createMessageHeader(TEST_PUT_CORRELATION_ID));
+        MessageUtil.makePutRequestMessage(serializationService, TEST_KEY, TEST_VALUE, TEST_REGION);
     protobufProtocolSerializer.serialize(putMessage, outputStream);
     validatePutResponse(socket, protobufProtocolSerializer);
 
-    ClientProtocol.Message getMessage = MessageUtil.makeGetRequestMessage(serializationService,
-        TEST_KEY, TEST_REGION, ProtobufUtilities.createMessageHeader(TEST_GET_CORRELATION_ID));
+    ClientProtocol.Message getMessage =
+        MessageUtil.makeGetRequestMessage(serializationService, TEST_KEY, TEST_REGION);
     protobufProtocolSerializer.serialize(getMessage, outputStream);
     validateGetResponse(socket, protobufProtocolSerializer, TEST_VALUE);
 
@@ -197,8 +191,8 @@ public class CacheConnectionJUnitTest {
 
     // make a request to the server
     ProtobufProtocolSerializer protobufProtocolSerializer = new ProtobufProtocolSerializer();
-    ClientProtocol.Message getMessage = MessageUtil.makeGetRequestMessage(serializationService,
-        TEST_KEY, TEST_REGION, ProtobufUtilities.createMessageHeader(TEST_GET_CORRELATION_ID));
+    ClientProtocol.Message getMessage =
+        MessageUtil.makeGetRequestMessage(serializationService, TEST_KEY, TEST_REGION);
     protobufProtocolSerializer.serialize(getMessage, outputStream);
 
     // make sure socket is still open
@@ -210,18 +204,15 @@ public class CacheConnectionJUnitTest {
 
   private void validatePutResponse(Socket socket,
       ProtobufProtocolSerializer protobufProtocolSerializer) throws Exception {
-    ClientProtocol.Response response =
-        deserializeResponse(socket, protobufProtocolSerializer, TEST_PUT_CORRELATION_ID);
+    ClientProtocol.Response response = deserializeResponse(socket, protobufProtocolSerializer);
     assertEquals(ClientProtocol.Response.ResponseAPICase.PUTRESPONSE,
         response.getResponseAPICase());
   }
 
   private void validateGetResponse(Socket socket,
       ProtobufProtocolSerializer protobufProtocolSerializer, Object expectedValue)
-      throws InvalidProtocolMessageException, IOException, UnsupportedEncodingTypeException,
-      CodecNotRegisteredForTypeException {
-    ClientProtocol.Response response =
-        deserializeResponse(socket, protobufProtocolSerializer, TEST_GET_CORRELATION_ID);
+      throws InvalidProtocolMessageException, IOException {
+    ClientProtocol.Response response = deserializeResponse(socket, protobufProtocolSerializer);
 
     assertEquals(ClientProtocol.Response.ResponseAPICase.GETRESPONSE,
         response.getResponseAPICase());
@@ -232,11 +223,10 @@ public class CacheConnectionJUnitTest {
   }
 
   private ClientProtocol.Response deserializeResponse(Socket socket,
-      ProtobufProtocolSerializer protobufProtocolSerializer, int expectedCorrelationId)
+      ProtobufProtocolSerializer protobufProtocolSerializer)
       throws InvalidProtocolMessageException, IOException {
     ClientProtocol.Message message =
         protobufProtocolSerializer.deserialize(socket.getInputStream());
-    assertEquals(expectedCorrelationId, message.getMessageHeader().getCorrelationId());
     assertEquals(ClientProtocol.Message.MessageTypeCase.RESPONSE, message.getMessageTypeCase());
     return message.getResponse();
   }
diff --git a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheConnectionTimeoutJUnitTest.java
b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheConnectionTimeoutJUnitTest.java
index 790abf6..810e5a7 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheConnectionTimeoutJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheConnectionTimeoutJUnitTest.java
@@ -43,11 +43,10 @@ import org.apache.geode.distributed.ConfigurationProperties;
 import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.internal.cache.tier.sockets.ClientHealthMonitor;
 import org.apache.geode.internal.net.SocketCreatorFactory;
-import org.apache.geode.internal.protocol.protobuf.ClientProtocol;
 import org.apache.geode.internal.protocol.MessageUtil;
+import org.apache.geode.internal.protocol.protobuf.ClientProtocol;
 import org.apache.geode.internal.protocol.protobuf.ProtobufSerializationService;
 import org.apache.geode.internal.protocol.protobuf.serializer.ProtobufProtocolSerializer;
-import org.apache.geode.internal.protocol.protobuf.utilities.ProtobufUtilities;
 import org.apache.geode.internal.serialization.SerializationService;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 
@@ -59,10 +58,8 @@ public class CacheConnectionTimeoutJUnitTest {
   private final String TEST_KEY = "testKey";
   private final String TEST_VALUE = "testValue";
   private final String TEST_REGION = "testRegion";
-  private final int TEST_PUT_CORRELATION_ID = 574;
 
   private Cache cache;
-  private int cacheServerPort;
   private SerializationService serializationService;
   private Socket socket;
   private OutputStream outputStream;
@@ -74,14 +71,12 @@ public class CacheConnectionTimeoutJUnitTest {
   public TestName testName = new TestName();
   private long monitorInterval;
   private int maximumTimeBetweenPings;
-  private static final int pollInterval = 20;
 
   @Before
   public void setup() throws Exception {
     Properties properties = new Properties();
     System.setProperty(ClientHealthMonitor.CLIENT_HEALTH_MONITOR_INTERVAL_PROPERTY, "25");
 
-
     CacheFactory cacheFactory = new CacheFactory(properties);
     cacheFactory.set(ConfigurationProperties.MCAST_PORT, "0");
     cacheFactory.set(ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, "false");
@@ -90,7 +85,7 @@ public class CacheConnectionTimeoutJUnitTest {
     cache = cacheFactory.create();
 
     CacheServer cacheServer = cache.addCacheServer();
-    cacheServerPort = AvailablePortHelper.getRandomAvailableTCPPort();
+    int cacheServerPort = AvailablePortHelper.getRandomAvailableTCPPort();
     cacheServer.setPort(cacheServerPort);
     cacheServer.setMaximumTimeBetweenPings(100);
     cacheServer.start();
@@ -128,8 +123,7 @@ public class CacheConnectionTimeoutJUnitTest {
   public void testUnresponsiveClientsGetDisconnected() throws Exception {
     ProtobufProtocolSerializer protobufProtocolSerializer = new ProtobufProtocolSerializer();
     ClientProtocol.Message putMessage =
-        MessageUtil.makePutRequestMessage(serializationService, TEST_KEY, TEST_VALUE, TEST_REGION,
-            ProtobufUtilities.createMessageHeader(TEST_PUT_CORRELATION_ID));
+        MessageUtil.makePutRequestMessage(serializationService, TEST_KEY, TEST_VALUE, TEST_REGION);
 
     InputStream inputStream = socket.getInputStream();
 
@@ -153,8 +147,7 @@ public class CacheConnectionTimeoutJUnitTest {
   public void testResponsiveClientsStaysConnected() throws Exception {
     ProtobufProtocolSerializer protobufProtocolSerializer = new ProtobufProtocolSerializer();
     ClientProtocol.Message putMessage =
-        MessageUtil.makePutRequestMessage(serializationService, TEST_KEY, TEST_VALUE, TEST_REGION,
-            ProtobufUtilities.createMessageHeader(TEST_PUT_CORRELATION_ID));
+        MessageUtil.makePutRequestMessage(serializationService, TEST_KEY, TEST_VALUE, TEST_REGION);
 
     int timeout = maximumTimeBetweenPings * 4;
     int interval = maximumTimeBetweenPings / 4;
diff --git a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheMaxConnectionJUnitTest.java
b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheMaxConnectionJUnitTest.java
index 4607fab..d928224 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheMaxConnectionJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheMaxConnectionJUnitTest.java
@@ -67,7 +67,6 @@ import org.apache.geode.test.junit.categories.IntegrationTest;
 public class CacheMaxConnectionJUnitTest {
   private static final String TEST_KEY = "testKey";
   private static final String TEST_VALUE = "testValue";
-  private static final int TEST_PUT_CORRELATION_ID = 12355;
   private static final String TEST_REGION = "testRegion";
 
   private Cache cache;
@@ -191,9 +190,8 @@ public class CacheMaxConnectionJUnitTest {
           OutputStream outputStream = socket.getOutputStream();
           outputStream.write(CommunicationMode.ProtobufClientServerProtocol.getModeNumber());
 
-          ClientProtocol.Message putMessage =
-              MessageUtil.makePutRequestMessage(serializationService, TEST_KEY, TEST_VALUE,
-                  TEST_REGION, ProtobufUtilities.createMessageHeader(TEST_PUT_CORRELATION_ID));
+          ClientProtocol.Message putMessage = MessageUtil
+              .makePutRequestMessage(serializationService, TEST_KEY, TEST_VALUE, TEST_REGION);
           protobufProtocolSerializer.serialize(putMessage, outputStream);
           validatePutResponse(socket, protobufProtocolSerializer);
         } catch (Exception e) {
@@ -223,18 +221,16 @@ public class CacheMaxConnectionJUnitTest {
 
   private void validatePutResponse(Socket socket,
       ProtobufProtocolSerializer protobufProtocolSerializer) throws Exception {
-    ClientProtocol.Response response =
-        deserializeResponse(socket, protobufProtocolSerializer, TEST_PUT_CORRELATION_ID);
+    ClientProtocol.Response response = deserializeResponse(socket, protobufProtocolSerializer);
     assertEquals(ClientProtocol.Response.ResponseAPICase.PUTRESPONSE,
         response.getResponseAPICase());
   }
 
   private ClientProtocol.Response deserializeResponse(Socket socket,
-      ProtobufProtocolSerializer protobufProtocolSerializer, int expectedCorrelationId)
+      ProtobufProtocolSerializer protobufProtocolSerializer)
       throws InvalidProtocolMessageException, IOException {
     ClientProtocol.Message message =
         protobufProtocolSerializer.deserialize(socket.getInputStream());
-    assertEquals(expectedCorrelationId, message.getMessageHeader().getCorrelationId());
     assertEquals(ClientProtocol.Message.MessageTypeCase.RESPONSE, message.getMessageTypeCase());
     return message.getResponse();
   }
diff --git a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheOperationsJUnitTest.java
b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheOperationsJUnitTest.java
index 266c658..29c6623 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheOperationsJUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/CacheOperationsJUnitTest.java
@@ -80,9 +80,6 @@ import org.apache.geode.util.test.TestUtil;
 public class CacheOperationsJUnitTest {
   private final String TEST_KEY = "testKey";
   private final String TEST_REGION = "testRegion";
-  private final int TEST_PUT_CORRELATION_ID = 574;
-  private final int TEST_GET_CORRELATION_ID = 68451;
-  private final int TEST_REMOVE_CORRELATION_ID = 51;
 
   private final String DEFAULT_STORE = "default.keystore";
   private final String SSL_PROTOCOLS = "any";
@@ -170,7 +167,6 @@ public class CacheOperationsJUnitTest {
     putEntries.add(ProtobufUtilities.createEntry(serializationService, TEST_MULTIOP_KEY3,
         TEST_MULTIOP_VALUE3));
     ClientProtocol.Message putAllMessage = ProtobufUtilities.createProtobufMessage(
-        ProtobufUtilities.createMessageHeader(TEST_PUT_CORRELATION_ID),
         ProtobufRequestUtilities.createPutAllRequest(TEST_REGION, putEntries));
     protobufProtocolSerializer.serialize(putAllMessage, outputStream);
     validatePutAllResponse(socket, protobufProtocolSerializer, new HashSet<>());
@@ -184,7 +180,6 @@ public class CacheOperationsJUnitTest {
         ProtobufRequestUtilities.createGetAllRequest(TEST_REGION, getEntries);
 
     ClientProtocol.Message getAllMessage = ProtobufUtilities.createProtobufMessage(
-        ProtobufUtilities.createMessageHeader(TEST_GET_CORRELATION_ID),
         ProtobufUtilities.createProtobufRequestWithGetAllRequest(getAllRequest));
     protobufProtocolSerializer.serialize(getAllMessage, outputStream);
     validateGetAllResponse(socket, protobufProtocolSerializer);
@@ -205,15 +200,12 @@ public class CacheOperationsJUnitTest {
 
     ProtobufProtocolSerializer protobufProtocolSerializer = new ProtobufProtocolSerializer();
     Set<BasicTypes.Entry> putEntries = new HashSet<>();
-    Float validKey = new Float(2.2);
-    putEntries
-        .add(ProtobufUtilities.createEntry(serializationService, validKey, TEST_MULTIOP_VALUE1));
+    putEntries.add(ProtobufUtilities.createEntry(serializationService, 2.2f, TEST_MULTIOP_VALUE1));
     putEntries.add(ProtobufUtilities.createEntry(serializationService, TEST_MULTIOP_KEY2,
         TEST_MULTIOP_VALUE2));
     putEntries.add(ProtobufUtilities.createEntry(serializationService, TEST_MULTIOP_KEY3,
         TEST_MULTIOP_VALUE3));
     ClientProtocol.Message putAllMessage = ProtobufUtilities.createProtobufMessage(
-        ProtobufUtilities.createMessageHeader(TEST_PUT_CORRELATION_ID),
         ProtobufRequestUtilities.createPutAllRequest(regionName, putEntries));
 
     protobufProtocolSerializer.serialize(putAllMessage, outputStream);
@@ -224,15 +216,14 @@ public class CacheOperationsJUnitTest {
         .add(ProtobufUtilities.createEncodedValue(serializationService, TEST_MULTIOP_KEY3));
     validatePutAllResponse(socket, protobufProtocolSerializer, expectedFailedKeys);
 
-    ClientProtocol.Message getMessage = MessageUtil.makeGetRequestMessage(serializationService,
-        validKey, regionName, ProtobufUtilities.createMessageHeader(TEST_GET_CORRELATION_ID));
+    ClientProtocol.Message getMessage =
+        MessageUtil.makeGetRequestMessage(serializationService, 2.2f, regionName);
     protobufProtocolSerializer.serialize(getMessage, outputStream);
     validateGetResponse(socket, protobufProtocolSerializer, TEST_MULTIOP_VALUE1);
 
-    ClientProtocol.Message removeMessage = ProtobufUtilities.createProtobufMessage(
-        ProtobufUtilities.createMessageHeader(TEST_REMOVE_CORRELATION_ID),
-        ProtobufRequestUtilities.createRemoveRequest(TEST_REGION,
-            ProtobufUtilities.createEncodedValue(serializationService, TEST_KEY)));
+    ClientProtocol.Message removeMessage =
+        ProtobufUtilities.createProtobufMessage(ProtobufRequestUtilities.createRemoveRequest(
+            TEST_REGION, ProtobufUtilities.createEncodedValue(serializationService, TEST_KEY)));
     protobufProtocolSerializer.serialize(removeMessage, outputStream);
     validateRemoveResponse(socket, protobufProtocolSerializer);
   }
@@ -241,12 +232,11 @@ public class CacheOperationsJUnitTest {
   public void testResponseToGetWithNoData() throws Exception {
     // Get request without any data set must return a null
     ProtobufProtocolSerializer protobufProtocolSerializer = new ProtobufProtocolSerializer();
-    ClientProtocol.Message getMessage = MessageUtil.makeGetRequestMessage(serializationService,
-        TEST_KEY, TEST_REGION, ProtobufUtilities.createMessageHeader(TEST_GET_CORRELATION_ID));
+    ClientProtocol.Message getMessage =
+        MessageUtil.makeGetRequestMessage(serializationService, TEST_KEY, TEST_REGION);
     protobufProtocolSerializer.serialize(getMessage, outputStream);
 
-    ClientProtocol.Response response =
-        deserializeResponse(socket, protobufProtocolSerializer, TEST_GET_CORRELATION_ID);
+    ClientProtocol.Response response = deserializeResponse(socket, protobufProtocolSerializer);
     assertEquals(ClientProtocol.Response.ResponseAPICase.GETRESPONSE,
         response.getResponseAPICase());
     RegionAPI.GetResponse getResponse = response.getGetResponse();
@@ -256,17 +246,14 @@ public class CacheOperationsJUnitTest {
 
   @Test
   public void testNewProtocolGetRegionNamesCallSucceeds() throws Exception {
-    int correlationId = TEST_GET_CORRELATION_ID; // reuse this value for this test
-
     ProtobufProtocolSerializer protobufProtocolSerializer = new ProtobufProtocolSerializer();
     RegionAPI.GetRegionNamesRequest getRegionNamesRequest =
         ProtobufRequestUtilities.createGetRegionNamesRequest();
 
     ClientProtocol.Message getRegionsMessage = ProtobufUtilities.createProtobufMessage(
-        ProtobufUtilities.createMessageHeader(correlationId),
         ProtobufUtilities.createProtobufRequestWithGetRegionNamesRequest(getRegionNamesRequest));
     protobufProtocolSerializer.serialize(getRegionsMessage, outputStream);
-    validateGetRegionNamesResponse(socket, correlationId, protobufProtocolSerializer);
+    validateGetRegionNamesResponse(socket, protobufProtocolSerializer);
   }
 
   @Test
@@ -279,8 +266,7 @@ public class CacheOperationsJUnitTest {
     outputStream.write(CommunicationMode.ProtobufClientServerProtocol.getModeNumber());
 
     ProtobufProtocolSerializer protobufProtocolSerializer = new ProtobufProtocolSerializer();
-    ClientProtocol.Message getRegionMessage = MessageUtil.makeGetRegionRequestMessage(TEST_REGION,
-        ClientProtocol.MessageHeader.newBuilder().build());
+    ClientProtocol.Message getRegionMessage = MessageUtil.makeGetRegionRequestMessage(TEST_REGION);
     protobufProtocolSerializer.serialize(getRegionMessage, outputStream);
     ClientProtocol.Message message =
         protobufProtocolSerializer.deserialize(socket.getInputStream());
@@ -302,10 +288,8 @@ public class CacheOperationsJUnitTest {
 
   private void validateGetResponse(Socket socket,
       ProtobufProtocolSerializer protobufProtocolSerializer, Object expectedValue)
-      throws InvalidProtocolMessageException, IOException, UnsupportedEncodingTypeException,
-      CodecNotRegisteredForTypeException {
-    ClientProtocol.Response response =
-        deserializeResponse(socket, protobufProtocolSerializer, TEST_GET_CORRELATION_ID);
+      throws InvalidProtocolMessageException, IOException {
+    ClientProtocol.Response response = deserializeResponse(socket, protobufProtocolSerializer);
 
     assertEquals(ClientProtocol.Response.ResponseAPICase.GETRESPONSE,
         response.getResponseAPICase());
@@ -316,20 +300,18 @@ public class CacheOperationsJUnitTest {
   }
 
   private ClientProtocol.Response deserializeResponse(Socket socket,
-      ProtobufProtocolSerializer protobufProtocolSerializer, int expectedCorrelationId)
+      ProtobufProtocolSerializer protobufProtocolSerializer)
       throws InvalidProtocolMessageException, IOException {
     ClientProtocol.Message message =
         protobufProtocolSerializer.deserialize(socket.getInputStream());
-    assertEquals(expectedCorrelationId, message.getMessageHeader().getCorrelationId());
     assertEquals(ClientProtocol.Message.MessageTypeCase.RESPONSE, message.getMessageTypeCase());
     return message.getResponse();
   }
 
-  private void validateGetRegionNamesResponse(Socket socket, int correlationId,
+  private void validateGetRegionNamesResponse(Socket socket,
       ProtobufProtocolSerializer protobufProtocolSerializer)
       throws InvalidProtocolMessageException, IOException {
-    ClientProtocol.Response response =
-        deserializeResponse(socket, protobufProtocolSerializer, correlationId);
+    ClientProtocol.Response response = deserializeResponse(socket, protobufProtocolSerializer);
 
     assertEquals(ClientProtocol.Response.ResponseAPICase.GETREGIONNAMESRESPONSE,
         response.getResponseAPICase());
@@ -341,8 +323,7 @@ public class CacheOperationsJUnitTest {
   private void validatePutAllResponse(Socket socket,
       ProtobufProtocolSerializer protobufProtocolSerializer,
       Collection<BasicTypes.EncodedValue> expectedFailedKeys) throws Exception {
-    ClientProtocol.Response response =
-        deserializeResponse(socket, protobufProtocolSerializer, TEST_PUT_CORRELATION_ID);
+    ClientProtocol.Response response = deserializeResponse(socket, protobufProtocolSerializer);
 
     assertEquals(ClientProtocol.Response.ResponseAPICase.PUTALLRESPONSE,
         response.getResponseAPICase());
@@ -357,8 +338,7 @@ public class CacheOperationsJUnitTest {
   private void validateGetAllResponse(Socket socket,
       ProtobufProtocolSerializer protobufProtocolSerializer) throws InvalidProtocolMessageException,
       IOException, UnsupportedEncodingTypeException, CodecNotRegisteredForTypeException {
-    ClientProtocol.Response response =
-        deserializeResponse(socket, protobufProtocolSerializer, TEST_GET_CORRELATION_ID);
+    ClientProtocol.Response response = deserializeResponse(socket, protobufProtocolSerializer);
     assertEquals(ClientProtocol.Response.ResponseAPICase.GETALLRESPONSE,
         response.getResponseAPICase());
     RegionAPI.GetAllResponse getAllResponse = response.getGetAllResponse();
@@ -385,8 +365,7 @@ public class CacheOperationsJUnitTest {
 
   private void validateRemoveResponse(Socket socket,
       ProtobufProtocolSerializer protobufProtocolSerializer) throws Exception {
-    ClientProtocol.Response response =
-        deserializeResponse(socket, protobufProtocolSerializer, TEST_REMOVE_CORRELATION_ID);
+    ClientProtocol.Response response = deserializeResponse(socket, protobufProtocolSerializer);
     assertEquals(ClientProtocol.Response.ResponseAPICase.REMOVERESPONSE,
         response.getResponseAPICase());
   }
diff --git a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/LocatorConnectionDUnitTest.java
b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/LocatorConnectionDUnitTest.java
index 1f4579c..b4be1b6 100644
--- a/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/LocatorConnectionDUnitTest.java
+++ b/geode-protobuf/src/test/java/org/apache/geode/internal/protocol/acceptance/LocatorConnectionDUnitTest.java
@@ -83,10 +83,9 @@ public class LocatorConnectionDUnitTest extends JUnit4CacheTestCase {
   public void testGetAvailableServersWithStats() throws Throwable {
     ClientProtocol.Request.Builder protobufRequestBuilder =
         ProtobufUtilities.createProtobufRequestBuilder();
-    ClientProtocol.Message getAvailableServersRequestMessage =
-        ProtobufUtilities.createProtobufMessage(ProtobufUtilities.createMessageHeader(1233445),
-            protobufRequestBuilder.setGetAvailableServersRequest(
-                ProtobufRequestUtilities.createGetAvailableServersRequest()).build());
+    ClientProtocol.Message getAvailableServersRequestMessage = ProtobufUtilities
+        .createProtobufMessage(protobufRequestBuilder.setGetAvailableServersRequest(
+            ProtobufRequestUtilities.createGetAvailableServersRequest()).build());
 
     ProtobufProtocolSerializer protobufProtocolSerializer = new ProtobufProtocolSerializer();
 
@@ -130,10 +129,9 @@ public class LocatorConnectionDUnitTest extends JUnit4CacheTestCase {
       ClientProtocol.Request.Builder protobufRequestBuilder =
           ProtobufUtilities.createProtobufRequestBuilder();
       ClientProtocol.Message getRegionNamesRequestMessage =
-          ProtobufUtilities.createProtobufMessage(ProtobufUtilities.createMessageHeader(1233445),
-              protobufRequestBuilder
-                  .setGetRegionNamesRequest(ProtobufRequestUtilities.createGetRegionNamesRequest())
-                  .build());
+          ProtobufUtilities.createProtobufMessage(protobufRequestBuilder
+              .setGetRegionNamesRequest(ProtobufRequestUtilities.createGetRegionNamesRequest())
+              .build());
 
       long messagesReceived = getMessagesReceived();
       long messagesSent = getMessagesSent();
@@ -147,8 +145,6 @@ public class LocatorConnectionDUnitTest extends JUnit4CacheTestCase {
 
       ClientProtocol.Message getAvailableServersResponseMessage =
           protobufProtocolSerializer.deserialize(socket.getInputStream());
-      assertEquals(1233445,
-          getAvailableServersResponseMessage.getMessageHeader().getCorrelationId());
       assertEquals(ClientProtocol.Message.MessageTypeCase.RESPONSE,
           getAvailableServersResponseMessage.getMessageTypeCase());
       ClientProtocol.Response messageResponse = getAvailableServersResponseMessage.getResponse();
@@ -218,10 +214,8 @@ public class LocatorConnectionDUnitTest extends JUnit4CacheTestCase {
   }
 
   private void validateGetAvailableServersResponse(
-      ClientProtocol.Message getAvailableServersResponseMessage)
-      throws InvalidProtocolMessageException, IOException {
+      ClientProtocol.Message getAvailableServersResponseMessage) {
     assertNotNull(getAvailableServersResponseMessage);
-    assertEquals(1233445, getAvailableServersResponseMessage.getMessageHeader().getCorrelationId());
     assertEquals(ClientProtocol.Message.MessageTypeCase.RESPONSE,
         getAvailableServersResponseMessage.getMessageTypeCase());
     ClientProtocol.Response messageResponse = getAvailableServersResponseMessage.getResponse();

-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <commits@geode.apache.org>'].

Mime
View raw message