Fixed incorrect property name:

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



git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1651792 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/DeploymentAdminConfig.java b/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/DeploymentAdminConfig.java
index e180ad7..bdafcbb 100644
--- a/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/DeploymentAdminConfig.java
+++ b/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/DeploymentAdminConfig.java
@@ -27,12 +27,17 @@
     /** 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 @@
      * 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);
     }
 
     /**
diff --git a/deploymentadmin/deploymentadmin/src/test/java/org/apache/felix/deploymentadmin/DeploymentAdminConfigTest.java b/deploymentadmin/deploymentadmin/src/test/java/org/apache/felix/deploymentadmin/DeploymentAdminConfigTest.java
index 83f4bfd..f2040e4 100644
--- a/deploymentadmin/deploymentadmin/src/test/java/org/apache/felix/deploymentadmin/DeploymentAdminConfigTest.java
+++ b/deploymentadmin/deploymentadmin/src/test/java/org/apache/felix/deploymentadmin/DeploymentAdminConfigTest.java
@@ -35,9 +35,10 @@
  */
 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 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 @@
      * 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 @@
             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 {