accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From milleruntime <...@git.apache.org>
Subject [GitHub] accumulo pull request #122: ACCUMULO-1604: added check for negate option in ...
Date Mon, 11 Jul 2016 13:13:49 GMT
Github user milleruntime commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/122#discussion_r70254227
  
    --- Diff: core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java ---
    @@ -234,20 +234,101 @@ public void test2a() throws IOException {
         a.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
         a.overrideCurrentTime(ts);
         a.seek(new Range(), EMPTY_COL_FAMS, false);
    -    assertEquals(size(a), 902);
    +    assertEquals(902, size(a));
     
         ColumnAgeOffFilter.addTTL(is, new IteratorSetting.Column("a", "b"), 101l);
         a.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
         a.overrideCurrentTime(ts);
         a.seek(new Range(), EMPTY_COL_FAMS, false);
    -    assertEquals(size(a), 102);
    +    assertEquals(102, size(a));
     
         ColumnAgeOffFilter.removeTTL(is, new IteratorSetting.Column("a", "b"));
         a.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
         a = (ColumnAgeOffFilter) a.deepCopy(null);
         a.overrideCurrentTime(ts);
         a.seek(new Range(), EMPTY_COL_FAMS, false);
    -    assertEquals(size(a), 902);
    +    assertEquals(902, size(a));
    +  }
    +
    +  /**
    +   * Test for fix to ACCUMULO-1604: ColumnAgeOffFilter was throwing an error when using
negate
    +   */
    +  @Test
    +  public void test2aNegate() throws IOException {
    +    Text colf = new Text("a");
    +    Text colq = new Text("b");
    +    Value dv = new Value();
    +    TreeMap<Key,Value> tm = new TreeMap<Key,Value>();
    +    IteratorSetting is = new IteratorSetting(1, ColumnAgeOffFilter.class);
    +    ColumnAgeOffFilter.addTTL(is, new IteratorSetting.Column("a"), 901l);
    +    ColumnAgeOffFilter.setNegate(is, true);
    +    long ts = System.currentTimeMillis();
    +
    +    for (long i = 0; i < 1000; i++) {
    +      Key k = new Key(new Text(String.format("%03d", i)), colf, colq, ts - i);
    +      tm.put(k, dv);
    +    }
    +    assertTrue(tm.size() == 1000);
    --- End diff --
    
    It looks like there are a bunch assertTrue checks that would be better as assertEquals.
How about I create an improvement ticket in JIRA?


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