Github user kjduling commented on a diff in the pull request:

    https://github.com/apache/incubator-geode/pull/285#discussion_r88080988
  
    --- Diff: 
geode-core/src/test/java/org/apache/geode/cache/RegionNameValidationJUnitTest.java
 ---
    @@ -0,0 +1,75 @@
    +package org.apache.geode.cache;
    +
    +import static org.junit.Assert.fail;
    +
    +import org.apache.geode.internal.cache.InternalRegionArguments;
    +import org.apache.geode.internal.cache.LocalRegion;
    +import org.apache.geode.test.junit.categories.UnitTest;
    +import org.junit.Test;
    +import org.junit.experimental.categories.Category;
    +
    +import java.util.regex.Matcher;
    +import java.util.regex.Pattern;
    +
    +@Category(UnitTest.class)
    +public class RegionNameValidationJUnitTest {
    +  private static final Pattern NAME_PATTERN = 
Pattern.compile("[aA-zZ0-9-_.]+");
    +  private static final String REGION_NAME = "MyRegion";
    +
    +
    +  @Test
    +  public void testInvalidNames() {
    +    InternalRegionArguments ira = new InternalRegionArguments();
    +    ira.setInternalRegion(false);
    +    try {
    +      LocalRegion.validateRegionName(null, ira);
    +      fail();
    +    } catch (IllegalArgumentException ignore) {
    +    }
    +    try {
    +      LocalRegion.validateRegionName("", ira);
    +      fail();
    +    } catch (IllegalArgumentException ignore) {
    +    }
    +    try {
    +      LocalRegion.validateRegionName("FOO" + Region.SEPARATOR, ira);
    +      fail();
    +    } catch (IllegalArgumentException ignore) {
    +    }
    +
    +  }
    +
    +  @Test
    +  public void testExternalRegionNames() {
    +    InternalRegionArguments ira = new InternalRegionArguments();
    +    ira.setInternalRegion(false);
    +    validateCharacters(ira);
    +    try {
    +      LocalRegion.validateRegionName("__InvalidInternalRegionName", ira);
    --- End diff --
    
    Yes, fixed.


---
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.
---

Reply via email to