You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by dd...@apache.org on 2005/08/03 23:43:55 UTC

svn commit: r227271 [1/2] - in /portals/pluto/branches/pluto-1.1: ./ pluto-portal/src/main/resources/org/ pluto-testsuite/src/main/java/org/apache/pluto/portalImpl/ pluto-testsuite/src/main/java/org/apache/pluto/testsuite/ pluto-testsuite/src/main/java...

Author: ddewolf
Date: Wed Aug  3 14:43:40 2005
New Revision: 227271

URL: http://svn.apache.org/viewcvs?rev=227271&view=rev
Log:
-- Refactoring / Clean Up CodeBase.
-- Fix Small Test Suite Issues.

Added:
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionAbstractReflectivePortletTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ComplexAttributeTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ContextInitParameterTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTestServlet.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTestCompanionServlet.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/MiscTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/NoOpTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PortletTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ResourceBundleTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SecurityMappingTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleActionParameterTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleAttributeTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleParameterTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimplePreferenceTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleRenderParameterTest.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/TestResult.java
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/TestResults.java
Removed:
    portals/pluto/branches/pluto-1.1/pluto-portal/src/main/resources/org/
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/portalImpl/
Modified:
    portals/pluto/branches/pluto-1.1/TODO
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/webapp/WEB-INF/classes/expectedResults.properties
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/webapp/WEB-INF/portlet.xml
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/webapp/WEB-INF/testsuite-2-config.xml
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/webapp/WEB-INF/testsuite-config.xml
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/webapp/WEB-INF/web.xml
    portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/webapp/jsp/navigation.inc
    portals/pluto/branches/pluto-1.1/pom.xml

Modified: portals/pluto/branches/pluto-1.1/TODO
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/TODO?rev=227271&r1=227270&r2=227271&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/TODO (original)
+++ portals/pluto/branches/pluto-1.1/TODO Wed Aug  3 14:43:40 2005
@@ -3,6 +3,8 @@
    and writing.
 
 2) Port all recent 1.0.x fixes.
+  - [DONE] Render Parameters in includes
+  - What else?
 
 3) Modify bin.xml and src.xml for
    each distribution.  Create

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * TestPortlet Configuration.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Sep 15, 2004
+ */
+public class TestConfig {
+
+    private String testClassName;
+    private String name;
+    private String displayURI;
+    private Map initParams = new java.util.HashMap();
+    private Map actionParameters = new java.util.HashMap();
+    private Map renderParameters = new java.util.HashMap();
+
+    public TestConfig() {
+
+    }
+
+    public String getTestClassName() {
+        return testClassName;
+    }
+
+    public void setTestClassName(String testClassName) {
+        this.testClassName = testClassName;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String testName) {
+        this.name = testName;
+    }
+
+    public String getDisplayURI() {
+        return displayURI;
+    }
+
+    public void setDisplayURI(String displayURI) {
+        this.displayURI = displayURI;
+    }
+
+    public void addInitParameter(String parameter, String value) {
+        this.initParams.put(parameter, value);
+    }
+
+    public Map getInitParameters() {
+        return Collections.unmodifiableMap(initParams);
+    }
+
+    public void addActionParameter(String parameter, String value) {
+        this.actionParameters.put(parameter, value);
+    }
+
+    public Map getActionParameters() {
+        return Collections.unmodifiableMap(actionParameters);
+    }
+
+    public void addRenderParameter(String parameter, String value) {
+        this.renderParameters.put(parameter, value);
+    }
+
+    public Map getRenderParameters() {
+        return Collections.unmodifiableMap(renderParameters);
+    }
+
+    public String toString() {
+        return super.toString()+"<"+getName()+">";
+    }
+}
+

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+import org.apache.commons.digester.Digester;
+import org.apache.pluto.testsuite.TestConfig;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="ddewolf@apache.com">David H. DeWolf</a>
+ *
+ */
+public class TestConfigFactory {
+
+    private Digester digester = new Digester();
+
+    public TestConfigFactory() {
+        digester = new Digester();
+        digester.addObjectCreate("testportlet-config",
+                                 java.util.ArrayList.class);
+
+
+        digester.addObjectCreate("testportlet-config/testsuite-config",
+                                 TestConfig.class);
+
+        digester.addBeanPropertySetter("testportlet-config/testsuite-config/name",
+                                       "name");
+
+        digester.addBeanPropertySetter("testportlet-config/testsuite-config/class",
+                                       "testClassName");
+
+        digester.addBeanPropertySetter("testportlet-config/testsuite-config/display-uri",
+                                       "displayURI");
+
+        digester.addCallMethod("testportlet-config/testsuite-config/init-param", "addInitParameter", 2);
+        digester.addCallParam("testportlet-config/testsuite-config/init-param/name", 0);
+        digester.addCallParam("testportlet-config/testsuite-config/init-param/value", 1);
+
+        digester.addCallMethod("testportlet-config/testsuite-config/action-param", "addActionParameter", 2);
+        digester.addCallParam("testportlet-config/testsuite-config/action-param/name", 0);
+        digester.addCallParam("testportlet-config/testsuite-config/action-param/value", 1);
+
+        digester.addCallMethod("testportlet-config/testsuite-config/render-param", "addRenderParameter", 2);
+        digester.addCallParam("testportlet-config/testsuite-config/render-param/name", 0);
+        digester.addCallParam("testportlet-config/testsuite-config/render-param/value", 1);
+
+        digester.addSetRoot("testportlet-config/testsuite-config",
+                            "add");
+
+    }
+
+    public List createTests(InputStream in)
+    throws SAXException, IOException {
+        return (List)digester.parse(in);
+    }
+}

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,236 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ * 
+ * Licensed 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;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+
+import org.apache.pluto.testsuite.test.ActionTest;
+import org.apache.pluto.testsuite.test.NoOpTest;
+import org.apache.pluto.testsuite.test.PortletTest;
+import org.apache.pluto.testsuite.test.TestResults;
+import org.apache.pluto.testsuite.TestConfig;
+import org.apache.pluto.testsuite.TestConfigFactory;
+
+public class TestPortlet extends GenericPortlet {
+
+    private List configs;
+    private Map tests;
+
+    public void init() throws PortletException {
+        String configFile = getInitParameter("config");
+        if(configFile==null) {
+            configFile = "/WEB-INF/testsuite-config.xml";
+        }
+
+        InputStream in = getPortletContext().getResourceAsStream(configFile);
+        if( in !=null ) {
+            TestConfigFactory fact = new TestConfigFactory();
+            try {
+                configs = fact.createTests(in);
+                tests = new HashMap();
+                Iterator it = configs.iterator();
+                int i = 0;
+                while(it.hasNext()) {
+                    TestConfig config = (TestConfig)it.next();
+                    String name=  config.getTestClassName();
+                    PortletTest test = null;
+                    if(name != null) {
+                        Class cl = Class.forName(config.getTestClassName());
+                        test = (PortletTest)cl.newInstance();
+                    }
+                    else {
+                        test = new NoOpTest();
+                    }
+                    test.init(config);
+                    tests.put(String.valueOf(i++), test);
+                }
+            }
+            catch (Throwable t) {
+                throw new PortletException("Unable to read configuration", t);
+            }
+        }
+        else {
+            throw new IllegalStateException("Configuration File Not Found");
+        }
+    }
+
+
+    public void processAction (ActionRequest request,
+                               ActionResponse response)
+    throws PortletException, java.io.IOException {
+
+        String testId = getTestId(request);
+        PortletTest test = (PortletTest)tests.get(testId);
+
+        if(test!=null && test instanceof ActionTest) {
+            TestResults results = test.doTest(getPortletConfig(),
+                                              getPortletContext(),
+                                              request, response);
+            request.getPortletSession().setAttribute(test.getClass().getName(), results);
+        }
+        Map renderParameters = null;
+
+        if(test!=null) {
+            renderParameters = test.getRenderParameters(request);
+        }
+
+        if(renderParameters==null) {
+            renderParameters = new java.util.HashMap();
+        }
+
+        renderParameters.put("testId", new String[] {testId});
+        response.setRenderParameters(renderParameters);
+    }
+
+    public void doView(RenderRequest request,
+                       RenderResponse response)
+    throws PortletException, IOException {
+
+        String testId = getTestId(request);
+
+        TestConfig config = null;
+        if(testId != null) {
+            config = (TestConfig)configs.get(Integer.parseInt(testId));
+        }
+
+        PortletTest test = (PortletTest)tests.get(testId);
+
+        WindowState state = request.getWindowState();
+        if (!state.equals(WindowState.MINIMIZED)) {
+            response.setContentType("text/html");
+
+            if(test != null && !(test instanceof ActionTest) ) {
+                TestResults results = test.doTest(getPortletConfig(),
+                                                  getPortletContext(),
+                                                  request, response);
+                request.setAttribute("results", results);
+            }
+            else if(test != null) {
+                PortletSession session = request.getPortletSession();
+                TestResults results = (TestResults)session.getAttribute(test.getClass().getName());
+                request.setAttribute("results", results);
+            }
+
+            if(testId == null) {
+                request.setAttribute("tests", configs);
+            }
+            else {
+                TestConfig next = null;
+                TestConfig prev = null;
+                int index = configs.indexOf(test.getConfig());
+                if(index==0) {
+                    prev = (TestConfig)configs.get(configs.size()-1);
+                    next = (TestConfig)configs.get(index+1);
+                }
+                else if(index == configs.size()-1) {
+                    prev = (TestConfig)configs.get(index-1);
+                    next = (TestConfig)configs.get(0);
+                }
+                else {
+                    prev = (TestConfig)configs.get(index-1);
+                    next = (TestConfig)configs.get(index+1);
+                }
+                request.setAttribute("prevTest", prev);
+                request.setAttribute("nextTest", next);
+            }
+
+            PortletContext context = getPortletContext();
+            PortletRequestDispatcher rd = null;
+            if(config != null) {
+                rd = context.getRequestDispatcher(config.getDisplayURI());
+            }
+            else {
+                rd = context.getRequestDispatcher("/jsp/introduction.jsp");
+            }
+            rd.include(request,response);
+        }
+    }
+
+
+    protected void doEdit(RenderRequest req, RenderResponse res)
+    throws PortletException, IOException {
+        WindowState state = req.getWindowState();
+        if(!state.equals(WindowState.MINIMIZED)) {
+            PortletContext context = getPortletContext();
+            PortletRequestDispatcher rd = context.getRequestDispatcher("/jsp/edit.jsp");
+            rd.include(req,res);
+        }
+    }
+
+    protected void doHelp(RenderRequest req, RenderResponse res)
+    throws PortletException, IOException {
+        WindowState state = req.getWindowState();
+        if(!state.equals(WindowState.MINIMIZED)) {
+            PortletContext context = getPortletContext();
+            PortletRequestDispatcher rd = context.getRequestDispatcher("/jsp/help.jsp");
+            rd.include(req,res);
+        }
+    }
+
+    private String getTestId(PortletRequest req) {
+        String testId =   req.getParameter("testId");
+        String previous = req.getParameter("previousTestId");
+        String next     = req.getParameter("nextTestId");
+
+        if((testId == null || testId.trim().length()==0)
+           && next == null && previous == null && tests.size() > 0) {
+            return null;
+        }
+        // Retrieve the test which is next to the previous
+        else if(testId == null && previous !=null) {
+            int pId = Integer.parseInt(previous);
+            if(pId >= configs.size()-1) {
+                testId = "0";
+            }
+            else {
+                testId = String.valueOf(pId+1);
+            }
+        }
+        // Retrieve the test which is previous to the next
+        else if(testId == null && next !=null) {
+            int nId = Integer.parseInt(next);
+            if(nId <= 0) {
+                testId = String.valueOf(configs.size()-1);
+            }
+            else {
+                testId = String.valueOf(nId - 1);
+            }
+        }
+
+        return testId;
+    }
+}

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.test;
+
+import org.apache.pluto.testsuite.TestConfig;
+
+import javax.portlet.*;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Map;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public abstract class AbstractReflectivePortletTest implements PortletTest {
+
+    private Map initParameters;
+    private TestConfig config;
+
+    public TestResults doTest(PortletConfig config,
+                              PortletContext context,
+                              PortletRequest req,
+                              PortletResponse res) {
+        TestResults results = new TestResults(getTestSuiteName());
+
+        Class klass = getClass();
+        Method[] methods = klass.getDeclaredMethods();
+
+        for(int i = 0; i<methods.length;i++) {
+            if(methods[i].getName().startsWith("check")) {
+                try {
+                    results.add(invoke(methods[i], config, context, req, res));
+                }
+                catch(Exception e) {
+                    e.printStackTrace();
+                    TestResult result = new TestResult();
+                    result.setName(methods[i].getName());
+                    result.setDesc("Unknown");
+                    result.setReturnCode(TestResult.FAILED);
+                    result.setResults(e.getMessage());
+                    results.add(result);
+                }
+            }
+        }
+        return results;
+    }
+
+    public void init(TestConfig config) {
+        this.initParameters = config.getInitParameters();
+        this.config = config;
+    }
+
+    private TestResult invoke(Method method, PortletConfig config,
+                              PortletContext context,
+                              PortletRequest req, PortletResponse res)
+    throws IllegalAccessException, InvocationTargetException {
+
+        TestResult result = null;
+        Class[] paramTypes= method.getParameterTypes();
+        Object[] paramValues = new Object[paramTypes.length];
+
+        for(int i=0;i<paramTypes.length;i++) {
+            if(paramTypes[i].equals(PortletContext.class)) {
+                paramValues[i] = context;
+            }
+            if(paramTypes[i].equals(PortletRequest.class)) {
+                paramValues[i] = req;
+            }
+            if(paramTypes[i].equals(PortletResponse.class)) {
+                paramValues[i] = res;
+            }
+            if(paramTypes[i].equals(PortletSession.class)) {
+                paramValues[i] = req.getPortletSession();
+            }
+            if(paramTypes[i].equals(PortletConfig.class)) {
+                paramValues[i] = config;
+            }
+        }
+        result = (TestResult)method.invoke(this, paramValues);
+        return result;
+    }
+
+    public Map getRenderParameters(PortletRequest req) {
+        Map map = new java.util.HashMap();
+        return map;
+    }
+
+    public Map getInitParameters() {
+        return initParameters;
+    }
+
+    public TestConfig getConfig() {
+        return config;
+    }
+}

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionAbstractReflectivePortletTest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionAbstractReflectivePortletTest.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionAbstractReflectivePortletTest.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionAbstractReflectivePortletTest.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.test;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public abstract class ActionAbstractReflectivePortletTest
+ extends AbstractReflectivePortletTest
+ implements ActionTest {
+
+}

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionTest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionTest.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionTest.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionTest.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.test;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public interface ActionTest extends PortletTest {
+
+
+
+}

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ComplexAttributeTest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ComplexAttributeTest.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ComplexAttributeTest.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ComplexAttributeTest.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.test;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletSession;
+import java.util.Map;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public class ComplexAttributeTest extends AbstractReflectivePortletTest {
+
+    private static final String BOGUS_KEY = "org.apache.pluto.testsuite.BOGUS_KEY";
+    private static final String KEY = "org.apache.pluto.testsuite.KEY";
+    private static final String VAL = "VALUE";
+
+    public String getTestSuiteName() {
+        return "Complex Attribute Test";
+    }
+
+    public Map doPrerequisiteAction(PortletContext context, ActionRequest req,
+                                    ActionResponse res) {
+        return new java.util.HashMap();
+    }
+
+    protected TestResult checkGetEmptyApplicationScopedAttribute(PortletSession session) {
+        TestResult res = new TestResult();
+        res.setName("Get Empty Application Scoped Attribute Test");
+        res.setDesc("Retrieve an attribute that has not been set in the session's application scope and ensure it's value is null.");
+
+        Object val = session.getAttribute(BOGUS_KEY, PortletSession.APPLICATION_SCOPE);
+        if(val == null) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Retrieved attribute value '"+val+"'; expected null.");
+        }
+        return res;
+    }
+
+    protected TestResult checkSetApplicationScopedAttribute(PortletSession session) {
+        TestResult res = new TestResult();
+        res.setName("Set Application Scoped Attribute Test");
+        res.setDesc("Set an application scoped session attribute and ensure it's retrievable");
+
+        session.setAttribute(KEY, VAL, PortletSession.APPLICATION_SCOPE);
+
+        Object val = session.getAttribute(KEY, PortletSession.APPLICATION_SCOPE);
+        if(VAL.equals(val)) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Retrieved attribute value '"+val+"'; expected '"+VAL+"'");
+        }
+        return res;
+    }
+
+    protected TestResult checkRemoveApplicationScopedAttribute(PortletSession session) {
+        TestResult res = new TestResult();
+        res.setName("Remove Application Scoped Attribute Test");
+        res.setDesc("Remove an application scoped session attribute and ensure it's null.");
+
+        session.setAttribute(KEY, VAL, PortletSession.APPLICATION_SCOPE);
+        session.removeAttribute(KEY, PortletSession.APPLICATION_SCOPE);
+        Object val = session.getAttribute(KEY, PortletSession.APPLICATION_SCOPE);
+        if(null == val) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Retrieved attribute value '"+val+"'; expected null.");
+        }
+        return res;
+    }
+}

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ContextInitParameterTest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ContextInitParameterTest.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ContextInitParameterTest.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ContextInitParameterTest.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.test;
+
+import javax.portlet.PortletContext;
+import javax.portlet.PortletSession;
+import java.util.Enumeration;
+
+/**
+ * <B>TODO</B>: Document
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Sep 15, 2004
+ */
+public class ContextInitParameterTest extends AbstractReflectivePortletTest  {
+    private static final String TEST_PARAM_NAME = "test-parameter-name";
+    private static final String TEST_PARAM_VAL = "test-parameter-val";
+
+    public ContextInitParameterTest() {
+
+    }
+
+    public String getTestSuiteName() {
+        return "Context Init Parameter Test";
+    }
+
+    protected TestResult checkEnumerationContainsElements(PortletContext ctx) {
+        TestResult res = new TestResult();
+        res.setName("Get Init Parameter Enumeration Test");
+        res.setDesc("Test the initialization parameter enumeration.");
+
+        Enumeration enumerator= ctx.getInitParameterNames();
+        if (enumerator.hasMoreElements()) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("No init parameters found.");
+        }
+        return res;
+    }
+
+    protected TestResult checkEnumerationContainsNames(PortletContext ctx) {
+        TestResult res = new TestResult();
+        res.setName("Init Parameter Names in Enumeration Test");
+        res.setDesc("Test to make sure that the expected init parameters exist.");
+
+        boolean found = false;
+        Enumeration enumerator= ctx.getInitParameterNames();
+        while(enumerator.hasMoreElements()) {
+            String name = (String)enumerator.nextElement();
+            if(TEST_PARAM_NAME.equals(name)) {
+                found = true;
+            }
+        }
+
+        if(found) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Expected init parameter '"+TEST_PARAM_NAME+"' no found.");
+        }
+
+        return res;
+    }
+
+    protected TestResult checkGetInitParameter(PortletContext context) {
+        TestResult res = new TestResult();
+        res.setName("Init Parameter Retrieved Test");
+        res.setDesc("Test to make sure that init parameters are successfully retrieved.");
+
+        String val = context.getInitParameter(TEST_PARAM_NAME);
+        if(TEST_PARAM_VAL.equals(val)) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Expected value not found for key '"+TEST_PARAM_NAME+"'.  Found '"+TEST_PARAM_VAL+"'");
+        }
+        return res;
+    }
+
+    protected TestResult checkGetContextFromSession(PortletSession session) {
+        TestResult res = new TestResult();
+        res.setName("PortletContext Retrieved From Session Test");
+        res.setDesc("Test ensures that the PortletContext can be retrieved from the session.");
+
+        PortletContext ctx = session.getPortletContext();
+        if(ctx != null) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Portlet Context is Null");
+        }
+        return res;
+    }
+}
+

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTest.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTest.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTest.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.test;
+
+import java.io.IOException;
+
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * <B>TODO</B>: Document
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Mar 9, 2005
+ */
+public class DispatcherRenderParameterTest 
+    extends AbstractReflectivePortletTest  {
+
+    public static final String KEY_A = "includedTestKey";
+    public static final String VAL_A = "includedTestVal";
+    public static final String KEY_B = "bTestKey";
+    public static final String VAL_B = "bTestVal";
+    public static final String RESULT_KEY = "org.apache.pluto.testsuite.RESULTKEY";
+    
+
+    public DispatcherRenderParameterTest() {
+
+    }
+
+    public String getTestSuiteName() {
+        return "Dispatcher Render Parameter Test";
+    }
+    
+    protected TestResult checkIncludedParameterTest(PortletContext ctx,
+                                                    PortletRequest req,
+                                                    PortletResponse res)
+    throws IOException, PortletException {
+        PortletRequestDispatcher disp =
+            ctx.getRequestDispatcher("/tests/include?"+KEY_A+"="+VAL_A+"&"+KEY_B+"="+VAL_B);
+        
+        disp.include((RenderRequest)req, (RenderResponse)res);
+
+        TestResult result = new TestResult();
+        result.setName("Dispatcher Render Parameter Test");
+        result.setDesc("Ensure query parameters added during dispatching are attached to the request.");
+        if(req.getAttribute(RESULT_KEY)!=null && Boolean.TRUE.equals(req.getAttribute(RESULT_KEY))) {
+            result.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            result.setReturnCode(TestResult.FAILED);
+            result.setResults("Unable to find expected parameter");
+        }
+        return result;
+    }
+    
+
+}
+

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTestServlet.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTestServlet.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTestServlet.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTestServlet.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.test;
+
+import java.io.IOException;
+
+import javax.servlet.GenericServlet;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+/**
+ * <B>TODO</B>: Document
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Mar 9, 2005
+ */
+public class DispatcherRenderParameterTestServlet extends GenericServlet {
+
+    public DispatcherRenderParameterTestServlet() {
+
+    }
+
+    public void service(ServletRequest req, ServletResponse res)
+    throws ServletException, IOException {
+        String valA = req.getParameter(DispatcherRenderParameterTest.KEY_A);
+        String valB = req.getParameter(DispatcherRenderParameterTest.KEY_B);
+        if(DispatcherRenderParameterTest.VAL_A.equals(valA) && DispatcherRenderParameterTest.VAL_B.equals(valB)) {
+            req.setAttribute(DispatcherRenderParameterTest.RESULT_KEY, Boolean.TRUE);
+        }
+    }
+
+    public String getServletInfo() {
+        return "Dispather Render Parameter Include Servlet";
+    }
+
+}
+

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTest.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTest.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTest.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.test;
+
+import javax.portlet.PortletSession;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+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";
+    public static final String VALUE = "Should be visible to all Portlets and Web Resources.";
+
+    public String getTestSuiteName() {
+        return "External Application Scoped Attribute Test";
+    }
+
+    public TestResult checkSetHereSeenElsewhere(PortletSession session) {
+        TestResult res = new TestResult();
+        res.setName("Session Visibility Test");
+        res.setDesc("Ensure application scoped attributes set here can be seen elsewhere.");
+        res.setReturnCode(TestResult.WARNING);
+        res.setResults("Click the provided link to validate test.");
+
+        session.setAttribute(INT_KEY, VALUE, PortletSession.APPLICATION_SCOPE);
+        return res;
+    }
+
+    public TestResult checkSetElsewhereSeenHere(PortletSession session) {
+        TestResult res = new TestResult();
+        res.setName("Session Visibility Test");
+        res.setDesc("Ensure application scoped attributes set elsewhere can be seen here.");
+
+        Object val = session.getAttribute(EXT_KEY, PortletSession.APPLICATION_SCOPE);
+        if(VALUE.equals(val)) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.WARNING);
+            res.setResults("This test will not pass until you have opened the external resource using the link provided below.");
+        }
+        return res;
+    }
+}

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTestCompanionServlet.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTestCompanionServlet.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTestCompanionServlet.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTestCompanionServlet.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.test;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public class ExternalAppScopedAttributeTestCompanionServlet extends HttpServlet {
+
+    public void doGet(HttpServletRequest req, HttpServletResponse res)
+    throws ServletException, IOException {
+
+        HttpSession session = req.getSession();
+        String val = (String)
+            session.getAttribute(ExternalAppScopedAttributeTest.INT_KEY);
+
+        if(ExternalAppScopedAttributeTest.VALUE.equals(val)) {
+            req.setAttribute("passed", new Boolean(true));
+
+            session.setAttribute(
+                ExternalAppScopedAttributeTest.EXT_KEY,
+                ExternalAppScopedAttributeTest.VALUE
+            );
+        }
+
+        RequestDispatcher dis = req.getRequestDispatcher("/jsp/external_app_scoped_test_ext.jsp");
+        dis.forward(req, res);
+
+    }
+}

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/MiscTest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/MiscTest.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/MiscTest.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/MiscTest.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,192 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.test;
+
+import java.util.Enumeration;
+import java.util.Properties;
+
+import javax.portlet.PortletContext;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletRequest;
+import javax.portlet.WindowState;
+
+import org.apache.pluto.testsuite.ExpectedResults;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public class MiscTest extends AbstractReflectivePortletTest {
+
+
+    public String getTestSuiteName() {
+        return "Misc Test";
+    }
+
+    protected TestResult checkContextMajorVersion(PortletContext ctx) {
+        TestResult res = new TestResult();
+        res.setName("Major Version Test");
+        res.setDesc("Make sure that the expected major version number is returned.");
+        Properties props = ExpectedResults.getExpectedProperties();
+        String major = String.valueOf(ctx.getMajorVersion());
+        if(major.equals(props.getProperty("expected.version.major"))) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Major Version: "+major+". Expected: "+props.getProperty("expected.version.major"));
+        }
+        return res;
+    }
+
+    protected TestResult checkContextMinorVersion(PortletContext ctx) {
+        TestResult res = new TestResult();
+        res.setName("Minor Version Test");
+        res.setDesc("Make sure that the expected minor version number is returned.");
+        Properties props = ExpectedResults.getExpectedProperties();
+        String minor = String.valueOf(ctx.getMinorVersion());
+        if(minor.equals(props.getProperty("expected.version.minor"))) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Minor Version: "+minor+". Expected: "+props.getProperty("expected.version.minor"));
+        }
+        return res;
+    }
+
+
+
+    protected TestResult checkContextServerInfo(PortletContext ctx) {
+        TestResult res = new TestResult();
+        res.setName("Server Info Test");
+        res.setDesc("Make sure that the expected server info is returned.");
+        Properties props = ExpectedResults.getExpectedProperties();
+        if(ctx.getServerInfo().equals(props.getProperty("expected.serverInfo"))) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Server info: "+ctx.getServerInfo()+". Expected: "+props.getProperty("expected.serverInfo"));
+        }
+        return res;
+    }
+
+    protected TestResult checkPortalInfo(PortletRequest req) {
+        TestResult res = new TestResult();
+        res.setName("Portal Info Test");
+        res.setDesc("Make sure that the expected portal info is returned.");
+        Properties props = ExpectedResults.getExpectedProperties();
+        if(req.getPortalContext().getPortalInfo().equals(props.getProperty("expected.portalInfo"))) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Portal info: "+req.getPortalContext().getPortalInfo()+". Expected: "+props.getProperty("expected.portalInfo"));
+        }
+        return res;
+    }
+
+    /**
+     * Test to ensure that the basic modes are supported.
+     * @todo Enhance to check for custom modes.
+     * @param req
+     * @return
+     */
+    protected TestResult checkSupportedModes(PortletRequest req)  {
+        TestResult res = new TestResult();
+        res.setName("Supported Modes Test");
+        res.setDesc("Make sure that the expected modes are returned.");
+
+        boolean hasView = false;
+        boolean hasEdit = false;
+        boolean hasHelp = false;
+
+        Enumeration enumerator= req.getPortalContext().getSupportedPortletModes();
+        while(enumerator.hasMoreElements()) {
+            PortletMode mode = (PortletMode)enumerator.nextElement();
+            if(mode.equals(PortletMode.VIEW)) {
+                hasView  = true;
+            }
+            else if(mode.equals(PortletMode.EDIT)) {
+                hasEdit  = true;
+            }
+            else if(mode.equals(PortletMode.HELP)) {
+                hasHelp  = true;
+            }
+        }
+
+        if(hasView && hasEdit &&  hasHelp) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            StringBuffer sb = new StringBuffer();
+            if(!hasView) {
+                sb.append("'View' mode not found. ");
+            }
+            if(!hasEdit) {
+                sb.append("'Edit' mode not found. ");
+            }
+            if(!hasHelp) {
+                sb.append("'Help' mode not found. ");
+            }
+        }
+        return res;
+    }
+
+    protected TestResult checkSupportedWindowSates(PortletRequest req) {
+        TestResult res = new TestResult();
+        res.setName("Supported Window States Test");
+        res.setDesc("Make sure that the expected states are returned.");
+
+        boolean hasMin = false;
+        boolean hasMax = false;
+        boolean hasNor = false;
+
+        Enumeration enumerator= req.getPortalContext().getSupportedWindowStates();
+        while(enumerator.hasMoreElements()) {
+            WindowState mode = (WindowState)enumerator.nextElement();
+            if(mode.equals(WindowState.MINIMIZED)) {
+                hasMin  = true;
+            }
+            else if(mode.equals(WindowState.MAXIMIZED)) {
+                hasMax  = true;
+            }
+            else if(mode.equals(WindowState.NORMAL)) {
+                hasNor  = true;
+            }
+        }
+
+        if(hasMin && hasMax &&  hasNor) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            StringBuffer sb = new StringBuffer();
+            if(!hasMin) {
+                sb.append("'Minimized' state not found. ");
+            }
+            if(!hasMax) {
+                sb.append("'Maximized' state not found. ");
+            }
+            if(!hasNor) {
+                sb.append("'Normal' state not found. ");
+            }
+        }
+        return res;
+    }
+
+}

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/NoOpTest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/NoOpTest.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/NoOpTest.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/NoOpTest.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.test;
+
+import java.util.Map;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+
+import org.apache.pluto.testsuite.TestConfig;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Mar 9, 2005
+ */
+public class NoOpTest implements PortletTest {
+    private TestConfig config;
+
+    public NoOpTest() {
+
+    }
+
+    public String getTestSuiteName() {
+        return "NoOpTest";
+    }
+
+    public Map getRenderParameters(PortletRequest req) {
+        return new java.util.HashMap();
+    }
+
+    public TestResults doTest(PortletConfig config, PortletContext context,
+                              PortletRequest req, PortletResponse res) {
+        return new TestResults("None");
+    }
+
+    public void init(TestConfig config) {
+        this.config = config;
+    }
+
+    public TestConfig getConfig() {
+        return config;
+    }
+}
+

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PortletTest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PortletTest.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PortletTest.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PortletTest.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.test;
+
+import java.util.Map;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+
+import org.apache.pluto.testsuite.TestConfig;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public interface PortletTest {
+
+    String getTestSuiteName();
+
+    Map getRenderParameters(PortletRequest req);
+
+    TestResults doTest(PortletConfig config,
+                       PortletContext context,
+                       PortletRequest req,
+                       PortletResponse res);
+
+    void init(TestConfig config);
+
+    TestConfig getConfig();
+}

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ResourceBundleTest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ResourceBundleTest.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ResourceBundleTest.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ResourceBundleTest.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.test;
+
+import javax.portlet.*;
+import java.util.*;
+
+/**
+ * Tests basic attribute retrieval and storage functions within
+ * the portlet request, session, and context objects.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public class ResourceBundleTest extends AbstractReflectivePortletTest {
+
+    public String getTestSuiteName() {
+        return "Resource Bundle Test";
+    }
+
+    public Map doPrerequisiteAction(PortletContext context, ActionRequest req,
+                                    ActionResponse res) {
+        return new HashMap();
+
+    }
+//
+// Begin Request Tests
+//
+    protected TestResult checkResourceBundleExists(PortletConfig config,
+                                                   PortletRequest req) {
+        TestResult res = new TestResult();
+        res.setName("Get ResourceBundle Test");
+        res.setDesc("Retrieves the resource bundle and ensures it's not null.");
+
+        ResourceBundle rb = config.getResourceBundle(req.getLocale());
+        if(rb != null) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults(TestResult.FAILED);
+        }
+        return res;
+    }
+    protected TestResult checkGetNames(PortletConfig config, PortletRequest req) {
+        TestResult res = new TestResult();
+        res.setName("Get Property Keys Test");
+        res.setDesc("Retrieve the property names and ensure that the required keys are present.");
+
+        ArrayList keys = new ArrayList();
+        keys.add("javax.portlet.title");
+        keys.add("javax.portlet.short-title");
+        keys.add("javax.portlet.keywords");
+
+        ResourceBundle rb = config.getResourceBundle(req.getLocale());
+        Enumeration enumerator= rb.getKeys();
+        while(enumerator.hasMoreElements()) {
+            String key = enumerator.nextElement().toString();
+            keys.remove(key);
+        }
+
+        if(keys.size() < 1) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            StringBuffer sb = new StringBuffer();
+            Iterator it = keys.iterator();
+            while(it.hasNext()) {
+                sb.append(it.next()).append(", ");
+            }
+
+            res.setResults("Keys: "+sb.toString()+" are not defined.");
+        }
+
+        return res;
+    }
+
+    protected TestResult checkGetGermanBundle(PortletConfig config,
+                                             PortletRequest req) {
+        return doGenericLocaleRequiredFields(config, req, Locale.GERMAN);
+    }
+
+    protected TestResult checkGetEnglishBundle(PortletConfig config,
+                                              PortletRequest req) {
+        return doGenericLocaleRequiredFields(config, req, Locale.ENGLISH);
+    }
+
+    /*
+    protected TestResult checkGetDfltBundle(PortletConfig config,
+                                            PortletRequest req) {
+        return doGenericLocaleRequiredFields(config, req, new Locale("dflt"));
+    }
+    */
+
+    private TestResult doGenericLocaleRequiredFields(PortletConfig config,
+                                          PortletRequest req,
+                                          Locale locale) {
+
+        TestResult res = new TestResult();
+        res.setName("Get Portlet Info for "+locale.getLanguage());
+        res.setDesc("Retrieve the title and ensure it's set properly");
+
+        String prefix = "_"+locale.getLanguage();
+
+        if(!isBundleDeclared()) {
+            prefix = "";
+        }
+        Map params = getInitParameters();
+        ResourceBundle rb = config.getResourceBundle(locale);
+
+        String eTitle = (String)params.get("title"+prefix);
+        String eSTitle = (String)params.get("shorttitle"+prefix);
+        String eKeywds = (String)params.get("keywords"+prefix);
+
+        String title = rb.getString("javax.portlet.title");
+        String sTitle = rb.getString("javax.portlet.short-title");
+        String keywds = rb.getString("javax.portlet.keywords");
+
+        StringBuffer sb = new StringBuffer();
+        if(title==null || !title.trim().equals(eTitle.trim())) {
+            sb.append("Title :'").append(title).append("' != '").append(eTitle).append("';");
+        }
+        if(sTitle==null || !sTitle.trim().equals(eSTitle.trim())) {
+            sb.append("Short Title :'").append(sTitle).append("' != '").append(eSTitle).append("';");
+        }
+        if(keywds==null || !keywds.trim().equals(eKeywds.trim())) {
+            sb.append("Keywords :'").append(keywds).append("' != '").append(eKeywds).append("' ");
+        }
+
+        if(sb.length() < 1) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            sb.insert(0, "The following information is not correct: ");
+            res.setResults(sb.toString());
+        }
+        return res;
+    }
+
+    private boolean isBundleDeclared() {
+        String param = (String)getInitParameters().get("resource-bundle");
+        if(Boolean.TRUE.toString().equals(param)) {
+            return true;
+        }
+        return false;
+    }
+
+
+
+
+
+}

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SecurityMappingTest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SecurityMappingTest.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SecurityMappingTest.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SecurityMappingTest.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.test;
+
+import java.util.Map;
+import java.util.Properties;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletRequest;
+
+import org.apache.pluto.testsuite.ExpectedResults;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public class SecurityMappingTest extends AbstractReflectivePortletTest {
+
+    public String getTestSuiteName() {
+        return "Security Mapping Tests";
+    }
+
+    public Map doPrerequisiteAction(PortletContext context, ActionRequest req,
+                                    ActionResponse res) {
+        return new java.util.HashMap();
+    }
+
+    protected TestResult checkIsUserInMappedRole(PortletRequest req) {
+        TestResult res = isUserLoggedIn(req);
+        res.setName("User In Mapped Role Test");
+        res.setDesc("Test if user is in mapped role");
+        if(TestResult.WARNING.equals(res.getReturnCode())) {
+            return res;
+        }
+
+        Properties props = ExpectedResults.getExpectedProperties();
+        String role = props.getProperty("expected.security.role.mapped");
+
+        if(req.isUserInRole(role)) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.WARNING);
+            res.setReturnCode("User is not in the expected '"+role+"' role.  This may be due to misconfiuration.");
+        }
+
+        return res;
+    }
+
+    protected TestResult checkIsUserInUnmappedRole(PortletRequest req) {
+        TestResult res = isUserLoggedIn(req);
+        res.setName("User In Unmapped Role Test");
+        res.setDesc("Test if user is in unmapped role");
+        if(TestResult.WARNING.equals(res.getReturnCode())) {
+            return res;
+        }
+
+        Properties props = ExpectedResults.getExpectedProperties();
+        String role = props.getProperty("expected.security.role");
+
+        if(req.isUserInRole(role)) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.WARNING);
+            res.setReturnCode("User is not in the expected '"+role+"' role.  This may be due to misconfiuration.");
+        }
+
+        return res;
+    }
+
+    protected TestResult checkIsUserIndUndeclaredRole(PortletRequest req) {
+        TestResult res = isUserLoggedIn(req);
+        res.setName("User In Undeclared Role Test");
+        res.setDesc("Test if user is in undeclared role");
+        if(TestResult.WARNING.equals(res.getReturnCode())) {
+            return res;
+        }
+
+        if(!req.isUserInRole("fakeTestRoleFooBar")) {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        else {
+            res.setReturnCode(TestResult.FAILED);
+            res.setReturnCode("User is in the fake role named 'fakeTestRoleFooBar'");
+        }
+
+        return res;
+    }
+
+
+    private TestResult isUserLoggedIn(PortletRequest req) {
+        if (req.getRemoteUser()==null) {
+            TestResult res = new TestResult();
+            res.setReturnCode(TestResult.WARNING);
+            res.setResults("User is not logged in.");
+            return res;
+        }
+        return new TestResult();
+    }
+}

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleActionParameterTest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleActionParameterTest.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleActionParameterTest.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleActionParameterTest.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.test;
+
+import java.util.Enumeration;
+import java.util.Map;
+
+import javax.portlet.PortletRequest;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public class SimpleActionParameterTest
+    extends ActionAbstractReflectivePortletTest {
+
+    public static final String KEY = "org.apache.pluto.testsuite.PARAM_TEST_KEY";
+    public static final String VALUE = "org.apache.pluto.testsuite.PARAM_TEST_VALUE";
+
+    public String getTestSuiteName() {
+        return "Simple Action Parameter Test";
+    }
+
+    protected TestResult checkSentActionParameter(PortletRequest req) {
+        TestResult res = new TestResult();
+        res.setName("Sent Action Parameter Test");
+        res.setDesc("Ensure that parameters sent through the action query stream have made it to the action reqest.");
+
+        String val = req.getParameter(KEY);
+        if(val == null || !VALUE.equals(val)) {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Expected : "+VALUE+" retrieved "+val);
+        }
+        else {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        return res;
+    }
+
+    protected TestResult checkSentActionParamerMap(PortletRequest req) {
+        TestResult res = new TestResult();
+        res.setName("Sent Action Parameter Map");
+        res.setDesc("Ensure that parameters sent through the action query stream have made it to the action parameter map");
+
+        Map map = req.getParameterMap();
+        String[] val = (String[])map.get(KEY);
+        if(val!=null) {
+            for(int i=0;i<val.length;i++) {
+                if(val[i].equals(VALUE)) {
+                    res.setReturnCode(TestResult.PASSED);
+                    return res;
+                }
+            }
+        }
+
+        res.setReturnCode(TestResult.FAILED);
+        res.setResults("Unable to retrieve key "+KEY+" with value of "+VALUE);
+        return res;
+    }
+
+    protected TestResult checkParameterNames(PortletRequest req) {
+        TestResult res = new TestResult();
+        res.setName("Test Parameter Names Enumeration.");
+        res.setDesc("Enumerate through all expected names.");
+
+        boolean hasExternal = false;
+        Enumeration enumerator= req.getParameterNames();
+        while(enumerator.hasMoreElements()) {
+            String val = enumerator.nextElement().toString();
+            if(KEY.equals(val)) {
+                hasExternal = true;
+            }
+        }
+        if(!hasExternal) {
+            res.setReturnCode(TestResult.FAILED);
+            StringBuffer sb = new StringBuffer();
+            if(!hasExternal) {
+                sb.append("External Parameter Not Found. ");
+            }
+            res.setResults(sb.toString());
+        }
+        else {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        return res;
+    }
+}

Added: portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleAttributeTest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleAttributeTest.java?rev=227271&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleAttributeTest.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleAttributeTest.java Wed Aug  3 14:43:40 2005
@@ -0,0 +1,305 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.test;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletSession;
+
+/**
+ * Tests basic attribute retrieval and storage functions within
+ * the portlet request, session, and context objects.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public class SimpleAttributeTest extends AbstractReflectivePortletTest {
+    private static final String KEY = "org.apache.pluto.testsuite.BOGUS_KEY";
+    private static final String VAL = "! TEST VAL !";
+
+    public String getTestSuiteName() {
+        return "Simple Attribute Test";
+    }
+
+    public Map doPrerequisiteAction(PortletContext context, ActionRequest req,
+                                    ActionResponse res) {
+        return new HashMap();
+
+    }
+//
+// Begin Request Tests
+//
+    protected TestResult checkGetNullAttribute(PortletRequest req) {
+        TestResult res = new TestResult();
+        res.setName("Retrieve Missing Request Attribute Test");
+        res.setDesc("Retrieves an attribute bound to an invalid key set are retrieved as null");
+
+        Object val = req.getAttribute(KEY);
+        if(val != null) {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Retrieved value: '"+val+"' for attribute '"+KEY+"'");
+        }
+        else {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        return res;
+    }
+
+
+    protected TestResult checkSetAttribute(PortletRequest req) {
+        TestResult res = new TestResult();
+        res.setName("Set Request Attribute Test");
+        res.setDesc("Sets and retrieves portlet request attribute.");
+
+        req.setAttribute(KEY, VAL);
+        Object val = req.getAttribute(KEY);
+        if(!VAL.equals(val)) {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Retrieved value: '"+val+"' - Expected '"+VAL+"'");
+        }
+        else {
+            res.setReturnCode(TestResult.PASSED);
+        }
+
+        req.removeAttribute(KEY);
+        return res;
+    }
+
+    protected TestResult checkRemoveAttribute(PortletRequest req) {
+        TestResult res = new TestResult();
+        res.setName("Remove Request Attribute Test");
+        res.setDesc("Sets, removes and retrieves portlet request attribute.");
+
+        req.setAttribute(KEY, VAL);
+        req.removeAttribute(KEY);
+        Object val = req.getAttribute(KEY);
+        if(val!=null) {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Retrieved value: '"+val+"' - Expected '"+VAL+"'");
+        }
+        else {
+            res.setReturnCode(TestResult.PASSED);
+        }
+
+        return res;
+    }
+
+    protected TestResult checkEnumerateAttributes(PortletRequest req) {
+        TestResult res = new TestResult();
+        res.setName("Enumerate Request Attribute Names Test");
+        res.setDesc("Sets request attributes and enumerates over them.");
+
+        int count = 5;
+        for(int i=0;i<count;i++) {
+            req.setAttribute(KEY+"."+i,VAL);
+        }
+
+        int found = 0;
+        Enumeration enumerator= req.getAttributeNames();
+        while(enumerator.hasMoreElements()) {
+            if(enumerator.nextElement().toString().startsWith(KEY)) {
+                found++;
+            }
+        }
+
+        if(count != found) {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Expected "+count+" attributes.  Found "+found);
+        }
+        else {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        return res;
+    }
+
+//
+// Begin Session Tests
+//
+
+    protected TestResult checkGetNullAttribute(PortletSession session) {
+        TestResult res = new TestResult();
+        res.setName("Retrieve Missing Session Attribute Test");
+        res.setDesc("Retrieves an attribute bound to an invalid key set are retrieved as null");
+
+        Object val = session.getAttribute(KEY);
+        if(val != null) {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Retrieved value: '"+val+"' for attribute '"+KEY+"'");
+        }
+        else {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        return res;
+    }
+
+    protected TestResult checkSetAttribute(PortletSession session) {
+        TestResult res = new TestResult();
+        res.setName("Set Attribute Test");
+        res.setDesc("Sets and retrieves portlet sessionuest attribute.");
+
+        session.setAttribute(KEY, VAL);
+        Object val = session.getAttribute(KEY);
+        if(!VAL.equals(val)) {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Retrieved value: '"+val+"' - Expected '"+VAL+"'");
+        }
+        else {
+            res.setReturnCode(TestResult.PASSED);
+        }
+
+        session.removeAttribute(KEY);
+        return res;
+    }
+
+    protected TestResult checkRemoveAttribute(PortletSession session) {
+        TestResult res = new TestResult();
+        res.setName("Remove Session Attribute Test");
+        res.setDesc("Sets, removes and retrieves portlet request attribute.");
+
+        session.setAttribute(KEY, VAL);
+        session.removeAttribute(KEY);
+        Object val = session.getAttribute(KEY);
+        if(val!=null) {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Retrieved value: '"+val+"' - Expected '"+VAL+"'");
+        }
+        else {
+            res.setReturnCode(TestResult.PASSED);
+        }
+
+        return res;
+    }
+
+    protected TestResult checkEnumerateAttributes(PortletSession req) {
+        TestResult res = new TestResult();
+        res.setName("Enumerate Session Attribute Names Test");
+        res.setDesc("Sets request attributes and enumerates over them.");
+
+        int count = 5;
+        for(int i=0;i<count;i++) {
+            req.setAttribute(KEY+"."+i,VAL);
+        }
+
+        int found = 0;
+        Enumeration enumerator= req.getAttributeNames();
+        while(enumerator.hasMoreElements()) {
+            if(enumerator.nextElement().toString().startsWith(KEY)) {
+                found++;
+            }
+        }
+
+        if(count != found) {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Expected "+count+" attributes.  Found "+found);
+        }
+        else {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        return res;
+    }
+
+//
+// Context Tests
+//
+
+    protected TestResult checkGetNullAttribute(PortletContext context) {
+        TestResult res = new TestResult();
+        res.setName("Retrieve Missing Context Attribute Test");
+        res.setDesc("Retrieves an attribute bound to an invalid key set are retrieved as null");
+
+        Object val = context.getAttribute(KEY);
+        if(val != null) {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Retrieved value: '"+val+"' for attribute '"+KEY+"'");
+        }
+        else {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        return res;
+    }
+
+    protected TestResult checkSetAttribute(PortletContext context) {
+        TestResult res = new TestResult();
+        res.setName("Set Attribute Test");
+        res.setDesc("Sets and retrieves portlet contextuest attribute.");
+
+        context.setAttribute(KEY, VAL);
+        Object val = context.getAttribute(KEY);
+        if(!VAL.equals(val)) {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Retrieved value: '"+val+"' - Expected '"+VAL+"'");
+        }
+        else {
+            res.setReturnCode(TestResult.PASSED);
+        }
+
+        context.removeAttribute(KEY);
+        return res;
+    }
+
+    protected TestResult checkRemoveAttribute(PortletContext context) {
+        TestResult res = new TestResult();
+        res.setName("Remove Context Attribute Test");
+        res.setDesc("Sets, removes and retrieves portlet request attribute.");
+
+        context.setAttribute(KEY, VAL);
+        context.removeAttribute(KEY);
+        Object val = context.getAttribute(KEY);
+        if(val!=null) {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Retrieved value: '"+val+"' - Expected '"+VAL+"'");
+        }
+        else {
+            res.setReturnCode(TestResult.PASSED);
+        }
+
+        return res;
+    }
+
+    protected TestResult checkEnumerateAttributes(PortletContext req) {
+        TestResult res = new TestResult();
+        res.setName("Enumerate Context Attribute Names Test");
+        res.setDesc("Sets request attributes and enumerates over them.");
+
+        int count = 5;
+        for(int i=0;i<count;i++) {
+            req.setAttribute(KEY+"."+i,VAL);
+        }
+
+        int found = 0;
+        Enumeration enumerator= req.getAttributeNames();
+        while(enumerator.hasMoreElements()) {
+            if(enumerator.nextElement().toString().startsWith(KEY)) {
+                found++;
+            }
+        }
+
+        if(count != found) {
+            res.setReturnCode(TestResult.FAILED);
+            res.setResults("Expected "+count+" attributes.  Found "+found);
+        }
+        else {
+            res.setReturnCode(TestResult.PASSED);
+        }
+        return res;
+    }
+
+}