commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r154669 - in jakarta/commons/proper/configuration/trunk/src: java/org/apache/commons/configuration/ java/org/apache/commons/configuration/web/ test/org/apache/commons/configuration/ test/org/apache/commons/configuration/web/
Date Mon, 21 Feb 2005 11:39:41 GMT
Author: ebourg
Date: Mon Feb 21 03:39:33 2005
New Revision: 154669

URL: http://svn.apache.org/viewcvs?view=rev&rev=154669
Log:
Updated ServletRequestConfiguration to support lists of values as suggested by Justin in Bug
33666.
Added support for lists in the other web configurations as well.

Modified:
    jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertyConverter.java
    jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/AppletConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletContextConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestAbstractConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestMapConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestAppletConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletContextConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletFilterConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletRequestConfiguration.java

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertyConverter.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertyConverter.java?view=diff&r1=154668&r2=154669
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertyConverter.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertyConverter.java
Mon Feb 21 03:39:33 2005
@@ -41,7 +41,7 @@
  * A utility class to convert the configuration properties into any type.
  *
  * @author Emmanuel Bourg
- * @version $Revision: 1.3 $, $Date: 2004/12/14 17:03:50 $
+ * @version $Revision: 1.3 $, $Date$
  * @since 1.1
  */
 public final class PropertyConverter
@@ -420,7 +420,7 @@
      * @param s          the string to split
      * @param delimiter  the delimiter
      */
-    static List split(String s, char delimiter)
+    public static List split(String s, char delimiter)
     {
         if (s == null)
         {

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/AppletConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/AppletConfiguration.java?view=diff&r1=154668&r2=154669
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/AppletConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/AppletConfiguration.java
Mon Feb 21 03:39:33 2005
@@ -18,9 +18,11 @@
 
 import java.applet.Applet;
 import java.util.Iterator;
+import java.util.List;
 
 import org.apache.commons.collections.iterators.ArrayIterator;
 import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.commons.configuration.PropertyConverter;
 
 /**
  * A configuration wrapper to read applet parameters. This configuration is
@@ -28,7 +30,7 @@
  * UnsupportedOperationException.
  *
  * @author <a href="mailto:ebourg@apache.org">Emmanuel Bourg</a>
- * @version $Revision: 1.4 $, $Date: 2004/12/02 22:05:52 $
+ * @version $Revision: 1.4 $, $Date$
  * @since 1.1
  */
 public class AppletConfiguration extends AbstractConfiguration
@@ -48,7 +50,10 @@
 
     public Object getProperty(String key)
     {
-        return applet.getParameter(key);
+        Object value = applet.getParameter(key);
+        List list = PropertyConverter.split((String) value, getDelimiter());
+
+        return list.size() > 1 ? list : value;
     }
 
     /**

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletConfiguration.java?view=diff&r1=154668&r2=154669
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletConfiguration.java
Mon Feb 21 03:39:33 2005
@@ -17,11 +17,13 @@
 package org.apache.commons.configuration.web;
 
 import java.util.Iterator;
+import java.util.List;
 import javax.servlet.Servlet;
 import javax.servlet.ServletConfig;
 
 import org.apache.commons.collections.iterators.EnumerationIterator;
 import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.commons.configuration.PropertyConverter;
 
 /**
  * A configuration wrapper around a {@link ServletConfig}. This configuration
@@ -29,7 +31,7 @@
  * UnsupportedOperationException.
  *
  * @author <a href="mailto:ebourg@apache.org">Emmanuel Bourg</a>
- * @version $Revision: 1.4 $, $Date: 2004/12/02 22:05:52 $
+ * @version $Revision: 1.4 $, $Date$
  * @since 1.1
  */
 public class ServletConfiguration extends AbstractConfiguration
@@ -59,7 +61,10 @@
 
     public Object getProperty(String key)
     {
-        return config.getInitParameter(key);
+        Object value = config.getInitParameter(key);
+        List list = PropertyConverter.split((String) value, getDelimiter());
+
+        return list.size() > 1 ? list : value;
     }
 
     /**

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletContextConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletContextConfiguration.java?view=diff&r1=154668&r2=154669
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletContextConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletContextConfiguration.java
Mon Feb 21 03:39:33 2005
@@ -17,11 +17,13 @@
 package org.apache.commons.configuration.web;
 
 import java.util.Iterator;
+import java.util.List;
 import javax.servlet.Servlet;
 import javax.servlet.ServletContext;
 
 import org.apache.commons.collections.iterators.EnumerationIterator;
 import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.commons.configuration.PropertyConverter;
 
 /**
  * A configuration wrapper to read the initialization parameters of a servlet
@@ -29,7 +31,7 @@
  * throw an UnsupportedOperationException.
  *
  * @author <a href="mailto:ebourg@apache.org">Emmanuel Bourg</a>
- * @version $Revision: 1.4 $, $Date: 2004/12/02 22:05:52 $
+ * @version $Revision: 1.4 $, $Date$
  * @since 1.1
  */
 public class ServletContextConfiguration extends AbstractConfiguration
@@ -60,7 +62,10 @@
 
     public Object getProperty(String key)
     {
-        return context.getInitParameter(key);
+        Object value = context.getInitParameter(key);
+        List list = PropertyConverter.split((String) value, getDelimiter());
+
+        return list.size() > 1 ? list : value;
     }
 
     /**

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java?view=diff&r1=154668&r2=154669
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java
Mon Feb 21 03:39:33 2005
@@ -17,10 +17,12 @@
 package org.apache.commons.configuration.web;
 
 import java.util.Iterator;
+import java.util.List;
 import javax.servlet.FilterConfig;
 
 import org.apache.commons.collections.iterators.EnumerationIterator;
 import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.commons.configuration.PropertyConverter;
 
 /**
  * A configuration wrapper around a {@link FilterConfig}. This configuration is
@@ -28,7 +30,7 @@
  * UnsupportedOperationException.
  *
  * @author <a href="mailto:ebourg@apache.org">Emmanuel Bourg</a>
- * @version $Revision: 1.4 $, $Date: 2004/12/02 22:05:52 $
+ * @version $Revision: 1.4 $, $Date$
  * @since 1.1
  */
 public class ServletFilterConfiguration extends AbstractConfiguration
@@ -45,7 +47,10 @@
 
     public Object getProperty(String key)
     {
-        return config.getInitParameter(key);
+        Object value = config.getInitParameter(key);
+        List list = PropertyConverter.split((String) value, getDelimiter());
+
+        return list.size() > 1 ? list : value;
     }
 
     /**

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java?view=diff&r1=154668&r2=154669
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
Mon Feb 21 03:39:33 2005
@@ -17,6 +17,7 @@
 package org.apache.commons.configuration.web;
 
 import java.util.Iterator;
+import java.util.Arrays;
 import javax.servlet.ServletRequest;
 
 import org.apache.commons.collections.iterators.EnumerationIterator;
@@ -28,7 +29,7 @@
  * UnsupportedOperationException.
  *
  * @author <a href="mailto:ebourg@apache.org">Emmanuel Bourg</a>
- * @version $Revision: 1.4 $, $Date: 2004/12/02 22:05:52 $
+ * @version $Revision: 1.4 $, $Date$
  * @since 1.1
  */
 public class ServletRequestConfiguration extends AbstractConfiguration
@@ -47,7 +48,20 @@
 
     public Object getProperty(String key)
     {
-        return request.getParameter(key);
+        String values[] = request.getParameterValues(key);
+
+        if (values == null || values.length == 0)
+        {
+            return null;
+        }
+        else if (values.length == 1)
+        {
+            return values[0];
+        }
+        else
+        {
+            return Arrays.asList(values);
+        }
     }
 
     /**

Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestAbstractConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestAbstractConfiguration.java?view=diff&r1=154668&r2=154669
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestAbstractConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestAbstractConfiguration.java
Mon Feb 21 03:39:33 2005
@@ -16,15 +16,18 @@
 
 package org.apache.commons.configuration;
 
-import junit.framework.TestCase;
-
+import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestCase;
+import junitx.framework.ListAssert;
 
 /**
  * Abstract TestCase for implementations of {@link AbstractConfiguration}.
  *
  * @author Emmanuel Bourg
- * @version $Revision: 1.2 $, $Date: 2004/12/02 22:05:52 $
+ * @version $Revision: 1.2 $, $Date$
  */
 public abstract class TestAbstractConfiguration extends TestCase
 {
@@ -33,6 +36,7 @@
      * <pre>
      * key1 = value1
      * key2 = value2
+     * list = value1, value2
      * </pre>
      */
     protected abstract AbstractConfiguration getConfiguration();
@@ -44,12 +48,23 @@
 
     public void testGetProperty()
     {
-        AbstractConfiguration config = getConfiguration();
+        Configuration config = getConfiguration();
         assertEquals("key1", "value1", config.getProperty("key1"));
         assertEquals("key2", "value2", config.getProperty("key2"));
         assertNull("key3", config.getProperty("key3"));
     }
 
+    public void testList()
+    {
+        Configuration config = getConfiguration();
+
+        List list = config.getList("list");
+        assertNotNull("list not found", config.getProperty("list"));
+        assertEquals("list size", 2, list.size());
+        assertTrue("'value1' is not in the list", list.contains("value1"));
+        assertTrue("'value2' is not in the list", list.contains("value2"));
+    }
+
     public void testAddPropertyDirect()
     {
         AbstractConfiguration config = getConfiguration();
@@ -59,38 +74,45 @@
 
     public void testIsEmpty()
     {
-        AbstractConfiguration config = getConfiguration();
+        Configuration config = getConfiguration();
         assertFalse("the configuration is empty", config.isEmpty());
         assertTrue("the configuration is not empty", getEmptyConfiguration().isEmpty());
     }
 
     public void testContainsKey()
     {
-        AbstractConfiguration config = getConfiguration();
+        Configuration config = getConfiguration();
         assertTrue("key1 not found", config.containsKey("key1"));
         assertFalse("key3 found", config.containsKey("key3"));
     }
 
     public void testClearProperty()
     {
-        AbstractConfiguration config = getConfiguration();
+        Configuration config = getConfiguration();
         config.clearProperty("key2");
         assertFalse("key2 not cleared", config.containsKey("key2"));
     }
 
     public void testGetKeys()
     {
-        AbstractConfiguration config = getConfiguration();
+        Configuration config = getConfiguration();
         Iterator keys = config.getKeys();
 
-        assertNotNull("null iterator", keys);
-        String k = keys.next() + ":" + keys.next();
-        assertTrue("elements", "key1:key2".equals(k) | "key2:key1".equals(k));
-        assertFalse("too many elements", keys.hasNext());
+        List expectedKeys = new ArrayList();
+        expectedKeys.add("key1");
+        expectedKeys.add("key2");
+        expectedKeys.add("list");
 
-        keys = getEmptyConfiguration().getKeys();
         assertNotNull("null iterator", keys);
-        assertFalse("too many elements", keys.hasNext());
+        assertTrue("empty iterator", keys.hasNext());
+
+        List actualKeys = new ArrayList();
+        while (keys.hasNext())
+        {
+            actualKeys.add(keys.next());
+        }
+
+        ListAssert.assertEquals("keys", expectedKeys, actualKeys);
     }
 
 }

Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestMapConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestMapConfiguration.java?view=diff&r1=154668&r2=154669
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestMapConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestMapConfiguration.java
Mon Feb 21 03:39:33 2005
@@ -23,7 +23,7 @@
  * Tests for MapConfiguration.
  *
  * @author Emmanuel Bourg
- * @version $Revision: 1.1 $, $Date: 2004/10/18 12:50:41 $
+ * @version $Revision: 1.1 $, $Date$
  */
 public class TestMapConfiguration extends TestAbstractConfiguration
 {
@@ -32,6 +32,7 @@
         Map map = new HashMap();
         map.put("key1", "value1");
         map.put("key2", "value2");
+        map.put("list", "value1, value2");
 
         return new MapConfiguration(map);
     }

Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestAppletConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestAppletConfiguration.java?view=diff&r1=154668&r2=154669
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestAppletConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestAppletConfiguration.java
Mon Feb 21 03:39:33 2005
@@ -26,7 +26,7 @@
  * Test case for the {@link AppletConfiguration} class.
  *
  * @author Emmanuel Bourg
- * @version $Revision: 1.1 $, $Date: 2004/10/14 09:54:35 $
+ * @version $Revision: 1.1 $, $Date$
  */
 public class TestAppletConfiguration extends TestAbstractConfiguration
 {
@@ -35,6 +35,7 @@
         final Properties parameters = new Properties();
         parameters.setProperty("key1", "value1");
         parameters.setProperty("key2", "value2");
+        parameters.setProperty("list", "value1, value2");
 
         Applet applet = new Applet()
         {
@@ -48,7 +49,8 @@
                 return new String[][]
                 {
                     {"key1", "String", ""},
-                    {"key2", "String", ""}
+                    {"key2", "String", ""},
+                    {"list", "String[]", ""}
                 };
             }
         };

Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletConfiguration.java?view=diff&r1=154668&r2=154669
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletConfiguration.java
Mon Feb 21 03:39:33 2005
@@ -28,7 +28,7 @@
  * Test case for the {@link ServletConfiguration} class.
  *
  * @author Emmanuel Bourg
- * @version $Revision: 1.1 $, $Date: 2004/10/14 09:54:35 $
+ * @version $Revision: 1.1 $, $Date$
  */
 public class TestServletConfiguration extends TestAbstractConfiguration
 {
@@ -37,6 +37,7 @@
         final MockServletConfig config = new MockServletConfig();
         config.setInitParameter("key1", "value1");
         config.setInitParameter("key2", "value2");
+        config.setInitParameter("list", "value1, value2");
 
         Servlet servlet = new HttpServlet() {
             public ServletConfig getServletConfig()

Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletContextConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletContextConfiguration.java?view=diff&r1=154668&r2=154669
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletContextConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletContextConfiguration.java
Mon Feb 21 03:39:33 2005
@@ -32,7 +32,7 @@
  * Test case for the {@link ServletContextConfiguration} class.
  *
  * @author Emmanuel Bourg
- * @version $Revision: 1.1 $, $Date: 2004/10/14 09:54:35 $
+ * @version $Revision: 1.1 $, $Date$
  */
 public class TestServletContextConfiguration extends TestAbstractConfiguration
 {
@@ -41,6 +41,7 @@
         final Properties parameters = new Properties();
         parameters.setProperty("key1", "value1");
         parameters.setProperty("key2", "value2");
+        parameters.setProperty("list", "value1, value2");
 
         // create a servlet context
         ServletContext context = new MockServletContext()

Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletFilterConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletFilterConfiguration.java?view=diff&r1=154668&r2=154669
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletFilterConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletFilterConfiguration.java
Mon Feb 21 03:39:33 2005
@@ -28,7 +28,7 @@
  * Test case for the {@link ServletFilterConfiguration} class.
  *
  * @author Emmanuel Bourg
- * @version $Revision: 1.1 $, $Date: 2004/10/14 09:54:35 $
+ * @version $Revision: 1.1 $, $Date$
  */
 public class TestServletFilterConfiguration extends TestAbstractConfiguration
 {
@@ -37,6 +37,7 @@
         MockFilterConfig config = new MockFilterConfig();
         config.setInitParameter("key1", "value1");
         config.setInitParameter("key2", "value2");
+        config.setInitParameter("list", "value1, value2");
 
         return new ServletFilterConfiguration(config);
     }

Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletRequestConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletRequestConfiguration.java?view=diff&r1=154668&r2=154669
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletRequestConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/web/TestServletRequestConfiguration.java
Mon Feb 21 03:39:33 2005
@@ -16,38 +16,42 @@
 
 package org.apache.commons.configuration.web;
 
+import java.util.Enumeration;
+import javax.servlet.ServletRequest;
+
 import com.mockobjects.servlet.MockHttpServletRequest;
+import org.apache.commons.collections.iterators.IteratorEnumeration;
 import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.commons.configuration.BaseConfiguration;
+import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.TestAbstractConfiguration;
 
-import javax.servlet.ServletRequest;
-import java.util.Enumeration;
-import java.util.Properties;
-
 /**
  * Test case for the {@link ServletRequestConfiguration} class.
  *
  * @author Emmanuel Bourg
- * @version $Revision: 1.1 $, $Date: 2004/10/14 09:54:35 $
+ * @version $Revision: 1.1 $, $Date$
  */
 public class TestServletRequestConfiguration extends TestAbstractConfiguration
 {
     protected AbstractConfiguration getConfiguration()
     {
-        final Properties parameters = new Properties();
-        parameters.setProperty("key1", "value1");
-        parameters.setProperty("key2", "value2");
+        final Configuration configuration = new BaseConfiguration();
+        configuration.setProperty("key1", "value1");
+        configuration.setProperty("key2", "value2");
+        configuration.addProperty("list", "value1");
+        configuration.addProperty("list", "value2");
 
         ServletRequest request = new MockHttpServletRequest()
         {
-            public String getParameter(String key)
+            public String[] getParameterValues(String key)
             {
-                return parameters.getProperty(key);
+                return configuration.getStringArray(key);
             }
 
             public Enumeration getParameterNames()
             {
-                return parameters.keys();
+                return new IteratorEnumeration(configuration.getKeys());
             }
         };
 
@@ -56,7 +60,7 @@
 
     protected AbstractConfiguration getEmptyConfiguration()
     {
-        final Properties parameters = new Properties();
+        final Configuration configuration = new BaseConfiguration();
 
         ServletRequest request = new MockHttpServletRequest()
         {
@@ -67,7 +71,7 @@
 
             public Enumeration getParameterNames()
             {
-                return parameters.keys();
+                return new IteratorEnumeration(configuration.getKeys());
             }
         };
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message