felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1651792 - in /felix/trunk/deploymentadmin/deploymentadmin/src: main/java/org/apache/felix/deploymentadmin/DeploymentAdminConfig.java test/java/org/apache/felix/deploymentadmin/DeploymentAdminConfigTest.java
Date Wed, 14 Jan 2015 19:54:59 GMT
Author: jawi
Date: Wed Jan 14 19:54:59 2015
New Revision: 1651792

URL: http://svn.apache.org/r1651792
Log:
Fixed incorrect property name:

- allow both 'stopUnaffectedBundle' as 'stopUnaffectedBundles' as key.


Modified:
    felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/DeploymentAdminConfig.java
    felix/trunk/deploymentadmin/deploymentadmin/src/test/java/org/apache/felix/deploymentadmin/DeploymentAdminConfigTest.java

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/DeploymentAdminConfig.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/DeploymentAdminConfig.java?rev=1651792&r1=1651791&r2=1651792&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/DeploymentAdminConfig.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/DeploymentAdminConfig.java
Wed Jan 14 19:54:59 2015
@@ -27,12 +27,17 @@ public class DeploymentAdminConfig {
     /** Prefix used for the configuration properties of DA. */
     private static final String PREFIX = "org.apache.felix.deploymentadmin.";
 
-    /** Configuration key used to stop only bundles mentioned in a DP instead of all bundles.
*/
+    /** 
+     * Configuration key used to stop only bundles mentioned in a DP instead of all bundles.
+     * @deprecated incorrect name append the 's'
+     */
     static final String KEY_STOP_UNAFFECTED_BUNDLE = PREFIX.concat("stopUnaffectedBundle");
+    /** Configuration key used to stop only bundles mentioned in a DP instead of all bundles.
*/
+    static final String KEY_STOP_UNAFFECTED_BUNDLES = PREFIX.concat("stopUnaffectedBundles");
     /** Configuration key used to allow usage of customizers outside a DP. */
     static final String KEY_ALLOW_FOREIGN_CUSTOMIZERS = PREFIX.concat("allowForeignCustomizers");
 
-    static final boolean DEFAULT_STOP_UNAFFECTED_BUNDLE = true;
+    static final boolean DEFAULT_STOP_UNAFFECTED_BUNDLES = true;
     static final boolean DEFAULT_ALLOW_FOREIGN_CUSTOMIZERS = false;
 
     private final boolean m_stopUnaffectedBundles;
@@ -42,8 +47,15 @@ public class DeploymentAdminConfig {
      * Creates a new {@link DeploymentAdminConfig} instance with the default settings.
      */
     public DeploymentAdminConfig(BundleContext context) {
-        m_stopUnaffectedBundles = parseBoolean(getFrameworkProperty(context, KEY_STOP_UNAFFECTED_BUNDLE),
DEFAULT_STOP_UNAFFECTED_BUNDLE);
-        m_allowForeignCustomizers = parseBoolean(getFrameworkProperty(context, KEY_ALLOW_FOREIGN_CUSTOMIZERS),
DEFAULT_ALLOW_FOREIGN_CUSTOMIZERS);
+        // Allow the constant to be used in singular or plural form...
+        String value = getFrameworkProperty(context, KEY_STOP_UNAFFECTED_BUNDLE);
+        if (value == null) {
+            value = getFrameworkProperty(context, KEY_STOP_UNAFFECTED_BUNDLES);
+        }
+        m_stopUnaffectedBundles = parseBoolean(value, DEFAULT_STOP_UNAFFECTED_BUNDLES);
+
+        value = getFrameworkProperty(context, KEY_ALLOW_FOREIGN_CUSTOMIZERS);
+        m_allowForeignCustomizers = parseBoolean(value, DEFAULT_ALLOW_FOREIGN_CUSTOMIZERS);
     }
 
     /**

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/test/java/org/apache/felix/deploymentadmin/DeploymentAdminConfigTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/test/java/org/apache/felix/deploymentadmin/DeploymentAdminConfigTest.java?rev=1651792&r1=1651791&r2=1651792&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/test/java/org/apache/felix/deploymentadmin/DeploymentAdminConfigTest.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/test/java/org/apache/felix/deploymentadmin/DeploymentAdminConfigTest.java
Wed Jan 14 19:54:59 2015
@@ -35,9 +35,10 @@ import org.osgi.service.cm.Configuration
  */
 public class DeploymentAdminConfigTest extends TestCase {
     private static final String KEY_STOP_UNAFFECTED_BUNDLE = DeploymentAdminConfig.KEY_STOP_UNAFFECTED_BUNDLE;
+    private static final String KEY_STOP_UNAFFECTED_BUNDLES = DeploymentAdminConfig.KEY_STOP_UNAFFECTED_BUNDLES;
     private static final String KEY_ALLOW_FOREIGN_CUSTOMIZERS = DeploymentAdminConfig.KEY_ALLOW_FOREIGN_CUSTOMIZERS;
 
-    private static final boolean DEFAULT_STOP_UNAFFECTED_BUNDLE = DeploymentAdminConfig.DEFAULT_STOP_UNAFFECTED_BUNDLE;
+    private static final boolean DEFAULT_STOP_UNAFFECTED_BUNDLES = DeploymentAdminConfig.DEFAULT_STOP_UNAFFECTED_BUNDLES;
     private static final boolean DEFAULT_ALLOW_FOREIGN_CUSTOMIZERS = DeploymentAdminConfig.DEFAULT_ALLOW_FOREIGN_CUSTOMIZERS;
 
     private final Map m_fwProperties = new HashMap();
@@ -48,7 +49,7 @@ public class DeploymentAdminConfigTest e
     public void testDefaultConfigurationOk() throws ConfigurationException {
         DeploymentAdminConfig config = createDeploymentAdminConfig();
 
-        assertEquals(DEFAULT_STOP_UNAFFECTED_BUNDLE, config.isStopUnaffectedBundles());
+        assertEquals(DEFAULT_STOP_UNAFFECTED_BUNDLES, config.isStopUnaffectedBundles());
         assertEquals(DEFAULT_ALLOW_FOREIGN_CUSTOMIZERS, config.isAllowForeignCustomizers());
     }
 
@@ -56,29 +57,40 @@ public class DeploymentAdminConfigTest e
      * Tests the configuration values of {@link DeploymentAdminImpl} without any explicit
configuration.
      */
     public void testFrameworkConfigurationOk() throws ConfigurationException {
-        m_fwProperties.put(KEY_STOP_UNAFFECTED_BUNDLE, Boolean.toString(!DEFAULT_STOP_UNAFFECTED_BUNDLE));
+        m_fwProperties.put(KEY_STOP_UNAFFECTED_BUNDLES, Boolean.toString(!DEFAULT_STOP_UNAFFECTED_BUNDLES));
         m_fwProperties.put(KEY_ALLOW_FOREIGN_CUSTOMIZERS, Boolean.toString(!DEFAULT_ALLOW_FOREIGN_CUSTOMIZERS));
 
         DeploymentAdminConfig config = createDeploymentAdminConfig();
 
-        assertEquals(!DEFAULT_STOP_UNAFFECTED_BUNDLE, config.isStopUnaffectedBundles());
+        assertEquals(!DEFAULT_STOP_UNAFFECTED_BUNDLES, config.isStopUnaffectedBundles());
         assertEquals(!DEFAULT_ALLOW_FOREIGN_CUSTOMIZERS, config.isAllowForeignCustomizers());
     }
 
     /**
      * Tests the configuration values of {@link DeploymentAdminImpl} without any explicit
configuration.
      */
+    public void testFrameworkConfigurationDeprecatedKeyOk() throws ConfigurationException
{
+        m_fwProperties.put(KEY_STOP_UNAFFECTED_BUNDLE, Boolean.toString(!DEFAULT_STOP_UNAFFECTED_BUNDLES));
+
+        DeploymentAdminConfig config = createDeploymentAdminConfig();
+
+        assertEquals(!DEFAULT_STOP_UNAFFECTED_BUNDLES, config.isStopUnaffectedBundles());
+    }
+
+    /**
+     * Tests the configuration values of {@link DeploymentAdminImpl} without any explicit
configuration.
+     */
     public void testSystemConfigurationOk() throws ConfigurationException {
-        String stopUnaffectedBundle = KEY_STOP_UNAFFECTED_BUNDLE;
+        String stopUnaffectedBundle = KEY_STOP_UNAFFECTED_BUNDLES;
         String allowForeignCustomizers = KEY_ALLOW_FOREIGN_CUSTOMIZERS;
 
-        System.setProperty(stopUnaffectedBundle, Boolean.toString(!DEFAULT_STOP_UNAFFECTED_BUNDLE));
+        System.setProperty(stopUnaffectedBundle, Boolean.toString(!DEFAULT_STOP_UNAFFECTED_BUNDLES));
         System.setProperty(allowForeignCustomizers, Boolean.toString(!DEFAULT_ALLOW_FOREIGN_CUSTOMIZERS));
 
         try {
             DeploymentAdminConfig config = createDeploymentAdminConfig();
 
-            assertEquals(!DEFAULT_STOP_UNAFFECTED_BUNDLE, config.isStopUnaffectedBundles());
+            assertEquals(!DEFAULT_STOP_UNAFFECTED_BUNDLES, config.isStopUnaffectedBundles());
             assertEquals(!DEFAULT_ALLOW_FOREIGN_CUSTOMIZERS, config.isAllowForeignCustomizers());
         }
         finally {
@@ -86,13 +98,13 @@ public class DeploymentAdminConfigTest e
             System.clearProperty(allowForeignCustomizers);
         }
 
-        System.setProperty(stopUnaffectedBundle.toLowerCase(), Boolean.toString(!DEFAULT_STOP_UNAFFECTED_BUNDLE));
+        System.setProperty(stopUnaffectedBundle.toLowerCase(), Boolean.toString(!DEFAULT_STOP_UNAFFECTED_BUNDLES));
         System.setProperty(allowForeignCustomizers.toLowerCase(), Boolean.toString(!DEFAULT_ALLOW_FOREIGN_CUSTOMIZERS));
 
         try {
             DeploymentAdminConfig config = createDeploymentAdminConfig();
 
-            assertEquals(!DEFAULT_STOP_UNAFFECTED_BUNDLE, config.isStopUnaffectedBundles());
+            assertEquals(!DEFAULT_STOP_UNAFFECTED_BUNDLES, config.isStopUnaffectedBundles());
             assertEquals(!DEFAULT_ALLOW_FOREIGN_CUSTOMIZERS, config.isAllowForeignCustomizers());
         }
         finally {



Mime
View raw message