karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject git commit: Itests for the shell command shell security ACL
Date Tue, 11 Feb 2014 16:35:24 GMT
Updated Branches:
  refs/heads/master 1a0dafcf9 -> bf6705f1e


Itests for the shell command shell security ACL


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

Branch: refs/heads/master
Commit: bf6705f1e5a5bd419413e22dfaa6e58a22b3f6ca
Parents: 1a0dafc
Author: David Bosschaert <davidb@apache.org>
Authored: Tue Feb 11 16:34:48 2014 +0000
Committer: David Bosschaert <davidb@apache.org>
Committed: Tue Feb 11 16:34:48 2014 +0000

----------------------------------------------------------------------
 .../karaf/itests/ShellCommandSecurityTest.java  | 48 ++++++++++++++++++++
 1 file changed, 48 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/bf6705f1/itests/src/test/java/org/apache/karaf/itests/ShellCommandSecurityTest.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/karaf/itests/ShellCommandSecurityTest.java b/itests/src/test/java/org/apache/karaf/itests/ShellCommandSecurityTest.java
new file mode 100644
index 0000000..7fec653
--- /dev/null
+++ b/itests/src/test/java/org/apache/karaf/itests/ShellCommandSecurityTest.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed 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.karaf.itests;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+/**
+ * This test exercises the Shell Command ACL for the shell scope commands as defined in
+ * /framework/src/main/resources/resources/etc/org.apache.karaf.command.acl.shell.cfg
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class ShellCommandSecurityTest extends SshCommandTestBase {
+    private static int counter = 0;
+    @Test
+    public void testConfigCommandSecurityViaSsh() throws Exception {
+        String vieweruser = "view" + System.nanoTime() + "_" + counter++;
+
+        addViewer(vieweruser);
+
+        assertCommand(vieweruser, "shell:date", Result.OK);
+        assertCommand(vieweruser, "shell:edit", Result.NOT_FOUND);
+        assertCommand(vieweruser, "shell:exec", Result.NOT_FOUND);
+        assertCommand(vieweruser, "shell:new", Result.NOT_FOUND);
+        assertCommand(vieweruser, "shell:java", Result.NOT_FOUND);
+
+        assertCommand("karaf", "shell:date", Result.OK);
+        assertCommand("karaf", "shell:edit", Result.OK);
+        assertCommand("karaf", "shell:exec", Result.OK);
+        assertCommand("karaf", "shell:new", Result.OK);
+        assertCommand("karaf", "shell:java", Result.OK);
+    }
+}


Mime
View raw message