accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlmarion <...@git.apache.org>
Subject [GitHub] accumulo pull request #111: ACCUMULO-4331: first draft
Date Tue, 14 Jun 2016 16:15:22 GMT
Github user dlmarion commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/111#discussion_r67002968
  
    --- Diff: core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
---
    @@ -72,4 +72,79 @@ public void testGetPropertyByString() {
         }
         assertTrue("test was a dud, and did nothing", found);
       }
    +
    +  @Test
    +  public void testGetSinglePort() {
    +    AccumuloConfiguration c = AccumuloConfiguration.getDefaultConfiguration();
    +    ConfigurationCopy cc = new ConfigurationCopy(c);
    +    cc.set(Property.TSERV_CLIENTPORT, "9997");
    +    int[] ports = cc.getPort(Property.TSERV_CLIENTPORT);
    +    assertEquals(1, ports.length);
    +    assertEquals(9997, ports[0]);
    +  }
    +
    +  @Test
    +  public void testGetAnyPort() {
    +    AccumuloConfiguration c = AccumuloConfiguration.getDefaultConfiguration();
    +    ConfigurationCopy cc = new ConfigurationCopy(c);
    +    cc.set(Property.TSERV_CLIENTPORT, "0");
    +    int[] ports = cc.getPort(Property.TSERV_CLIENTPORT);
    +    assertEquals(1, ports.length);
    +    assertEquals(0, ports[0]);
    +  }
    +
    +  @Test
    +  public void testGetInvalidPort() {
    +    AccumuloConfiguration c = AccumuloConfiguration.getDefaultConfiguration();
    +    ConfigurationCopy cc = new ConfigurationCopy(c);
    +    cc.set(Property.TSERV_CLIENTPORT, "1020");
    +    int[] ports = cc.getPort(Property.TSERV_CLIENTPORT);
    +    assertEquals(1, ports.length);
    +    assertEquals(Integer.parseInt(Property.TSERV_CLIENTPORT.getDefaultValue()), ports[0]);
    +  }
    +
    +  @Test
    +  public void testGetPortRange() {
    +    AccumuloConfiguration c = AccumuloConfiguration.getDefaultConfiguration();
    +    ConfigurationCopy cc = new ConfigurationCopy(c);
    +    cc.set(Property.TSERV_CLIENTPORT, "9997-9999");
    +    int[] ports = cc.getPort(Property.TSERV_CLIENTPORT);
    +    assertEquals(3, ports.length);
    +    assertEquals(9997, ports[0]);
    +    assertEquals(9998, ports[1]);
    +    assertEquals(9999, ports[2]);
    +  }
    +
    +  @Test
    +  public void testGetPortRangeInvalidLow() {
    +    AccumuloConfiguration c = AccumuloConfiguration.getDefaultConfiguration();
    +    ConfigurationCopy cc = new ConfigurationCopy(c);
    +    cc.set(Property.TSERV_CLIENTPORT, "1020-1026");
    +    int[] ports = cc.getPort(Property.TSERV_CLIENTPORT);
    +    assertEquals(3, ports.length);
    +    assertEquals(1024, ports[0]);
    +    assertEquals(1025, ports[1]);
    +    assertEquals(1026, ports[2]);
    +  }
    +
    +  @Test
    +  public void testGetPortRangeInvalidHigh() {
    +    AccumuloConfiguration c = AccumuloConfiguration.getDefaultConfiguration();
    +    ConfigurationCopy cc = new ConfigurationCopy(c);
    +    cc.set(Property.TSERV_CLIENTPORT, "65533-65538");
    +    int[] ports = cc.getPort(Property.TSERV_CLIENTPORT);
    +    assertEquals(3, ports.length);
    +    assertEquals(65533, ports[0]);
    +    assertEquals(65534, ports[1]);
    +    assertEquals(65535, ports[2]);
    +  }
    +
    +  @Test(expected = IllegalArgumentException.class)
    --- End diff --
    
    Because the range syntax is M-N, not [M,N].


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message