portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r607448 [29/36] - in /portals/pluto/branches/pluto-1.1.x: ./ assembly/src/main/assembly/ assembly/src/main/resources/ maven-pluto-plugin/ maven-pluto-plugin/src/main/java/org/apache/pluto/maven/ pluto-ant-tasks/ pluto-ant-tasks/src/assemble...
Date Sat, 29 Dec 2007 17:20:42 GMT
Modified: portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java?rev=607448&r1=607447&r2=607448&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java (original)
+++ portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java Sat Dec 29 09:20:23 2007
@@ -1,155 +1,155 @@
-/*
+/*
  * 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;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Configuration for <code>PortletTest</code>.
- *
- * @see TestConfigFactory
- * @see PortletTest
- *
- * @version 1.0
- * @since Sep 15, 2004
- */
-public class TestConfig implements Serializable {
-
-	// Private Member Variables ------------------------------------------------
-
-	/** PortletTest class name. */
-    private String testClassName;
-
-    /** Test name. */
-    private String name = null;
-
-    private String displayURI;
-
-    private final Map initParameters = new HashMap();
-
-    /**
-     * 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 final List actionParameters = new ArrayList();
-
-    /**
-     * The render parameters list holding TestConfig.Parameter objects.
-     * We are not using Map to hold render parameters because parameters with
-     * the same name are allowed.
-     *
-     * FIXME: when is this field used?
-     */
-    private final List renderParameters = new ArrayList();
-
-
-    // Constructor -------------------------------------------------------------
-
-    /**
-     * Default constructor required by Digester.
-     */
-    public TestConfig() {
-    	// Do nothing.
-    }
-
-    // Public Methods ----------------------------------------------------------
-
-    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) {
-        initParameters.put(parameter, value);
-    }
-
-    public Map getInitParameters() {
-        return Collections.unmodifiableMap(initParameters);
-    }
-
-    public void addActionParameter(String name, String value) {
-    	actionParameters.add(new Parameter(name, value));
-    }
-
-    public List 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();
-    	buffer.append(getClass().getName());
-    	buffer.append("[").append(getName()).append("]");
-    	return buffer.toString();
-    }
-
-    public static class Parameter {
-    	private String name = null;
-    	private String value = null;
-    	public Parameter(String name, String value) {
-    		this.name = name;
-    		this.value = value;
-    	}
-
-    	public String getName() {
-    		return name;
-    	}
-    	public String getValue() {
-    		return value;
-    	}
-    }
-
-}
-
+ * 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.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Configuration for <code>PortletTest</code>.
+ *
+ * @see TestConfigFactory
+ * @see PortletTest
+ *
+ * @version 1.0
+ * @since Sep 15, 2004
+ */
+public class TestConfig implements Serializable {
+
+	// Private Member Variables ------------------------------------------------
+
+	/** PortletTest class name. */
+    private String testClassName;
+
+    /** Test name. */
+    private String name = null;
+
+    private String displayURI;
+
+    private final Map initParameters = new HashMap();
+
+    /**
+     * 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 final List actionParameters = new ArrayList();
+
+    /**
+     * The render parameters list holding TestConfig.Parameter objects.
+     * We are not using Map to hold render parameters because parameters with
+     * the same name are allowed.
+     *
+     * FIXME: when is this field used?
+     */
+    private final List renderParameters = new ArrayList();
+
+
+    // Constructor -------------------------------------------------------------
+
+    /**
+     * Default constructor required by Digester.
+     */
+    public TestConfig() {
+    	// Do nothing.
+    }
+
+    // Public Methods ----------------------------------------------------------
+
+    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) {
+        initParameters.put(parameter, value);
+    }
+
+    public Map getInitParameters() {
+        return Collections.unmodifiableMap(initParameters);
+    }
+
+    public void addActionParameter(String name, String value) {
+    	actionParameters.add(new Parameter(name, value));
+    }
+
+    public List 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();
+    	buffer.append(getClass().getName());
+    	buffer.append("[").append(getName()).append("]");
+    	return buffer.toString();
+    }
+
+    public static class Parameter {
+    	private String name = null;
+    	private String value = null;
+    	public Parameter(String name, String value) {
+    		this.name = name;
+    		this.value = value;
+    	}
+
+    	public String getName() {
+    		return name;
+    	}
+    	public String getValue() {
+    		return value;
+    	}
+    }
+
+}
+

Propchange: portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java?rev=607448&r1=607447&r2=607448&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java (original)
+++ portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java Sat Dec 29 09:20:23 2007
@@ -1,94 +1,94 @@
-/*
+/*
  * 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;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.digester.Digester;
-import org.xml.sax.SAXException;
-
-/**
- * Test configuration factory that reads and parses testsuite config file using
- * Digester and constructs <code>TestConfig</code> objects.
- *
- * @see TestConfig
- *
- */
-public class TestConfigFactory {
-
-	/** Digester instance used to parse testsuite config file. */
-    private Digester digester = new Digester();
-
-
-    // Constructor -------------------------------------------------------------
-
-    /**
-     * Creates a factory instance.
-     */
-    public TestConfigFactory() {
-        digester = new Digester();
-        digester.addObjectCreate("testportlet-config", 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 Methods ----------------------------------------------------------
-
-    /**
-     * Reads and parses testsuite config file, creates a list of
-     * <code>TestConfig</code> objects.
-     *
-     * @param in  the input stream of the testsuite config file.
-     * @return a list of <code>TestConfig</code> objects.
-     * @throws SAXException  if a parsing error occurs.
-     * @throws IOException  if an IO error occurs.
-     * @see TestConfig
-     */
-    public List createTestConfigs(InputStream in)
-    throws SAXException, IOException {
-        return (List) digester.parse(in);
-    }
-
-}
+ * 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.ArrayList;
+import java.util.List;
+
+import org.apache.commons.digester.Digester;
+import org.xml.sax.SAXException;
+
+/**
+ * Test configuration factory that reads and parses testsuite config file using
+ * Digester and constructs <code>TestConfig</code> objects.
+ *
+ * @see TestConfig
+ *
+ */
+public class TestConfigFactory {
+
+	/** Digester instance used to parse testsuite config file. */
+    private Digester digester = new Digester();
+
+
+    // Constructor -------------------------------------------------------------
+
+    /**
+     * Creates a factory instance.
+     */
+    public TestConfigFactory() {
+        digester = new Digester();
+        digester.addObjectCreate("testportlet-config", 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 Methods ----------------------------------------------------------
+
+    /**
+     * Reads and parses testsuite config file, creates a list of
+     * <code>TestConfig</code> objects.
+     *
+     * @param in  the input stream of the testsuite config file.
+     * @return a list of <code>TestConfig</code> objects.
+     * @throws SAXException  if a parsing error occurs.
+     * @throws IOException  if an IO error occurs.
+     * @see TestConfig
+     */
+    public List createTestConfigs(InputStream in)
+    throws SAXException, IOException {
+        return (List) digester.parse(in);
+    }
+
+}

Propchange: portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java?rev=607448&r1=607447&r2=607448&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java (original)
+++ portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java Sat Dec 29 09:20:23 2007
@@ -1,287 +1,287 @@
-/*
+/*
  * 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;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.GenericPortlet;
-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 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.
- *
- * @see TestConfig
- * @see PortletTest
- * @version 1.0
- */
-public class TestPortlet extends GenericPortlet {
-
-	/** Internal logger. */
-	private static final Log LOG = LogFactory.getLog(TestPortlet.class);
-
-
-	// Private Member Variables ------------------------------------------------
-
-	/** List of test configurations. */
-    private List testConfigs;
-
-    /**
-     * Map of test instances: key is an integer ID (as a string), and value is
-     * the <code>PortletTest</code> instances.
-     */
-    private Map tests;
-
-
-    // GenericPortlet Impl -----------------------------------------------------
-
-    /**
-     * Initialize the test portlet. This method reads the testsuite's config
-     * files, constructs and initializes all <code>PortletTest</code> instances.
-     * @throws PortletException if fail to read the configuration file.
-     */
-    public void init() throws PortletException {
-
-    	// Get configuration file name.
-        String configFile = getInitParameter("config");
-        if (configFile == null) {
-            configFile = "/WEB-INF/testsuite-config.xml";
-        }
-
-        // 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);
-        }
-
-        // Load PortletTest instances: constructing and initializing.
-        TestConfigFactory factory = new TestConfigFactory();
-        try {
-        	testConfigs = factory.createTestConfigs(is);
-            tests = new HashMap();
-            int i = 0;
-            for (Iterator it = testConfigs.iterator(); it.hasNext(); ) {
-                TestConfig testConfig = (TestConfig) it.next();
-                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();
-                } else {
-                	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);
-            throw new PortletException(message, th);
-        }
-    }
-
-
-    public void processAction(ActionRequest request, ActionResponse response)
-    throws PortletException, IOException {
-
-        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) {
-            TestResults results = test.doTest(getPortletConfig(),
-                                              getPortletContext(),
-                                              request,
-                                              response);
-            PortletSession session = request.getPortletSession();
-            session.setAttribute(test.getClass().getName(), results);
-        }
-
-        Map renderParameters = null;
-        if (test != null) {
-            renderParameters = test.getRenderParameters(request);
-        }
-        if (renderParameters == null) {
-            renderParameters = new HashMap();
-        }
-        renderParameters.put("testId", new String[] { testId });
-        response.setRenderParameters(renderParameters);
-    }
-
-    /**
-     * Serves up the <code>view</code> mode.
-     * TODO: more javadoc.
-     *
-     * @param request  the protlet request.
-     * @param response  the portlet response.
-     */
-    public void doView(RenderRequest request, RenderResponse response)
-    throws PortletException, IOException {
-
-    	// 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);
-        }
-
-        // For non-ActionTest, run test and save results in request.
-        if (test != null && !(test instanceof ActionTest)) {
-            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);
-        }
-
-
-        if (testId == null) {
-        	// FIXME: update attribute name from tests to testConfigs.
-            request.setAttribute("tests", testConfigs);
-        } else {
-            TestConfig nextTestConfig = null;
-            TestConfig prevTestConfig = null;
-            int index = testConfigs.indexOf(test.getConfig());
-            if (index == 0) {
-            	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);
-                nextTestConfig = (TestConfig) testConfigs.get(0);
-            } else {
-            	prevTestConfig = (TestConfig) testConfigs.get(index - 1);
-                nextTestConfig = (TestConfig) testConfigs.get(index + 1);
-            }
-            request.setAttribute("prevTest", prevTestConfig);
-            request.setAttribute("nextTest", nextTestConfig);
-        }
-
-        // Set content type for render response, and dispatch to JSP.
-        response.setContentType("text/html");
-        String displayUri = null;
-        if (testConfig != null) {
-        	displayUri = testConfig.getDisplayURI();
-        } else {
-        	displayUri = "/jsp/introduction.jsp";
-        }
-        PortletRequestDispatcher dispatcher = getPortletContext()
-        		.getRequestDispatcher(displayUri);
-        dispatcher.include(request, response);
-    }
-
-    /**
-     * Serves up the <code>edit</code> mode. This method dispatches the request
-     * and response to the edit JSP page (<code>/jsp/edit.jsp</code>).
-     * @param request  the portlet request.
-     * @param response  the portlet response.
-     */
-    protected void doEdit(RenderRequest request, RenderResponse response)
-    throws PortletException, IOException {
-        PortletRequestDispatcher dispatcher = getPortletContext()
-        		.getRequestDispatcher("/jsp/edit.jsp");
-        dispatcher.include(request, response);
-    }
-
-    /**
-     * Serves up the <code>help</code> mode. This method dispatches the request
-     * and response to the help JSP page (<code>/jsp/help.jsp</code>).
-     * @param request  the portlet request.
-     * @param response  the portlet response.
-     */
-    protected void doHelp(RenderRequest request, RenderResponse response)
-    throws PortletException, IOException {
-    	PortletRequestDispatcher dispatcher = getPortletContext()
-    			.getRequestDispatcher("/jsp/help.jsp");
-    	dispatcher.include(request, response);
-    }
-
-
-    // Private Methods ---------------------------------------------------------
-
-    /**
-     * Returns the current test ID.
-     * @param request  the portlet request.
-     * @return the current test ID.
-     */
-    private String getTestId(PortletRequest request) {
-
-    	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) {
-            return null;
-        }
-
-        // Retrieve the test which is next to the previous test.
-        else if (testId == null && prevTestId != null) {
-            int previousTestIdInt = Integer.parseInt(prevTestId);
-            if (previousTestIdInt >= testConfigs.size() - 1) {
-                testId = "0";
-            } else {
-                testId = String.valueOf(previousTestIdInt + 1);
-            }
-        }
-
-        // Retrieve the test which is previous to the next test.
-        else if (testId == null && nextTestId != null) {
-            int nextTestIdInt = Integer.parseInt(nextTestId);
-            if (nextTestIdInt <= 0) {
-                testId = String.valueOf(testConfigs.size()-1);
-            } else {
-                testId = String.valueOf(nextTestIdInt - 1);
-            }
-        }
-
-        // Return the current test ID.
-        return testId;
-    }
-}
+ * 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 javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+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 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.
+ *
+ * @see TestConfig
+ * @see PortletTest
+ * @version 1.0
+ */
+public class TestPortlet extends GenericPortlet {
+
+	/** Internal logger. */
+	private static final Log LOG = LogFactory.getLog(TestPortlet.class);
+
+
+	// Private Member Variables ------------------------------------------------
+
+	/** List of test configurations. */
+    private List testConfigs;
+
+    /**
+     * Map of test instances: key is an integer ID (as a string), and value is
+     * the <code>PortletTest</code> instances.
+     */
+    private Map tests;
+
+
+    // GenericPortlet Impl -----------------------------------------------------
+
+    /**
+     * Initialize the test portlet. This method reads the testsuite's config
+     * files, constructs and initializes all <code>PortletTest</code> instances.
+     * @throws PortletException if fail to read the configuration file.
+     */
+    public void init() throws PortletException {
+
+    	// Get configuration file name.
+        String configFile = getInitParameter("config");
+        if (configFile == null) {
+            configFile = "/WEB-INF/testsuite-config.xml";
+        }
+
+        // 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);
+        }
+
+        // Load PortletTest instances: constructing and initializing.
+        TestConfigFactory factory = new TestConfigFactory();
+        try {
+        	testConfigs = factory.createTestConfigs(is);
+            tests = new HashMap();
+            int i = 0;
+            for (Iterator it = testConfigs.iterator(); it.hasNext(); ) {
+                TestConfig testConfig = (TestConfig) it.next();
+                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();
+                } else {
+                	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);
+            throw new PortletException(message, th);
+        }
+    }
+
+
+    public void processAction(ActionRequest request, ActionResponse response)
+    throws PortletException, IOException {
+
+        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) {
+            TestResults results = test.doTest(getPortletConfig(),
+                                              getPortletContext(),
+                                              request,
+                                              response);
+            PortletSession session = request.getPortletSession();
+            session.setAttribute(test.getClass().getName(), results);
+        }
+
+        Map renderParameters = null;
+        if (test != null) {
+            renderParameters = test.getRenderParameters(request);
+        }
+        if (renderParameters == null) {
+            renderParameters = new HashMap();
+        }
+        renderParameters.put("testId", new String[] { testId });
+        response.setRenderParameters(renderParameters);
+    }
+
+    /**
+     * Serves up the <code>view</code> mode.
+     * TODO: more javadoc.
+     *
+     * @param request  the protlet request.
+     * @param response  the portlet response.
+     */
+    public void doView(RenderRequest request, RenderResponse response)
+    throws PortletException, IOException {
+
+    	// 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);
+        }
+
+        // For non-ActionTest, run test and save results in request.
+        if (test != null && !(test instanceof ActionTest)) {
+            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);
+        }
+
+
+        if (testId == null) {
+        	// FIXME: update attribute name from tests to testConfigs.
+            request.setAttribute("tests", testConfigs);
+        } else {
+            TestConfig nextTestConfig = null;
+            TestConfig prevTestConfig = null;
+            int index = testConfigs.indexOf(test.getConfig());
+            if (index == 0) {
+            	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);
+                nextTestConfig = (TestConfig) testConfigs.get(0);
+            } else {
+            	prevTestConfig = (TestConfig) testConfigs.get(index - 1);
+                nextTestConfig = (TestConfig) testConfigs.get(index + 1);
+            }
+            request.setAttribute("prevTest", prevTestConfig);
+            request.setAttribute("nextTest", nextTestConfig);
+        }
+
+        // Set content type for render response, and dispatch to JSP.
+        response.setContentType("text/html");
+        String displayUri = null;
+        if (testConfig != null) {
+        	displayUri = testConfig.getDisplayURI();
+        } else {
+        	displayUri = "/jsp/introduction.jsp";
+        }
+        PortletRequestDispatcher dispatcher = getPortletContext()
+        		.getRequestDispatcher(displayUri);
+        dispatcher.include(request, response);
+    }
+
+    /**
+     * Serves up the <code>edit</code> mode. This method dispatches the request
+     * and response to the edit JSP page (<code>/jsp/edit.jsp</code>).
+     * @param request  the portlet request.
+     * @param response  the portlet response.
+     */
+    protected void doEdit(RenderRequest request, RenderResponse response)
+    throws PortletException, IOException {
+        PortletRequestDispatcher dispatcher = getPortletContext()
+        		.getRequestDispatcher("/jsp/edit.jsp");
+        dispatcher.include(request, response);
+    }
+
+    /**
+     * Serves up the <code>help</code> mode. This method dispatches the request
+     * and response to the help JSP page (<code>/jsp/help.jsp</code>).
+     * @param request  the portlet request.
+     * @param response  the portlet response.
+     */
+    protected void doHelp(RenderRequest request, RenderResponse response)
+    throws PortletException, IOException {
+    	PortletRequestDispatcher dispatcher = getPortletContext()
+    			.getRequestDispatcher("/jsp/help.jsp");
+    	dispatcher.include(request, response);
+    }
+
+
+    // Private Methods ---------------------------------------------------------
+
+    /**
+     * Returns the current test ID.
+     * @param request  the portlet request.
+     * @return the current test ID.
+     */
+    private String getTestId(PortletRequest request) {
+
+    	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) {
+            return null;
+        }
+
+        // Retrieve the test which is next to the previous test.
+        else if (testId == null && prevTestId != null) {
+            int previousTestIdInt = Integer.parseInt(prevTestId);
+            if (previousTestIdInt >= testConfigs.size() - 1) {
+                testId = "0";
+            } else {
+                testId = String.valueOf(previousTestIdInt + 1);
+            }
+        }
+
+        // Retrieve the test which is previous to the next test.
+        else if (testId == null && nextTestId != null) {
+            int nextTestIdInt = Integer.parseInt(nextTestId);
+            if (nextTestIdInt <= 0) {
+                testId = String.valueOf(testConfigs.size()-1);
+            } else {
+                testId = String.valueOf(nextTestIdInt - 1);
+            }
+        }
+
+        // Return the current test ID.
+        return testId;
+    }
+}

Propchange: portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResult.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResult.java?rev=607448&r1=607447&r2=607448&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResult.java (original)
+++ portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResult.java Sat Dec 29 09:20:23 2007
@@ -1,128 +1,128 @@
-/*
+/*
  * 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;
-
-import java.io.Serializable;
-
-/**
- * The test result represents the result of one test method.
- *
- */
-public class TestResult implements Serializable {
-
-	/** The undefined return code. */
-	public static final int UNDEFINED = -1;
-
-	/** The warning return code. */
-	public static final int WARNING = 0;
-
-	/** The failed return code. */
-	public static final int FAILED = 1;
-
-	/** The passed return code. */
-	public static final int PASSED = 2;
-
-
-    // Private Member Variables ------------------------------------------------
-
-    /** The name of the test. */
-    private String name = null;
-
-    /** The description of the test. */
-    private String description = "[unknown]";
-
-    /** The PLT number in the spec that is tested. */
-    private String specPLT = "[unknown]";
-
-    /** The return code of the test result: PASSED, WARNING, FAILED. */
-    private int returnCode = UNDEFINED;
-
-    /** The message of the test result. */
-    private String resultMessage ="[unknown]";
-
-
-    // Public Methods ----------------------------------------------------------
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getDescription() {
-    	return description;
-    }
-
-    public void setDescription(String description) {
-    	this.description = description;
-    }
-
-    public String getSpecPLT() {
-    	return specPLT;
-    }
-
-    public void setSpecPLT(String specPLT) {
-    	this.specPLT = specPLT;
-    }
-
-    public int getReturnCode() {
-        return returnCode;
-    }
-
-    public String getReturnCodeAsString() {
-    	if (returnCode == WARNING) {
-    		return "WARNING";
-    	} else if (returnCode == FAILED) {
-    		return "FAILED";
-    	} else if (returnCode == PASSED) {
-    		return "PASSED";
-    	} else {
-    		return "UNKNOWN RETURN CODE";
-    	}
-    }
-
-    public void setReturnCode(int returnCode) {
-        this.returnCode = returnCode;
-    }
-
-    public String getResultMessage() {
-    	return resultMessage;
-    }
-
-    public void setResultMessage(String resultMessage) {
-    	this.resultMessage = resultMessage;
-    }
-
-
-    // Object Methods ----------------------------------------------------------
-
-    /**
-     * Override of toString() that prints out name and results values.
-     * @see java.lang.Object#toString()
-     */
-    public String toString(){
-    	StringBuffer buffer = new StringBuffer();
-    	buffer.append(getClass().getName());
-    	buffer.append("[name=").append(name);
-    	buffer.append(";returnCode=").append(returnCode);
-    	buffer.append(";resultMessage=").append(resultMessage).append("]");
-    	return buffer.toString();
-    }
-
-}
+ * 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.Serializable;
+
+/**
+ * The test result represents the result of one test method.
+ *
+ */
+public class TestResult implements Serializable {
+
+	/** The undefined return code. */
+	public static final int UNDEFINED = -1;
+
+	/** The warning return code. */
+	public static final int WARNING = 0;
+
+	/** The failed return code. */
+	public static final int FAILED = 1;
+
+	/** The passed return code. */
+	public static final int PASSED = 2;
+
+
+    // Private Member Variables ------------------------------------------------
+
+    /** The name of the test. */
+    private String name = null;
+
+    /** The description of the test. */
+    private String description = "[unknown]";
+
+    /** The PLT number in the spec that is tested. */
+    private String specPLT = "[unknown]";
+
+    /** The return code of the test result: PASSED, WARNING, FAILED. */
+    private int returnCode = UNDEFINED;
+
+    /** The message of the test result. */
+    private String resultMessage ="[unknown]";
+
+
+    // Public Methods ----------------------------------------------------------
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescription() {
+    	return description;
+    }
+
+    public void setDescription(String description) {
+    	this.description = description;
+    }
+
+    public String getSpecPLT() {
+    	return specPLT;
+    }
+
+    public void setSpecPLT(String specPLT) {
+    	this.specPLT = specPLT;
+    }
+
+    public int getReturnCode() {
+        return returnCode;
+    }
+
+    public String getReturnCodeAsString() {
+    	if (returnCode == WARNING) {
+    		return "WARNING";
+    	} else if (returnCode == FAILED) {
+    		return "FAILED";
+    	} else if (returnCode == PASSED) {
+    		return "PASSED";
+    	} else {
+    		return "UNKNOWN RETURN CODE";
+    	}
+    }
+
+    public void setReturnCode(int returnCode) {
+        this.returnCode = returnCode;
+    }
+
+    public String getResultMessage() {
+    	return resultMessage;
+    }
+
+    public void setResultMessage(String resultMessage) {
+    	this.resultMessage = resultMessage;
+    }
+
+
+    // Object Methods ----------------------------------------------------------
+
+    /**
+     * Override of toString() that prints out name and results values.
+     * @see java.lang.Object#toString()
+     */
+    public String toString(){
+    	StringBuffer buffer = new StringBuffer();
+    	buffer.append(getClass().getName());
+    	buffer.append("[name=").append(name);
+    	buffer.append(";returnCode=").append(returnCode);
+    	buffer.append(";resultMessage=").append(resultMessage).append("]");
+    	return buffer.toString();
+    }
+
+}

Propchange: portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResults.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResults.java?rev=607448&r1=607447&r2=607448&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResults.java (original)
+++ portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResults.java Sat Dec 29 09:20:23 2007
@@ -1,85 +1,85 @@
-/*
+/*
  * 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;
-
-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 String name;
-
-    private final ArrayList list = new ArrayList();
-
-    private boolean failed = false;
-    private boolean inQuestion = false;
-
-    public TestResults(String name) {
-        this.name = name;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public void add(TestResult result) {
-        if (result.getReturnCode() == TestResult.FAILED) {
-            failed = true;
-        } else if (result.getReturnCode() == TestResult.WARNING) {
-            inQuestion = true;
-        }
-        list.add(result);
-    }
-
-    public boolean isFailed() {
-        return failed;
-    }
-
-    public boolean isInQuestion() {
-        return inQuestion;
-    }
-
-    public Collection getCollection() {
-        return Collections.unmodifiableCollection(list);
-    }
-
-    /**
-     * Override of toString() that prints out variable
-     * names and values.
-     *
-     * @see java.lang.Object#toString()
-     */
-    public String toString(){
-    	StringBuffer buffer = new StringBuffer();
-    	buffer.append(getClass().getName());
-    	buffer.append("[name=").append(name);
-    	buffer.append(";failed=").append(failed);
-    	buffer.append(";inQuestion=").append(inQuestion);
-    	buffer.append(";results={").append(list).append("}]");
-    	return buffer.toString();
-    }
-}
+ * 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.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 String name;
+
+    private final ArrayList list = new ArrayList();
+
+    private boolean failed = false;
+    private boolean inQuestion = false;
+
+    public TestResults(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void add(TestResult result) {
+        if (result.getReturnCode() == TestResult.FAILED) {
+            failed = true;
+        } else if (result.getReturnCode() == TestResult.WARNING) {
+            inQuestion = true;
+        }
+        list.add(result);
+    }
+
+    public boolean isFailed() {
+        return failed;
+    }
+
+    public boolean isInQuestion() {
+        return inQuestion;
+    }
+
+    public Collection getCollection() {
+        return Collections.unmodifiableCollection(list);
+    }
+
+    /**
+     * Override of toString() that prints out variable
+     * names and values.
+     *
+     * @see java.lang.Object#toString()
+     */
+    public String toString(){
+    	StringBuffer buffer = new StringBuffer();
+    	buffer.append(getClass().getName());
+    	buffer.append("[name=").append(name);
+    	buffer.append(";failed=").append(failed);
+    	buffer.append(";inQuestion=").append(inQuestion);
+    	buffer.append(";results={").append(list).append("}]");
+    	return buffer.toString();
+    }
+}

Propchange: portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResults.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestUtils.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestUtils.java?rev=607448&r1=607447&r2=607448&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestUtils.java (original)
+++ portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestUtils.java Sat Dec 29 09:20:23 2007
@@ -1,138 +1,138 @@
-/*
+/*
  * 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;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Static class that provides utility methods for Pluto testsuite.
- * @since 2006-02-13
- */
-public class TestUtils {
-
-	/** Logger. */
-	private static final Log LOG = LogFactory.getLog(TestUtils.class);
-
-
-	// Private Constructor -----------------------------------------------------
-
-	/**
-	 * Private method that prevents external instantiation.
-	 */
-	private TestUtils() {
-		// Do nothing.
-	}
-
-
-	// Public Static Methods ---------------------------------------------------
-
-	/**
-	 * Sets the test result return code to <code>FAILED</code>, and reports
-	 * assertion details by specifying values got and values expected.
-	 * @param valueName  the name of the values to assert.
-	 * @param valueGot  the values got.
-	 * @param valueExpected  the values expected.
-	 * @param result  the test result.
-	 */
-	public static void failOnAssertion(String valuesName,
-	                                   String[] valuesGot,
-	                                   String[] valuesExpected,
-	                                   TestResult result) {
-		failOnAssertion(valuesName,
-		                arrayToString(valuesGot),
-		                arrayToString(valuesExpected),
-		                result);
-	}
-
-	/**
-	 * Sets the test result return code to <code>FAILED</code>, and reports
-	 * assertion details by specifying value got and value expected.
-	 * @param valueName  the name of the value to assert.
-	 * @param valueGot  the value object got.
-	 * @param valueExpected  the value object expected.
-	 * @param result  the test result.
-	 */
-	public static void failOnAssertion(String valueName,
-	                                   Object valueGot,
-	                                   Object valueExpected,
-	                                   TestResult result) {
-		StringBuffer buffer = new StringBuffer();
-		buffer.append("Assertion failed: ");
-		buffer.append("got ").append(valueName).append(": ").append(valueGot);
-		buffer.append(", expected: ").append(valueExpected);
-    	result.setReturnCode(TestResult.FAILED);
-    	result.setResultMessage(buffer.toString());
-	}
-
-    /**
-     * Sets the test result return code to <code>FAILED</code>, and reports
-     * exception details.
-     * @param message  the error message.
-     * @param cause  the cause exception.
-     * @param result  the test result.
-     */
-    public static void failOnException(String message,
-                                       Throwable cause,
-                                       TestResult result) {
-    	// Construct error message.
-    	StringBuffer buffer = new StringBuffer();
-    	if (message != null) {
-    		buffer.append(message);
-    	} else {
-    		buffer.append("Exception occurred.");
-    	}
-    	buffer.append(" Cause (").append(cause.getClass().getName()).append("): ");
-    	buffer.append(cause.getMessage());
-
-    	// Log error message.
-    	if (LOG.isErrorEnabled()) {
-    		LOG.error(buffer.toString(), cause);
-    	}
-
-    	// Set error message to test result.
-    	result.setReturnCode(TestResult.FAILED);
-    	result.setResultMessage(buffer.toString());
-    }
-
-
-    // Private Static Methods --------------------------------------------------
-
-    /**
-     * Converts a string array to a string.
-     * @param values  the string array to convert.
-     * @return a string representing the values in the string array.
-     */
-    private static String arrayToString(String[] values) {
-		StringBuffer buffer = new StringBuffer();
-		if (values == null) {
-			buffer.append("null");
-		} else {
-			buffer.append("{");
-			for (int i = 0; i < values.length; i++) {
-				buffer.append(values[i]);
-				if (i < values.length - 1) {
-					buffer.append(",");
-				}
-			}
-			buffer.append("}");
-		}
-    	return buffer.toString();
-    }
-
-
-}
+ * 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 org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Static class that provides utility methods for Pluto testsuite.
+ * @since 2006-02-13
+ */
+public class TestUtils {
+
+	/** Logger. */
+	private static final Log LOG = LogFactory.getLog(TestUtils.class);
+
+
+	// Private Constructor -----------------------------------------------------
+
+	/**
+	 * Private method that prevents external instantiation.
+	 */
+	private TestUtils() {
+		// Do nothing.
+	}
+
+
+	// Public Static Methods ---------------------------------------------------
+
+	/**
+	 * Sets the test result return code to <code>FAILED</code>, and reports
+	 * assertion details by specifying values got and values expected.
+	 * @param valueName  the name of the values to assert.
+	 * @param valueGot  the values got.
+	 * @param valueExpected  the values expected.
+	 * @param result  the test result.
+	 */
+	public static void failOnAssertion(String valuesName,
+	                                   String[] valuesGot,
+	                                   String[] valuesExpected,
+	                                   TestResult result) {
+		failOnAssertion(valuesName,
+		                arrayToString(valuesGot),
+		                arrayToString(valuesExpected),
+		                result);
+	}
+
+	/**
+	 * Sets the test result return code to <code>FAILED</code>, and reports
+	 * assertion details by specifying value got and value expected.
+	 * @param valueName  the name of the value to assert.
+	 * @param valueGot  the value object got.
+	 * @param valueExpected  the value object expected.
+	 * @param result  the test result.
+	 */
+	public static void failOnAssertion(String valueName,
+	                                   Object valueGot,
+	                                   Object valueExpected,
+	                                   TestResult result) {
+		StringBuffer buffer = new StringBuffer();
+		buffer.append("Assertion failed: ");
+		buffer.append("got ").append(valueName).append(": ").append(valueGot);
+		buffer.append(", expected: ").append(valueExpected);
+    	result.setReturnCode(TestResult.FAILED);
+    	result.setResultMessage(buffer.toString());
+	}
+
+    /**
+     * Sets the test result return code to <code>FAILED</code>, and reports
+     * exception details.
+     * @param message  the error message.
+     * @param cause  the cause exception.
+     * @param result  the test result.
+     */
+    public static void failOnException(String message,
+                                       Throwable cause,
+                                       TestResult result) {
+    	// Construct error message.
+    	StringBuffer buffer = new StringBuffer();
+    	if (message != null) {
+    		buffer.append(message);
+    	} else {
+    		buffer.append("Exception occurred.");
+    	}
+    	buffer.append(" Cause (").append(cause.getClass().getName()).append("): ");
+    	buffer.append(cause.getMessage());
+
+    	// Log error message.
+    	if (LOG.isErrorEnabled()) {
+    		LOG.error(buffer.toString(), cause);
+    	}
+
+    	// Set error message to test result.
+    	result.setReturnCode(TestResult.FAILED);
+    	result.setResultMessage(buffer.toString());
+    }
+
+
+    // Private Static Methods --------------------------------------------------
+
+    /**
+     * Converts a string array to a string.
+     * @param values  the string array to convert.
+     * @return a string representing the values in the string array.
+     */
+    private static String arrayToString(String[] values) {
+		StringBuffer buffer = new StringBuffer();
+		if (values == null) {
+			buffer.append("null");
+		} else {
+			buffer.append("{");
+			for (int i = 0; i < values.length; i++) {
+				buffer.append(values[i]);
+				if (i < values.length - 1) {
+					buffer.append(",");
+				}
+			}
+			buffer.append("}");
+		}
+    	return buffer.toString();
+    }
+
+
+}

Propchange: portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java?rev=607448&r1=607447&r2=607448&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java (original)
+++ portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java Sat Dec 29 09:20:23 2007
@@ -1,236 +1,236 @@
-/*
+/*
  * 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.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.List;
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- *
- */
-public abstract class AbstractReflectivePortletTest implements PortletTest {
-
-	/** Logger. */
-	private static final Log LOG = LogFactory.getLog(
-			AbstractReflectivePortletTest.class);
-
-    private Map initParameters;
-    private TestConfig config;
-
-
-    // PortletTest Impl --------------------------------------------------------
-
-    public void init(TestConfig config) {
-        this.config = config;
-        this.initParameters = config.getInitParameters();
-    }
-
-    /**
-     * Returns the render parameters that will be set into the render request.
-     * The default implementation just returns an empty Map object. This method
-     * may be overwritten by some concrete test to provide test-specific render
-     * parameters.
-     * @param request  the portlet request.
-     * @return an empty Map object.
-     */
-    public Map getRenderParameters(PortletRequest request) {
-        return new HashMap();
-    }
-
-    public TestConfig getConfig() {
-        return config;
-    }
-
-    /**
-     * Returns the test suite name. The test suite name is the portlet test
-     * class name without package name prefix.
-     * @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;
-    	}
-    }
-
-    /**
-     * Invoke test methods using java reflection. All 'check*' methods are
-     * invoked and test results are saved into <code>TestResults</code> object.
-     * @param config  the portlet config.
-     * @param context  the portlet context.
-     * @param request  the portlet request.
-     * @param response  the portlet response.
-     * @return the test results including several TestResult instances.
-     */
-    public TestResults doTest(PortletConfig config,
-                              PortletContext context,
-                              PortletRequest request,
-                              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);
-            }
-        }
-
-        return results;
-    }
-
-
-    // Protected Methods -------------------------------------------------------
-
-    protected Map getInitParameters() {
-        return initParameters;
-    }
-
-
-    // Private Methods ---------------------------------------------------------
-
-    private void debugWithName(String 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);
-    	}
-    }
-
-    /**
-     * Returns check methods to run as tests using java reflection.
-     * The following rules are applied to select check methods:
-     * <ul>
-     *   <li>methods declared in this class or inherited from super class</li>
-     *   <li>methods with modifier 'public' or 'protected', but not 'abstract'</li>
-     *   <li>methods that starts with <code>check</code></li>
-     * </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]);
-    			}
-    		}
-    	}
-        return checkMethods;
-    }
-
-    /**
-     * Invokes the test method ('<code>check*</code>') by preparing method
-     * parameters. A test method may accept the following types of parameters:
-     * <ul>
-     *   <li><code>javax.portlet.PortletConfig</code></li>
-     *   <li><code>javax.portlet.PortletContext</code></li>
-     *   <li><code>javax.portlet.PortletRequest</code></li>
-     *   <li><code>javax.portlet.PortletResponse</code></li>
-     *   <li><code>javax.portlet.PortletSession</code></li>
-     * </ul>
-     */
-    private TestResult invoke(Method method,
-                              PortletConfig config,
-                              PortletContext context,
-                              PortletRequest request,
-                              PortletResponse response)
-    throws IllegalAccessException, InvocationTargetException {
-
-        Class[] paramTypes = method.getParameterTypes();
-        Object[] paramValues = new Object[paramTypes.length];
-
-        for (int i = 0; i < paramTypes.length; i++) {
-            if (paramTypes[i].equals(PortletConfig.class)) {
-                paramValues[i] = config;
-            } else if (paramTypes[i].equals(PortletContext.class)) {
-                paramValues[i] = context;
-            } else if (paramTypes[i].equals(PortletRequest.class)) {
-                paramValues[i] = request;
-            } else if (paramTypes[i].equals(PortletResponse.class)) {
-                paramValues[i] = response;
-            } else if (paramTypes[i].equals(PortletSession.class)) {
-                paramValues[i] = request.getPortletSession();
-            }
-        }
-        TestResult result = (TestResult) method.invoke(this, paramValues);
-        return result;
-    }
-
-
-    // Object Methods ----------------------------------------------------------
-
-    /**
-     * Override of toString() that prints out names and values of variables.
-     * @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();
-    }
-}
+ * 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.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.List;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ *
+ */
+public abstract class AbstractReflectivePortletTest implements PortletTest {
+
+	/** Logger. */
+	private static final Log LOG = LogFactory.getLog(
+			AbstractReflectivePortletTest.class);
+
+    private Map initParameters;
+    private TestConfig config;
+
+
+    // PortletTest Impl --------------------------------------------------------
+
+    public void init(TestConfig config) {
+        this.config = config;
+        this.initParameters = config.getInitParameters();
+    }
+
+    /**
+     * Returns the render parameters that will be set into the render request.
+     * The default implementation just returns an empty Map object. This method
+     * may be overwritten by some concrete test to provide test-specific render
+     * parameters.
+     * @param request  the portlet request.
+     * @return an empty Map object.
+     */
+    public Map getRenderParameters(PortletRequest request) {
+        return new HashMap();
+    }
+
+    public TestConfig getConfig() {
+        return config;
+    }
+
+    /**
+     * Returns the test suite name. The test suite name is the portlet test
+     * class name without package name prefix.
+     * @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;
+    	}
+    }
+
+    /**
+     * Invoke test methods using java reflection. All 'check*' methods are
+     * invoked and test results are saved into <code>TestResults</code> object.
+     * @param config  the portlet config.
+     * @param context  the portlet context.
+     * @param request  the portlet request.
+     * @param response  the portlet response.
+     * @return the test results including several TestResult instances.
+     */
+    public TestResults doTest(PortletConfig config,
+                              PortletContext context,
+                              PortletRequest request,
+                              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);
+            }
+        }
+
+        return results;
+    }
+
+
+    // Protected Methods -------------------------------------------------------
+
+    protected Map getInitParameters() {
+        return initParameters;
+    }
+
+
+    // Private Methods ---------------------------------------------------------
+
+    private void debugWithName(String 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);
+    	}
+    }
+
+    /**
+     * Returns check methods to run as tests using java reflection.
+     * The following rules are applied to select check methods:
+     * <ul>
+     *   <li>methods declared in this class or inherited from super class</li>
+     *   <li>methods with modifier 'public' or 'protected', but not 'abstract'</li>
+     *   <li>methods that starts with <code>check</code></li>
+     * </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]);
+    			}
+    		}
+    	}
+        return checkMethods;
+    }
+
+    /**
+     * Invokes the test method ('<code>check*</code>') by preparing method
+     * parameters. A test method may accept the following types of parameters:
+     * <ul>
+     *   <li><code>javax.portlet.PortletConfig</code></li>
+     *   <li><code>javax.portlet.PortletContext</code></li>
+     *   <li><code>javax.portlet.PortletRequest</code></li>
+     *   <li><code>javax.portlet.PortletResponse</code></li>
+     *   <li><code>javax.portlet.PortletSession</code></li>
+     * </ul>
+     */
+    private TestResult invoke(Method method,
+                              PortletConfig config,
+                              PortletContext context,
+                              PortletRequest request,
+                              PortletResponse response)
+    throws IllegalAccessException, InvocationTargetException {
+
+        Class[] paramTypes = method.getParameterTypes();
+        Object[] paramValues = new Object[paramTypes.length];
+
+        for (int i = 0; i < paramTypes.length; i++) {
+            if (paramTypes[i].equals(PortletConfig.class)) {
+                paramValues[i] = config;
+            } else if (paramTypes[i].equals(PortletContext.class)) {
+                paramValues[i] = context;
+            } else if (paramTypes[i].equals(PortletRequest.class)) {
+                paramValues[i] = request;
+            } else if (paramTypes[i].equals(PortletResponse.class)) {
+                paramValues[i] = response;
+            } else if (paramTypes[i].equals(PortletSession.class)) {
+                paramValues[i] = request.getPortletSession();
+            }
+        }
+        TestResult result = (TestResult) method.invoke(this, paramValues);
+        return result;
+    }
+
+
+    // Object Methods ----------------------------------------------------------
+
+    /**
+     * Override of toString() that prints out names and values of variables.
+     * @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();
+    }
+}

Propchange: portals/pluto/branches/pluto-1.1.x/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message