You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by pi...@apache.org on 2018/03/23 16:33:00 UTC

[geode] branch develop updated: GEODE-3881: Prevent illegal region names in the unit tests. (#1668)

This is an automated email from the ASF dual-hosted git repository.

pivotalsarge 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 3f2bae8  GEODE-3881: Prevent illegal region names in the unit tests. (#1668)
3f2bae8 is described below

commit 3f2bae860e6438e5800bd4c7e6bf3945a3c3283c
Author: Michael "Sarge" Dodge <md...@pivotal.io>
AuthorDate: Fri Mar 23 09:32:57 2018 -0700

    GEODE-3881: Prevent illegal region names in the unit tests. (#1668)
---
 .../main/java/org/apache/geode/redis/GeodeRedisServer.java |  7 +------
 .../test/java/org/apache/geode/redis/SetsJUnitTest.java    | 14 ++++++--------
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisServer.java b/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisServer.java
index 4087418..afa6640 100644
--- a/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisServer.java
+++ b/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisServer.java
@@ -144,7 +144,6 @@ import org.apache.geode.redis.internal.RegionProvider;
 
 @Experimental
 public class GeodeRedisServer {
-
   /**
    * Thread used to start main method
    */
@@ -236,7 +235,7 @@ public class GeodeRedisServer {
    * The field that defines the name of the {@link Region} which holds all of the Redis meta data.
    * The current value of this field is {@code REDIS_META_DATA_REGION}.
    */
-  public static final String REDIS_META_DATA_REGION = "__ReDiS_MeTa_DaTa";
+  public static final String REDIS_META_DATA_REGION = "ReDiS_MeTa_DaTa";
 
   /**
    * The system property name used to set the default {@link Region} creation type. The property
@@ -493,7 +492,6 @@ public class GeodeRedisServer {
         t.setDaemon(true);
         return t;
       }
-
     };
 
     ThreadFactory workerThreadFactory = new ThreadFactory() {
@@ -505,7 +503,6 @@ public class GeodeRedisServer {
         t.setName("GeodeRedisServer-WorkerThread-" + counter.incrementAndGet());
         return t;
       }
-
     };
 
     bossGroup = null;
@@ -596,7 +593,6 @@ public class GeodeRedisServer {
   }
 
   private class MetaCacheListener extends CacheListenerAdapter<String, RedisDataType> {
-
     @Override
     public void afterCreate(EntryEvent<String, RedisDataType> event) {
       afterKeyCreate(event);
@@ -735,5 +731,4 @@ public class GeodeRedisServer {
     }
     return logLevel;
   }
-
 }
diff --git a/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
index 2122570..e179258 100755
--- a/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
@@ -40,7 +40,6 @@ import org.apache.geode.test.junit.categories.IntegrationTest;
 
 @Category(IntegrationTest.class)
 public class SetsJUnitTest {
-
   private static Jedis jedis;
   private static GeodeRedisServer server;
   private static GemFireCache cache;
@@ -51,7 +50,6 @@ public class SetsJUnitTest {
   public static void setUp() throws IOException {
     rand = new Random();
     CacheFactory cf = new CacheFactory();
-    // cf.set("log-file", "redis.log");
     cf.set(LOG_LEVEL, "error");
     cf.set(MCAST_PORT, "0");
     cf.set(LOCATORS, "");
@@ -160,7 +158,6 @@ public class SetsJUnitTest {
     Set<String> destResult = jedis.smembers(destination);
 
     assertEquals(result, destResult);
-
   }
 
   @Test
@@ -196,7 +193,6 @@ public class SetsJUnitTest {
     Set<String> destResult = jedis.smembers(destination);
 
     assertEquals(result, destResult);
-
   }
 
   @Test
@@ -232,16 +228,18 @@ public class SetsJUnitTest {
     Set<String> destResult = jedis.smembers(destination);
 
     assertEquals(result, destResult);
-
   }
 
   private String randString() {
     int length = rand.nextInt(8) + 5;
     StringBuilder rString = new StringBuilder();
-    for (int i = 0; i < length; i++)
-      rString.append((char) (rand.nextInt(57) + 65));
+    for (int i = 0; i < length; i++) {
+      // Use random upper- and lower-case letters only. Using punctuation characters,
+      // namely the underscore, can lead to spurious test failures due to invalid region
+      // names, e.g., two leading underscores.
+      rString.append((char) (65 + rand.nextInt(26) + (rand.nextBoolean() ? 26 : 0)));
+    }
     return rString.toString();
-    // return Long.toHexString(Double.doubleToLongBits(Math.random()));
   }
 
   @After

-- 
To stop receiving notification emails like this one, please contact
pivotalsarge@apache.org.