Author: oheger
Date: Sun Apr 4 18:03:20 2010
New Revision: 930728
URL: http://svn.apache.org/viewvc?rev=930728&view=rev
Log:
CONFIGURATION-413: SubsetConfiguration now generates correct events. Ported
patch from Alexander Prishchepov to branch.
Added:
commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/event/TestSubsetConfigurationEvents.java
(with props)
Modified:
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/SubsetConfiguration.java
commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml
Modified:
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/SubsetConfiguration.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/SubsetConfiguration.java?rev=930728&r1=930727&r2=930728&view=diff
==============================================================================
---
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/SubsetConfiguration.java
(original)
+++
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/SubsetConfiguration.java
Sun Apr 4 18:03:20 2010
@@ -17,10 +17,10 @@
package org.apache.commons.configuration2;
-import org.apache.commons.configuration2.interpol.ConfigurationInterpolator;
-
import java.util.Iterator;
+import org.apache.commons.configuration2.interpol.ConfigurationInterpolator;
+
/**
* <p>A subset of another configuration. The new Configuration object contains
* every key from the parent Configuration that starts with prefix. The prefix
@@ -30,7 +30,7 @@ import java.util.Iterator;
* which will return a correctly initialized instance.</p>
*
* @author Emmanuel Bourg
- * @version $Revision$, $Date$
+ * @version $Id$
*/
public class SubsetConfiguration extends AbstractConfiguration
{
@@ -171,13 +171,7 @@ public class SubsetConfiguration extends
}
@Override
- public void setProperty(String key, Object value)
- {
- parent.setProperty(getParentKey(key), value);
- }
-
- @Override
- public void clearProperty(String key)
+ protected void clearPropertyDirect(String key)
{
parent.clearProperty(getParentKey(key));
}
@@ -197,7 +191,7 @@ public class SubsetConfiguration extends
{
return new SubsetIterator(parent.getKeys(prefix));
}
-
+
@Override
protected Object interpolate(Object base)
{
Added:
commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/event/TestSubsetConfigurationEvents.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/event/TestSubsetConfigurationEvents.java?rev=930728&view=auto
==============================================================================
---
commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/event/TestSubsetConfigurationEvents.java
(added)
+++
commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/event/TestSubsetConfigurationEvents.java
Sun Apr 4 18:03:20 2010
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.configuration2.event;
+
+import java.util.HashMap;
+
+import org.apache.commons.configuration2.AbstractConfiguration;
+import org.apache.commons.configuration2.MapConfiguration;
+import org.apache.commons.configuration2.SubsetConfiguration;
+
+/**
+ * Test class for the events generated by SubsetConfiguration.
+ *
+ * @version $Id$
+ */
+public class TestSubsetConfigurationEvents extends
AbstractTestConfigurationEvents
+{
+ @Override
+ protected AbstractConfiguration createConfiguration()
+ {
+ return (SubsetConfiguration) new MapConfiguration(
+ new HashMap<Object, Object>()).subset("test");
+ }
+}
Propchange:
commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/event/TestSubsetConfigurationEvents.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/event/TestSubsetConfigurationEvents.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange:
commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/event/TestSubsetConfigurationEvents.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified:
commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml?rev=930728&r1=930727&r2=930728&view=diff
==============================================================================
---
commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml
(original)
+++
commons/proper/configuration/branches/configuration2_experimental/xdocs/changes.xml
Sun Apr 4 18:03:20 2010
@@ -79,6 +79,9 @@
</release>
<release version="1.7" date="in SVN" description="">
+ <action dev="oheger" type="fix" issue="CONFIGURATION-413"
due-to="Alexander Prishchepov">
+ SubsetConfiguration now produces correct events.
+ </action>
<action dev="oheger" type="fix" issue="CONFIGURATION-409">
HierarchicalINIConfiguration now correctly saves sections whose name
contains delimiter characters.