Updated Branches: refs/heads/master 05521f5c3 -> 1a0dafcf9
Itests for the kar 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/1a0dafcf Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/1a0dafcf Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/1a0dafcf Branch: refs/heads/master Commit: 1a0dafcf972504ea4d1c05b71ddd694759f8be9f Parents: 05521f5 Author: David Bosschaert <dav...@apache.org> Authored: Tue Feb 11 16:23:38 2014 +0000 Committer: David Bosschaert <dav...@apache.org> Committed: Tue Feb 11 16:23:38 2014 +0000 ---------------------------------------------------------------------- .../karaf/itests/KarSshCommandSecurityTest.java | 44 ++++++++++++++++++++ 1 file changed, 44 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf/blob/1a0dafcf/itests/src/test/java/org/apache/karaf/itests/KarSshCommandSecurityTest.java ---------------------------------------------------------------------- diff --git a/itests/src/test/java/org/apache/karaf/itests/KarSshCommandSecurityTest.java b/itests/src/test/java/org/apache/karaf/itests/KarSshCommandSecurityTest.java new file mode 100644 index 0000000..e94c33e --- /dev/null +++ b/itests/src/test/java/org/apache/karaf/itests/KarSshCommandSecurityTest.java @@ -0,0 +1,44 @@ +/* + * 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 kar scope commands as defined in + * /framework/src/main/resources/resources/etc/org.apache.karaf.command.acl.kar.cfg + */ +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerClass.class) +public class KarSshCommandSecurityTest extends SshCommandTestBase { + private static int counter = 0; + @Test + public void testConfigCommandSecurityViaSsh() throws Exception { + String vieweruser = "view" + System.nanoTime() + "_" + counter++; + + addViewer(vieweruser); + + assertCommand(vieweruser, "kar:list", Result.OK); + assertCommand(vieweruser, "kar:install", Result.NOT_FOUND); + assertCommand(vieweruser, "kar:uninstall", Result.NOT_FOUND); + + assertCommand("karaf", "kar:list", Result.OK); + assertCommand("karaf", "kar:install", Result.OK); + assertCommand("karaf", "kar:uninstall", Result.OK); + } +}