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

dschneider 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 eea1001  GEODE-9781: clean up radish sys props (#7080)
eea1001 is described below

commit eea10019d65f68b9ab1303762f568844e1755bbd
Author: Darrel Schneider <[email protected]>
AuthorDate: Fri Nov 5 09:32:15 2021 -0700

    GEODE-9781: clean up radish sys props (#7080)
    
    * all geode-for-redis system property names are now defined in 
RedisProperties.
    A check is now done that the property name has the required prefix.
    Warnings are logged if the system property is set to a value that will not 
be used.
    
    * AuthIntegrationTest was trying to test with a non-default region name by 
setting
    the system property "REDIS_REGION_NAME_PROPERTY" in 
setupCacheWithRegionName.
    But this actually did nothing and geode still used the default. The problem 
was that
    the constant was not actually the name of the system property. It now is 
and this test
    should now be using a non-default region name.
    
    * if the bucket sys prop is greater than 16384 it will now log a warning 
and use the default number of buckets. It used to fail the redis server startup.
    
    * RedisPropertiesTest now uses RestoreSystemProperties rule
---
 .../geode/redis/internal/RedisProperties.java      |  88 ++++++++++++----
 .../geode/redis/internal/RegionProvider.java       |  26 ++---
 .../redis/internal/netty/ByteToCommandDecoder.java |  12 +--
 .../geode/redis/internal/RedisPropertiesTest.java  | 114 ++++++++++++---------
 .../redis/internal/RegionProviderJUnitTest.java    |  36 -------
 5 files changed, 147 insertions(+), 129 deletions(-)

diff --git 
a/geode-for-redis/src/main/java/org/apache/geode/redis/internal/RedisProperties.java
 
b/geode-for-redis/src/main/java/org/apache/geode/redis/internal/RedisProperties.java
index 58ce3fe2..4efdde4 100644
--- 
a/geode-for-redis/src/main/java/org/apache/geode/redis/internal/RedisProperties.java
+++ 
b/geode-for-redis/src/main/java/org/apache/geode/redis/internal/RedisProperties.java
@@ -16,38 +16,90 @@
 package org.apache.geode.redis.internal;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.logging.internal.log4j.api.LogService;
 
 public class RedisProperties {
-  /** System Property Names **/
-  public static final String REDIS_REGION_NAME_PROPERTY = 
"geode-for-redis-region-name";
-  public static final String WRITE_TIMEOUT_SECONDS = 
"geode-for-redis-write-timeout-seconds";
-  public static final String EXPIRATION_INTERVAL_SECONDS =
-      "geode-for-redis-expiration-interval-seconds";
+  private static final Logger logger = LogService.getLogger();
+
+  private static final String PREFIX = "geode.geode-for-redis-";
+  public static final String REDIS_REGION_NAME_PROPERTY = PREFIX + 
"region-name";
+  public static final String WRITE_TIMEOUT_SECONDS = PREFIX + 
"write-timeout-seconds";
+  public static final String EXPIRATION_INTERVAL_SECONDS = PREFIX + 
"expiration-interval-seconds";
+  public static final String REGION_BUCKETS = PREFIX + "region-buckets";
+  public static final String UNAUTHENTICATED_MAX_ARRAY_SIZE =
+      PREFIX + "unauthenticated-max-array-size";
+  public static final String UNAUTHENTICATED_MAX_BULK_STRING_LENGTH =
+      PREFIX + "unauthenticated-max-bulk-string-length";
+
+
+  private static String convertToGemfire(String geodeName) {
+    return "gemfire." + geodeName.substring("geode.".length());
+  }
+
+  private static void validatePropertyName(String geodeName) {
+    if (!geodeName.startsWith(PREFIX)) {
+      throw new IllegalStateException("Property names must start with \"" + 
PREFIX + "\"");
+    }
+  }
 
   public static String getStringSystemProperty(String propName, String 
defaultValue) {
-    String geodeValue = System.getProperty("geode." + propName, defaultValue);
-    String gemfireValue = System.getProperty("gemfire." + propName, 
defaultValue);
+    validatePropertyName(propName);
 
-    if (StringUtils.isNotEmpty(geodeValue) && 
!geodeValue.equals(defaultValue)) {
+    String geodeValue = System.getProperty(propName);
+    if (StringUtils.isNotEmpty(geodeValue)) {
       return geodeValue;
-    } else if (StringUtils.isNotEmpty(gemfireValue) && 
!gemfireValue.equals(defaultValue)) {
+    }
+
+    String gemfireValue = System.getProperty(convertToGemfire(propName));
+    if (StringUtils.isNotEmpty(gemfireValue)) {
       return gemfireValue;
-    } else {
-      return defaultValue;
     }
+
+    return defaultValue;
   }
 
-  /** assumes that default is greater than or equal to minValue **/
   public static int getIntegerSystemProperty(String propName, int 
defaultValue, int minValue) {
-    int geodeValue = Integer.getInteger("geode." + propName, defaultValue);
-    int gemfireValue = Integer.getInteger("gemfire." + propName, defaultValue);
+    return getIntegerSystemProperty(propName, defaultValue, minValue, 
Integer.MAX_VALUE);
+  }
 
-    if (geodeValue != defaultValue && geodeValue >= minValue) {
+  public static int getIntegerSystemProperty(String propName, int 
defaultValue, int minValue,
+      int maxValue) {
+    validatePropertyName(propName);
+
+    int geodeValue = getIntegerFromProperty(propName, defaultValue, minValue, 
maxValue);
+    if (geodeValue != defaultValue) {
       return geodeValue;
-    } else if (gemfireValue != defaultValue && gemfireValue >= minValue) {
-      return gemfireValue;
-    } else {
+    }
+
+    return getIntegerFromProperty(convertToGemfire(propName), defaultValue, 
minValue, maxValue);
+  }
+
+  private static int getIntegerFromProperty(String propName, int defaultValue, 
int minValue,
+      int maxValue) {
+    String stringValue = System.getProperty(propName);
+    if (stringValue == null) {
+      return defaultValue;
+    }
+    int intValue;
+    try {
+      intValue = Integer.decode(stringValue);
+    } catch (NumberFormatException e) {
+      logger.warn("Ignoring system property \"" + propName + "\" because it's 
value of \""
+          + stringValue + "\" is not a valid integer. Defaulting to " + 
defaultValue);
+      return defaultValue;
+    }
+    if (intValue < minValue) {
+      logger.warn("Ignoring system property \"" + propName + "\" because it's 
value of \""
+          + intValue + "\" is less than \"" + minValue + "\". Defaulting to " 
+ defaultValue);
+      return defaultValue;
+    }
+    if (intValue > maxValue) {
+      logger.warn("Ignoring system property \"" + propName + "\" because it's 
value of \""
+          + intValue + "\" is greater than \"" + maxValue + "\". Defaulting to 
" + defaultValue);
       return defaultValue;
     }
+    return intValue;
   }
 }
diff --git 
a/geode-for-redis/src/main/java/org/apache/geode/redis/internal/RegionProvider.java
 
b/geode-for-redis/src/main/java/org/apache/geode/redis/internal/RegionProvider.java
index 437e253..4d7c109 100644
--- 
a/geode-for-redis/src/main/java/org/apache/geode/redis/internal/RegionProvider.java
+++ 
b/geode-for-redis/src/main/java/org/apache/geode/redis/internal/RegionProvider.java
@@ -15,6 +15,8 @@
 package org.apache.geode.redis.internal;
 
 import static 
org.apache.geode.redis.internal.RedisProperties.REDIS_REGION_NAME_PROPERTY;
+import static org.apache.geode.redis.internal.RedisProperties.REGION_BUCKETS;
+import static 
org.apache.geode.redis.internal.RedisProperties.getIntegerSystemProperty;
 import static 
org.apache.geode.redis.internal.RedisProperties.getStringSystemProperty;
 import static 
org.apache.geode.redis.internal.data.NullRedisDataStructures.NULL_REDIS_STRING;
 import static org.apache.geode.redis.internal.data.RedisDataType.REDIS_DATA;
@@ -41,7 +43,6 @@ import 
org.apache.geode.internal.cache.control.HeapMemoryMonitor;
 import org.apache.geode.internal.cache.control.InternalResourceManager;
 import org.apache.geode.internal.cache.control.MemoryThresholds;
 import org.apache.geode.internal.cache.execute.BucketMovedException;
-import org.apache.geode.management.ManagementException;
 import org.apache.geode.redis.internal.cluster.RedisMemberInfo;
 import org.apache.geode.redis.internal.data.RedisData;
 import org.apache.geode.redis.internal.data.RedisDataMovedException;
@@ -59,13 +60,13 @@ public class RegionProvider {
    * The name of the region that holds data stored in redis.
    */
   public static final String DEFAULT_REDIS_REGION_NAME = "GEODE_FOR_REDIS";
-  public static final String REDIS_REGION_BUCKETS_PARAM = 
"redis.region.buckets";
+  public static final String REDIS_REGION_BUCKETS_PARAM = REGION_BUCKETS;
+
+  public static final int REDIS_SLOTS = 16384;
 
   // Ideally the bucket count should be a power of 2, but technically it is 
not required.
   public static final int REDIS_REGION_BUCKETS =
-      Integer.getInteger(REDIS_REGION_BUCKETS_PARAM, 128);
-
-  public static final int REDIS_SLOTS = 16384;
+      getIntegerSystemProperty(REDIS_REGION_BUCKETS_PARAM, 128, 1, 
REDIS_SLOTS);
 
   public static final int REDIS_SLOTS_PER_BUCKET = REDIS_SLOTS / 
REDIS_REGION_BUCKETS;
 
@@ -79,8 +80,6 @@ public class RegionProvider {
 
   public RegionProvider(InternalCache cache, StripedCoordinator 
stripedCoordinator,
       RedisStats redisStats) {
-    validateBucketCount(REDIS_REGION_BUCKETS);
-
     this.stripedCoordinator = stripedCoordinator;
     this.redisStats = redisStats;
 
@@ -277,19 +276,6 @@ public class RegionProvider {
     return checkStringTypeIgnoringMismatch(redisData);
   }
 
-  /**
-   * Validates that the value passed in is not greater than {@link 
#REDIS_SLOTS}.
-   *
-   * @throws ManagementException if there is a problem with the value
-   */
-  protected static void validateBucketCount(int buckets) {
-    if (buckets > REDIS_SLOTS) {
-      throw new ManagementException(String.format(
-          "Could not start server compatible with Redis - System property '%s' 
must be <= %d",
-          REDIS_REGION_BUCKETS_PARAM, REDIS_SLOTS));
-    }
-  }
-
   @SuppressWarnings("unchecked")
   public Set<DistributedMember> getRemoteRegionMembers() {
     return (Set<DistributedMember>) (Set<?>) 
partitionedRegion.getRegionAdvisor().adviseDataStore();
diff --git 
a/geode-for-redis/src/main/java/org/apache/geode/redis/internal/netty/ByteToCommandDecoder.java
 
b/geode-for-redis/src/main/java/org/apache/geode/redis/internal/netty/ByteToCommandDecoder.java
index 28ee3fe..fa1d281 100644
--- 
a/geode-for-redis/src/main/java/org/apache/geode/redis/internal/netty/ByteToCommandDecoder.java
+++ 
b/geode-for-redis/src/main/java/org/apache/geode/redis/internal/netty/ByteToCommandDecoder.java
@@ -17,6 +17,7 @@ package org.apache.geode.redis.internal.netty;
 
 import static 
org.apache.geode.redis.internal.RedisConstants.ERROR_UNAUTHENTICATED_BULK;
 import static 
org.apache.geode.redis.internal.RedisConstants.ERROR_UNAUTHENTICATED_MULTIBULK;
+import static 
org.apache.geode.redis.internal.RedisProperties.getIntegerSystemProperty;
 import static 
org.apache.geode.redis.internal.netty.StringBytesGlossary.ARRAY_ID;
 import static 
org.apache.geode.redis.internal.netty.StringBytesGlossary.BULK_STRING_ID;
 import static org.apache.geode.redis.internal.netty.StringBytesGlossary.bCRLF;
@@ -31,6 +32,7 @@ import io.netty.channel.ChannelId;
 import io.netty.handler.codec.ByteToMessageDecoder;
 
 import org.apache.geode.redis.internal.RedisException;
+import org.apache.geode.redis.internal.RedisProperties;
 import org.apache.geode.redis.internal.services.RedisSecurityService;
 import org.apache.geode.redis.internal.statistics.RedisStats;
 
@@ -49,18 +51,12 @@ import 
org.apache.geode.redis.internal.statistics.RedisStats;
  * proper Redis client.
  */
 public class ByteToCommandDecoder extends ByteToMessageDecoder {
-
-  public static final String UNAUTHENTICATED_MAX_ARRAY_SIZE_PARAM =
-      "gemfire.geode-for-redis-unauthenticated-max-array-size";
-  public static final String UNAUTHENTICATED_MAX_BULK_STRING_LENGTH_PARAM =
-      "gemfire.geode-for-redis-unauthenticated-max-bulk-string-length";
-
   private static final int MAX_BULK_STRING_LENGTH = 512 * 1024 * 1024; // 512 
MB
   // These 2 defaults are taken from native Redis
   public static final int UNAUTHENTICATED_MAX_ARRAY_SIZE =
-      Integer.getInteger(UNAUTHENTICATED_MAX_ARRAY_SIZE_PARAM, 10);
+      getIntegerSystemProperty(RedisProperties.UNAUTHENTICATED_MAX_ARRAY_SIZE, 
10, 1);
   public static final int UNAUTHENTICATED_MAX_BULK_STRING_LENGTH =
-      Integer.getInteger(UNAUTHENTICATED_MAX_BULK_STRING_LENGTH_PARAM, 16384);
+      
getIntegerSystemProperty(RedisProperties.UNAUTHENTICATED_MAX_BULK_STRING_LENGTH,
 16384, 1);
 
   private final RedisStats redisStats;
   private final RedisSecurityService securityService;
diff --git 
a/geode-for-redis/src/test/java/org/apache/geode/redis/internal/RedisPropertiesTest.java
 
b/geode-for-redis/src/test/java/org/apache/geode/redis/internal/RedisPropertiesTest.java
index 3076325..a820031 100644
--- 
a/geode-for-redis/src/test/java/org/apache/geode/redis/internal/RedisPropertiesTest.java
+++ 
b/geode-for-redis/src/test/java/org/apache/geode/redis/internal/RedisPropertiesTest.java
@@ -18,132 +18,152 @@ package org.apache.geode.redis.internal;
 import static 
org.apache.geode.redis.internal.RedisProperties.getIntegerSystemProperty;
 import static 
org.apache.geode.redis.internal.RedisProperties.getStringSystemProperty;
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
 
 public class RedisPropertiesTest {
-  private final String geodePrefix = "geode.";
-  private final String gemfirePrefix = "gemfire.";
-  private final String propName = "prop-name";
+
+  @Rule
+  public RestoreSystemProperties restoreSystemProperties = new 
RestoreSystemProperties();
+
+  private final String basePropName = "prop-name";
+  private final String propName = "geode.geode-for-redis-" + basePropName;
+  private final String gemfirePropName = "gemfire.geode-for-redis-" + 
basePropName;
   private final String defaultValue = "default";
 
   @Test
   public void 
getIntegerSystemProperty_shouldReturnSpecifiedDefault_whenNeitherPrefixIsSet() {
-    assertThat(getIntegerSystemProperty("prop.name", 5, 0)).isEqualTo(5);
+    assertThat(getIntegerSystemProperty(propName, 5, 0)).isEqualTo(5);
   }
 
   @Test
   public void 
getIntegerSystemProperty_shouldReturnSpecifiedDefault_whenSetToEmptyString() {
-    System.setProperty("geode.prop.name0", "");
-    assertThat(getIntegerSystemProperty("prop.name0", 5, 0)).isEqualTo(5);
+    System.setProperty(propName, "");
+    assertThat(getIntegerSystemProperty(propName, 5, 0)).isEqualTo(5);
   }
 
   @Test
   public void 
getIntegerSystemProperty_shouldReturnSpecifiedDefault_whenSetToNonIntegerString()
 {
-    System.setProperty("geode.prop.name0", "nonintegervalue");
-    assertThat(getIntegerSystemProperty("prop.name0", 5, 0)).isEqualTo(5);
+    System.setProperty(propName, "nonintegervalue");
+    assertThat(getIntegerSystemProperty(propName, 5, 0)).isEqualTo(5);
   }
 
   @Test
   public void 
getIntegerSystemProperty_shouldReturnSpecifiedDefault_whenSetToIntegerOutOfRange()
 {
-    System.setProperty("geode.prop.name1", "-5");
-    assertThat(getIntegerSystemProperty("prop.name1", 5, 0)).isEqualTo(5);
+    System.setProperty(propName, "-5");
+    assertThat(getIntegerSystemProperty(propName, 5, 0)).isEqualTo(5);
   }
 
   @Test
   public void 
getIntegerSystemProperty_shouldReturnSetValue_whenSetToIntegerInRange() {
-    System.setProperty("geode.prop.name2", "10");
-    assertThat(getIntegerSystemProperty("prop.name2", 5, 0)).isEqualTo(10);
+    System.setProperty(propName, "10");
+    assertThat(getIntegerSystemProperty(propName, 5, 0)).isEqualTo(10);
   }
 
   @Test
   public void 
getIntegerSystemProperty_shouldDefaultToGeodePrefix_whenGemfireAlsoSet() {
-    System.setProperty("geode.prop.name3", "15");
-    System.setProperty("gemfire.prop.name3", "16");
-    assertThat(getIntegerSystemProperty("prop.name3", 5, 0))
-        .isEqualTo(15);
+    System.setProperty(propName, "15");
+    System.setProperty(gemfirePropName, "16");
+    assertThat(getIntegerSystemProperty(propName, 5, 0)).isEqualTo(15);
   }
 
   @Test
   public void 
getIntegerSystemProperty_shouldUseGemfirePrefix_whenGeodePrefixOutOfRange() {
-    System.setProperty("geode.prop.name4", "-1");
-    System.setProperty("gemfire.prop.name4", "42");
-    assertThat(getIntegerSystemProperty("prop.name4", 3, 0)).isEqualTo(42);
+    System.setProperty(propName, "-1");
+    System.setProperty(gemfirePropName, "42");
+    assertThat(getIntegerSystemProperty(propName, 3, 0)).isEqualTo(42);
+  }
+
+  @Test
+  public void 
getIntegerSystemProperty_shouldUseDefault_whenSetValuesAreLessThanMin() {
+    System.setProperty(propName, "-1");
+    System.setProperty(gemfirePropName, "-2");
+    assertThat(getIntegerSystemProperty(propName, 5, 0)).isEqualTo(5);
   }
 
   @Test
-  public void 
getIntegerSystemProperty_shouldUseDefault_whenPrefixesAreOutOfRange() {
-    System.setProperty("geode.prop.name5", "-1");
-    System.setProperty("gemfire.prop.name5", "-2");
-    assertThat(getIntegerSystemProperty("prop.name5", 5, 0)).isEqualTo(5);
+  public void 
getIntegerSystemProperty_shouldUseDefault_whenSetValuesAreMoreThanMax() {
+    System.setProperty(propName, "100");
+    System.setProperty(gemfirePropName, "200");
+    assertThat(getIntegerSystemProperty(propName, 5, 0, 50)).isEqualTo(5);
   }
 
   @Test
   public void 
getIntegerSystemProperty_shouldUseGemfirePrefix_whenGeodeNotSet() {
-    System.setProperty("gemfire.prop.name6", "72");
-    assertThat(getIntegerSystemProperty("prop.name6", 5, 0)).isEqualTo(72);
+    System.setProperty(gemfirePropName, "72");
+    assertThat(getIntegerSystemProperty(propName, 5, 0)).isEqualTo(72);
   }
 
   @Test
   public void 
getIntegerSystemProperty_shouldUseSetValue_whenSetToMinimumValue() {
-    System.setProperty("geode.prop.name7", "42");
-    assertThat(getIntegerSystemProperty("prop.name7", 5, 42)).isEqualTo(42);
+    System.setProperty(propName, "42");
+    assertThat(getIntegerSystemProperty(propName, 5, 42)).isEqualTo(42);
+  }
+
+  @Test
+  public void 
getIntegerSystemProperty_shouldUseSetValue_whenSetToMaximumValue() {
+    System.setProperty(propName, "42");
+    assertThat(getIntegerSystemProperty(propName, 5, 0, 42)).isEqualTo(42);
   }
 
   @Test
   public void 
getStringSystemProperty_shouldReturnSpecifiedDefault_whenNeitherAreSet() {
-    clearSystemProperties(propName);
     assertThat(getStringSystemProperty(propName, 
defaultValue)).isEqualTo(defaultValue);
   }
 
   @Test
   public void 
getStringSystemProperty_shouldReturnSpecifiedDefault_whenSetToEmptyString_whenFalse()
 {
-    System.setProperty(geodePrefix + propName, "");
+    System.setProperty(propName, "");
     assertThat(getStringSystemProperty(propName, 
defaultValue)).isEqualTo(defaultValue);
-    clearSystemProperties(propName);
   }
 
   @Test
   public void getStringSystemProperty_shouldReturnString_whenSet() {
-    System.setProperty(geodePrefix + propName, "not default");
+    System.setProperty(propName, "not default");
     assertThat(getStringSystemProperty(propName, defaultValue)).isEqualTo("not 
default");
-    clearSystemProperties(propName);
   }
 
   @Test
   public void 
getStringSystemProperty_shouldDefaultToGeodePrefix_whenBothAreSet() {
-    System.setProperty(geodePrefix + propName, "String1");
-    System.setProperty(gemfirePrefix + propName, "String2");
+    System.setProperty(propName, "String1");
+    System.setProperty(gemfirePropName, "String2");
     assertThat(getStringSystemProperty(propName, 
defaultValue)).isEqualTo("String1");
-    clearSystemProperties(propName);
   }
 
   @Test
   public void getStringSystemProperty_shouldUseGemfirePrefix_whenGeodeNotSet() 
{
-    System.setProperty(gemfirePrefix + propName, "String1");
+    System.setProperty(gemfirePropName, "String1");
     assertThat(getStringSystemProperty(propName, 
defaultValue)).isEqualTo("String1");
-    clearSystemProperties(propName);
   }
 
   @Test
   public void 
getStringSystemProperty_shouldUseDefault_whenBothSetToEmptyString() {
-    System.setProperty(geodePrefix + propName, "");
-    System.setProperty(gemfirePrefix + propName, "");
+    System.setProperty(propName, "");
+    System.setProperty(gemfirePropName, "");
     assertThat(getStringSystemProperty(propName, 
defaultValue)).isEqualTo(defaultValue);
-    clearSystemProperties(propName);
   }
 
   @Test
   public void 
getStringSystemProperty_shouldUseGemfirePrefix_whenGeodeSetToEmptyString() {
-    System.setProperty(geodePrefix + propName, "");
-    System.setProperty(gemfirePrefix + propName, "String1");
+    System.setProperty(propName, "");
+    System.setProperty(gemfirePropName, "String1");
     assertThat(getStringSystemProperty(propName, 
defaultValue)).isEqualTo("String1");
-    clearSystemProperties(propName);
   }
 
-  /************* Helper Methods *************/
-  private void clearSystemProperties(String property) {
-    System.clearProperty(geodePrefix + property);
-    System.clearProperty(gemfirePrefix + property);
+  @Test
+  public void getStringSystemProperty_throwsException_givenUnprefixedName() {
+    assertThatThrownBy(
+        () -> getStringSystemProperty("foo", ""))
+            .hasMessageContaining("Property names must start with");
+  }
+
+  @Test
+  public void getIntegerSystemProperty_throwsException_givenUnprefixedName() {
+    assertThatThrownBy(
+        () -> getIntegerSystemProperty("foo", 0, 0))
+            .hasMessageContaining("Property names must start with");
   }
 }
diff --git 
a/geode-for-redis/src/test/java/org/apache/geode/redis/internal/RegionProviderJUnitTest.java
 
b/geode-for-redis/src/test/java/org/apache/geode/redis/internal/RegionProviderJUnitTest.java
deleted file mode 100644
index b493218..0000000
--- 
a/geode-for-redis/src/test/java/org/apache/geode/redis/internal/RegionProviderJUnitTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.redis.internal;
-
-import static org.assertj.core.api.Assertions.assertThatNoException;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-import org.junit.Test;
-
-public class RegionProviderJUnitTest {
-
-  @Test
-  public void testBucket_whenPowerOfTwo() {
-    assertThatNoException().isThrownBy(() -> 
RegionProvider.validateBucketCount(128));
-  }
-
-  @Test
-  public void testException_whenGreaterThanSlots() {
-    assertThatThrownBy(() -> RegionProvider.validateBucketCount(32768))
-        .hasMessageContaining("System property 'redis.region.buckets' must be 
<= 16384");
-  }
-
-}

Reply via email to