karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r1546012 - in /karaf/trunk/service/guard/src: main/java/org/apache/karaf/service/guard/impl/GuardProxyCatalog.java test/java/org/apache/karaf/service/guard/impl/GuardProxyCatalogTest.java
Date Wed, 27 Nov 2013 12:20:57 GMT
Author: davidb
Date: Wed Nov 27 12:20:57 2013
New Revision: 1546012

URL: http://svn.apache.org/r1546012
Log:
Small fix for the "org.apache.karaf.service.guard.roles" property values.

The "org.apache.karaf.service.guard.roles" service property is set by the OSGi Service Guard
to indicate what roles can possibly invoke this service. 
Previously it was not propertly handling roles that were defined as follows:
  method[/regexp/] = role1
This commit fixes that and adds a test for it.

Modified:
    karaf/trunk/service/guard/src/main/java/org/apache/karaf/service/guard/impl/GuardProxyCatalog.java
    karaf/trunk/service/guard/src/test/java/org/apache/karaf/service/guard/impl/GuardProxyCatalogTest.java

Modified: karaf/trunk/service/guard/src/main/java/org/apache/karaf/service/guard/impl/GuardProxyCatalog.java
URL: http://svn.apache.org/viewvc/karaf/trunk/service/guard/src/main/java/org/apache/karaf/service/guard/impl/GuardProxyCatalog.java?rev=1546012&r1=1546011&r2=1546012&view=diff
==============================================================================
--- karaf/trunk/service/guard/src/main/java/org/apache/karaf/service/guard/impl/GuardProxyCatalog.java
(original)
+++ karaf/trunk/service/guard/src/main/java/org/apache/karaf/service/guard/impl/GuardProxyCatalog.java
Wed Nov 27 12:20:57 2013
@@ -316,6 +316,10 @@ public class GuardProxyCatalog implement
                         if (idx >= 0) {
                             bareKey = bareKey.substring(0, idx);
                         }
+                        int idx1 = bareKey.indexOf('[');
+                        if (idx1 >= 0) {
+                            bareKey = bareKey.substring(0, idx1);
+                        }
                         int idx2 = bareKey.indexOf('*');
                         if (idx2 >= 0) {
                             bareKey = bareKey.substring(0, idx2);

Modified: karaf/trunk/service/guard/src/test/java/org/apache/karaf/service/guard/impl/GuardProxyCatalogTest.java
URL: http://svn.apache.org/viewvc/karaf/trunk/service/guard/src/test/java/org/apache/karaf/service/guard/impl/GuardProxyCatalogTest.java?rev=1546012&r1=1546011&r2=1546012&view=diff
==============================================================================
--- karaf/trunk/service/guard/src/test/java/org/apache/karaf/service/guard/impl/GuardProxyCatalogTest.java
(original)
+++ karaf/trunk/service/guard/src/test/java/org/apache/karaf/service/guard/impl/GuardProxyCatalogTest.java
Wed Nov 27 12:20:57 2013
@@ -252,12 +252,13 @@ public class GuardProxyCatalogTest {
         config.put("someOtherMethod(int)", "c");
         config.put("someOtherMethod(int)[/12/]", "d");
         config.put("someOtherMethod(int)[\"42\"]", "e");
-        config.put("someFoo*", "f");
+        config.put("someOtherMethod[/.*[x][y][z].*/]", "f");
+        config.put("someFoo*", "g");
 
         BundleContext bc = mockConfigAdminBundleContext(config);
 
         Dictionary<String, Object> proxyProps = testCreateProxy(bc, TestServiceAPI.class,
new TestService());
-        assertEquals(new HashSet<String>(Arrays.asList("a", "b", "c", "d", "e", "f")),
+        assertEquals(new HashSet<String>(Arrays.asList("a", "b", "c", "d", "e", "f",
"g")),
                 new HashSet<String>((Collection<String>) proxyProps.get(GuardProxyCatalog.SERVICE_GUARD_ROLES_PROPERTY)));
     }
 



Mime
View raw message