You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2012/02/13 22:19:09 UTC

svn commit: r1243699 [2/3] - in /commons/proper/chain/trunk/src: changes/ main/java/org/apache/commons/chain/ main/java/org/apache/commons/chain/config/ main/java/org/apache/commons/chain/generic/ main/java/org/apache/commons/chain/impl/ main/java/org/...

Modified: commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/RequestParameterMapper.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/RequestParameterMapper.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/RequestParameterMapper.java (original)
+++ commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/RequestParameterMapper.java Mon Feb 13 21:19:07 2012
@@ -38,7 +38,8 @@ import org.apache.commons.chain.generic.
  * @author Craig R. McClanahan
  */
 
-public class RequestParameterMapper<C extends Context> extends LookupCommand<C> {
+public class RequestParameterMapper
+        extends LookupCommand<String, Object, ServletWebContext> {
 
 
     // ------------------------------------------------------ Instance Variables
@@ -124,11 +125,9 @@ public class RequestParameterMapper<C ex
      * @since Chain 1.2
      */
     @Override
-    protected String getCommandName(C context) {
-
+    protected String getCommandName(ServletWebContext context) {
         // Look up the specified request parameter for this request
-        ServletWebContext swcontext = (ServletWebContext) context;
-        HttpServletRequest request = swcontext.getRequest();
+        HttpServletRequest request = context.getRequest();
         String value = request.getParameter(getCatalogName());
         return value;
 
@@ -146,11 +145,16 @@ public class RequestParameterMapper<C ex
      * @since Chain 1.2
      */
     @Override
-    protected Catalog getCatalog(C context) {
-        Catalog catalog = (Catalog) context.get(getCatalogKey());
+    protected Catalog<String, Object, ServletWebContext> getCatalog(ServletWebContext context) {
+        /* Assume that the returned value will be null or of a valid catalog
+         * type according to chain's historical contract. */
+        @SuppressWarnings("unchecked")
+        Catalog<String, Object, ServletWebContext> catalog = (Catalog<String, Object, ServletWebContext>) context.get(getCatalogKey());
+
         if (catalog == null) {
             catalog = super.getCatalog(context);
         }
+
         return catalog;
     }
 

Modified: commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/ServletGetLocaleCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/ServletGetLocaleCommand.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/ServletGetLocaleCommand.java (original)
+++ commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/ServletGetLocaleCommand.java Mon Feb 13 21:19:07 2012
@@ -31,7 +31,8 @@ import org.apache.commons.chain.web.Abst
  *
  */
 
-public class ServletGetLocaleCommand<C extends Context> extends AbstractGetLocaleCommand<C> {
+public class ServletGetLocaleCommand
+        extends AbstractGetLocaleCommand<ServletWebContext> {
 
 
     // ------------------------------------------------------- Protected Methods
@@ -43,7 +44,7 @@ public class ServletGetLocaleCommand<C e
      * @param context The {@link Context} we are operating on.
      * @return The Locale for the request.
      */
-    protected Locale getLocale(C context) {
+    protected Locale getLocale(ServletWebContext context) {
 
     HttpServletRequest request = (HttpServletRequest)
         context.get("request");

Modified: commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/ServletPathMapper.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/ServletPathMapper.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/ServletPathMapper.java (original)
+++ commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/ServletPathMapper.java Mon Feb 13 21:19:07 2012
@@ -37,7 +37,7 @@ import org.apache.commons.chain.generic.
  * @author Craig R. McClanahan
  */
 
-public class ServletPathMapper<C extends Context> extends LookupCommand<C> {
+public class ServletPathMapper extends LookupCommand<String, Object, ServletWebContext> {
 
 
     // ------------------------------------------------------ Instance Variables
@@ -95,10 +95,9 @@ public class ServletPathMapper<C extends
      *
      * @since Chain 1.2
      */
-    protected String getCommandName(Context context) {
-
+    @Override
+    protected String getCommandName(ServletWebContext swcontext) {
         // Look up the servlet path for this request
-        ServletWebContext swcontext = (ServletWebContext) context;
         HttpServletRequest request = swcontext.getRequest();
         String servletPath = (String)
             request.getAttribute("javax.servlet.include.servlet_path");
@@ -120,12 +119,25 @@ public class ServletPathMapper<C extends
      *
      * @since Chain 1.2
      */
-    protected Catalog getCatalog(C context) {
-        Catalog catalog = (Catalog) context.get(getCatalogName());
-        if (catalog == null) {
-            catalog = super.getCatalog(context);
-        }
+    @Override
+    protected Catalog<String, Object, ServletWebContext> getCatalog(ServletWebContext context) {
+
+        /* If the object returned from the passed context is not a valid catalog
+         * then we use the super class's catalog extraction logic to pull it
+         * or to error gracefully.
+         */
+        Object testCatalog = context.get(getCatalogName());
+
+        /* Assume that the underlying implementation is following convention and
+         * returning a catalog with the current context.
+         */
+        @SuppressWarnings("unchecked")
+        Catalog<String, Object, ServletWebContext> catalog = testCatalog != null && testCatalog instanceof Catalog ?
+                (Catalog<String, Object, ServletWebContext>) testCatalog :
+                super.getCatalog(context);
+
         return catalog;
+
     }
 
 }

Modified: commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/ServletSetLocaleCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/ServletSetLocaleCommand.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/ServletSetLocaleCommand.java (original)
+++ commons/proper/chain/trunk/src/main/java/org/apache/commons/chain/web/servlet/ServletSetLocaleCommand.java Mon Feb 13 21:19:07 2012
@@ -31,7 +31,8 @@ import org.apache.commons.chain.web.Abst
  *
  */
 
-public class ServletSetLocaleCommand<C extends Context> extends AbstractSetLocaleCommand<C> {
+public class ServletSetLocaleCommand
+        extends AbstractSetLocaleCommand<ServletWebContext> {
 
 
     // ------------------------------------------------------- Protected Methods
@@ -43,7 +44,7 @@ public class ServletSetLocaleCommand<C e
      * @param context The {@link Context} we are operating on.
      * @param locale The Locale for the request.
      */
-    protected void setLocale(C context, Locale locale) {
+    protected void setLocale(ServletWebContext context, Locale locale) {
 
     HttpServletResponse response = (HttpServletResponse)
         context.get("response");

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParser2TestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParser2TestCase.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParser2TestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParser2TestCase.java Mon Feb 13 21:19:07 2012
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertTru
 import java.util.Iterator;
 
 import org.apache.commons.chain.Catalog;
+import org.apache.commons.chain.CatalogFactory;
 import org.apache.commons.chain.Command;
 import org.apache.commons.chain.Context;
 import org.apache.commons.chain.impl.AddingCommand;
@@ -63,13 +64,13 @@ public class ConfigParser2TestCase {
     /**
      * <p>The <code>Catalog</code> to contain our configured commands.</p>
      */
-    protected Catalog catalog = null;
+    protected Catalog<String, Object, Context<String, Object>> catalog = null;
 
 
     /**
      * <p>The <code>Context</code> to use for execution tests.</p>
      */
-    protected Context context = null;
+    protected Context<String, Object> context = null;
 
 
     /**
@@ -86,7 +87,7 @@ public class ConfigParser2TestCase {
      */
     @Before
     public void setUp() {
-        catalog = new CatalogBase();
+        catalog = new CatalogBase<String, Object, Context<String, Object>>();
         context = new ContextBase();
         parser = new ConfigParser();
     }
@@ -115,7 +116,7 @@ public class ConfigParser2TestCase {
         checkCommandCount(17);
 
         // Check individual single command instances
-        Command command = null;
+        Command<String, Object, Context<String, Object>> command = null;
 
         command = catalog.getCommand("AddingCommand");
         assertNotNull(command);
@@ -315,9 +316,9 @@ public class ConfigParser2TestCase {
     // Verify the number of configured commands
     protected void checkCommandCount(int expected) {
         int n = 0;
-        Iterator names = catalog.getNames();
+        Iterator<String> names = catalog.getNames();
         while (names.hasNext()) {
-            String name = (String) names.next();
+            String name = names.next();
             n++;
             assertNotNull(name + " exists", catalog.getCommand(name));
         }
@@ -337,7 +338,9 @@ public class ConfigParser2TestCase {
     // Load the specified catalog from the specified resource path
     protected void load(String path) throws Exception {
         parser.parse(catalog, this.getClass().getResource(path));
-        catalog = CatalogFactoryBase.getInstance().getCatalog("foo");
+        CatalogFactory<String, Object, Context<String, Object>> catalogFactory
+            = CatalogFactoryBase.getInstance();
+        catalog = catalogFactory.getCatalog("foo");
     }
 
 

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParserTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParserTestCase.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParserTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParserTestCase.java Mon Feb 13 21:19:07 2012
@@ -62,13 +62,13 @@ public class ConfigParserTestCase {
     /**
      * <p>The <code>Catalog</code> to contain our configured commands.</p>
      */
-    protected Catalog catalog = null;
+    protected Catalog<String, Object, Context<String, Object>> catalog = null;
 
 
     /**
      * <p>The <code>Context</code> to use for execution tests.</p>
      */
-    protected Context context = null;
+    protected Context<String, Object> context = null;
 
 
     /**
@@ -86,7 +86,7 @@ public class ConfigParserTestCase {
     @Before
     public void setUp() {
         CatalogFactory.clear();
-        catalog = new CatalogBase();
+        catalog = new CatalogBase<String, Object, Context<String, Object>>();
         context = new ContextBase();
         parser = new ConfigParser();
     }
@@ -115,7 +115,7 @@ public class ConfigParserTestCase {
         checkCommandCount(17);
 
         // Check individual single command instances
-        Command command = null;
+        Command<String, Object, Context<String, Object>> command = null;
 
         command = catalog.getCommand("AddingCommand");
         assertNotNull(command);
@@ -315,9 +315,9 @@ public class ConfigParserTestCase {
     // Verify the number of configured commands
     protected void checkCommandCount(int expected) {
         int n = 0;
-        Iterator names = catalog.getNames();
+        Iterator<String> names = catalog.getNames();
         while (names.hasNext()) {
-            String name = (String) names.next();
+            String name = names.next();
             n++;
             assertNotNull(name + " exists", catalog.getCommand(name));
         }
@@ -337,7 +337,9 @@ public class ConfigParserTestCase {
     // Load the specified catalog from the specified resource path
     protected void load(String path) throws Exception {
         parser.parse(this.getClass().getResource(path));
-        catalog = CatalogFactoryBase.getInstance().getCatalog();
+        CatalogFactory<String, Object, Context<String, Object>> catalogFactory
+            = CatalogFactoryBase.getInstance();
+        catalog = catalogFactory.getCatalog();
     }
 
 

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/TestChain.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/TestChain.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/TestChain.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/TestChain.java Mon Feb 13 21:19:07 2012
@@ -17,6 +17,7 @@
 package org.apache.commons.chain.config;
 
 
+import org.apache.commons.chain.Context;
 import org.apache.commons.chain.impl.ChainBase;
 
 
@@ -25,7 +26,7 @@ import org.apache.commons.chain.impl.Cha
  * <code>getCommands()</code> method publicy.</p>
  */
 
-public class TestChain extends ChainBase {
+public class TestChain extends ChainBase<String, Object, Context<String, Object>> {
 
 
     /*public Command[] getCommands() {

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/TestCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/TestCommand.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/TestCommand.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/TestCommand.java Mon Feb 13 21:19:07 2012
@@ -26,7 +26,7 @@ import org.apache.commons.chain.Context;
  * configurable properties.</p>
  */
 
-public class TestCommand implements Command {
+public class TestCommand implements Command<String, Object, Context<String, Object>> {
 
 
     private String bar = null;
@@ -47,7 +47,7 @@ public class TestCommand implements Comm
     }
 
 
-    public boolean execute(Context context) throws Exception {
+    public boolean execute(Context<String, Object> context) throws Exception {
     return (false);
     }
 

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchCommandTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchCommandTestCase.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchCommandTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchCommandTestCase.java Mon Feb 13 21:19:07 2012
@@ -34,7 +34,7 @@ public class DispatchCommandTestCase {
         TestCommand test = new TestCommand();
 
         test.setMethod("testMethod");
-        Context context = new ContextBase();
+        Context<String, Object> context = new ContextBase();
         assertNull(context.get("foo"));
         boolean result = test.execute(context);
         assertTrue(result);
@@ -50,7 +50,7 @@ public class DispatchCommandTestCase {
         TestCommand test = new TestCommand();
 
         test.setMethodKey("foo");
-        Context context = new ContextBase();
+        Context<String, Object> context = new ContextBase();
         context.put("foo", "testMethodKey");
         assertNull(context.get("bar"));
         boolean result = test.execute(context);
@@ -66,7 +66,7 @@ public class DispatchCommandTestCase {
         TestAlternateContextCommand test = new TestAlternateContextCommand();
 
         test.setMethod("foo");
-        Context context = new ContextBase();
+        Context<String, Object> context = new ContextBase();
         assertNull(context.get("elephant"));
         boolean result = test.execute(context);
         assertTrue(result);
@@ -76,17 +76,17 @@ public class DispatchCommandTestCase {
 
     }
 
-    
-    class TestCommand extends DispatchCommand {
-        
 
-        public boolean testMethod(Context context) {
+    class TestCommand extends DispatchCommand<String, Object, Context<String, Object>> {
+
+
+        public boolean testMethod(Context<String, Object> context) {
             context.put("foo", "foo");
             return true;
         }
 
-        public boolean testMethodKey(Context context) {
-            
+        public boolean testMethodKey(Context<String, Object> context) {
+
             context.put("bar", "bar");
             return false;
         }
@@ -98,14 +98,14 @@ public class DispatchCommandTestCase {
      * @author germuska
      * @version 0.2-dev
      */
-    class TestAlternateContextCommand extends DispatchCommand {
+    class TestAlternateContextCommand extends DispatchCommand<String, Object, Context<String, Object>> {
 
 
-        protected Class[] getSignature() {
+        protected Class<?>[] getSignature() {
             return new Class[] { TestAlternateContext.class };
         }
 
-        protected Object[] getArguments(Context context) {
+        protected Object[] getArguments(Context<String, Object> context) {
             return new Object[] { new TestAlternateContext(context) };
         }
 
@@ -113,13 +113,17 @@ public class DispatchCommandTestCase {
             context.put("elephant", "elephant");
             return true;
         }
-        
+
     }
 
 
-    class TestAlternateContext extends java.util.HashMap<String, Object> implements Context {
-        Context wrappedContext = null;
-         TestAlternateContext(Context context) {
+    class TestAlternateContext extends java.util.HashMap<String, Object>
+            implements Context<String, Object> {
+
+        private static final long serialVersionUID = -8169700369254126548L;
+
+        Context<String, Object> wrappedContext = null;
+        TestAlternateContext(Context<String, Object> context) {
             this.wrappedContext = context;
         }
 
@@ -128,7 +132,7 @@ public class DispatchCommandTestCase {
             return this.wrappedContext.get(o);
         }
 
-        public <T> T retrieve(String key) {
+        public <T extends Object> T retrieve(String key) {
             return wrappedContext.<T>retrieve(key);
         }
 

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchLookupCommandTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchLookupCommandTestCase.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchLookupCommandTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchLookupCommandTestCase.java Mon Feb 13 21:19:07 2012
@@ -18,6 +18,7 @@ package org.apache.commons.chain.generic
 
 import static org.junit.Assert.*;
 
+import org.apache.commons.chain.CatalogFactory;
 import org.apache.commons.chain.Context;
 import org.apache.commons.chain.Catalog;
 import org.apache.commons.chain.impl.CatalogBase;
@@ -43,17 +44,17 @@ public class DispatchLookupCommandTestCa
     /**
      * The instance of {@link Catalog} to use when looking up commands
      */
-    protected Catalog catalog;
+    protected Catalog<String, Object, Context<String, Object>> catalog;
 
     /**
      * The {@link DispatchLookupCommand} instance under test.
      */
-    protected DispatchLookupCommand<Context> command;
+    protected DispatchLookupCommand<String, Object, Context<String, Object>> command;
 
     /**
      * The {@link Context} instance on which to execute the chain.
      */
-    protected Context context = null;
+    protected Context<String, Object> context = null;
 
 
     // -------------------------------------------------- Overall Test Methods
@@ -64,9 +65,10 @@ public class DispatchLookupCommandTestCa
      */
     @Before
     public void setUp() {
-        catalog = new CatalogBase();
-        CatalogFactoryBase.getInstance().setCatalog(catalog);
-        command = new DispatchLookupCommand<Context>();
+        catalog = new CatalogBase<String, Object, Context<String, Object>>();
+        CatalogFactory<String, Object, Context<String, Object>> catalogFactory = CatalogFactoryBase.getInstance();
+        catalogFactory.setCatalog(catalog);
+        command = new DispatchLookupCommand<String, Object, Context<String, Object>>();
         context = new ContextBase();
     }
 
@@ -85,18 +87,18 @@ public class DispatchLookupCommandTestCa
     // ------------------------------------------------ Individual Test Methods
 
 
-    // Test ability to lookup and execute a dispatch method on a single 
+    // Test ability to lookup and execute a dispatch method on a single
     // non-delegating command
     @Test
     public void testExecuteDispatchLookup_1a() {
 
         // use default catalog
-        catalog.addCommand("fooCommand", new TestCommand<Context>("1"));
-        
+        catalog.addCommand("fooCommand", new TestCommand<Context<String, Object>>("1"));
+
         // command should lookup the fooCommand and execute the fooMethod
         command.setName("fooCommand");
         command.setMethod("fooMethod");
-        
+
         try {
             assertTrue("Command should return true",
                        command.execute(context));
@@ -104,7 +106,7 @@ public class DispatchLookupCommandTestCa
 
             fail("Threw exception: " + e);
         }
-        
+
         // command should lookup the fooCommand and execute the barMethod
         command.setMethod("barMethod");
 
@@ -114,17 +116,17 @@ public class DispatchLookupCommandTestCa
         } catch (Exception e) {
             fail("Threw exception: " + e);
         }
-        
+
         checkExecuteLog("1/1");
-        
+
     }
-    
+
     // Test IllegalArgumentException when incorrect command name specified
     @Test
     public void testExecuteDispatchLookup_2() {
 
         // use default catalog
-        catalog.addCommand("barCommand", new TestCommand("2"));
+        catalog.addCommand("barCommand", new TestCommand<Context<String, Object>>("2"));
 
         // command should lookup the fooCommand and execute the fooMethod
         command.setName("fooCommand");
@@ -138,17 +140,17 @@ public class DispatchLookupCommandTestCa
         } catch (Exception e) {
             // this is a failure
         }
-      
+
         fail("Expected IllegalArgumentException");
     }
 
-    // Test ability to lookup and execute a dispatch method on a single 
+    // Test ability to lookup and execute a dispatch method on a single
     // non-delegating command (using context to specify method name)
     @Test
     public void testExecuteDispatchLookup_3() {
 
         // use default catalog
-        catalog.addCommand("fooCommand", new TestCommand("3"));
+        catalog.addCommand("fooCommand", new TestCommand<Context<String, Object>>("3"));
 
         // command should lookup the fooCommand and execute the fooMethod
         command.setName("fooCommand");
@@ -193,23 +195,23 @@ public class DispatchLookupCommandTestCa
     // ---------------------------------------------------------- Inner Classes
 
 
-    class TestCommand<C extends Context> extends NonDelegatingCommand<C> {
+    class TestCommand<C extends Context<String, Object>> extends NonDelegatingCommand {
 
         public TestCommand(String id)
         {
             super(id);
         }
-    
+
         public boolean fooMethod(C context) {
-            log(context, id);            
+            log(context, id);
             return true;
         }
-        
+
         public boolean barMethod(C context) {
             log(context, id);
             return true;
         }
-        
+
     }
 
 }

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/LookupCommandTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/LookupCommandTestCase.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/LookupCommandTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/LookupCommandTestCase.java Mon Feb 13 21:19:07 2012
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import org.apache.commons.chain.Catalog;
+import org.apache.commons.chain.CatalogFactory;
 import org.apache.commons.chain.Chain;
 import org.apache.commons.chain.Context;
 import org.apache.commons.chain.impl.CatalogBase;
@@ -50,17 +51,17 @@ public class LookupCommandTestCase {
     /**
      * The instance of {@link Catalog} to use when looking up commands
      */
-    protected Catalog catalog;
+    protected Catalog<String, Object, Context<String, Object>> catalog;
 
     /**
      * The {@link LookupCommand} instance under test.
      */
-    protected LookupCommand<Context> command;
+    protected LookupCommand<String, Object, Context<String, Object>> command;
 
     /**
      * The {@link Context} instance on which to execute the chain.
      */
-    protected Context context = null;
+    protected Context<String, Object> context = null;
 
 
     // -------------------------------------------------- Overall Test Methods
@@ -71,9 +72,10 @@ public class LookupCommandTestCase {
      */
     @Before
     public void setUp() {
-        catalog = new CatalogBase();
-        CatalogFactoryBase.getInstance().setCatalog(catalog);
-        command = new LookupCommand<Context>();
+        catalog = new CatalogBase<String, Object, Context<String, Object>>();
+        CatalogFactory<String, Object, Context<String, Object>> catalogFactory = CatalogFactoryBase.getInstance();
+        catalogFactory.setCatalog(catalog);
+        command = new LookupCommand<String, Object, Context<String, Object>>();
         context = new ContextBase();
     }
 
@@ -113,11 +115,12 @@ public class LookupCommandTestCase {
     @Test
     public void testExecuteMethodLookup_1b() {
 
-        ChainBase<Context> chain = new ChainBase<Context>();
+        ChainBase<String, Object, Context<String, Object>> chain =
+            new ChainBase<String, Object, Context<String, Object>>();
         chain.addCommand(new DelegatingCommand("1b1"));
         chain.addCommand(new DelegatingCommand("1b2"));
         chain.addCommand(new NonDelegatingCommand("1b3"));
-        
+
         // use default catalog
         catalog.addCommand("foo", chain);
         command.setName("foo");
@@ -150,11 +153,12 @@ public class LookupCommandTestCase {
         checkExecuteLog("2a");
     }
 
-    // Test ability to lookup and execute a chain using the context 
+    // Test ability to lookup and execute a chain using the context
     @Test
     public void testExecuteMethodLookup_2b() {
 
-        Chain<Context> chain = new ChainBase<Context>();
+        Chain<String, Object, Context<String, Object>> chain =
+            new ChainBase<String, Object, Context<String, Object>>();
         chain.addCommand(new DelegatingCommand("2b1"));
         chain.addCommand(new DelegatingCommand("2b2"));
         chain.addCommand(new NonDelegatingCommand("2b3"));
@@ -178,7 +182,8 @@ public class LookupCommandTestCase {
     public void testExecuteMethodLookup_3a() {
 
         // use default catalog
-        catalog.addCommand("foo", new NonDelegatingCommand<Context>("3a"));
+        catalog.addCommand("foo",
+                new NonDelegatingCommand("3a"));
         command.setIgnoreExecuteResult(true);
         command.setName("foo");
 

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/AddingCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/AddingCommand.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/AddingCommand.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/AddingCommand.java Mon Feb 13 21:19:07 2012
@@ -39,25 +39,25 @@ public class AddingCommand extends NonDe
 
 
     public AddingCommand() {
-    this("", null);
+        this("", null);
     }
 
     // Construct an instance that will log the specified identifier
-    public AddingCommand(String id, Chain parent) {
+    public AddingCommand(String id, Chain<String, Object, Context<String, Object>> parent) {
         super(id);
         this.parent = parent;
     }
 
 
     // The parent Chain
-    private Chain parent = null;
+    private Chain<String, Object, Context<String, Object>> parent = null;
 
 
     // -------------------------------------------------------- Command Methods
 
 
     // Execution method for this Command
-    public boolean execute(Context context, Chain chain) throws Exception {
+    public boolean execute(Context<String, Object> context, Chain<String, Object, Context<String, Object>> chain) throws Exception {
 
         super.execute(context);
         parent.addCommand(new NonDelegatingCommand("NEW")); // Should cause ISE

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogBaseTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogBaseTestCase.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogBaseTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogBaseTestCase.java Mon Feb 13 21:19:07 2012
@@ -25,6 +25,7 @@ import java.util.Iterator;
 
 import org.apache.commons.chain.Catalog;
 import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -46,7 +47,7 @@ public class CatalogBaseTestCase {
     /**
      * The {@link Catalog} instance under test.
      */
-    protected CatalogBase catalog = null;
+    protected CatalogBase<String, Object, Context<String, Object>> catalog = null;
 
 
     // -------------------------------------------------- Overall Test Methods
@@ -57,7 +58,7 @@ public class CatalogBaseTestCase {
      */
     @Before
     public void setUp() {
-        catalog = new CatalogBase();
+        catalog = new CatalogBase<String, Object, Context<String, Object>>();
     }
 
     /**
@@ -85,7 +86,7 @@ public class CatalogBaseTestCase {
     public void testGetCommand() {
 
         addCommands();
-        Command command = null;
+        Command<String, Object, Context<String, Object>> command = null;
 
         command = catalog.getCommand("AddingCommand");
         assertNotNull(command);
@@ -154,16 +155,16 @@ public class CatalogBaseTestCase {
         catalog.addCommand("ExceptionFilter", new ExceptionFilter("", ""));
         catalog.addCommand("NonDelegatingCommand", new NonDelegatingCommand(""));
         catalog.addCommand("NonDelegatingFilter", new NonDelegatingFilter("", ""));
-        catalog.addCommand("ChainBase", new ChainBase());
+        catalog.addCommand("ChainBase", new ChainBase<String, Object, Context<String, Object>>());
     }
 
 
     // Verify the number of configured commands
     protected void checkCommandCount(int expected) {
         int n = 0;
-        Iterator names = catalog.getNames();
+        Iterator<String> names = catalog.getNames();
         while (names.hasNext()) {
-            String name = (String) names.next();
+            String name = names.next();
             n++;
             assertNotNull(name + " exists", catalog.getCommand(name));
         }

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogFactoryBaseTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogFactoryBaseTestCase.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogFactoryBaseTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogFactoryBaseTestCase.java Mon Feb 13 21:19:07 2012
@@ -28,6 +28,7 @@ import java.util.Iterator;
 import org.apache.commons.chain.Catalog;
 import org.apache.commons.chain.CatalogFactory;
 import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -48,7 +49,7 @@ public class CatalogFactoryBaseTestCase 
     /**
      * <p>The {@link CatalogFactory} instance under test.</p>
      */
-    protected CatalogFactory factory = null;
+    protected CatalogFactory<String, Object, Context<String, Object>> factory = null;
 
 
     // -------------------------------------------------- Overall Test Methods
@@ -96,7 +97,7 @@ public class CatalogFactoryBaseTestCase 
     @Test
     public void testDefaultCatalog() {
 
-        Catalog catalog = new CatalogBase();
+        Catalog<String, Object, Context<String, Object>> catalog = new CatalogBase<String, Object, Context<String, Object>>();
         factory.setCatalog(catalog);
         assertTrue(catalog == factory.getCatalog());
         assertEquals(0, getCatalogCount());
@@ -110,13 +111,13 @@ public class CatalogFactoryBaseTestCase 
     @Test
     public void testSpecificCatalog() {
 
-        Catalog catalog = new CatalogBase();
+        Catalog<String, Object, Context<String, Object>> catalog = new CatalogBase<String, Object, Context<String, Object>>();
         factory.setCatalog(catalog);
-        catalog = new CatalogBase();
+        catalog = new CatalogBase<String, Object, Context<String, Object>>();
         factory.addCatalog("foo", catalog);
         assertTrue(catalog == factory.getCatalog("foo"));
         assertEquals(1, getCatalogCount());
-        factory.addCatalog("foo", new CatalogBase());
+        factory.addCatalog("foo", new CatalogBase<String, Object, Context<String, Object>>());
         assertEquals(1, getCatalogCount());
         assertTrue(!(catalog == factory.getCatalog("foo")));
         CatalogFactory.clear();
@@ -132,20 +133,20 @@ public class CatalogFactoryBaseTestCase 
     @Test
     public void testCatalogIdentifier() {
 
-        Catalog defaultCatalog = new CatalogBase();
-        Command defaultFoo = new NonDelegatingCommand();
+        Catalog<String, Object, Context<String, Object>> defaultCatalog = new CatalogBase<String, Object, Context<String, Object>>();
+        Command<String, Object, Context<String, Object>> defaultFoo = new NonDelegatingCommand();
         defaultCatalog.addCommand("foo", defaultFoo);
-        Command fallback = new NonDelegatingCommand();
+        Command<String, Object, Context<String, Object>> fallback = new NonDelegatingCommand();
         defaultCatalog.addCommand("noSuchCatalog:fallback", fallback);
 
         factory.setCatalog(defaultCatalog);
 
-        Catalog specificCatalog = new CatalogBase();
-        Command specificFoo = new NonDelegatingCommand();
+        Catalog<String, Object, Context<String, Object>> specificCatalog = new CatalogBase<String, Object, Context<String, Object>>();
+        Command<String, Object, Context<String, Object>> specificFoo = new NonDelegatingCommand();
         specificCatalog.addCommand("foo", specificFoo);
         factory.addCatalog("specific", specificCatalog);
 
-        Command command = factory.getCommand("foo");
+        Command<String, Object, Context<String, Object>> command = factory.getCommand("foo");
         assertSame(defaultFoo, command);
 
         command = factory.getCommand("specific:foo");
@@ -183,7 +184,7 @@ public class CatalogFactoryBaseTestCase 
      */
     private int getCatalogCount() {
 
-        Iterator names = factory.getNames();
+        Iterator<String> names = factory.getNames();
         assertNotNull(names);
         int n = 0;
         while (names.hasNext()) {

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ChainBaseTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ChainBaseTestCase.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ChainBaseTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ChainBaseTestCase.java Mon Feb 13 21:19:07 2012
@@ -47,13 +47,13 @@ public class ChainBaseTestCase {
     /**
      * The {@link Chain} instance under test.
      */
-    protected Chain chain = null;
+    protected Chain<String, Object, Context<String, Object>> chain = null;
 
 
     /**
      * The {@link Context} instance on which to execute the chain.
      */
-    protected Context context = null;
+    protected Context<String, Object> context = null;
 
 
     // -------------------------------------------------- Overall Test Methods
@@ -64,7 +64,7 @@ public class ChainBaseTestCase {
      */
     @Before
     public void setUp() {
-        chain = new ChainBase();
+        chain = new ChainBase<String, Object, Context<String, Object>>();
         context = new ContextBase();
     }
 
@@ -87,15 +87,15 @@ public class ChainBaseTestCase {
 
         checkCommandCount(0);
 
-        Command command1 = new NonDelegatingCommand("1");
+        Command<String, Object, Context<String, Object>> command1 = new NonDelegatingCommand("1");
         chain.addCommand(command1);
         checkCommandCount(1);
 
-        Command command2 = new DelegatingCommand("2");
+        Command<String, Object, Context<String, Object>> command2 = new DelegatingCommand("2");
         chain.addCommand(command2);
         checkCommandCount(2);
 
-        Command command3 = new ExceptionCommand("3");
+        Command<String, Object, Context<String, Object>> command3 = new ExceptionCommand("3");
         chain.addCommand(command3);
         checkCommandCount(3);
 
@@ -348,7 +348,8 @@ public class ChainBaseTestCase {
     // Verify the number of configured commands
     protected void checkCommandCount(int expected) {
         if (chain instanceof ChainBase) {
-            List<Command> commands = ((ChainBase) chain).getCommands();
+            List<Command<String, Object, Context<String, Object>>> commands =
+                ((ChainBase<String, Object, Context<String, Object>>) chain).getCommands();
             assertNotNull("getCommands() returned a non-null array",
                           commands);
             assertEquals("Correct command count", expected, commands.size());

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ContextBaseTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ContextBaseTestCase.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ContextBaseTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ContextBaseTestCase.java Mon Feb 13 21:19:07 2012
@@ -57,7 +57,7 @@ public class ContextBaseTestCase {
     /**
      * The {@link Context} instance under test.
      */
-    protected Context context = null;
+    protected Context<String, Object> context = null;
 
 
     // -------------------------------------------------- Overall Test Methods
@@ -168,7 +168,7 @@ public class ContextBaseTestCase {
         assertTrue(context.hashCode() == context.hashCode());
 
         // Compare to equivalent instance
-        Context other = createContext();
+        Context<String, Object> other = createContext();
         assertTrue(context.equals(other));
         assertTrue(context.hashCode() == other.hashCode());
 
@@ -190,8 +190,8 @@ public class ContextBaseTestCase {
     @Test
     public void testKeySet() {
 
-        Set keySet = null;
-        Collection all = new ArrayList();
+        Set<String> keySet = null;
+        Collection<String> all = new ArrayList<String>();
 
         // Unsupported operations
         keySet = context.keySet();
@@ -202,7 +202,7 @@ public class ContextBaseTestCase {
             ; // Expected result
         }
         try {
-            Collection adds = new ArrayList();
+            Collection<String> adds = new ArrayList<String>();
             adds.add("bop");
             keySet.addAll(adds);
             fail("Should have thrown UnsupportedOperationException");
@@ -315,7 +315,7 @@ public class ContextBaseTestCase {
         assertTrue(!context.containsValue("baz value"));
 
         // Call putAll()
-        Map adds = new HashMap();
+        Map<String, String> adds = new HashMap<String, String>();
         adds.put("foo", "foo value");
         adds.put("bar", "bar value");
         adds.put("baz", "baz value");
@@ -365,7 +365,7 @@ public class ContextBaseTestCase {
         ByteArrayInputStream bais =
           new ByteArrayInputStream(baos.toByteArray());
         ObjectInputStream ois = new ObjectInputStream(bais);
-        context = (Context) ois.readObject();
+        context = (Context<String, Object>) ois.readObject();
         ois.close();
 
         // Do some rudimentary checks to make sure we have the same contents
@@ -384,9 +384,9 @@ public class ContextBaseTestCase {
     // Verify the number of defined attributes
     protected void checkAttributeCount(int expected) {
         int actual = 0;
-        Iterator keys = context.keySet().iterator();
+        Iterator<String> keys = context.keySet().iterator();
         while (keys.hasNext()) {
-            Object key = (Object) keys.next();
+            keys.next();
             actual++;
         }
         assertEquals("Correct attribute count",
@@ -400,7 +400,7 @@ public class ContextBaseTestCase {
 
 
     // Create a new instance of the appropriate Context type for this test case
-    protected Context createContext() {
+    protected Context<String, Object> createContext() {
         return (new ContextBase());
     }
 

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/DelegatingCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/DelegatingCommand.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/DelegatingCommand.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/DelegatingCommand.java Mon Feb 13 21:19:07 2012
@@ -50,7 +50,7 @@ public class DelegatingCommand extends N
 
 
     // Execution method for this Command
-    public boolean execute(Context context) throws Exception {
+    public boolean execute(Context<String, Object> context) throws Exception {
 
         super.execute(context);
         return (false);

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/DelegatingFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/DelegatingFilter.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/DelegatingFilter.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/DelegatingFilter.java Mon Feb 13 21:19:07 2012
@@ -29,7 +29,7 @@ import org.apache.commons.chain.Filter;
  * @version $Revision$ $Date$
  */
 
-public class DelegatingFilter<C extends Context> extends NonDelegatingFilter<C> {
+public class DelegatingFilter extends NonDelegatingFilter {
 
 
     // ------------------------------------------------------------ Constructor
@@ -51,7 +51,7 @@ public class DelegatingFilter<C extends 
 
     // Execution method for this Command
     @Override
-    public boolean execute(C context) throws Exception {
+    public boolean execute(Context<String, Object> context) throws Exception {
 
         super.execute(context);
         return (false);

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ExceptionCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ExceptionCommand.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ExceptionCommand.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ExceptionCommand.java Mon Feb 13 21:19:07 2012
@@ -50,7 +50,7 @@ public class ExceptionCommand extends No
 
 
     // Execution method for this Command
-    public void execute(Context context, Chain chain) throws Exception {
+    public void execute(Context<String, Object> context, Chain<String, Object, Context<String, Object>> chain) throws Exception {
 
         super.execute(context);
         throw new ArithmeticException(this.id);

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ExceptionFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ExceptionFilter.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ExceptionFilter.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ExceptionFilter.java Mon Feb 13 21:19:07 2012
@@ -28,14 +28,15 @@ import org.apache.commons.chain.Filter;
  * @author Craig R. McClanahan
  * @version $Revision$ $Date$
  */
-public class ExceptionFilter extends ExceptionCommand implements Filter {
+public class ExceptionFilter
+    extends ExceptionCommand implements Filter<String, Object, Context<String, Object>> {
 
 
     // ------------------------------------------------------------- Constructor
 
 
     public ExceptionFilter() {
-    this("", "");
+        this("", "");
     }
 
 
@@ -50,10 +51,10 @@ public class ExceptionFilter extends Exc
 
     protected String id2 = null;
     public String getId2() {
-    return (this.id2);
+        return (this.id2);
     }
     public void setId2(String id2) {
-    this.id2 = id2;
+        this.id2 = id2;
     }
 
 
@@ -61,7 +62,7 @@ public class ExceptionFilter extends Exc
 
 
     // Postprocess command for this Filter
-    public boolean postprocess(Context context, Exception exception) {
+    public boolean postprocess(Context<String, Object> context, Exception exception) {
         log(context, id2);
         return (false);
     }

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/NonDelegatingCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/NonDelegatingCommand.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/NonDelegatingCommand.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/NonDelegatingCommand.java Mon Feb 13 21:19:07 2012
@@ -29,7 +29,7 @@ import org.apache.commons.chain.Context;
  * @version $Revision$ $Date$
  */
 
-public class NonDelegatingCommand<C extends Context> implements Command<C> {
+public class NonDelegatingCommand implements Command<String, Object, Context<String, Object>> {
 
 
     // ------------------------------------------------------------ Constructor
@@ -65,7 +65,7 @@ public class NonDelegatingCommand<C exte
 
 
     // Execution method for this Command
-    public boolean execute(C context) throws Exception {
+    public boolean execute(Context<String, Object> context) throws Exception {
 
         if (context == null) {
             throw new IllegalArgumentException();
@@ -88,7 +88,7 @@ public class NonDelegatingCommand<C exte
      * @param context The {@link Context} into which we log the identifiers
      * @param id The identifier to be logged
      */
-    protected void log(Context context, String id) {
+    protected void log(Context<String, Object> context, String id) {
         StringBuffer sb = (StringBuffer) context.get("log");
         if (sb == null) {
             sb = new StringBuffer();

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/NonDelegatingFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/NonDelegatingFilter.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/NonDelegatingFilter.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/NonDelegatingFilter.java Mon Feb 13 21:19:07 2012
@@ -29,15 +29,15 @@ import org.apache.commons.chain.Filter;
  * @version $Revision$ $Date$
  */
 
-public class NonDelegatingFilter<C extends Context>
-    extends NonDelegatingCommand<C> implements Filter<C> {
+public class NonDelegatingFilter
+    extends NonDelegatingCommand implements Filter<String, Object, Context<String, Object>> {
 
 
     // ------------------------------------------------------------- Constructor
 
 
     public NonDelegatingFilter() {
-    this("", "");
+        this("", "");
     }
 
 
@@ -53,10 +53,10 @@ public class NonDelegatingFilter<C exten
 
     protected String id2 = null;
     public String getId2() {
-    return (this.id2);
+        return (this.id2);
     }
     public void setId2(String id2) {
-    this.id2 = id2;
+        this.id2 = id2;
     }
 
 
@@ -65,7 +65,7 @@ public class NonDelegatingFilter<C exten
 
     // Execution method for this Command
     @Override
-    public boolean execute(C context) throws Exception {
+    public boolean execute(Context<String, Object> context) throws Exception {
 
         super.execute(context);
         return (true);
@@ -74,7 +74,7 @@ public class NonDelegatingFilter<C exten
 
 
     // Postprocess method for this Filter
-    public boolean postprocess(C context, Exception exception) {
+    public boolean postprocess(Context<String, Object> context, Exception exception) {
         log(context, id2);
         return (false);
     }

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/TestContext.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/TestContext.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/TestContext.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/TestContext.java Mon Feb 13 21:19:07 2012
@@ -25,6 +25,11 @@ package org.apache.commons.chain.impl;
 public class TestContext extends ContextBase {
 
 
+    /**
+     *
+     */
+    private static final long serialVersionUID = -582126541014253603L;
+
     // Read-only property
     private String readOnly = "readOnly";
     public String getReadOnly() {

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/TestContextTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/TestContextTestCase.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/TestContextTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/TestContextTestCase.java Mon Feb 13 21:19:07 2012
@@ -127,7 +127,7 @@ public class TestContextTestCase extends
 
 
     // Create a new instance of the appropriate Context type for this test case
-    protected Context createContext() {
+    protected Context<String, Object> createContext() {
         return (new TestContext());
     }
 

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/MockEnumeration.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/MockEnumeration.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/MockEnumeration.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/MockEnumeration.java Mon Feb 13 21:19:07 2012
@@ -26,15 +26,15 @@ import java.util.Iterator;
  * <code>Iterator</code> specified to our controller.</p>
  */
 
-public class MockEnumeration implements Enumeration {
+public class MockEnumeration<E> implements Enumeration<E> {
 
 
-    public MockEnumeration(Iterator iterator) {
+    public MockEnumeration(Iterator<E> iterator) {
         this.iterator = iterator;
     }
 
 
-    protected Iterator iterator;
+    protected Iterator<E> iterator;
 
 
     public boolean hasMoreElements() {
@@ -42,7 +42,7 @@ public class MockEnumeration implements 
     }
 
 
-    public Object nextElement() {
+    public E nextElement() {
         return (iterator.next());
     }
 

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/MockPortletContext.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/MockPortletContext.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/MockPortletContext.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/MockPortletContext.java Mon Feb 13 21:19:07 2012
@@ -17,9 +17,6 @@
 package org.apache.commons.chain.web.portlet;
 
 
-import javax.portlet.Portlet;
-import javax.portlet.PortletContext;
-import javax.portlet.PortletRequestDispatcher;
 import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -27,6 +24,9 @@ import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.Set;
 
+import javax.portlet.PortletContext;
+import javax.portlet.PortletRequestDispatcher;
+
 
 // Mock Object for PortletContext
 public class MockPortletContext implements PortletContext {
@@ -36,8 +36,8 @@ public class MockPortletContext implemen
     private int minorVersion = 0;
     private String portletContextName = "MockPortletContext";
     private String serverInfo = portletContextName;
-    private Hashtable parameters = new Hashtable();
-    private Hashtable attributes = new Hashtable();
+    private Hashtable<String, String> parameters = new Hashtable<String, String>();
+    private Hashtable<String, Object> attributes = new Hashtable<String, Object>();
 
 
     // --------------------------------------------------------- Public Methods
@@ -63,7 +63,7 @@ public class MockPortletContext implemen
         return attributes.get(name);
     }
 
-    public Enumeration getAttributeNames() {
+    public Enumeration<String> getAttributeNames() {
         return attributes.keys();
     }
 
@@ -71,7 +71,7 @@ public class MockPortletContext implemen
         return (String)parameters.get(name);
     }
 
-    public Enumeration getInitParameterNames() {
+    public Enumeration<String> getInitParameterNames() {
         return parameters.keys();
     }
 
@@ -111,7 +111,7 @@ public class MockPortletContext implemen
         throw new UnsupportedOperationException();
     }
 
-    public Set getResourcePaths(String path) {
+    public Set<String> getResourcePaths(String path) {
         throw new UnsupportedOperationException();
     }
 

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/MockPortletRequest.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/MockPortletRequest.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/MockPortletRequest.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/MockPortletRequest.java Mon Feb 13 21:19:07 2012
@@ -52,9 +52,9 @@ public class MockPortletRequest implemen
     private PortletPreferences portletPreferences;
     private WindowState windowState;
     private Principal principal;
-    private Map parameters = new HashMap();
-    private Map attributes = new HashMap();
-    private Map properties = new HashMap();
+    private Map<String, String[]> parameters = new HashMap<String, String[]>();
+    private Map<String, Object> attributes = new HashMap<String, Object>();
+    private Map<String, String[]> properties = new HashMap<String, String[]>();
 
 
     public MockPortletRequest() {
@@ -70,7 +70,7 @@ public class MockPortletRequest implemen
     // --------------------------------------------------------- Public Methods
 
     public void addParameter(String name, String value) {
-        String values[] = (String[])parameters.get(name);
+        String values[] = parameters.get(name);
         if (values == null) {
             String results[] = new String[] { value };
             parameters.put(name, results);
@@ -83,7 +83,7 @@ public class MockPortletRequest implemen
     }
 
     public void addProperty(String name, String value) {
-        String values[] = (String[])properties.get(name);
+        String values[] = properties.get(name);
         if (values == null) {
             String results[] = new String[] { value };
             properties.put(name, results);
@@ -154,8 +154,8 @@ public class MockPortletRequest implemen
         return attributes.get(name);
     }
 
-    public Enumeration getAttributeNames() {
-        return new MockEnumeration(attributes.keySet().iterator());
+    public Enumeration<String> getAttributeNames() {
+        return new MockEnumeration<String>(attributes.keySet().iterator());
     }
 
     public String getAuthType() {
@@ -170,7 +170,7 @@ public class MockPortletRequest implemen
         return locale;
     }
 
-    public Enumeration getLocales() {
+    public Enumeration<Locale> getLocales() {
         throw new UnsupportedOperationException();
     }
 
@@ -183,24 +183,24 @@ public class MockPortletRequest implemen
         }
     }
 
-    public Map getParameterMap() {
+    public Map<String, String[]> getParameterMap() {
         return parameters;
     }
 
-    public Enumeration getParameterNames() {
-        return new MockEnumeration(parameters.keySet().iterator());
+    public Enumeration<String> getParameterNames() {
+        return new MockEnumeration<String>(parameters.keySet().iterator());
     }
 
     public String[] getParameterValues(String name) {
-        return (String[])parameters.get(name);
+        return parameters.get(name);
     }
 
     public PortalContext getPortalContext() {
-        return portalContext; 
+        return portalContext;
     }
 
     public PortletMode getPortletMode() {
-        return portletMode; 
+        return portletMode;
     }
 
     public PortletSession getPortletSession() {
@@ -215,11 +215,11 @@ public class MockPortletRequest implemen
     }
 
     public PortletPreferences getPreferences() {
-        return portletPreferences; 
+        return portletPreferences;
     }
 
-    public Enumeration getProperties(String name) {
-        throw new UnsupportedOperationException(); 
+    public Enumeration<String> getProperties(String name) {
+        throw new UnsupportedOperationException();
     }
 
     public String getProperty(String name) {
@@ -231,8 +231,8 @@ public class MockPortletRequest implemen
         }
      }
 
-    public Enumeration getPropertyNames() {
-        return new MockEnumeration(properties.keySet().iterator());
+    public Enumeration<String> getPropertyNames() {
+        return new MockEnumeration<String>(properties.keySet().iterator());
     }
 
 
@@ -252,8 +252,8 @@ public class MockPortletRequest implemen
         throw new UnsupportedOperationException();
     }
 
-    public Enumeration getResponseContentTypes() {
-        throw new UnsupportedOperationException(); 
+    public Enumeration<String> getResponseContentTypes() {
+        throw new UnsupportedOperationException();
     }
 
     public String getScheme() {
@@ -329,5 +329,5 @@ public class MockPortletRequest implemen
         throw new UnsupportedOperationException("Not supported yet.");
     }
 
-    
+
 }

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/MockPortletSession.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/MockPortletSession.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/MockPortletSession.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/MockPortletSession.java Mon Feb 13 21:19:07 2012
@@ -17,15 +17,15 @@
 package org.apache.commons.chain.web.portlet;
 
 
-import org.apache.commons.chain.web.MockEnumeration;
-
-import javax.portlet.PortletContext;
-import javax.portlet.PortletSession;
-import javax.portlet.PortletContext;
+import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Date;
+
+import javax.portlet.PortletContext;
+import javax.portlet.PortletSession;
+
+import org.apache.commons.chain.web.MockEnumeration;
 
 
 
@@ -40,8 +40,8 @@ public class MockPortletSession implemen
     private int maxInactiveInterval = 100;
     private boolean newSession = true;
     private String id = "mockId" + creationTime.getTime();
-    private Map portletScope = new HashMap();
-    private Map applicationScope = new HashMap();
+    private Map<String, Object> portletScope = new HashMap<String, Object>();
+    private Map<String, Object> applicationScope = new HashMap<String, Object>();
 
 
     public MockPortletSession() {
@@ -85,14 +85,14 @@ public class MockPortletSession implemen
     }
 
 
-    public Enumeration getAttributeNames() {
+    public Enumeration<String> getAttributeNames() {
         accessed();
         return getAttributeNames(PortletSession.PORTLET_SCOPE);
     }
 
-    public Enumeration getAttributeNames(int scope) {
+    public Enumeration<String> getAttributeNames(int scope) {
         accessed();
-        return new MockEnumeration(getScope(scope).keySet().iterator());
+        return new MockEnumeration<String>(getScope(scope).keySet().iterator());
     }
 
 
@@ -162,7 +162,7 @@ public class MockPortletSession implemen
         lastAccessedTime = new Date();
     }
 
-    private Map getScope(int scope) {
+    private Map<String, Object> getScope(int scope) {
         if (scope == PortletSession.PORTLET_SCOPE) {
             return portletScope;
         } else if (scope == PortletSession.APPLICATION_SCOPE) {
@@ -180,5 +180,5 @@ public class MockPortletSession implemen
         throw new UnsupportedOperationException("Not supported yet.");
     }
 
-    
+
 }

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletGetLocaleCommandTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletGetLocaleCommandTestCase.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletGetLocaleCommandTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletGetLocaleCommandTestCase.java Mon Feb 13 21:19:07 2012
@@ -29,7 +29,6 @@ import javax.portlet.PortletRequest;
 import javax.portlet.PortletResponse;
 import javax.portlet.PortletSession;
 
-import org.apache.commons.chain.Context;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -52,7 +51,7 @@ public class PortletGetLocaleCommandTest
     protected PortletSession session = null;
 
     // Chain API Objects
-    protected Context context = null;
+    protected PortletWebContext context = null;
     protected PortletGetLocaleCommand command = null;
 
 
@@ -124,7 +123,7 @@ public class PortletGetLocaleCommandTest
     // --------------------------------------------------------- Support Methods
 
 
-    protected void check(Context context, PortletGetLocaleCommand command)
+    protected void check(PortletWebContext context, PortletGetLocaleCommand command)
         throws Exception {
 
         String localeKey = command.getLocaleKey();

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletWebContextTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletWebContextTestCase.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletWebContextTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletWebContextTestCase.java Mon Feb 13 21:19:07 2012
@@ -29,9 +29,12 @@ import javax.portlet.PortletContext;
 import javax.portlet.PortletRequest;
 import javax.portlet.PortletResponse;
 import javax.portlet.PortletSession;
+import javax.servlet.http.Cookie;
+
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 import java.util.Collection;
 
@@ -104,19 +107,19 @@ public class PortletWebContextTestCase e
     @Test
     public void testApplicationScope() {
 
-        Map map = ((WebContext) context).getApplicationScope();
+        Map<String, Object> map = ((WebContext) context).getApplicationScope();
         assertNotNull(map);
 
         // Initial contents
         checkMapSize(map, 4);
-        assertEquals("avalue1", (String) map.get("akey1"));
-        assertEquals("avalue2", (String) map.get("akey2"));
-        assertEquals("avalue3", (String) map.get("akey3"));
-        assertEquals("avalue4", (String) map.get("akey4"));
+        assertEquals("avalue1", map.get("akey1"));
+        assertEquals("avalue2", map.get("akey2"));
+        assertEquals("avalue3", map.get("akey3"));
+        assertEquals("avalue4", map.get("akey4"));
 
         // Transparency - entrySet()
         checkEntrySet(map, true);
- 
+
         // Transparency - removal via web object
         pcontext.removeAttribute("akey1");
         checkMapSize(map, 3);
@@ -130,30 +133,30 @@ public class PortletWebContextTestCase e
         // Transparency - addition via web object
         pcontext.setAttribute("akeyA", "avalueA");
         checkMapSize(map, 3);
-        assertEquals("avalueA", (String) map.get("akeyA"));
+        assertEquals("avalueA", map.get("akeyA"));
 
         // Transparency - addition via map
         map.put("akeyB", "avalueB");
         checkMapSize(map, 4);
-        assertEquals("avalueB", (String) pcontext.getAttribute("akeyB"));
+        assertEquals("avalueB", pcontext.getAttribute("akeyB"));
 
         // Transparency - replacement via web object
         pcontext.setAttribute("akeyA", "newvalueA");
         checkMapSize(map, 4);
-        assertEquals("newvalueA", (String) map.get("akeyA"));
+        assertEquals("newvalueA", map.get("akeyA"));
 
         // Transparency - replacement via map
         map.put("akeyB", "newvalueB");
         assertEquals(4, map.size());
-        assertEquals("newvalueB", (String) pcontext.getAttribute("akeyB"));
+        assertEquals("newvalueB", pcontext.getAttribute("akeyB"));
 
         // Clearing the map
         map.clear();
         checkMapSize(map, 0);
 
         // Test putAll()
-        Map values = new HashMap();
-        values.put(new Integer(1), "One");
+        Map<String, Object> values = new HashMap<String, Object>();
+        values.put("1", "One");
         values.put("2", "Two");
         map.putAll(values);
         assertEquals("putAll(1)", "One", map.get("1"));
@@ -173,7 +176,7 @@ public class PortletWebContextTestCase e
         assertTrue(context.hashCode() == context.hashCode());
 
         // Compare to equivalent instance
-        Context other = new PortletWebContext(pcontext, request, response);
+        Context<String, Object> other = new PortletWebContext(pcontext, request, response);
         // assertTrue(context.equals(other));
         assertTrue(context.hashCode() == other.hashCode());
 
@@ -188,14 +191,14 @@ public class PortletWebContextTestCase e
         // assertTrue(!context.equals(other));
         assertTrue(context.hashCode() != other.hashCode());
 
-    }        
+    }
 
 
     // Test getHeader()
     @Test
     public void testHeader() {
 
-        Map map = ((WebContext) context).getHeader();
+        Map<String, String> map = ((WebContext) context).getHeader();
         assertNotNull("Header Map Null", map);
 
         // Initial contents
@@ -215,19 +218,22 @@ public class PortletWebContextTestCase e
     @Test
     public void testHeaderValues() {
 
-        Map map = ((WebContext) context).getHeaderValues();
+        Map<String, String[]> map = ((WebContext) context).getHeaderValues();
         assertNotNull("HeaderValues Map Null", map);
 
         // Initial contents
         checkMapSize(map, 0);
- 
+
+        /*
+         FIXME
+         This test is inconsistent once introduced generics
         try {
             map.put("hkey3", "ABC");
             fail("Should have thrown UnsupportedOperationException");
         } catch (UnsupportedOperationException e) {
             ; // expected result
         }
-
+        */
     }
 
 
@@ -235,14 +241,14 @@ public class PortletWebContextTestCase e
     @Test
     public void testInitParam() {
 
-        Map map = ((WebContext) context).getInitParam();
+        Map<String, String> map = ((WebContext) context).getInitParam();
         assertNotNull(map);
 
         // Initial contents
         checkMapSize(map, 3);
-        assertEquals("ivalue1", (String) map.get("ikey1"));
-        assertEquals("ivalue2", (String) map.get("ikey2"));
-        assertEquals("ivalue3", (String) map.get("ikey3"));
+        assertEquals("ivalue1", map.get("ikey1"));
+        assertEquals("ivalue2", map.get("ikey2"));
+        assertEquals("ivalue3", map.get("ikey3"));
         assertTrue(map.containsKey("ikey1"));
         assertTrue(map.containsKey("ikey2"));
         assertTrue(map.containsKey("ikey3"));
@@ -252,7 +258,7 @@ public class PortletWebContextTestCase e
 
         // Transparency - entrySet()
         checkEntrySet(map, false);
- 
+
         // Unsupported operations on read-only map
         try {
             map.clear();
@@ -267,7 +273,7 @@ public class PortletWebContextTestCase e
             ; // expected result
         }
         try {
-            map.putAll(new HashMap());
+            map.putAll(new HashMap<String, String>());
             fail("Should have thrown UnsupportedOperationException");
         } catch (UnsupportedOperationException e) {
             ; // expected result
@@ -286,13 +292,13 @@ public class PortletWebContextTestCase e
     @Test
     public void testParam() {
 
-        Map map = ((WebContext) context).getParam();
+        Map<String, String> map = ((WebContext) context).getParam();
         assertNotNull(map);
 
         // Initial contents
         checkMapSize(map, 2);
-        assertEquals("pvalue1", (String) map.get("pkey1"));
-        assertEquals("pvalue2a", (String) map.get("pkey2"));
+        assertEquals("pvalue1", map.get("pkey1"));
+        assertEquals("pvalue2a", map.get("pkey2"));
         assertTrue(map.containsKey("pkey1"));
         assertTrue(map.containsKey("pkey2"));
         assertTrue(map.containsValue("pvalue1"));
@@ -314,7 +320,7 @@ public class PortletWebContextTestCase e
             ; // expected result
         }
         try {
-            map.putAll(new HashMap());
+            map.putAll(new HashMap<String, String>());
             fail("Should have thrown UnsupportedOperationException");
         } catch (UnsupportedOperationException e) {
             ; // expected result
@@ -333,7 +339,7 @@ public class PortletWebContextTestCase e
     @Test
     public void testParamValues() {
 
-        Map map = ((WebContext) context).getParamValues();
+        Map<String, String[]> map = ((WebContext) context).getParamValues();
         assertNotNull(map);
 
         // Initial contents
@@ -370,7 +376,7 @@ public class PortletWebContextTestCase e
             ; // expected result
         }
         try {
-            map.putAll(new HashMap());
+            map.putAll(new HashMap<String, String[]>());
             fail("Should have thrown UnsupportedOperationException");
         } catch (UnsupportedOperationException e) {
             ; // expected result
@@ -389,18 +395,22 @@ public class PortletWebContextTestCase e
     @Test
     public void testCookies() {
 
-        Map map = ((WebContext) context).getCookies();
+        Map<String, Cookie> map = ((WebContext) context).getCookies();
         assertNotNull(map);
 
         // Initial contents
         checkMapSize(map, 0);
 
+        /*
+         FIXME
+         This test is inconsistent once introduced generics
         try {
             map.put("ckey3", "XXX");
             fail("map.put() Should have thrown UnsupportedOperationException");
         } catch (UnsupportedOperationException e) {
             ; // expected result
         }
+        */
     }
 
     // Test state of newly created instance
@@ -478,7 +488,7 @@ public class PortletWebContextTestCase e
     @Test
     public void testRequestScope() {
 
-        Map map = ((WebContext) context).getRequestScope();
+        Map<String, Object> map = ((WebContext) context).getRequestScope();
         assertNotNull(map);
 
         // Initial contents
@@ -488,7 +498,7 @@ public class PortletWebContextTestCase e
 
         // Transparency - entrySet()
         checkEntrySet(map, true);
- 
+
         // Transparency - removal via web object
         request.removeAttribute("rkey1");
         checkMapSize(map, 1);
@@ -524,8 +534,8 @@ public class PortletWebContextTestCase e
         checkMapSize(map, 0);
 
         // Test putAll()
-        Map values = new HashMap();
-        values.put(new Integer(1), "One");
+        Map<String, Object> values = new HashMap<String, Object>();
+        values.put("1", "One");
         values.put("2", "Two");
         map.putAll(values);
         assertEquals("putAll(1)", "One", map.get("1"));
@@ -539,7 +549,7 @@ public class PortletWebContextTestCase e
     @Test
     public void testSessionScope() {
 
-        Map map = ((WebContext) context).getSessionScope();
+        Map<String, Object> map = ((WebContext) context).getSessionScope();
         assertNotNull(map);
 
         // Initial contents
@@ -550,7 +560,7 @@ public class PortletWebContextTestCase e
 
         // Transparency - entrySet()
         checkEntrySet(map, true);
- 
+
         // Transparency - removal via web object
         session.removeAttribute("skey1");
         checkMapSize(map, 2);
@@ -586,8 +596,8 @@ public class PortletWebContextTestCase e
         checkMapSize(map, 0);
 
         // Test putAll()
-        Map values = new HashMap();
-        values.put(new Integer(1), "One");
+        Map<String, Object> values = new HashMap<String, Object>();
+        values.put("1", "One");
         values.put("2", "Two");
         map.putAll(values);
         assertEquals("putAll(1)", "One", map.get("1"));
@@ -602,12 +612,12 @@ public class PortletWebContextTestCase e
     public void testSessionScopeWithoutSession() {
 
         // Create a Context without a session
-        PortletWebContext ctx = new PortletWebContext(pcontext, 
+        PortletWebContext ctx = new PortletWebContext(pcontext,
            new MockPortletRequest(), response);
         assertNull("Session(A)", ctx.getRequest().getPortletSession(false));
 
         // Get the session Map & check session doesn't exist
-        Map sessionMap = ctx.getSessionScope();
+        Map<String, Object> sessionMap = ctx.getSessionScope();
         assertNull("Session(B)", ctx.getRequest().getPortletSession(false));
         assertNotNull("Session Map(A)", sessionMap);
 
@@ -624,7 +634,7 @@ public class PortletWebContextTestCase e
         assertNull("Session(E)", ctx.getRequest().getPortletSession(false));
 
         // test entrySet()
-        Set entrySet = sessionMap.entrySet();
+        Set<Entry<String, Object>> entrySet = sessionMap.entrySet();
         assertNotNull("entrySet", entrySet);
         assertEquals("entrySet Size", 0, entrySet.size());
         assertNull("Session(F)", ctx.getRequest().getPortletSession(false));
@@ -646,13 +656,13 @@ public class PortletWebContextTestCase e
         assertNull("Session(J)", ctx.getRequest().getPortletSession(false));
 
         // test keySet()
-        Set keySet = sessionMap.keySet();
+        Set<String> keySet = sessionMap.keySet();
         assertNotNull("keySet", keySet);
         assertEquals("keySet Size", 0, keySet.size());
         assertNull("Session(K)", ctx.getRequest().getPortletSession(false));
 
         // test putAll() with an empty Map
-        sessionMap.putAll(new HashMap());
+        sessionMap.putAll(new HashMap<String, Object>());
         assertNull("Session(L)", ctx.getRequest().getPortletSession(false));
 
         // test remove()
@@ -664,7 +674,7 @@ public class PortletWebContextTestCase e
         assertNull("Session(N)", ctx.getRequest().getPortletSession(false));
 
         // test values()
-        Collection values = sessionMap.values();
+        Collection<Object> values = sessionMap.values();
         assertNotNull("values", values);
         assertEquals("values Size", 0, values.size());
         assertNull("Session(O)", ctx.getRequest().getPortletSession(false));
@@ -684,12 +694,12 @@ public class PortletWebContextTestCase e
     // ------------------------------------------------------- Protected Methods
 
 
-    protected void checkMapSize(Map map, int size) {
+    protected void checkMapSize(Map<?, ?> map, int size) {
         // Check reported size of the map
         assertEquals("checkMapSize(A)", size, map.size());
         // Iterate over key set
         int nk = 0;
-        Iterator keys = map.keySet().iterator();
+        Iterator<?> keys = map.keySet().iterator();
         while (keys.hasNext()) {
             keys.next();
             nk++;
@@ -697,7 +707,7 @@ public class PortletWebContextTestCase e
         assertEquals("checkMapSize(B)", size, nk);
         // Iterate over entry set
         int nv = 0;
-        Iterator values = map.entrySet().iterator();
+        Iterator<?> values = map.entrySet().iterator();
         while (values.hasNext()) {
             values.next();
             nv++;
@@ -727,11 +737,11 @@ public class PortletWebContextTestCase e
             // Should pass and not throw UnsupportedOperationException
             Map.Entry e = (Map.Entry)o;
             e.setValue(e.setValue(new Object()));
-        }    
-    }    
+        }
+    }
 
     // Create a new instance of the appropriate Context type for this test case
-    protected Context createContext() {
+    protected Context<String, Object> createContext() {
         return (new PortletWebContext(pcontext, request, response));
     }
 

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/MockHttpServletRequest.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/MockHttpServletRequest.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/MockHttpServletRequest.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/MockHttpServletRequest.java Mon Feb 13 21:19:07 2012
@@ -63,12 +63,12 @@ public class MockHttpServletRequest impl
 
 
 
-    protected HashMap attributes = new HashMap();
+    protected Map<String, Object> attributes = new HashMap<String, Object>();
     protected String contextPath = null;
-    protected HashMap headers = new HashMap();
+    protected Map<String, String[]> headers = new HashMap<String, String[]>();
     protected Cookie[] cookies = new Cookie[0];
     protected Locale locale = null;
-    protected HashMap parameters = new HashMap();
+    protected Map<String, String[]> parameters = new HashMap<String, String[]>();
     protected String pathInfo = null;
     protected Principal principal = null;
     protected String queryString = null;
@@ -80,7 +80,7 @@ public class MockHttpServletRequest impl
 
 
     public void addHeader(String name, String value) {
-        String values[] = (String[]) headers.get(name);
+        String values[] = headers.get(name);
         if (values == null) {
             String results[] = new String[] { value };
             headers.put(name, results);
@@ -178,21 +178,17 @@ public class MockHttpServletRequest impl
     }
 
 
-    public Enumeration getHeaderNames() {
-        return (new MockEnumeration(headers.keySet().iterator()));
+    public Enumeration<String> getHeaderNames() {
+        return (new MockEnumeration<String>(headers.keySet().iterator()));
     }
 
 
-    public Enumeration getHeaders(String name) {
-        String headers[] = (String[]) this.headers.get(name);
+    public Enumeration<String> getHeaders(String name) {
+        String headers[] = this.headers.get(name);
         if (headers == null) {
             headers = new String[0];
         }
-        List list = new ArrayList();
-        for (int i = 0; i < headers.length; i++) {
-            list.add(headers[i]);
-        }
-        return (new MockEnumeration(list.iterator()));
+        return (new MockEnumeration<String>(Arrays.asList(headers).iterator()));
     }
 
 
@@ -318,8 +314,8 @@ public class MockHttpServletRequest impl
     }
 
 
-    public Enumeration getAttributeNames() {
-        return (new MockEnumeration(attributes.keySet().iterator()));
+    public Enumeration<String> getAttributeNames() {
+        return (new MockEnumeration<String>(attributes.keySet().iterator()));
     }
 
 
@@ -348,7 +344,7 @@ public class MockHttpServletRequest impl
     }
 
 
-    public Enumeration getLocales() {
+    public Enumeration<Locale> getLocales() {
         throw new UnsupportedOperationException();
     }
 
@@ -369,7 +365,7 @@ public class MockHttpServletRequest impl
 
 
     public String getParameter(String name) {
-        String values[] = (String[]) parameters.get(name);
+        String values[] = parameters.get(name);
         if (values != null) {
             return (values[0]);
         } else {
@@ -378,13 +374,13 @@ public class MockHttpServletRequest impl
     }
 
 
-    public Map getParameterMap() {
+    public Map<String, String[]> getParameterMap() {
         return (parameters);
     }
 
 
-    public Enumeration getParameterNames() {
-        return (new MockEnumeration(parameters.keySet().iterator()));
+    public Enumeration<String> getParameterNames() {
+        return (new MockEnumeration<String>(parameters.keySet().iterator()));
     }
 
 

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/MockHttpSession.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/MockHttpSession.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/MockHttpSession.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/MockHttpSession.java Mon Feb 13 21:19:07 2012
@@ -17,13 +17,15 @@
 package org.apache.commons.chain.web.servlet;
 
 
-import org.apache.commons.chain.web.MockEnumeration;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpSession;
 import javax.servlet.http.HttpSessionContext;
-import java.util.Enumeration;
-import java.util.HashMap;
+
+import org.apache.commons.chain.web.MockEnumeration;
 
 
 
@@ -44,7 +46,7 @@ public class MockHttpSession implements 
 
 
 
-    protected HashMap attributes = new HashMap();
+    protected Map<String, Object> attributes = new HashMap<String, Object>();
     protected ServletContext servletContext = null;
 
 
@@ -64,8 +66,8 @@ public class MockHttpSession implements 
     }
 
 
-    public Enumeration getAttributeNames() {
-        return (new MockEnumeration(attributes.keySet().iterator()));
+    public Enumeration<String> getAttributeNames() {
+        return (new MockEnumeration<String>(attributes.keySet().iterator()));
     }
 
 

Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/MockServletConfig.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/MockServletConfig.java?rev=1243699&r1=1243698&r2=1243699&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/MockServletConfig.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/MockServletConfig.java Mon Feb 13 21:19:07 2012
@@ -31,7 +31,7 @@ import org.apache.commons.chain.web.Mock
 public class MockServletConfig implements ServletConfig {
     private final String servletName;
     private final ServletContext servletContext;
-    private final Map parameters = new HashMap();
+    private final Map<String, Object> parameters = new HashMap<String, Object>();
 
     /**
      * Default Constructor.
@@ -75,8 +75,8 @@ public class MockServletConfig implement
      *
      * @return the set of parameter names
      */
-    public Enumeration getInitParameterNames() {
-        return (new MockEnumeration(parameters.keySet().iterator()));
+    public Enumeration<String> getInitParameterNames() {
+        return (new MockEnumeration<String>(parameters.keySet().iterator()));
     }
 
     /**