accumulo-dev mailing list archives

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

    https://github.com/apache/accumulo/pull/111#discussion_r67007078
  
    --- 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 --
    
    Yeah, sorry. I didn't look closely enough at the changeset you committed after the last
review. I had just assumed that since Keith and I had agreed that would be a good idea that
you had done that. That, tied in with a test case that used that syntax but with invalid bounds
further cemented the assumption.
    
    Anyways, sorry for the confusion.


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