Applying  testsuite-with-phase-annotations.patch from PLUTO-442. THank you Ben!

git-svn-id: https://svn.apache.org/repos/asf/portals/pluto/branches/1.1-286-COMPATIBILITY@598238 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/ActionTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/ActionTest.java
deleted file mode 100644
index 28a088e..0000000
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/ActionTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at

- *

- *      http://www.apache.org/licenses/LICENSE-2.0

- *

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS,

- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

- * See the License for the specific language governing permissions and

- * limitations under the License.

- */

-package org.apache.pluto.testsuite;

-

-

-/**

- * Empty interface that marks a PortletTest class that has test code which

- * should be run in the <code>Portlet.processAction()</code> method.

- *

- */

-public interface ActionTest extends PortletTest {

-

-	// Empty interface.

-

-}

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/InvalidConfigurationException.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/InvalidConfigurationException.java
index 82e74a6..c5489a9 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/InvalidConfigurationException.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/InvalidConfigurationException.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  * 

  *     http://www.apache.org/licenses/LICENSE-2.0

@@ -22,6 +22,8 @@
  */

 public class InvalidConfigurationException extends RuntimeException {

 

+	private static final long serialVersionUID = -7010299791708559054L;

+

 	public InvalidConfigurationException(String message) {

 		super(message);

 	}

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/NoOpTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/NoOpTest.java
index 7562f9a..f3d21d0 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/NoOpTest.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/NoOpTest.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -20,6 +20,8 @@
 import javax.portlet.PortletContext;

 import javax.portlet.PortletRequest;

 import javax.portlet.PortletResponse;

+import javax.portlet.RenderRequest;

+import javax.portlet.RenderResponse;

 

 import java.util.HashMap;

 import java.util.Map;

@@ -50,8 +52,8 @@
         return "NoOpTest";

     }

 

-    public Map getRenderParameters(PortletRequest request) {

-        return new HashMap();

+    public Map<String, String[]> getRenderParameters(PortletRequest request) {

+        return new HashMap<String, String[]>();

     }

 

     public TestResults doTest(PortletConfig config,

@@ -69,5 +71,10 @@
         return config;

     }

 

+    public void doHeaders(PortletConfig config, PortletContext context,

+            RenderRequest request, RenderResponse response) {

+        

+    }

+

 }

 

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/PortletTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/PortletTest.java
index da20cfe..3ed4f30 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/PortletTest.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/PortletTest.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -22,6 +22,8 @@
 import javax.portlet.PortletContext;

 import javax.portlet.PortletRequest;

 import javax.portlet.PortletResponse;

+import javax.portlet.RenderRequest;

+import javax.portlet.RenderResponse;

 

 /**

  * Interface for pluto portlet test classes.

@@ -50,7 +52,7 @@
      * @return a map of render parameters, key is the string name of the

      *         parameter, value is a string array.

      */

-    public Map getRenderParameters(PortletRequest request);

+    public Map<String, String[]> getRenderParameters(PortletRequest request);

 

     /**

      * Runs the test.

@@ -71,5 +73,17 @@
      */

     public TestConfig getConfig();

 

+    /**

+     * Called by TestPortlet.doHeaders()

+     * @param config

+     * @param context

+     * @param request

+     * @param response

+     */

+    public void doHeaders(PortletConfig config,

+                          PortletContext context,

+                          RenderRequest request,

+                          RenderResponse response);

+    

 }

 

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java
index 8d767e3..a0b7d33 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -34,6 +34,8 @@
  */

 public class TestConfig implements Serializable {

 

+	private static final long serialVersionUID = -6878431356359186658L;

+

 	// Private Member Variables ------------------------------------------------

 

 	/** PortletTest class name. */

@@ -44,14 +46,14 @@
 

     private String displayURI;

 

-    private Map initParameters = new HashMap();

+    private Map<String, String> initParameters = new HashMap<String, String>();

 

     /**

      * The action parameters list holding TestConfig.Parameter objects.

      * We are not using Map to hold action parameters because parameters with

      * the same name are allowed.

      */

-    private List actionParameters = new ArrayList();

+    private List<Parameter> actionParameters = new ArrayList<Parameter>();

 

     /**

      * The render parameters list holding TestConfig.Parameter objects.

@@ -60,7 +62,7 @@
      *

      * FIXME: when is this field used?

      */

-    private List renderParameters = new ArrayList();

+//    private List renderParameters = new ArrayList();

 

 

     // Constructor -------------------------------------------------------------

@@ -102,7 +104,7 @@
         initParameters.put(parameter, value);

     }

 

-    public Map getInitParameters() {

+    public Map<String, String> getInitParameters() {

         return Collections.unmodifiableMap(initParameters);

     }

 

@@ -110,23 +112,27 @@
     	actionParameters.add(new Parameter(name, value));

     }

 

-    public List getActionParameters() {

+    public List<Parameter> getActionParameters() {

     	return actionParameters;

     }

 

     /**

      * FIXME: why is this method required?

      */

+    /*

     public void addRenderParameter(String name, String value) {

     	renderParameters.add(new Parameter(name, value));

     }

+    */

 

     /**

      * FIXME: when is this method used?

      */

+    /*

     public List getRenderParameters() {

     	return renderParameters;

     }

+    */

 

     public String toString() {

     	StringBuffer buffer = new StringBuffer();

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java
index 7e13bb3..48c5ac9 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -86,9 +86,10 @@
      * @throws IOException  if an IO error occurs.

      * @see TestConfig

      */

-    public List createTestConfigs(InputStream in)

+    @SuppressWarnings("unchecked")

+	public List<TestConfig> createTestConfigs(InputStream in)

     throws SAXException, IOException {

-        return (List) digester.parse(in);

+        return (List<TestConfig>) digester.parse(in);

     }

 

 }

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java
index 6a55339..bac913a 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -16,26 +16,33 @@
  */

 package org.apache.pluto.testsuite;

 

+import java.io.IOException;

+import java.io.InputStream;

+import java.util.Arrays;

+import java.util.HashMap;

+import java.util.List;

+import java.util.Map;

+import java.util.Map.Entry;

+

 import javax.portlet.ActionRequest;

 import javax.portlet.ActionResponse;

+import javax.portlet.EventRequest;

+import javax.portlet.EventResponse;

 import javax.portlet.GenericPortlet;

 import javax.portlet.PortletException;

+import javax.portlet.PortletMode;

 import javax.portlet.PortletRequest;

 import javax.portlet.PortletRequestDispatcher;

 import javax.portlet.PortletSession;

 import javax.portlet.RenderRequest;

 import javax.portlet.RenderResponse;

+import javax.portlet.ResourceRequest;

+import javax.portlet.ResourceResponse;

+import javax.portlet.StateAwareResponse;

 

 import org.apache.commons.logging.Log;

 import org.apache.commons.logging.LogFactory;

 

-import java.io.IOException;

-import java.io.InputStream;

-import java.util.HashMap;

-import java.util.Iterator;

-import java.util.List;

-import java.util.Map;

-

 /**

  * Pluto testsuite's test portlet.

  *

@@ -45,20 +52,20 @@
  */

 public class TestPortlet extends GenericPortlet {

 

-	/** Internal logger. */

-	private static final Log LOG = LogFactory.getLog(TestPortlet.class);

+    /** Internal logger. */

+    private static final Log LOG = LogFactory.getLog(TestPortlet.class);

 

 

-	// Private Member Variables ------------------------------------------------

+    // Private Member Variables ------------------------------------------------

 

-	/** List of test configurations. */

-    private List testConfigs;

+    /** List of test configurations. */

+    private List<TestConfig> testConfigs;

 

     /**

      * Map of test instances: key is an integer ID (as a string), and value is

      * the <code>PortletTest</code> instances.

      */

-    private Map tests;

+    private Map<String, PortletTest> tests;

 

 

     // GenericPortlet Impl -----------------------------------------------------

@@ -68,9 +75,10 @@
      * files, constructs and initializes all <code>PortletTest</code> instances.

      * @throws PortletException if fail to read the configuration file.

      */

+    @SuppressWarnings("unchecked")

     public void init() throws PortletException {

 

-    	// Get configuration file name.

+        // Get configuration file name.

         String configFile = getInitParameter("config");

         if (configFile == null) {

             configFile = "/WEB-INF/testsuite-config.xml";

@@ -79,39 +87,39 @@
         // Get configuration file as an input stream.

         InputStream is = getPortletContext().getResourceAsStream(configFile);

         if (is == null) {

-        	String message = "Testsuite configuration file not found.";

-        	LOG.error(message);

-        	throw new PortletException(message);

+            String message = "Testsuite configuration file not found.";

+            LOG.error(message);

+            throw new PortletException(message);

         }

 

         // Load PortletTest instances: constructing and initializing.

         TestConfigFactory factory = new TestConfigFactory();

         try {

-        	testConfigs = factory.createTestConfigs(is);

-            tests = new HashMap();

+            testConfigs = factory.createTestConfigs(is);

+            tests = new HashMap<String, PortletTest>();

             int i = 0;

-            for (Iterator it = testConfigs.iterator(); it.hasNext(); ) {

-                TestConfig testConfig = (TestConfig) it.next();

+            for (TestConfig testConfig : testConfigs) {

                 String name = testConfig.getTestClassName();

                 PortletTest test = null;

                 if (name != null) {

-                	if (LOG.isDebugEnabled()) {

-                		LOG.debug("Loading test: " + name);

-                	}

-                    Class clazz = Class.forName(testConfig.getTestClassName());

-                    test = (PortletTest) clazz.newInstance();

+                    if (LOG.isDebugEnabled()) {

+                        LOG.debug("Loading test: " + name);

+                    }

+                    Class<PortletTest> clazz = (Class<PortletTest>)

+                        Class.forName(testConfig.getTestClassName());

+                    test = clazz.newInstance();

                 } else {

-                	if (LOG.isDebugEnabled()) {

-                		LOG.debug("Loading NoOpTest (test with no name).");

-                	}

+                    if (LOG.isDebugEnabled()) {

+                        LOG.debug("Loading NoOpTest (test with no name).");

+                    }

                     test = new NoOpTest();

                 }

                 test.init(testConfig);

                 tests.put(String.valueOf(i++), test);

             }

         } catch (Throwable th) {

-        	String message = "Unable to read testsuite configuration.";

-        	LOG.error(message, th);

+            String message = "Unable to read testsuite configuration.";

+            LOG.error(message, th);

             throw new PortletException(message, th);

         }

     }

@@ -119,29 +127,60 @@
 

     public void processAction(ActionRequest request, ActionResponse response)

     throws PortletException, IOException {

+        this.processStateAwarePhase(request, response);

+    }

+    

+    protected void doHeaders(RenderRequest request, RenderResponse response) {

+        if (PortletMode.VIEW.equals(request.getPortletMode())) {

+            String testId = getTestId(request);

+            PortletTest test = (PortletTest) tests.get(testId);

+            if (test != null)

+                test.doHeaders( getPortletConfig(), 

+                                getPortletContext(), 

+                                request,

+                                response);

+        }

+    }

 

+    private void processStateAwarePhase(

+            PortletRequest request, StateAwareResponse response) {

         String testId = getTestId(request);

         PortletTest test = (PortletTest) tests.get(testId);

-

-        // For ActionTest, run test and save results in session.

-        if (test != null && test instanceof ActionTest) {

+        if (test != null) {

             TestResults results = test.doTest(getPortletConfig(),

                                               getPortletContext(),

                                               request,

                                               response);

             PortletSession session = request.getPortletSession();

-            session.setAttribute(test.getClass().getName(), results);

+            TestResults existingResults = (TestResults) 

+                session.getAttribute(test.getClass().getName());

+            if (existingResults != null) {

+                existingResults.getCollection().addAll(results.getCollection());

+            } else {

+                session.setAttribute(test.getClass().getName(), results);

+            }

         }

-

-        Map renderParameters = null;

+        Map<String, String[]> renderParameters = null;

         if (test != null) {

             renderParameters = test.getRenderParameters(request);

         }

         if (renderParameters == null) {

-            renderParameters = new HashMap();

+            renderParameters = new HashMap<String, String[]>();

         }

         renderParameters.put("testId", new String[] { testId });

-        response.setRenderParameters(renderParameters);

+        response.setRenderParameters(renderParameters);        

+    }

+

+    public void processEvent(EventRequest request, EventResponse response)

+            throws PortletException, IOException {

+        this.processStateAwarePhase(request, response);

+    }

+

+

+    public void serveResource(ResourceRequest arg0, ResourceResponse arg1)

+            throws PortletException, IOException {

+        // TODO: Add resource serving support

+        super.serveResource(arg0, arg1);

     }

 

     /**

@@ -154,47 +193,58 @@
     public void doView(RenderRequest request, RenderResponse response)

     throws PortletException, IOException {

 

-    	// Get the current test ID, the test instance and its config.

+        // Get the current test ID, the test instance and its config.

         String testId = getTestId(request);

         TestConfig testConfig = null;

         PortletTest test = null;

         if (testId != null) {

-        	testConfig = (TestConfig) testConfigs.get(Integer.parseInt(testId));

-        	test = (PortletTest) tests.get(testId);

+            testConfig = (TestConfig) testConfigs.get(Integer.parseInt(testId));

+            test = (PortletTest) tests.get(testId);

         }

-

+        

+        if (LOG.isDebugEnabled()) {

+            for (Entry<String, String[]> e : request.getParameterMap().entrySet()) {

+                LOG.debug(e.getKey() + " => " + Arrays.asList(e.getValue()));

+            }

+            

+            LOG.debug("Test ID: " + testId);

+            LOG.debug("Test Config: " + testConfig);

+            if (testConfig != null) {

+                LOG.debug("Test config view: " + testConfig.getDisplayURI());

+            }

+        }

         // For non-ActionTest, run test and save results in request.

-        if (test != null && !(test instanceof ActionTest)) {

+        if (test != null) {

             TestResults results = test.doTest(getPortletConfig(),

                                               getPortletContext(),

                                               request,

                                               response);

-            request.setAttribute("results", results);

-        }

-        // For ActionTest, retrieve results from session and save in request.

-        else if (test != null) {

             PortletSession session = request.getPortletSession();

-            TestResults results = (TestResults) session.getAttribute(

-            		test.getClass().getName());

-            request.setAttribute("results", results);

+            TestResults existing = (TestResults) session.getAttribute(

+                    test.getClass().getName());

+            if (existing != null) {

+                existing.getCollection().addAll(results.getCollection());

+                request.setAttribute("results", existing);

+                session.setAttribute(test.getClass().getName(), null);

+            } else {

+                request.setAttribute("results", results);

+            }

         }

 

-

         if (testId == null) {

-        	// FIXME: update attribute name from tests to testConfigs.

-            request.setAttribute("tests", testConfigs);

+            request.setAttribute("testConfigs", testConfigs);

         } else {

             TestConfig nextTestConfig = null;

             TestConfig prevTestConfig = null;

             int index = testConfigs.indexOf(test.getConfig());

             if (index == 0) {

-            	prevTestConfig = (TestConfig) testConfigs.get(testConfigs.size() - 1);

+                prevTestConfig = (TestConfig) testConfigs.get(testConfigs.size() - 1);

                 nextTestConfig = (TestConfig) testConfigs.get(index + 1);

             } else if (index == testConfigs.size() - 1) {

-            	prevTestConfig = (TestConfig) testConfigs.get(index - 1);

+                prevTestConfig = (TestConfig) testConfigs.get(index - 1);

                 nextTestConfig = (TestConfig) testConfigs.get(0);

             } else {

-            	prevTestConfig = (TestConfig) testConfigs.get(index - 1);

+                prevTestConfig = (TestConfig) testConfigs.get(index - 1);

                 nextTestConfig = (TestConfig) testConfigs.get(index + 1);

             }

             request.setAttribute("prevTest", prevTestConfig);

@@ -205,12 +255,14 @@
         response.setContentType("text/html");

         String displayUri = null;

         if (testConfig != null) {

-        	displayUri = testConfig.getDisplayURI();

+            displayUri = testConfig.getDisplayURI();

         } else {

-        	displayUri = "/jsp/introduction.jsp";

+            displayUri = "/jsp/introduction.jsp";

         }

+        LOG.debug("Display URI: " + displayUri);

         PortletRequestDispatcher dispatcher = getPortletContext()

-        		.getRequestDispatcher(displayUri);

+                .getRequestDispatcher(displayUri);

+        LOG.debug("request dispatcher: " + dispatcher);

         dispatcher.include(request, response);

     }

 

@@ -222,8 +274,9 @@
      */

     protected void doEdit(RenderRequest request, RenderResponse response)

     throws PortletException, IOException {

+        response.setContentType("text/html");

         PortletRequestDispatcher dispatcher = getPortletContext()

-        		.getRequestDispatcher("/jsp/edit.jsp");

+                .getRequestDispatcher("/jsp/edit.jsp");

         dispatcher.include(request, response);

     }

 

@@ -235,9 +288,10 @@
      */

     protected void doHelp(RenderRequest request, RenderResponse response)

     throws PortletException, IOException {

-    	PortletRequestDispatcher dispatcher = getPortletContext()

-    			.getRequestDispatcher("/jsp/help.jsp");

-    	dispatcher.include(request, response);

+        response.setContentType("text/html");

+        PortletRequestDispatcher dispatcher = getPortletContext()

+                .getRequestDispatcher("/jsp/help.jsp");

+        dispatcher.include(request, response);

     }

 

 

@@ -250,14 +304,14 @@
      */

     private String getTestId(PortletRequest request) {

 

-    	String testId = request.getParameter("testId");

+        String testId = request.getParameter("testId");

         String prevTestId = request.getParameter("previousTestId");

         String nextTestId = request.getParameter("nextTestId");

 

         // If none of the parameters are available, return null.

         if ((testId == null || testId.trim().length() == 0)

-        		&& nextTestId == null && prevTestId == null

-        		&& tests.size() > 0) {

+                && nextTestId == null && prevTestId == null

+                && tests.size() > 0) {

             return null;

         }

 

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResult.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResult.java
index cdbd7a1..6631db2 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResult.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResult.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -24,6 +24,8 @@
  */

 public class TestResult implements Serializable {

 

+	private static final long serialVersionUID = 5247797277017349129L;

+

 	/** The undefined return code. */

 	public static final int UNDEFINED = -1;

 

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResults.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResults.java
index 70e775e..9d03c8c 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResults.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResults.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -19,17 +19,17 @@
 import java.io.Serializable;

 import java.util.ArrayList;

 import java.util.Collection;

-import java.util.Collections;

 

 /**

  * This class contains one or more test results.

  */

 public class TestResults implements Serializable {

 

+	private static final long serialVersionUID = 279901260532957514L;

 

-    private String name;

+	private String name;

 

-    private ArrayList list = new ArrayList();

+    private ArrayList<TestResult> list = new ArrayList<TestResult>();

 

     private boolean failed = false;

     private boolean inQuestion = false;

@@ -63,8 +63,8 @@
         return inQuestion;

     }

 

-    public Collection getCollection() {

-        return Collections.unmodifiableCollection(list);

+    public Collection<TestResult> getCollection() {

+        return list;

     }

 

     /**

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java
index c84b694..8dda174 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -16,36 +16,40 @@
  */

 package org.apache.pluto.testsuite.test;

 

-import org.apache.commons.logging.Log;

-import org.apache.commons.logging.LogFactory;

-import org.apache.pluto.testsuite.TestConfig;

-import org.apache.pluto.testsuite.PortletTest;

-import org.apache.pluto.testsuite.TestResult;

-import org.apache.pluto.testsuite.TestResults;

-

-import javax.portlet.PortletResponse;

-import javax.portlet.PortletRequest;

-import javax.portlet.PortletContext;

-import javax.portlet.PortletConfig;

-import javax.portlet.PortletSession;

 import java.lang.reflect.InvocationTargetException;

 import java.lang.reflect.Method;

 import java.lang.reflect.Modifier;

 import java.util.ArrayList;

-import java.util.Iterator;

+import java.util.HashMap;

 import java.util.List;

 import java.util.Map;

-import java.util.HashMap;

+

+import javax.portlet.PortletConfig;

+import javax.portlet.PortletContext;

+import javax.portlet.PortletRequest;

+import javax.portlet.PortletResponse;

+import javax.portlet.PortletSession;

+import javax.portlet.RenderRequest;

+import javax.portlet.RenderResponse;

+

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+import org.apache.pluto.testsuite.PortletTest;

+import org.apache.pluto.testsuite.TestConfig;

+import org.apache.pluto.testsuite.TestResult;

+import org.apache.pluto.testsuite.TestResults;

+import org.apache.pluto.testsuite.annotations.DefaultTestPhase;

+import org.apache.pluto.testsuite.annotations.TestPhase;

 

 /**

  */

 public abstract class AbstractReflectivePortletTest implements PortletTest {

 

-	/** Logger. */

-	private static final Log LOG = LogFactory.getLog(

-			AbstractReflectivePortletTest.class);

+    /** Logger. */

+    private static final Log LOG = LogFactory.getLog(

+            AbstractReflectivePortletTest.class);

 

-    private Map initParameters;

+    private Map<String, String> initParameters;

     private TestConfig config;

 

 

@@ -64,8 +68,8 @@
      * @param request  the portlet request.

      * @return an empty Map object.

      */

-    public Map getRenderParameters(PortletRequest request) {

-        return new HashMap();

+    public Map<String, String[]> getRenderParameters(PortletRequest request) {

+        return new HashMap<String, String[]>();

     }

 

     public TestConfig getConfig() {

@@ -78,13 +82,13 @@
      * @return the test suite name.

      */

     public String getTestSuiteName() {

-    	String className = getClass().getName();

-    	int index = className.lastIndexOf(".");

-    	if (index >= 0 && index < className.length() - 1) {

-    		return className.substring(index + 1);

-    	} else {

-    		return className;

-    	}

+        String className = getClass().getName();

+        int index = className.lastIndexOf(".");

+        if (index >= 0 && index < className.length() - 1) {

+            return className.substring(index + 1);

+        } else {

+            return className;

+        }

     }

 

     /**

@@ -102,36 +106,32 @@
                               PortletResponse response) {

         TestResults results = new TestResults(getTestSuiteName());

 

-        for (Iterator it = getCheckMethods().iterator(); it.hasNext(); ) {

-        	Method method = (Method) it.next();

-        	debugWithName("Invoking test method: " + method.getName());

-        	try {

-        		TestResult result = invoke(method, config, context, request, response);

-        		if (result.getName() == null) {

-        			result.setName(method.getName());

-        		}

-        		results.add(result);

-        		debugWithName("Result: " + result.getReturnCodeAsString());

-        	} catch (Throwable th) {

-        		String message = "Error invoking " + method.getName()

-        				+ " (" + th.getClass().getName() + "): "

-        				+ th.getMessage();

-        		errorWithName(message, th);

-        		TestResult result = new TestResult();

-        		result.setName(method.getName());

-        		result.setReturnCode(TestResult.FAILED);

-        		result.setResultMessage(message);

-        		results.add(result);

+        for (Method method : getCheckMethods(request)) {

+            try {

+                TestResult result = invoke(method, config, context, request, response);

+                if (result.getName() == null) {

+                    result.setName(method.getName());

+                }

+                results.add(result);

+            } catch (Throwable th) {

+                String message = "Error invoking " + method.getName()

+                        + " (" + th.getClass().getName() + "): "

+                        + th.getMessage();

+                errorWithName(message, th);

+                TestResult result = new TestResult();

+                result.setName(method.getName());

+                result.setReturnCode(TestResult.FAILED);

+                result.setResultMessage(message);

+                results.add(result);

             }

         }

 

         return results;

     }

 

-

     // Protected Methods -------------------------------------------------------

 

-    protected Map getInitParameters() {

+    protected Map<String, String> getInitParameters() {

         return initParameters;

     }

 

@@ -139,15 +139,15 @@
     // Private Methods ---------------------------------------------------------

 

     private void debugWithName(String message) {

-    	if (LOG.isDebugEnabled()) {

-    		LOG.debug("Test [" + getTestSuiteName() + "]: " + message);

-    	}

+        if (LOG.isDebugEnabled()) {

+            LOG.debug("Test [" + getTestSuiteName() + "]: " + message);

+        }

     }

 

     private void errorWithName(String message, Throwable cause) {

-    	if (LOG.isErrorEnabled()) {

-    		LOG.error("Test [" + getTestSuiteName() + "]: " + message, cause);

-    	}

+        if (LOG.isErrorEnabled()) {

+            LOG.error("Test [" + getTestSuiteName() + "]: " + message, cause);

+        }

     }

 

     /**

@@ -160,26 +160,39 @@
      * </ul>

      * @return a list of check methods.

      */

-    private List getCheckMethods() {

-    	List checkMethods = new ArrayList();

-    	for (Class clazz = getClass();

-    			clazz != null && AbstractReflectivePortletTest.class.isAssignableFrom(clazz);

-    			clazz = clazz.getSuperclass()) {

-    		// debugWithName("Checking class: " + clazz.getName());

-    		Method[] methods = clazz.getDeclaredMethods();

-    		for (int i = 0; i < methods.length; i++) {

-    			int mod = methods[i].getModifiers();

-    			if ((Modifier.isPublic(mod) || Modifier.isProtected(mod))

-    					&& !Modifier.isAbstract(mod)

-    					&& methods[i].getName().startsWith("check")) {

-    				// debugWithName(" - got check method: " + methods[i].getName());

-    				checkMethods.add(methods[i]);

-    			}

-    		}

-    	}

+    private List<Method> getCheckMethods(PortletRequest request) {

+        List<Method> checkMethods = new ArrayList<Method>();

+        DefaultTestPhase dtp = getClass().getAnnotation(DefaultTestPhase.class);

+        String defaultPhase = dtp != null ? dtp.value() 

+                                          : PortletRequest.RENDER_PHASE;

+        String lifecyclePhase = (String) 

+                request.getAttribute(PortletRequest.LIFECYCLE_PHASE);

+        debugWithName("Default phase: " + defaultPhase);

+        debugWithName("Lifecycle Phase: " + lifecyclePhase);

+        for (Class<?> clazz = getClass();

+                clazz != null && AbstractReflectivePortletTest.class.isAssignableFrom(clazz);

+                clazz = clazz.getSuperclass()) {

+            // debugWithName("Checking class: " + clazz.getName());

+            Method[] methods = clazz.getDeclaredMethods();

+            String phase;

+            TestPhase testPhase;

+            for (int i = 0; i < methods.length; i++) {

+                int mod = methods[i].getModifiers();

+                testPhase = methods[i].getAnnotation(TestPhase.class);

+                phase = testPhase != null ? testPhase.value() : defaultPhase;

+                if ((Modifier.isPublic(mod) || Modifier.isProtected(mod))

+                       && lifecyclePhase.equals(phase)

+                       && !Modifier.isAbstract(mod)

+                       && methods[i].getName().startsWith("check")) {

+                    // debugWithName(" - got check method: " + methods[i].getName());

+                    debugWithName(" - got check method: " + methods[i].getName());

+                    checkMethods.add(methods[i]);

+                }

+            }

+        }

         return checkMethods;

     }

-

+    

     /**

      * Invokes the test method ('<code>check*</code>') by preparing method

      * parameters. A test method may accept the following types of parameters:

@@ -198,7 +211,7 @@
                               PortletResponse response)

     throws IllegalAccessException, InvocationTargetException {

 

-        Class[] paramTypes = method.getParameterTypes();

+        Class<?>[] paramTypes = method.getParameterTypes();

         Object[] paramValues = new Object[paramTypes.length];

 

         for (int i = 0; i < paramTypes.length; i++) {

@@ -206,9 +219,9 @@
                 paramValues[i] = config;

             } else if (paramTypes[i].equals(PortletContext.class)) {

                 paramValues[i] = context;

-            } else if (paramTypes[i].equals(PortletRequest.class)) {

+            } else if (paramTypes[i].isAssignableFrom(request.getClass())) {

                 paramValues[i] = request;

-            } else if (paramTypes[i].equals(PortletResponse.class)) {

+            } else if (paramTypes[i].isAssignableFrom(response.getClass())) {

                 paramValues[i] = response;

             } else if (paramTypes[i].equals(PortletSession.class)) {

                 paramValues[i] = request.getPortletSession();

@@ -226,10 +239,14 @@
      * @see java.lang.Object#toString()

      */

     public String toString(){

-    	StringBuffer buffer = new StringBuffer();

-    	buffer.append(getClass().getName());

-    	buffer.append("[initParameters=").append(initParameters);

-    	buffer.append(";config=").append(config).append("]");

-    	return buffer.toString();

+        StringBuffer buffer = new StringBuffer();

+        buffer.append(getClass().getName());

+        buffer.append("[initParameters=").append(initParameters);

+        buffer.append(";config=").append(config).append("]");

+        return buffer.toString();

+    }

+

+    public void doHeaders(PortletConfig config, PortletContext context,

+            RenderRequest request, RenderResponse response) {

     }

 }

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionParameterTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionParameterTest.java
index 8ce0794..619bba1 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionParameterTest.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionParameterTest.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -16,19 +16,20 @@
  */

 package org.apache.pluto.testsuite.test;

 

-import org.apache.pluto.testsuite.ActionTest;

-import org.apache.pluto.testsuite.TestResult;

-import org.apache.pluto.testsuite.TestUtils;

-

 import java.util.Enumeration;

 import java.util.Map;

 

+import javax.portlet.ActionRequest;

 import javax.portlet.PortletRequest;

 

+import org.apache.pluto.testsuite.TestResult;

+import org.apache.pluto.testsuite.TestUtils;

+import org.apache.pluto.testsuite.annotations.DefaultTestPhase;

+

 /**

  */

-public class ActionParameterTest extends AbstractReflectivePortletTest

-implements ActionTest {

+@DefaultTestPhase(PortletRequest.ACTION_PHASE)

+public class ActionParameterTest extends AbstractReflectivePortletTest {

 

 	/** Parameter key encoded in the action URL. */

     public static final String KEY = "org.apache.pluto.testsuite.PARAM_ACTION_KEY";

@@ -39,7 +40,7 @@
 

     // Test Methods ------------------------------------------------------------

 

-    protected TestResult checkGetActionParameter(PortletRequest request) {

+    protected TestResult checkGetActionParameter(ActionRequest request) {

         TestResult result = new TestResult();

         result.setDescription("Ensure parameters encoded in action URL are "

         		+ "available in the action request.");

@@ -53,13 +54,13 @@
         return result;

     }

 

-    protected TestResult checkGetActionParamerMap(PortletRequest request) {

+    protected TestResult checkGetActionParamerMap(ActionRequest request) {

         TestResult result = new TestResult();

         result.setDescription("Ensure parameters encoded in action URL are "

         		+ "available in the action request parameter map.");

 

-        Map parameterMap = request.getParameterMap();

-        String[] values = (String[]) parameterMap.get(KEY);

+        Map<String, String[]> parameterMap = request.getParameterMap();

+        String[] values = parameterMap.get(KEY);

         if (values != null && values.length == 1 && VALUE.equals(values[0])) {

         	result.setReturnCode(TestResult.PASSED);

         } else {

@@ -69,15 +70,15 @@
         return result;

     }

 

-    protected TestResult checkParameterNames(PortletRequest request) {

+    protected TestResult checkParameterNames(ActionRequest request) {

         TestResult result = new TestResult();

         result.setDescription("Ensure parameters encoded in action URL "

         		+ "exists in the parameter name enumeration.");

 

         boolean hasParameterName = false;

-        for (Enumeration en = request.getParameterNames();

+        for (Enumeration<String> en = request.getParameterNames();

         		!hasParameterName && en.hasMoreElements(); ) {

-        	String name = (String) en.nextElement();

+        	String name = en.nextElement();

         	if (KEY.equals(name)) {

         		hasParameterName = true;

         	}

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AppScopedSessionAttributeTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AppScopedSessionAttributeTest.java
index 3a30bf0..1803294 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AppScopedSessionAttributeTest.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AppScopedSessionAttributeTest.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -17,15 +17,15 @@
 

 package org.apache.pluto.testsuite.test;

 

+import javax.portlet.PortletSession;

+

 import org.apache.pluto.testsuite.TestResult;

 import org.apache.pluto.testsuite.TestUtils;

 

-import javax.portlet.PortletSession;

-

 /**

  */

 public class AppScopedSessionAttributeTest

-extends AbstractReflectivePortletTest {

+extends AbstractReflectivePortletTest  {

 

     private static final String BOGUS_KEY = "org.apache.pluto.testsuite.BOGUS_KEY";

     private static final String KEY = "org.apache.pluto.testsuite.KEY";

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ContextInitParameterTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ContextInitParameterTest.java
index 16c2bb6..a5333bc 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ContextInitParameterTest.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ContextInitParameterTest.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -16,18 +16,19 @@
  */

 package org.apache.pluto.testsuite.test;

 

-import org.apache.pluto.testsuite.TestResult;

-import org.apache.pluto.testsuite.TestUtils;

+import java.util.Enumeration;

 

 import javax.portlet.PortletContext;

 import javax.portlet.PortletSession;

-import java.util.Enumeration;

+

+import org.apache.pluto.testsuite.TestResult;

+import org.apache.pluto.testsuite.TestUtils;

 

 /**

  * @version 1.0

  * @since Sep 15, 2004

  */

-public class ContextInitParameterTest extends AbstractReflectivePortletTest  {

+public class ContextInitParameterTest extends AbstractReflectivePortletTest {

 

     private static final String TEST_PARAM_NAME = "test-parameter-name";

     private static final String TEST_PARAM_VALUE = "test-parameter-val";

@@ -43,9 +44,9 @@
         result.setSpecPLT("10.3.1");

 

         boolean found = false;

-        for (Enumeration en = context.getInitParameterNames();

+        for (Enumeration<String> en = context.getInitParameterNames();

         		!found && en.hasMoreElements(); ) {

-            String name = (String) en.nextElement();

+            String name = en.nextElement();

             if (TEST_PARAM_NAME.equals(name)) {

                 found = true;

             }

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTest.java
index 0f460e4..527012a 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTest.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTest.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -16,11 +16,6 @@
  */

 package org.apache.pluto.testsuite.test;

 

-import org.apache.commons.logging.Log;

-import org.apache.commons.logging.LogFactory;

-import org.apache.pluto.testsuite.TestResult;

-import org.apache.pluto.testsuite.TestUtils;

-

 import java.io.IOException;

 import java.util.Arrays;

 import java.util.Map;

@@ -37,6 +32,11 @@
 import javax.servlet.ServletRequest;

 import javax.servlet.ServletResponse;

 

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+import org.apache.pluto.testsuite.TestResult;

+import org.apache.pluto.testsuite.TestUtils;

+

 /**

  *

  * @version 1.0

@@ -87,8 +87,8 @@
      * Overwrites <code>super.getRenderParameters(..)</code> to set the

      * test-specific render parameter in the render URL.

      */

-    public Map getRenderParameters(PortletRequest request) {

-    	Map parameterMap = super.getRenderParameters(request);

+    public Map<String, String[]> getRenderParameters(PortletRequest request) {

+    	Map<String, String[]> parameterMap = super.getRenderParameters(request);

     	parameterMap.put(KEY_RENDER, new String[] { VALUE_RENDER });

     	return parameterMap;

     }

@@ -208,7 +208,9 @@
 

         // GenericServlet Impl -------------------------------------------------

 

-        public String getServletInfo() {

+		private static final long serialVersionUID = -963706386141654216L;

+

+		public String getServletInfo() {

         	return getClass().getName();

         }

 

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRequestTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRequestTest.java
index b610b54..343db52 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRequestTest.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRequestTest.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -174,7 +174,9 @@
     

     public static class CompanionServlet extends HttpServlet {

     	

-        private static final String KEY_REQUEST_URI = "javax.servlet.include.request_uri";

+		private static final long serialVersionUID = -6032809452145653960L;

+		

+		private static final String KEY_REQUEST_URI = "javax.servlet.include.request_uri";

         private static final String KEY_CONTEXT_PATH = "javax.servlet.include.context_path";

         private static final String KEY_SERVLET_PATH = "javax.servlet.include.servlet_path";

         private static final String KEY_PATH_INFO = "javax.servlet.include.path_info";

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTest.java
index 2a0a6d4..42c8c64 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTest.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTest.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -19,8 +19,6 @@
 

 import java.io.IOException;

 

-import org.apache.pluto.testsuite.TestResult;

-

 import javax.portlet.PortletSession;

 import javax.servlet.RequestDispatcher;

 import javax.servlet.ServletException;

@@ -29,9 +27,12 @@
 import javax.servlet.http.HttpServletResponse;

 import javax.servlet.http.HttpSession;

 

+import org.apache.pluto.testsuite.TestResult;

+

 /**

  */

-public class ExternalAppScopedAttributeTest extends AbstractReflectivePortletTest {

+public class ExternalAppScopedAttributeTest 

+extends AbstractReflectivePortletTest {

 

     public static final String INT_KEY = "org.apache.pluto.testsuite.INTERNALLY_SET_APP_SCOPED_SESSION_TEST_KEY";

     public static final String EXT_KEY = "org.apache.pluto.testsuite.EXTERNALLY_SET_APP_SCOPED_SESSION_TEST_KEY";

@@ -78,7 +79,9 @@
      */

     public static class CompanionServlet extends HttpServlet {

 

-        public void doGet(HttpServletRequest request,

+		private static final long serialVersionUID = 8921101365853307609L;

+

+		public void doGet(HttpServletRequest request,

                           HttpServletResponse response)

         throws ServletException, IOException {

             HttpSession session = request.getSession();

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/MiscTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/MiscTest.java
index b3582eb..6d68d50 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/MiscTest.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/MiscTest.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -105,14 +105,15 @@
         TestResult result = new TestResult();

         result.setDescription("Ensure the expected portlet modes are returned.");

 

-        List requiredPortletModes = new ArrayList();

+        List<PortletMode> requiredPortletModes = new ArrayList<PortletMode>();

         requiredPortletModes.add(PortletMode.VIEW);

         requiredPortletModes.add(PortletMode.EDIT);

         requiredPortletModes.add(PortletMode.HELP);

 

-        for (Enumeration en = request.getPortalContext().getSupportedPortletModes();

+        for (Enumeration<PortletMode> en = 

+        		request.getPortalContext().getSupportedPortletModes();

         		en.hasMoreElements(); ) {

-            PortletMode portletMode = (PortletMode) en.nextElement();

+            PortletMode portletMode = en.nextElement();

             requiredPortletModes.remove(portletMode);

         }

 

@@ -121,7 +122,7 @@
         } else {

         	result.setReturnCode(TestResult.FAILED);

         	StringBuffer buffer = new StringBuffer();

-        	for (Iterator it = requiredPortletModes.iterator();

+        	for (Iterator<PortletMode> it = requiredPortletModes.iterator();

         			it.hasNext(); ) {

         		buffer.append(it.next()).append(", ");

         	}

@@ -135,12 +136,13 @@
         TestResult result = new TestResult();

         result.setDescription("Ensure the expected window states are returned.");

 

-        List requiredWindowStates = new ArrayList();

+        List<WindowState> requiredWindowStates = new ArrayList<WindowState>();

         requiredWindowStates.add(WindowState.MINIMIZED);

         requiredWindowStates.add(WindowState.MAXIMIZED);

         requiredWindowStates.add(WindowState.NORMAL);

 

-        for (Enumeration en = request.getPortalContext().getSupportedWindowStates();

+        for (Enumeration<WindowState> en = 

+        		request.getPortalContext().getSupportedWindowStates();

         		en.hasMoreElements(); ) {

             WindowState windowState = (WindowState) en.nextElement();

             requiredWindowStates.remove(windowState);

@@ -151,7 +153,7 @@
         } else {

         	result.setReturnCode(TestResult.FAILED);

             StringBuffer buffer = new StringBuffer();

-            for (Iterator it = requiredWindowStates.iterator();

+            for (Iterator<WindowState> it = requiredWindowStates.iterator();

             		it.hasNext(); ) {

             	buffer.append(it.next()).append(", ");

             }

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PreferenceCommonTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PreferenceCommonTest.java
index 4dcc7cf..d90d29c 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PreferenceCommonTest.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PreferenceCommonTest.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -16,19 +16,18 @@
  */

 package org.apache.pluto.testsuite.test;

 

-import org.apache.commons.logging.Log;

-import org.apache.commons.logging.LogFactory;

-import org.apache.pluto.testsuite.TestResult;

-import org.apache.pluto.testsuite.TestUtils;

-

 import java.util.Enumeration;

-import java.util.Iterator;

 import java.util.Map;

 

 import javax.portlet.PortletPreferences;

 import javax.portlet.PortletRequest;

 import javax.portlet.ReadOnlyException;

 

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+import org.apache.pluto.testsuite.TestResult;

+import org.apache.pluto.testsuite.TestUtils;

+

 /**

  * Common portlet preferences test.

  */

@@ -376,9 +375,10 @@
         result.setSpecPLT("14.1");

 

         PortletPreferences preferences = request.getPreferences();

-        Map prefMap = preferences.getMap();

+        Map<String, String[]> prefMap = preferences.getMap();

         boolean hasAll = true;

-        for (Enumeration en = preferences.getNames(); en.hasMoreElements(); ) {

+        for (Enumeration<String> en = preferences.getNames(); 

+        		en.hasMoreElements(); ) {

             if (!prefMap.containsKey(en.nextElement())) {

                 hasAll = false;

                 break;

@@ -422,7 +422,7 @@
         }

 

         // Modify the returned preference map.

-    	Map prefMap = preferences.getMap();

+    	Map<String, String[]> prefMap = preferences.getMap();

     	String[] values = (String[]) prefMap.get(PREF_NAME);

     	String originalValue = null;

     	String modifiedValue = "Value modified in preferences map.";

@@ -457,9 +457,8 @@
      */

     protected void logPreferences(PortletPreferences preferences) {

     	StringBuffer buffer = new StringBuffer();

-    	Map map = preferences.getMap();

-    	for (Iterator it = map.keySet().iterator(); it.hasNext(); ) {

-    		String key = (String) it.next();

+    	Map<String, String[]> map = preferences.getMap();

+    	for (String key : map.keySet()) {

     		String[] values = (String[]) map.get(key);

     		buffer.append(key).append("=");

     		if (values != null) {

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PreferenceInActionTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PreferenceInActionTest.java
index ca94729..e15ac04 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PreferenceInActionTest.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PreferenceInActionTest.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -16,24 +16,25 @@
  */

 package org.apache.pluto.testsuite.test;

 

-import org.apache.commons.logging.Log;

-import org.apache.commons.logging.LogFactory;

-import org.apache.pluto.testsuite.ActionTest;

-import org.apache.pluto.testsuite.TestResult;

-import org.apache.pluto.testsuite.TestUtils;

-import org.apache.pluto.testsuite.validator.PreferencesValidatorImpl;

-

 import java.io.IOException;

 

+import javax.portlet.ActionRequest;

 import javax.portlet.PortletPreferences;

 import javax.portlet.PortletRequest;

 import javax.portlet.ReadOnlyException;

 import javax.portlet.ValidatorException;

 

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+import org.apache.pluto.testsuite.TestResult;

+import org.apache.pluto.testsuite.TestUtils;

+import org.apache.pluto.testsuite.annotations.DefaultTestPhase;

+import org.apache.pluto.testsuite.validator.PreferencesValidatorImpl;

+

 /**

  */

-public class PreferenceInActionTest extends PreferenceCommonTest

-implements ActionTest {

+@DefaultTestPhase(PortletRequest.ACTION_PHASE)

+public class PreferenceInActionTest extends PreferenceCommonTest {

 

 	/** Logger. */

     private static final Log LOG = LogFactory.getLog(PreferenceInActionTest.class);

@@ -41,7 +42,7 @@
 

     // Test Methods ------------------------------------------------------------

 

-    protected TestResult checkPreferenceValidator(PortletRequest request) {

+    protected TestResult checkPreferenceValidator(ActionRequest request) {

         TestResult result = new TestResult();

         result.setDescription("Ensure the validator catches invalid preferences.");

         result.setSpecPLT("14.4");

@@ -92,7 +93,7 @@
     }

 

     protected TestResult checkOnePreferenceValidatorPerPortletDefinition(

-    		PortletRequest request) {

+    		ActionRequest request) {

         TestResult result = new TestResult();

         result.setDescription("Ensure only one validator instance is created "

         		+ "per portlet definition.");

@@ -125,7 +126,7 @@
         return result;

     }

 

-    protected TestResult checkStorePreferences(PortletRequest request) {

+    protected TestResult checkStorePreferences(ActionRequest request) {

         TestResult result = new TestResult();

         result.setDescription("Ensure storage works for portlet preferences.");

         result.setSpecPLT("14.1");

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/RenderParameterTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/RenderParameterTest.java
index b9fa822..16f37f1 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/RenderParameterTest.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/RenderParameterTest.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -16,15 +16,15 @@
  */

 package org.apache.pluto.testsuite.test;

 

-import org.apache.pluto.testsuite.TestResult;

-import org.apache.pluto.testsuite.TestUtils;

-

 import java.util.Enumeration;

 import java.util.HashMap;

 import java.util.Map;

 

 import javax.portlet.PortletRequest;

 

+import org.apache.pluto.testsuite.TestResult;

+import org.apache.pluto.testsuite.TestUtils;

+

 /**

  */

 public class RenderParameterTest extends AbstractReflectivePortletTest {

@@ -35,8 +35,8 @@
     private static final String RENDER_VALUE = "org.apache.pluto.testsuite.RENDER_VALUE";

 

 

-    public Map getRenderParameters(PortletRequest request) {

-        Map parameterMap = new HashMap();

+    public Map<String, String[]> getRenderParameters(PortletRequest request) {

+        Map<String, String[]> parameterMap = new HashMap<String, String[]>();

         parameterMap.put(RENDER_KEY, new String[] { RENDER_VALUE });

         return parameterMap;

     }

@@ -94,7 +94,7 @@
         result.setDescription("Ensure that render request returns the correct "

         		+ "parameter map.");

 

-        Map parameterMap = request.getParameterMap();

+        Map<String, String[]> parameterMap = request.getParameterMap();

         String[] values = (String[]) parameterMap.get(RENDER_KEY);

         if (values != null && values.length == 1

         		&& RENDER_VALUE.equals(values[0])

@@ -121,9 +121,9 @@
 

         boolean hasActionParameter = false;

         boolean hasRenderParameter = false;

-        for (Enumeration en = request.getParameterNames();

+        for (Enumeration<String> en = request.getParameterNames();

         		en.hasMoreElements(); ) {

-            String name = (String) en.nextElement();

+            String name = en.nextElement();

             if (ACTION_KEY.equals(name)) {

             	hasActionParameter = true;

             }

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ResourceBundleTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ResourceBundleTest.java
index 092b212..457dbf3 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ResourceBundleTest.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ResourceBundleTest.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -34,7 +34,7 @@
  * the portlet request, session, and context objects.

  *

  */

-public class ResourceBundleTest extends AbstractReflectivePortletTest {

+public class ResourceBundleTest extends AbstractReflectivePortletTest  {

 

 	// Static Constant Definitions ---------------------------------------------

 

@@ -96,7 +96,7 @@
         result.setDescription("Retrieve the property names and ensure that "

         		+ "the required keys are present.");

 

-        List requiredKeys = new ArrayList();

+        List<String> requiredKeys = new ArrayList<String>();

         requiredKeys.add(TITLE_KEY);

         requiredKeys.add(SHORT_TITLE_KEY);

         requiredKeys.add(KEYWORDS_KEY);

@@ -110,7 +110,8 @@
         	return result;

         }

 

-        for (Enumeration en = bundle.getKeys(); en.hasMoreElements(); ) {

+        for (Enumeration<String> en = bundle.getKeys(); 

+        			en.hasMoreElements(); ) {

             String key = (String) en.nextElement();

             requiredKeys.remove(key);

         }

@@ -120,7 +121,7 @@
         } else {

         	result.setReturnCode(TestResult.FAILED);

             StringBuffer buffer = new StringBuffer();

-            for (Iterator it = requiredKeys.iterator(); it.hasNext(); ) {

+            for (Iterator<String> it = requiredKeys.iterator(); it.hasNext(); ) {

             	buffer.append(it.next()).append(", ");

             }

             result.setResultMessage("Required keys [" + buffer.toString()

@@ -175,7 +176,7 @@
 

         // Retrieve expected title, short title and keywords from test config.

         String suffix = isBundleDeclared() ? ("_" + locale.getLanguage()) : "";

-        Map initParams = getInitParameters();

+        Map<String, String> initParams = getInitParameters();

         String expectedTitle = (String) initParams.get(

         		TITLE_PARAM + suffix);

         String expectedShortTitle = (String) initParams.get(

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleAttributeTest.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleAttributeTest.java
index 82f0f9f..95670d4 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleAttributeTest.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleAttributeTest.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -16,15 +16,15 @@
  */

 package org.apache.pluto.testsuite.test;

 

-import org.apache.pluto.testsuite.TestResult;

-import org.apache.pluto.testsuite.TestUtils;

-

 import java.util.Enumeration;

 

 import javax.portlet.PortletContext;

 import javax.portlet.PortletRequest;

 import javax.portlet.PortletSession;

 

+import org.apache.pluto.testsuite.TestResult;

+import org.apache.pluto.testsuite.TestUtils;

+

 /**

  * Tests basic attribute retrieval and storage functions within the portlet

  * request, session, and context objects.

@@ -97,7 +97,7 @@
         }

 

         int found = 0;

-        for (Enumeration en = req.getAttributeNames();

+        for (Enumeration<String> en = req.getAttributeNames();

         		en.hasMoreElements(); ) {

             if (en.nextElement().toString().startsWith(KEY)) {

                 found++;

@@ -181,7 +181,7 @@
         }

 

         int found = 0;

-        for (Enumeration en = session.getAttributeNames();

+        for (Enumeration<String> en = session.getAttributeNames();

         		en.hasMoreElements(); ) {

         	String name = (String) en.nextElement();

             if (name.startsWith(KEY)) {

@@ -269,7 +269,7 @@
         }

 

         int found = 0;

-        for (Enumeration en = context.getAttributeNames();

+        for (Enumeration<?> en = context.getAttributeNames();

         		en.hasMoreElements(); ) {

             if (en.nextElement().toString().startsWith(KEY)) {

                 found++;

diff --git a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/validator/PreferencesValidatorImpl.java b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/validator/PreferencesValidatorImpl.java
index 01ad63e..2b134cd 100644
--- a/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/validator/PreferencesValidatorImpl.java
+++ b/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/validator/PreferencesValidatorImpl.java
@@ -1,9 +1,9 @@
 /*

- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more

+ * contributor license agreements.  See the NOTICE file distributed with

+ * this work for additional information regarding copyright ownership.

+ * The ASF licenses this file to You under the Apache License, Version 2.0

+ * (the "License"); you may not use this file except in compliance with

  * the License.  You may obtain a copy of the License at

  *

  *      http://www.apache.org/licenses/LICENSE-2.0

@@ -40,7 +40,8 @@
     public static final String CHECK_VALIDATOR_COUNT = "checkValidatorCount";

 

     /** Count of instances created. */

-    private static final Map INSTANCE_COUNTER = new HashMap();

+    private static final Map<String, Integer> INSTANCE_COUNTER = 

+    	new HashMap<String, Integer>();

 

     /** Count of invocation number of method <code>validate()</code>. */

     private int validateInvoked = 0;

@@ -80,8 +81,9 @@
         //   anymore.  When enabled, all preferences fail in testsuite.

         //

         final String[] DEFAULT_VALUES = new String[] { "no values" };

-    	Collection failedNames = new ArrayList();

-        for (Enumeration en = preferences.getNames(); en.hasMoreElements(); ) {

+    	Collection<String> failedNames = new ArrayList<String>();

+        for (Enumeration<String> en = preferences.getNames(); 

+        		en.hasMoreElements(); ) {

             String name = (String) en.nextElement();

             String[] values = preferences.getValues(name, DEFAULT_VALUES);

             if (values != null) { // null values are allowed