accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1448698 - in /accumulo/trunk: ./ assemble/ core/ core/src/main/java/org/apache/accumulo/core/iterators/user/ core/src/test/java/org/apache/accumulo/core/iterators/user/ examples/ fate/src/main/java/org/apache/accumulo/fate/ fate/src/main/j...
Date Thu, 21 Feb 2013 16:01:38 GMT
Author: kturner
Date: Thu Feb 21 16:01:37 2013
New Revision: 1448698

URL: http://svn.apache.org/r1448698
Log:
ACCUMULO-1001 implemented verifyopts for TransformingIterator (merged from 1.5)

Modified:
    accumulo/trunk/   (props changed)
    accumulo/trunk/assemble/   (props changed)
    accumulo/trunk/core/   (props changed)
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
    accumulo/trunk/examples/   (props changed)
    accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java   (props changed)
    accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java 
 (props changed)
    accumulo/trunk/server/   (props changed)
    accumulo/trunk/src/   (props changed)

Propchange: accumulo/trunk/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5:r1448388-1448697

Propchange: accumulo/trunk/assemble/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/assemble:r1448388-1448697

Propchange: accumulo/trunk/core/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/core:r1448388-1448697

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java?rev=1448698&r1=1448697&r2=1448698&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/TransformingIterator.java
Thu Feb 21 16:01:37 2013
@@ -140,9 +140,22 @@ abstract public class TransformingIterat
   
   @Override
   public boolean validateOptions(Map<String,String> options) {
+    
+    for (String opt : options.keySet()) {
+      try {
+        if (options.equals(AUTH_OPT)) {
+          new Authorizations(options.get(opt).getBytes());
+        } else if (opt.equals(MAX_BUFFER_SIZE_OPT)) {
+          AccumuloConfiguration.getMemoryInBytes(options.get(opt));
+        }
+      } catch (Exception e) {
+        throw new IllegalArgumentException("Failed to parse opt " + opt + " " + options.get(opt),
e);
+      }
+    }
+    
     return true;
   }
-  
+
   @Override
   public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
     TransformingIterator copy;

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java?rev=1448698&r1=1448697&r2=1448698&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
(original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
Thu Feb 21 16:01:37 2013
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -55,6 +56,7 @@ import org.apache.accumulo.core.iterator
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.hadoop.io.Text;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -388,6 +390,28 @@ public class TransformingIteratorTest {
     assertEquals(81, count);
   }
   
+  @Test
+  public void testValidateOptions() {
+    TransformingIterator ti = new ColFamReversingKeyTransformingIterator();
+    IteratorSetting is = new IteratorSetting(100, "cfrkt", ColFamReversingKeyTransformingIterator.class);
+    TransformingIterator.setAuthorizations(is, new Authorizations("A", "B"));
+    TransformingIterator.setMaxBufferSize(is, 10000000);
+    Assert.assertTrue(ti.validateOptions(is.getOptions()));
+    
+    Map<String,String> opts = new HashMap<String,String>();
+    
+    opts.put(TransformingIterator.MAX_BUFFER_SIZE_OPT, "10M");
+    Assert.assertTrue(ti.validateOptions(is.getOptions()));
+    
+    opts.clear();
+    opts.put(TransformingIterator.MAX_BUFFER_SIZE_OPT, "A,B");
+    try {
+      ti.validateOptions(opts);
+      Assert.assertFalse(true);
+    } catch (IllegalArgumentException e) {}
+
+  }
+  
   private Key createDeleteKey(String row, String colFam, String colQual, String colVis, long
timestamp) {
     Key key = new Key(row, colFam, colQual, colVis, timestamp);
     key.setDeleted(true);

Propchange: accumulo/trunk/examples/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/examples:r1448388-1448697

Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1448388-1448697

Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1448388-1448697

Propchange: accumulo/trunk/server/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/server:r1448388-1448697

Propchange: accumulo/trunk/src/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/src:r1448388-1448697



Mime
View raw message