You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2015/04/08 22:48:52 UTC

accumulo git commit: ACCUMULO-3201 Update example shell extension

Repository: accumulo
Updated Branches:
  refs/heads/master 66e6001c6 -> 4fd1cfdea


ACCUMULO-3201 Update example shell extension

* Rename extension so it's clear it is an example
* Add a test for the example shell extension
* Use auto-service to ensure the service file is written correctly


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

Branch: refs/heads/master
Commit: 4fd1cfdeac5d0b0effdae737d6046669adbf0587
Parents: 66e6001
Author: Christopher Tubbs <ct...@apache.org>
Authored: Wed Apr 8 16:47:26 2015 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Wed Apr 8 16:47:26 2015 -0400

----------------------------------------------------------------------
 .../simple/shell/ExampleShellExtension.java     | 37 ++++++++++++++++++++
 .../simple/shell/MyAppShellExtension.java       | 34 ------------------
 ...ache.accumulo.core.util.shell.ShellExtension |  1 -
 .../org/apache/accumulo/test/ShellServerIT.java | 25 +++++++++++++
 4 files changed, 62 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/4fd1cfde/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shell/ExampleShellExtension.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shell/ExampleShellExtension.java b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shell/ExampleShellExtension.java
new file mode 100644
index 0000000..bcd6690
--- /dev/null
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shell/ExampleShellExtension.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.examples.simple.shell;
+
+import org.apache.accumulo.shell.Shell.Command;
+import org.apache.accumulo.shell.ShellExtension;
+
+import com.google.auto.service.AutoService;
+
+@AutoService(ShellExtension.class)
+public class ExampleShellExtension extends ShellExtension {
+
+  @Override
+  public String getExtensionName() {
+    return "ExampleShellExtension";
+  }
+
+  @Override
+  public Command[] getCommands() {
+    return new Command[] {new DebugCommand()};
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/4fd1cfde/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shell/MyAppShellExtension.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shell/MyAppShellExtension.java b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shell/MyAppShellExtension.java
deleted file mode 100644
index 14dc170..0000000
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shell/MyAppShellExtension.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.examples.simple.shell;
-
-import org.apache.accumulo.shell.Shell.Command;
-import org.apache.accumulo.shell.ShellExtension;
-
-public class MyAppShellExtension extends ShellExtension {
-
-  @Override
-  public String getExtensionName() {
-    return "MyApp";
-  }
-
-  @Override
-  public Command[] getCommands() {
-    return new Command[] {new DebugCommand()};
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/4fd1cfde/examples/simple/src/main/resources/META-INF/services/org.apache.accumulo.core.util.shell.ShellExtension
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/resources/META-INF/services/org.apache.accumulo.core.util.shell.ShellExtension b/examples/simple/src/main/resources/META-INF/services/org.apache.accumulo.core.util.shell.ShellExtension
deleted file mode 100644
index 27e1beb..0000000
--- a/examples/simple/src/main/resources/META-INF/services/org.apache.accumulo.core.util.shell.ShellExtension
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.accumulo.examples.simple.shell.MyAppShellExtension
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/accumulo/blob/4fd1cfde/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
index 7388af8..fb725d6 100644
--- a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
@@ -1084,6 +1084,31 @@ public class ShellServerIT extends SharedMiniClusterIT {
   }
 
   @Test
+  public void extensions() throws Exception {
+    String extName = "ExampleShellExtension";
+
+    // check for example extension
+    ts.exec("help", true, extName, false);
+    ts.exec("extensions -l", true, extName, false);
+
+    // enable extensions and check for example
+    ts.exec("extensions -e", true);
+    ts.exec("extensions -l", true, extName, true);
+    ts.exec("help", true, extName, true);
+
+    // test example extension command
+    ts.exec(extName + "::debug", true, "This is a test", true);
+
+    // disable extensions and check for example
+    ts.exec("extensions -d", true);
+    ts.exec("extensions -l", true, extName, false);
+    ts.exec("help", true, extName, false);
+
+    // ensure extensions are really disabled
+    ts.exec(extName + "::debug", true, "Unknown command", true);
+  }
+
+  @Test
   public void grep() throws Exception {
     final String table = name.getMethodName();