accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject git commit: ACCUMULO-1704 Adding an IteratorSetting(int, String, Class, Map) constructor.
Date Sun, 27 Oct 2013 05:19:39 GMT
Updated Branches:
  refs/heads/master e95dee9ec -> 2f570f5f8


ACCUMULO-1704 Adding an IteratorSetting(int, String, Class, Map)
    constructor.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/2f570f5f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/2f570f5f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/2f570f5f

Branch: refs/heads/master
Commit: 2f570f5f80988413ab6da68ca2a65833aaaaf914
Parents: e95dee9
Author: Josh Elser <elserj@apache.org>
Authored: Sun Oct 27 01:13:06 2013 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Sun Oct 27 01:17:02 2013 -0400

----------------------------------------------------------------------
 .../accumulo/core/client/IteratorSetting.java   | 14 +++++++++++++
 .../core/client/IteratorSettingTest.java        | 22 ++++++++++++++++++++
 2 files changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/2f570f5f/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java b/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java
index a6345a0..7a98df2 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java
@@ -191,6 +191,20 @@ public class IteratorSetting implements Writable {
   }
   
   /**
+   * Constructs an iterator setting using the provided name and the provided class's name
for the scan scope with the provided parameters.
+   * 
+   * @param priority The priority for the iterator (see {@link #setPriority(int)})
+   * @param name The distinguishing name for the iterator
+   * @param iteratorClass The class for the iterator
+   * @param properties Any properties for the iterator
+   * 
+   * @since 1.6.0
+   */
+  public IteratorSetting(int priority, String name, Class<? extends SortedKeyValueIterator<Key,Value>>
iteratorClass, Map<String,String> properties) {
+    this(priority, name, iteratorClass.getName(), properties);
+  }
+  
+  /**
    * @since 1.5.0
    */
   public IteratorSetting(DataInput din) throws IOException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2f570f5f/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java b/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java
index 3208d64..39d7512 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java
@@ -19,10 +19,14 @@ package org.apache.accumulo.core.client;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 
+import java.util.Map;
+
 import org.apache.accumulo.core.iterators.Combiner;
 import org.apache.accumulo.core.iterators.DevNull;
 import org.junit.Test;
 
+import com.google.common.collect.Maps;
+
 /**
  * Test cases for the IteratorSetting class
  */
@@ -89,4 +93,22 @@ public class IteratorSettingTest {
     assertNotEquals(setting1, setting5);
     assertNotEquals(setting1, setting6);
   }
+  
+  @Test
+  public void testEquivalentConstructor() {
+    IteratorSetting setting1 = new IteratorSetting(100, Combiner.class);
+    IteratorSetting setting2 = new IteratorSetting(100, "Combiner", Combiner.class, Maps.<String,String>
newHashMap());
+    
+    assertEquals(setting1, setting2);
+    
+    IteratorSetting notEqual1 = new IteratorSetting(100, "FooCombiner", Combiner.class, Maps.<String,String>
newHashMap());
+    
+    assertNotEquals(setting1, notEqual1);
+    
+    Map<String,String> props = Maps.newHashMap();
+    props.put("foo", "bar");
+    IteratorSetting notEquals2 = new IteratorSetting(100, "Combiner", Combiner.class, props);
+    
+    assertNotEquals(setting1, notEquals2);
+  }
 }


Mime
View raw message