geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [42/44] incubator-geode git commit: GEODE-986 MultiuserAPIDUnitTest.testMultiUserUnsupportedAPIs failed with SocketException
Date Tue, 15 Mar 2016 00:24:25 GMT
GEODE-986 MultiuserAPIDUnitTest.testMultiUserUnsupportedAPIs failed with SocketException

Reactivated the TcpServer backward-compatibility test.  This test failed if
TcpClient thought that the locator was running 5.7 (I hand-sabotaged the
code to make it think the locator was 5.7) but it passes with 9a .0 fallback
default.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/aef84eb0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/aef84eb0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/aef84eb0

Branch: refs/heads/feature/GEODE-949-2
Commit: aef84eb091791312efba7d42bcde9b7f6436223c
Parents: d25e445
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
Authored: Mon Mar 14 09:31:08 2016 -0700
Committer: Bruce Schuchardt <bschuchardt@pivotal.io>
Committed: Mon Mar 14 09:34:52 2016 -0700

----------------------------------------------------------------------
 .../internal/tcpserver/TcpClient.java           | 16 +++-
 .../internal/tcpserver/TcpServer.java           |  0
 .../TcpServerBackwardCompatDUnitTest.java       | 97 +++++++-------------
 .../gemfire/test/dunit/DistributedTestCase.java |  2 +
 4 files changed, 44 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aef84eb0/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java
b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java
old mode 100644
new mode 100755
index dfcb78c..803f284
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java
@@ -105,8 +105,6 @@ public class TcpClient {
       ipAddr = new InetSocketAddress(addr, port); // fix for bug 30810
     }
     
-    logger.debug("TcpClient sending {} to {}", request, ipAddr);
-
     long giveupTime = System.currentTimeMillis() + timeout;
     
     // Get the GemFire version of the TcpServer first, before sending any other request.
@@ -128,6 +126,8 @@ public class TcpClient {
       return null;
     }
     
+    logger.debug("TcpClient sending {} to {}", request, ipAddr);
+
     Socket sock=SocketCreator.getDefaultInstance().connect(ipAddr.getAddress(), ipAddr.getPort(),
(int)newTimeout, null, false);
     sock.setSoTimeout((int)newTimeout);
     DataOutputStream out = null;
@@ -214,7 +214,7 @@ public class TcpClient {
       out.flush();
 
       DataInputStream in = new DataInputStream(sock.getInputStream());
-      in = new VersionedDataInputStream(in, Version.GFE_57); 
+      in = new VersionedDataInputStream(in, Version.GFE_90); 
       try {
         VersionResponse response = DataSerializer.readObject(in);
         if (response != null) {
@@ -239,13 +239,19 @@ public class TcpClient {
       logger.debug("Locator " + ipAddr + " did not respond to a request for its version.
 I will assume it is using v5.7 for safety.");
     }
     synchronized(serverVersions) {
-      serverVersions.put(ipAddr, Version.GFE_57.ordinal());
+      serverVersions.put(ipAddr, Version.GFE_90.ordinal());
     }
-    return Short.valueOf(Version.GFE_57.ordinal());
+    return Short.valueOf(Version.GFE_90.ordinal());
   }
 
   private TcpClient() {
     //static class
   }
+  
+  public static void clearStaticData() {
+    synchronized(serverVersions) {
+      serverVersions.clear();
+    }
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aef84eb0/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServer.java
b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServer.java
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aef84eb0/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java
index a66367b..3685ac4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java
@@ -32,8 +32,13 @@ import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
 import com.gemstone.gemfire.distributed.Locator;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
+import com.gemstone.gemfire.distributed.internal.membership.gms.locator.FindCoordinatorRequest;
+import com.gemstone.gemfire.distributed.internal.membership.gms.locator.FindCoordinatorResponse;
 import com.gemstone.gemfire.distributed.internal.tcpserver.TcpServer;
 import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.SocketCreator;
 import com.gemstone.gemfire.internal.Version;
 import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
@@ -51,7 +56,7 @@ import com.gemstone.gemfire.test.junit.categories.DistributedTest;
  *
  */
 @Category(DistributedTest.class)
-@Ignore("Test was disabled by renaming to DisabledTest")
+//@Ignore("Test was disabled by renaming to DisabledTest")
 public class TcpServerBackwardCompatDUnitTest extends DistributedTestCase {
 
   /**
@@ -98,18 +103,15 @@ public class TcpServerBackwardCompatDUnitTest extends DistributedTestCase
{
     final VM locatorRestart0 = host.getVM(2);
     final VM member = host.getVM(3);
 
+    int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+
     // Create properties for locator0
-    final int port0 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    final File logFile0 = new File(getUniqueName() + "-locator" + port0 + ".log");
+    final int port0 = ports[0];
+    final File logFile0 = null;//new File("");
     
     // Create properties for locator1
-    int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    while (port == port0) {
-      port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    }
-    final int port1 = port;
-
-    final File logFile1 = new File(getUniqueName() + "-locator" + port1 + ".log");
+    final int port1 = ports[1];
+    final File logFile1 = null;//new File("");
     
     final String locators = host.getHostName() + "[" + port0 + "]," +
                             host.getHostName() + "[" + port1 + "]";
@@ -118,6 +120,7 @@ public class TcpServerBackwardCompatDUnitTest extends DistributedTestCase
{
     props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
     props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
     props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
+    props.setProperty(DistributionConfig.LOG_LEVEL_NAME, "finest");
     
     // Start locator0 with props.
     //props.setProperty(DistributionConfig.START_LOCATOR_NAME, host.getHostName() + "["+port0+"]");
@@ -157,45 +160,20 @@ public class TcpServerBackwardCompatDUnitTest extends DistributedTestCase
{
           TcpServer.OLDTESTVERSION -= 100;
           TcpServer.getGossipVersionMapForTestOnly().put(TcpServer.TESTVERSION, Version.CURRENT_ORDINAL);
           TcpServer.getGossipVersionMapForTestOnly().put(TcpServer.OLDTESTVERSION, Version.GFE_57.ordinal());
-          assertEquals("Gossip Version and Test version are not same", TcpServer.GOSSIPVERSION,
TcpServer.TESTVERSION);
-          assertEquals("Previous Gossip Version and Test version are not same", TcpServer.OLDGOSSIPVERSION,
TcpServer.OLDTESTVERSION);
+//          assertEquals("Gossip Version and Test version are not same", TcpServer.GOSSIPVERSION,
TcpServer.TESTVERSION);
+//          assertEquals("Previous Gossip Version and Test version are not same", TcpServer.OLDGOSSIPVERSION,
TcpServer.OLDTESTVERSION);
 
           Locator.startLocatorAndDS(port1, logFile1, props);
 
           // Start a gossip client to connect to first locator "locator0".
-          fail("this test must be fixed to work with the jgroups replacement");
-          // TODO
-//          final GossipClient client = new GossipClient(new IpAddress(InetAddress.getLocalHost(),
port1),  500);
-//          client.register("mygroup1", new IpAddress(InetAddress.getLocalHost(), port1),
5000, false);
-
-          WaitCriterion ev = new WaitCriterion() {
-            public boolean done() {
-              try {
-                // TODO
-//                Vector members = client.getMembers("mygroup1", 
-//                    new IpAddress(InetAddress.getLocalHost(), port0), true, 5000);
-//                return members.size() == 2;
-              }
-              catch (Exception e) {
-                e.printStackTrace();
-                fail("unexpected exception");
-              }
-              return false; // NOTREACHED
-            }
-            public String description() {
-              return null;
-            }
-          };
+          FindCoordinatorRequest req = new FindCoordinatorRequest(new InternalDistributedMember(
+              SocketCreator.getLocalHost(), 1234));
+          FindCoordinatorResponse response = null;
           
-          Wait.waitForCriterion(ev, 1000, 200, true);
-          fail("this test must be fixed to work with the jgroups replacement");
-          // TODO
-//          Vector members = client.getMembers("mygroup1", new IpAddress(InetAddress.getLocalHost(),
port0), true, 5000);
-//          Assert.assertEquals(2, members.size());
-//          Assert.assertTrue(members.contains(new IpAddress(InetAddress.getLocalHost(),
port0)));
-//          Assert.assertTrue(members.contains(new IpAddress(InetAddress.getLocalHost(),
port1)));
+          response = (FindCoordinatorResponse)TcpClient.requestToServer(SocketCreator.getLocalHost(),
port1, req, 5000);
+          assertNotNull(response);
 
-        } catch (IOException e) {
+        } catch (Exception e) {
           com.gemstone.gemfire.test.dunit.Assert.fail("Locator1 start failed with Gossip
Version: " + TcpServer.GOSSIPVERSION + "!", e);
         }
       }
@@ -222,33 +200,20 @@ public class TcpServerBackwardCompatDUnitTest extends DistributedTestCase
{
           TcpServer.OLDTESTVERSION -= 100;
           TcpServer.getGossipVersionMapForTestOnly().put(TcpServer.TESTVERSION, Version.CURRENT_ORDINAL);
           TcpServer.getGossipVersionMapForTestOnly().put(TcpServer.OLDTESTVERSION, Version.GFE_57.ordinal());
-          assertEquals("Gossip Version and Test version are not same", TcpServer.GOSSIPVERSION,
TcpServer.TESTVERSION);
-          assertEquals("Previous Gossip Version and Test version are not same", TcpServer.OLDGOSSIPVERSION,
TcpServer.OLDTESTVERSION);
+//          assertEquals("Gossip Version and Test version are not same", TcpServer.GOSSIPVERSION,
TcpServer.TESTVERSION);
+//          assertEquals("Previous Gossip Version and Test version are not same", TcpServer.OLDGOSSIPVERSION,
TcpServer.OLDTESTVERSION);
 
           Locator.startLocatorAndDS(port0, logFile0, props);
 
-          // A new gossip client with new GOSSIPVERSION must be able
-          // to connect with new locator on port1, remote locator.
-          // Reuse locator0 VM.
-          fail("this test must be fixed to work with the jgroups replacement");
-          // TODO
-//          final GossipClient client2 = new GossipClient(new IpAddress(InetAddress.getLocalHost(),
port1),  500);
-//          Vector<IpAddress> members = client2.getMembers("mygroup1", new IpAddress(InetAddress.getLocalHost(),
port1), true, 5000);
-//          Assert.assertEquals(2, members.size());
-          // As they are coming from other locator, their pid is of other locator process.
-//          getLogWriter().info(members.get(0) + " " + members.get(1));
-
-          // TODO
-//          for (IpAddress ipAddr : members) {
-//            int port = ipAddr.getPort();
-//            String hostname = ipAddr.getIpAddress().getHostAddress();
-//            int pid = ipAddr.getProcessId();
-//            Assert.assertTrue(" " + ipAddr, port == port0 || port == port1);
-//            Assert.assertTrue(" " + ipAddr, hostname.equals(InetAddress.getLocalHost().getHostAddress()));
-//            Assert.assertTrue(" " + ipAddr, pid == locator1.getPid());
-//          }
+          // Start a gossip client to connect to first locator "locator0".
+          FindCoordinatorRequest req = new FindCoordinatorRequest(new InternalDistributedMember(
+              SocketCreator.getLocalHost(), 1234));
+          FindCoordinatorResponse response = null;
+          
+          response = (FindCoordinatorResponse)TcpClient.requestToServer(SocketCreator.getLocalHost(),
port0, req, 5000);
+          assertNotNull(response);
 
-        } catch (IOException e) {
+        } catch (Exception e) {
           com.gemstone.gemfire.test.dunit.Assert.fail("Locator0 start failed with Gossip
Version: " + TcpServer.GOSSIPVERSION + "!", e);
         }
       }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aef84eb0/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestCase.java
b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestCase.java
index c7227a2..4f656fd 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestCase.java
@@ -42,6 +42,7 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem.CreationStackGenerator;
+import com.gemstone.gemfire.distributed.internal.tcpserver.TcpClient;
 import com.gemstone.gemfire.internal.SocketCreator;
 import com.gemstone.gemfire.internal.admin.ClientStatsManager;
 import com.gemstone.gemfire.internal.cache.DiskStoreObserver;
@@ -487,6 +488,7 @@ public abstract class DistributedTestCase extends TestCase implements
java.io.Se
     RegionTestCase.preSnapshotRegion = null;
     SocketCreator.resetHostNameCache();
     SocketCreator.resolve_dns = true;
+    TcpClient.clearStaticData();
 
     // clear system properties -- keep alphabetized
     System.clearProperty("gemfire.log-level");


Mime
View raw message