Github user pivotal-amurmann commented on a diff in the pull request: https://github.com/apache/geode/pull/673#discussion_r130646935 --- Diff: geode-protobuf/src/test/java/org/apache/geode/protocol/GetAvailableServersDUnitTest.java --- @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.protocol; + +import org.apache.geode.cache.server.CacheServer; +import org.apache.geode.internal.cache.InternalCache; +import org.apache.geode.protocol.exception.InvalidProtocolMessageException; +import org.apache.geode.protocol.protobuf.ClientProtocol; +import org.apache.geode.protocol.protobuf.ServerAPI; +import org.apache.geode.protocol.protobuf.serializer.ProtobufProtocolSerializer; +import org.apache.geode.protocol.protobuf.utilities.ProtobufRequestUtilities; +import org.apache.geode.protocol.protobuf.utilities.ProtobufUtilities; +import org.apache.geode.test.dunit.DistributedTestUtils; +import org.apache.geode.test.dunit.Host; +import org.apache.geode.test.dunit.VM; +import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase; +import org.apache.geode.test.dunit.rules.DistributedRestoreSystemProperties; +import org.apache.geode.test.junit.categories.DistributedTest; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.io.IOException; +import java.net.Socket; + +import static org.junit.Assert.assertEquals; + +@Category(DistributedTest.class) +public class GetAvailableServersDUnitTest extends JUnit4CacheTestCase { + + @Rule + public DistributedRestoreSystemProperties distributedRestoreSystemProperties = + new DistributedRestoreSystemProperties(); + + @Before + public void setup() { + + } + + @Test + public void testGetAllAvailableServersRequest() + throws IOException, InvalidProtocolMessageException { + Host host = Host.getHost(0); + VM vm0 = host.getVM(0); + VM vm1 = host.getVM(1); + VM vm2 = host.getVM(2); + + int locatorPort = DistributedTestUtils.getDUnitLocatorPort(); + + // int cacheServer1Port = vm0.invoke("Start Cache1", () -> startCacheWithCacheServer()); + int cacheServer1Port = startCacheWithCacheServer(); + int cacheServer2Port = vm1.invoke("Start Cache2", () -> startCacheWithCacheServer()); + int cacheServer3Port = vm2.invoke("Start Cache3", () -> startCacheWithCacheServer()); + + vm0.invoke(() -> { + Socket socket = new Socket(host.getHostName(), cacheServer1Port); + socket.getOutputStream().write(110); + + ClientProtocol.Request.Builder protobufRequestBuilder = + ProtobufUtilities.createProtobufRequestBuilder(); + ClientProtocol.Message getAvailableServersRequestMessage = + ProtobufUtilities.createProtobufMessage(ProtobufUtilities.createMessageHeader(1233445), --- End diff -- nit pick: Could we move the first param to the line below, so that is lines up with the second one? That would make this much more readable. Not sure if spotless hates that though.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---