You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2013/05/07 17:37:59 UTC

svn commit: r1479946 - in /accumulo/trunk: ./ assemble/ core/ core/src/main/java/org/apache/accumulo/core/util/shell/commands/ core/src/test/java/org/apache/accumulo/core/util/shell/ examples/ fate/src/main/java/org/apache/accumulo/fate/ fate/src/main/...

Author: kturner
Date: Tue May  7 15:37:58 2013
New Revision: 1479946

URL: http://svn.apache.org/r1479946
Log:
ACCUMULO-1358 Appled patch from Mike Drob, with modification to delete table in unit test.

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/util/shell/commands/SetIterCommand.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.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/pom.xml   (props changed)
    accumulo/trunk/server/   (props changed)
    accumulo/trunk/src/   (props changed)

Propchange: accumulo/trunk/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5:r1479932

Propchange: accumulo/trunk/assemble/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/assemble:r1479932

Propchange: accumulo/trunk/core/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/core:r1479932

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java?rev=1479946&r1=1479945&r2=1479946&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/SetIterCommand.java Tue May  7 15:37:58 2013
@@ -175,14 +175,23 @@ public class SetIterCommand extends Comm
       clazz = classloader.loadClass(className).asSubclass(OptionDescriber.class);
       skvi = clazz.newInstance();
     } catch (ClassNotFoundException e) {
-      throw new IllegalArgumentException(e.getMessage());
+      StringBuilder msg = new StringBuilder("Unable to load ").append(className);
+      if (className.indexOf('.') < 0) {
+        msg.append("; did you use a fully qualified package name?");
+      } else {
+        msg.append("; class not found.");
+      }
+      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, msg.toString());
     } catch (InstantiationException e) {
       throw new IllegalArgumentException(e.getMessage());
     } catch (IllegalAccessException e) {
       throw new IllegalArgumentException(e.getMessage());
     } catch (ClassCastException e) {
-      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Unable to load " + className + " as type " + OptionDescriber.class.getName()
-          + "; configure with 'config' instead");
+      StringBuilder msg = new StringBuilder("Loaded ");
+      msg.append(className).append(" but it does not implement ");
+      msg.append(OptionDescriber.class.getSimpleName());
+      msg.append("; use 'config -s' instead.");
+      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, msg.toString());
     }
     
     final IteratorOptions itopts = skvi.describeOptions();

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java?rev=1479946&r1=1479945&r2=1479946&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java Tue May  7 15:37:58 2013
@@ -222,4 +222,23 @@ public class ShellTest {
     assertEquals(0, shell.start());
     assertGoodExit("Unknown command", false);
   }
+  
+  @Test
+  public void setIterTest() throws IOException {
+    Shell.log.debug("Starting setiter test --------------------------");
+    exec("createtable t", true);
+    
+    String cmdJustClass = "setiter -class VersioningIterator -p 1";
+    exec(cmdJustClass, false, "java.lang.IllegalArgumentException", false);
+    exec(cmdJustClass, false, "fully qualified package name", true);
+    
+    String cmdFullPackage = "setiter -class o.a.a.foo -p 1";
+    exec(cmdFullPackage, false, "java.lang.IllegalArgumentException", false);
+    exec(cmdFullPackage, false, "class not found", true);
+    
+    String cmdNoOption = "setiter -class java.lang.String -p 1";
+    exec(cmdNoOption, false, "Loaded", true);
+    
+    exec("deletetable t -f", true, "Table: [t] has been deleted");
+  }
 }

Propchange: accumulo/trunk/examples/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/examples:r1479932

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

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

Propchange: accumulo/trunk/pom.xml
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/pom.xml:r1479932

Propchange: accumulo/trunk/server/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/server:r1479932

Propchange: accumulo/trunk/src/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/src:r1479932