karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject git commit: More itest changes for config commands.
Date Tue, 07 Jan 2014 15:21:00 GMT
Updated Branches:
  refs/heads/master 891c43b7e -> 169e91774


More itest changes for config commands.


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

Branch: refs/heads/master
Commit: 169e917744648d4a34307e4d16e7c80b8a2e860b
Parents: 891c43b
Author: David Bosschaert <davidb@apache.org>
Authored: Tue Jan 7 15:09:13 2014 +0000
Committer: David Bosschaert <davidb@apache.org>
Committed: Tue Jan 7 15:09:13 2014 +0000

----------------------------------------------------------------------
 .../karaf/itests/SshCommandSecurityTest.java    | 25 +++++++++++++++-----
 1 file changed, 19 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/169e9177/itests/src/test/java/org/apache/karaf/itests/SshCommandSecurityTest.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/karaf/itests/SshCommandSecurityTest.java b/itests/src/test/java/org/apache/karaf/itests/SshCommandSecurityTest.java
index 2606cb4..cf7b8b8 100644
--- a/itests/src/test/java/org/apache/karaf/itests/SshCommandSecurityTest.java
+++ b/itests/src/test/java/org/apache/karaf/itests/SshCommandSecurityTest.java
@@ -96,19 +96,32 @@ public class SshCommandSecurityTest extends KarafTestSupport {
 
         addUsers(manageruser, vieweruser);
 
-        testConfigEditsSuccessful(manageruser, false);
-        testConfigEditsSuccessful("karaf", true);
+        // A viewer cannot do anything to ConfigAdmin
+        assertCommand(vieweruser, "config:edit cfg." + vieweruser, Result.NOT_FOUND);
+        assertCommand(vieweruser, "config:delete cfg." + vieweruser, Result.NOT_FOUND);
+
+        testConfigEdits(manageruser, Result.OK, "cfg." + manageruser, false);
+        testConfigEdits(manageruser, Result.NO_CREDENTIALS, "jmx.acl.test_" + counter++,
false);
+        testConfigEdits(manageruser, Result.NO_CREDENTIALS, "org.apache.karaf.command.acl.test_"
+ counter++, false);
+        testConfigEdits(manageruser, Result.NO_CREDENTIALS, "org.apache.karaf.service.acl.test_"
+ counter++, false);
+        testConfigEdits("karaf", Result.OK, "cfg.karaf_" + counter++, true);
+        testConfigEdits("karaf", Result.OK, "org.apache.karaf.command.acl.test_" + counter++,
true);
+        testConfigEdits("karaf", Result.OK, "org.apache.karaf.service.acl.test_" + counter++,
true);
     }
 
-    private void testConfigEditsSuccessful(String user, boolean isAdmin) throws Exception,
IOException {
-        String pid = "cfg." + user + "_" + counter++;
+    private void testConfigEdits(String user, Result expectedEditResult, String pid, boolean
isAdmin) throws Exception, IOException {
         assertCommand(user, "config:edit " + pid + "\n" +
         		"config:property-set x y\n" +
         		"config:property-set a b\n" +
         		"config:property-append x z\n" +
-        		"config:update", Result.OK);
+        		"config:update", expectedEditResult);
+        if (expectedEditResult != Result.OK)
+            // If we're expecting failure, don't continue any further...
+            return;
+
         String result = assertCommand(user, "config:edit " + pid + "\n" +
-        		"config:property-list", Result.OK);
+        		"config:property-list\n" +
+        		"config:cancel", Result.OK);
         Assert.assertTrue(result.contains("x = yz"));
         Assert.assertTrue(result.contains("a = b"));
         String result2 = assertCommand(user, "config:edit " + pid + "\n" +


Mime
View raw message