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 cd...@apache.org on 2007/09/01 14:51:28 UTC
svn commit: r571792 [1/2] - in
/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite: ./
src/assemble/ src/main/java/org/apache/pluto/testsuite/
src/main/java/org/apache/pluto/testsuite/test/
src/main/java/org/apache/pluto/testsuite/validator/ sr...
Author: cdoremus
Date: Sat Sep 1 05:51:24 2007
New Revision: 571792
URL: http://svn.apache.org/viewvc?rev=571792&view=rev
Log:
Applied changes from trunk.
Added:
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/resources/expectedResults.properties
- copied unchanged from r571765, portals/pluto/trunk/pluto-testsuite/src/main/resources/expectedResults.properties
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/WEB-INF/classes/logging.properties
- copied unchanged from r571765, portals/pluto/trunk/pluto-testsuite/src/main/webapp/WEB-INF/classes/logging.properties
Modified:
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/pom.xml
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/assemble/bin.xml
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/ActionTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/InvalidConfigurationException.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/NoOpTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/PortletTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResult.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResults.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestUtils.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionParameterTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AppScopedSessionAttributeTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ContextInitParameterTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRequestTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExpectedResults.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/MiscTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PreferenceCommonTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PreferenceInActionTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/PreferenceInRenderTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/RenderParameterTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/RenderResponseNoContentTypeTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ResourceBundleTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SecurityMappingTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SessionTimeoutTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/SimpleAttributeTest.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/validator/PreferencesValidatorImpl.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/validator/PreferencesValidatorImpl2.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/resources/testsuite.xml
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/WEB-INF/classes/TestPortlet.properties
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/WEB-INF/classes/TestPortlet_de.properties
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/WEB-INF/classes/TestPortlet_en.properties
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/WEB-INF/portlet.xml
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/WEB-INF/testsuite-2-config.xml
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/WEB-INF/testsuite-config.xml
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/WEB-INF/web.xml
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/index.jsp
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/jsp/ExternalAppScopedAttributeTest.jsp
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/jsp/ExternalAppScopedAttributeTest_companion.jsp
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/jsp/SessionTimeoutTest.jsp
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/jsp/edit.jsp
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/jsp/help.jsp
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/jsp/introduction.jsp
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/jsp/navigation.inc
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/jsp/portlet_mode_test.jsp
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/jsp/test4.jsp
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/jsp/test_results.inc
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/jsp/test_results.jsp
portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/webapp/jsp/window_state_test.jsp
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/pom.xml?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/pom.xml (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/pom.xml Sat Sep 1 05:51:24 2007
@@ -61,17 +61,11 @@
</dependency>
<dependency>
<groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
+ <artifactId>commons-logging-api</artifactId>
<version>${commons-logging.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j.version}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>${taglibs.standard.version}</version>
@@ -89,6 +83,12 @@
<!-- Build configuration -->
<build>
<finalName>pluto-testsuite</finalName>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
<plugins>
<!-- configure maven-war-plugin to use updated web.xml -->
<plugin>
@@ -116,6 +116,10 @@
<configuration>
<resourcesDirectory>${basedir}/../pluto-site/src/site/resources</resourcesDirectory>
</configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-remote-resources-plugin</artifactId>
</plugin>
</plugins>
</build>
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/assemble/bin.xml
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/assemble/bin.xml?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/assemble/bin.xml (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/assemble/bin.xml Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
<!--
- Copyright 2005-2006 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
+ 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
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/ActionTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/ActionTest.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/ActionTest.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/ActionTest.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * 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
*
@@ -15,17 +16,14 @@
*/
package org.apache.pluto.testsuite;
-import org.apache.pluto.testsuite.PortletTest;
/**
* Empty interface that marks a PortletTest class that has test code which
* should be run in the <code>Portlet.processAction()</code> method.
- *
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
+ *
*/
public interface ActionTest extends PortletTest {
-
+
// Empty interface.
-
+
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/InvalidConfigurationException.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/InvalidConfigurationException.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/InvalidConfigurationException.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/InvalidConfigurationException.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * 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
*
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/NoOpTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/NoOpTest.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/NoOpTest.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/NoOpTest.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -24,29 +25,27 @@
import java.util.Map;
/**
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
* @version 1.0
* @since Mar 9, 2005
*/
public class NoOpTest implements PortletTest {
-
+
/** The test configuration. */
- private TestConfig config = null;
-
-
+ private TestConfig config;
+
+
// Constructor -------------------------------------------------------------
-
+
/**
* Default no-arg constructor.
*/
public NoOpTest() {
// Do nothing.
}
-
-
+
+
// PortletTest Impl --------------------------------------------------------
-
+
public String getTestSuiteName() {
return "NoOpTest";
}
@@ -54,7 +53,7 @@
public Map getRenderParameters(PortletRequest request) {
return new HashMap();
}
-
+
public TestResults doTest(PortletConfig config,
PortletContext context,
PortletRequest request,
@@ -69,6 +68,6 @@
public TestConfig getConfig() {
return config;
}
-
+
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/PortletTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/PortletTest.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/PortletTest.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/PortletTest.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -22,39 +23,35 @@
import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;
-import org.apache.pluto.testsuite.TestConfig;
-
/**
* Interface for pluto portlet test classes.
- *
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
+ *
*/
public interface PortletTest {
-
+
/**
* Returns the test suite name.
* @return the test suite name.
*/
public String getTestSuiteName();
-
+
/**
* Initializes the portlet test using test configuration.
* @param config the test configuration.
*/
public void init(TestConfig config);
-
+
/**
* Returns the render parameters. This method will be invoked in
* <code>Portlet.processAction()</code> method. All parameters returned
* by this method will be set as render parameters.
- *
+ *
* @param request the portlet request.
* @return a map of render parameters, key is the string name of the
* parameter, value is a string array.
*/
public Map getRenderParameters(PortletRequest request);
-
+
/**
* Runs the test.
* @param config the portlet config.
@@ -67,12 +64,12 @@
PortletContext context,
PortletRequest request,
PortletResponse response);
-
+
/**
* Returns the test configuration.
* @return the test configuration.
*/
public TestConfig getConfig();
-
+
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfig.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -24,57 +25,55 @@
/**
* Configuration for <code>PortletTest</code>.
- *
+ *
* @see TestConfigFactory
* @see PortletTest
- *
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
+ *
* @version 1.0
* @since Sep 15, 2004
*/
public class TestConfig implements Serializable {
-
+
// Private Member Variables ------------------------------------------------
-
+
/** PortletTest class name. */
- private String testClassName = null;
-
+ private String testClassName;
+
/** Test name. */
- private String name = null;
-
- private String displayURI = null;
-
+ private String name;
+
+ private String displayURI;
+
private 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 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 List renderParameters = new ArrayList();
-
-
+
+
// Constructor -------------------------------------------------------------
-
+
/**
* Default constructor required by Digester.
*/
public TestConfig() {
// Do nothing.
}
-
+
// Public Methods ----------------------------------------------------------
-
+
public String getTestClassName() {
return testClassName;
}
@@ -110,18 +109,18 @@
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?
*/
@@ -135,7 +134,7 @@
buffer.append("[").append(getName()).append("]");
return buffer.toString();
}
-
+
public static class Parameter {
private String name = null;
private String value = null;
@@ -143,7 +142,7 @@
this.name = name;
this.value = value;
}
-
+
public String getName() {
return name;
}
@@ -151,6 +150,6 @@
return value;
}
}
-
+
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestConfigFactory.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * 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
*
@@ -21,26 +22,23 @@
import java.util.List;
import org.apache.commons.digester.Digester;
-import org.apache.pluto.testsuite.TestConfig;
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
- *
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
+ *
*/
public class TestConfigFactory {
-
+
/** Digester instance used to parse testsuite config file. */
private Digester digester = new Digester();
-
-
+
+
// Constructor -------------------------------------------------------------
-
+
/**
* Creates a factory instance.
*/
@@ -74,14 +72,14 @@
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.
@@ -92,5 +90,5 @@
throws SAXException, IOException {
return (List) digester.parse(in);
}
-
+
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestPortlet.java Sat Sep 1 05:51:24 2007
@@ -1,12 +1,13 @@
/*
- * 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
- *
+ * 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.
@@ -24,8 +25,6 @@
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
-import javax.portlet.ResourceRequest;
-import javax.portlet.ResourceResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -39,46 +38,44 @@
/**
* Pluto testsuite's test portlet.
- *
+ *
* @see TestConfig
* @see PortletTest
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
* @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 = null;
-
+ 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 = null;
-
-
+ 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) {
@@ -86,7 +83,7 @@
LOG.error(message);
throw new PortletException(message);
}
-
+
// Load PortletTest instances: constructing and initializing.
TestConfigFactory factory = new TestConfigFactory();
try {
@@ -118,14 +115,14 @@
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(),
@@ -135,7 +132,7 @@
PortletSession session = request.getPortletSession();
session.setAttribute(test.getClass().getName(), results);
}
-
+
Map renderParameters = null;
if (test != null) {
renderParameters = test.getRenderParameters(request);
@@ -146,17 +143,17 @@
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;
@@ -165,7 +162,7 @@
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(),
@@ -181,8 +178,8 @@
test.getClass().getName());
request.setAttribute("results", results);
}
-
-
+
+
if (testId == null) {
// FIXME: update attribute name from tests to testConfigs.
request.setAttribute("tests", testConfigs);
@@ -203,7 +200,7 @@
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;
@@ -229,7 +226,7 @@
.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>).
@@ -242,28 +239,28 @@
.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);
@@ -273,7 +270,7 @@
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);
@@ -283,13 +280,8 @@
testId = String.valueOf(nextTestIdInt - 1);
}
}
-
+
// Return the current test ID.
return testId;
}
-
- public void serveResource(ResourceRequest arg0, ResourceResponse arg1) throws PortletException, IOException {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException("This method needs to be implemented.");
- }
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResult.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResult.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResult.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResult.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -19,45 +20,43 @@
/**
* The test result represents the result of one test method.
- *
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
+ *
*/
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;
-
+ private String name;
+
/** 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;
}
@@ -65,27 +64,27 @@
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";
@@ -101,18 +100,18 @@
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()
@@ -122,8 +121,8 @@
buffer.append(getClass().getName());
buffer.append("[name=").append(name);
buffer.append(";returnCode=").append(returnCode);
- buffer.append(";resultMessage=").append(resultMessage).append("]");
+ buffer.append(";resultMessage=").append(resultMessage).append("]");
return buffer.toString();
}
-
+
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResults.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResults.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResults.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestResults.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * 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
*
@@ -15,25 +16,21 @@
*/
package org.apache.pluto.testsuite;
-import org.apache.pluto.testsuite.TestResult;
-
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.io.Serializable;
/**
* This class contains one or more test results.
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
*/
public class TestResults implements Serializable {
-
-
- private String name = null;
-
+
+
+ private String name;
+
private ArrayList list = new ArrayList();
-
+
private boolean failed = false;
private boolean inQuestion = false;
@@ -73,7 +70,7 @@
/**
* Override of toString() that prints out variable
* names and values.
- *
+ *
* @see java.lang.Object#toString()
*/
public String toString(){
@@ -82,7 +79,7 @@
buffer.append("[name=").append(name);
buffer.append(";failed=").append(failed);
buffer.append(";inQuestion=").append(inQuestion);
- buffer.append(";results={").append(list).append("}]");
+ buffer.append(";results={").append(list).append("}]");
return buffer.toString();
}
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestUtils.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestUtils.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestUtils.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/TestUtils.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -20,27 +21,26 @@
/**
* Static class that provides utility methods for Pluto testsuite.
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
* @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.
@@ -58,7 +58,7 @@
arrayToString(valuesExpected),
result);
}
-
+
/**
* Sets the test result return code to <code>FAILED</code>, and reports
* assertion details by specifying value got and value expected.
@@ -78,7 +78,7 @@
result.setReturnCode(TestResult.FAILED);
result.setResultMessage(buffer.toString());
}
-
+
/**
* Sets the test result return code to <code>FAILED</code>, and reports
* exception details.
@@ -98,20 +98,20 @@
}
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.
@@ -133,6 +133,6 @@
}
return buffer.toString();
}
-
-
+
+
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AbstractReflectivePortletTest.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * 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
*
@@ -37,26 +38,24 @@
import java.util.HashMap;
/**
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
*/
public abstract class AbstractReflectivePortletTest implements PortletTest {
-
+
/** Logger. */
private static final Log LOG = LogFactory.getLog(
AbstractReflectivePortletTest.class);
-
- private Map initParameters = null;
- private TestConfig config = null;
-
-
+
+ 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
@@ -68,11 +67,11 @@
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.
@@ -87,7 +86,7 @@
return className;
}
}
-
+
/**
* Invoke test methods using java reflection. All 'check*' methods are
* invoked and test results are saved into <code>TestResults</code> object.
@@ -95,14 +94,14 @@
* @param context the portlet context.
* @param request the portlet request.
* @param response the portlet response.
- * @return the test results including several TestResult instances.
+ * @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());
@@ -125,39 +124,39 @@
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>
+ * <li>methods that starts with <code>check</code></li>
* </ul>
* @return a list of check methods.
*/
@@ -180,7 +179,7 @@
}
return checkMethods;
}
-
+
/**
* Invokes the test method ('<code>check*</code>') by preparing method
* parameters. A test method may accept the following types of parameters:
@@ -218,10 +217,10 @@
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()
@@ -230,7 +229,7 @@
StringBuffer buffer = new StringBuffer();
buffer.append(getClass().getName());
buffer.append("[initParameters=").append(initParameters);
- buffer.append(";config=").append(config).append("]");
+ buffer.append(";config=").append(config).append("]");
return buffer.toString();
}
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionParameterTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionParameterTest.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionParameterTest.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ActionParameterTest.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * 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
*
@@ -25,21 +26,19 @@
import javax.portlet.PortletRequest;
/**
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
*/
public class ActionParameterTest extends AbstractReflectivePortletTest
implements ActionTest {
-
+
/** Parameter key encoded in the action URL. */
public static final String KEY = "org.apache.pluto.testsuite.PARAM_ACTION_KEY";
-
+
/** Parameter value encoded in the action URL. */
public static final String VALUE = "org.apache.pluto.testsuite.ACTION_VALUE";
-
-
+
+
// Test Methods ------------------------------------------------------------
-
+
protected TestResult checkGetActionParameter(PortletRequest request) {
TestResult result = new TestResult();
result.setDescription("Ensure parameters encoded in action URL are "
@@ -58,7 +57,7 @@
TestResult result = new TestResult();
result.setDescription("Ensure parameters encoded in action URL are "
+ "available in the action request parameter map.");
-
+
Map parameterMap = request.getParameterMap();
String[] values = (String[]) parameterMap.get(KEY);
if (values != null && values.length == 1 && VALUE.equals(values[0])) {
@@ -69,12 +68,12 @@
}
return result;
}
-
+
protected TestResult checkParameterNames(PortletRequest request) {
TestResult result = new TestResult();
result.setDescription("Ensure parameters encoded in action URL "
+ "exists in the parameter name enumeration.");
-
+
boolean hasParameterName = false;
for (Enumeration en = request.getParameterNames();
!hasParameterName && en.hasMoreElements(); ) {
@@ -83,7 +82,7 @@
hasParameterName = true;
}
}
-
+
if (hasParameterName) {
result.setReturnCode(TestResult.PASSED);
} else {
@@ -93,5 +92,5 @@
}
return result;
}
-
+
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AppScopedSessionAttributeTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AppScopedSessionAttributeTest.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AppScopedSessionAttributeTest.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/AppScopedSessionAttributeTest.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -22,8 +23,6 @@
import javax.portlet.PortletSession;
/**
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
*/
public class AppScopedSessionAttributeTest
extends AbstractReflectivePortletTest {
@@ -31,17 +30,17 @@
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 VALUE = "VALUE";
-
-
+
+
// Test Methods ------------------------------------------------------------
-
+
protected TestResult checkGetEmptyAppScopedAttribute(PortletSession session) {
TestResult result = new TestResult();
result.setDescription("Retrieve an attribute that has not been set "
+ "in the session's application scope "
+ "and ensure it's value is null.");
result.setSpecPLT("15.3");
-
+
Object value = session.getAttribute(BOGUS_KEY, PortletSession.APPLICATION_SCOPE);
if (value == null) {
result.setReturnCode(TestResult.PASSED);
@@ -50,13 +49,13 @@
}
return result;
}
-
+
protected TestResult checkSetAppScopedAttribute(PortletSession session) {
TestResult result = new TestResult();
result.setDescription("Set an application scoped session attribute "
+ "and ensure it's retrievable.");
result.setSpecPLT("15.3");
-
+
session.setAttribute(KEY, VALUE, PortletSession.APPLICATION_SCOPE);
Object value = session.getAttribute(KEY, PortletSession.APPLICATION_SCOPE);
if (VALUE.equals(value)) {
@@ -72,7 +71,7 @@
result.setDescription("Remove an application scoped session attribute "
+ "and ensure it's null.");
result.setSpecPLT("15.3");
-
+
session.setAttribute(KEY, VALUE, PortletSession.APPLICATION_SCOPE);
session.removeAttribute(KEY, PortletSession.APPLICATION_SCOPE);
Object value = session.getAttribute(KEY, PortletSession.APPLICATION_SCOPE);
@@ -83,5 +82,5 @@
}
return result;
}
-
+
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ContextInitParameterTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ContextInitParameterTest.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ContextInitParameterTest.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ContextInitParameterTest.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * 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
*
@@ -23,26 +24,24 @@
import java.util.Enumeration;
/**
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</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_VALUE = "test-parameter-val";
-
-
+
+
// Test Methods ------------------------------------------------------------
-
+
protected TestResult checkEnumerationContainsNames(
PortletContext context) {
TestResult result = new TestResult();
result.setDescription("Ensure that the expected init parameter name "
+ "exists in the portlet context's init parameters.");
result.setSpecPLT("10.3.1");
-
+
boolean found = false;
for (Enumeration en = context.getInitParameterNames();
!found && en.hasMoreElements(); ) {
@@ -61,12 +60,12 @@
}
return result;
}
-
+
protected TestResult checkGetInitParameter(PortletContext context) {
TestResult result = new TestResult();
result.setDescription("Ensure that init parameters are retrieveable.");
result.setSpecPLT("10.3.1");
-
+
String value = context.getInitParameter(TEST_PARAM_NAME);
if (TEST_PARAM_VALUE.equals(value)) {
result.setReturnCode(TestResult.PASSED);
@@ -75,7 +74,7 @@
}
return result;
}
-
+
/**
* FIXME: should this test reside in this class? -- ZHENG Zhong
*/
@@ -83,7 +82,7 @@
TestResult result = new TestResult();
result.setDescription("Ensure that the PortletContext can be retrieved "
+ "from the portlet session.");
-
+
PortletContext context = session.getPortletContext();
if (context != null) {
result.setReturnCode(TestResult.PASSED);
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTest.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTest.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRenderParameterTest.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * 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
*
@@ -37,53 +38,51 @@
import javax.servlet.ServletResponse;
/**
- *
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
+ *
* @version 1.0
* @since Mar 9, 2005
*/
-public class DispatcherRenderParameterTest
+public class DispatcherRenderParameterTest
extends AbstractReflectivePortletTest {
-
+
/** Internal logger. */
private static final Log LOG = LogFactory.getLog(
DispatcherRenderParameterTest.class);
-
+
// Static Final Constants --------------------------------------------------
-
+
/** The path to the companion servlet. */
private static final String SERVLET_PATH = "/test/DispatcherRenderParameterTest_Servlet";
-
+
private static final String KEY_TARGET = "target";
-
+
private static final String TARGET_PARAMS = "testParams";
private static final String TARGET_SAME_NAME_PARAM = "testSameNameParam";
private static final String TARGET_ADDED_SAME_NAME_PARAM = "testAddedSameNameParam";
private static final String TARGET_INVALID_PARAMS = "testInvalidParams";
-
+
private static final String KEY_RENDER = "renderParamKey";
private static final String VALUE_RENDER = "renderParamValue";
private static final String VALUE_ADDED1 = "addedParamValue1";
private static final String VALUE_ADDED2 = "addedParamValue2";
-
+
private static final String KEY_A = "includedTestKeyA";
private static final String VALUE_A = "includedTestValueA";
-
+
private static final String KEY_B = "includedTestKeyB";
private static final String VALUE_B = "includedTestValueB";
-
+
private static final String KEY_C = "includedTestKeyC";
private static final String VALUE_C1 = "valueOneOfKeyC";
private static final String VALUE_C2 = "valueTwoOfKeyC";
private static final String VALUE_C3 = "valueThreeOfKeyC";
-
+
public static final String RESULT_KEY =
DispatcherRenderParameterTest.class.getName() + ".RESULT_KEY";
-
-
+
+
// AbstractReflectivePortletTest Impl --------------------------------------
-
+
/**
* Overwrites <code>super.getRenderParameters(..)</code> to set the
* test-specific render parameter in the render URL.
@@ -93,42 +92,42 @@
parameterMap.put(KEY_RENDER, new String[] { VALUE_RENDER });
return parameterMap;
}
-
-
+
+
// Test Methods ------------------------------------------------------------
-
+
protected TestResult checkParameters(PortletContext context,
PortletRequest request,
PortletResponse response)
throws IOException, PortletException {
-
+
// Dispatch to the companion servlet: call checkParameters().
StringBuffer buffer = new StringBuffer();
buffer.append(SERVLET_PATH).append("?")
.append(KEY_TARGET).append("=").append(TARGET_PARAMS)
.append("&").append(KEY_A).append("=").append(VALUE_A)
.append("&").append(KEY_B).append("=").append(VALUE_B);
-
+
if (LOG.isDebugEnabled()) {
LOG.debug("Dispatching to: " + buffer.toString());
}
PortletRequestDispatcher dispatcher = context.getRequestDispatcher(
buffer.toString());
dispatcher.include((RenderRequest) request, (RenderResponse) response);
-
+
// Retrieve test result returned by the companion servlet.
TestResult result = (TestResult) request.getAttribute(RESULT_KEY);
request.removeAttribute(RESULT_KEY);
return result;
}
-
-
+
+
protected TestResult checkSameNameParameter(PortletContext context,
PortletRequest request,
PortletResponse response)
throws IOException, PortletException {
-
+
// Dispatch to the companion servlet: call checkSameNameParameter().
StringBuffer buffer = new StringBuffer();
buffer.append(SERVLET_PATH).append("?")
@@ -136,20 +135,20 @@
.append("&").append(KEY_C).append("=").append(VALUE_C1)
.append("&").append(KEY_C).append("=").append(VALUE_C2)
.append("&").append(KEY_C).append("=").append(VALUE_C3);
-
+
if (LOG.isDebugEnabled()) {
LOG.debug("Dispatching to: " + buffer.toString());
}
PortletRequestDispatcher dispatcher = context.getRequestDispatcher(
buffer.toString());
dispatcher.include((RenderRequest) request, (RenderResponse) response);
-
+
// Retrieve test result returned by the companion servlet.
TestResult result = (TestResult) request.getAttribute(RESULT_KEY);
request.removeAttribute(RESULT_KEY);
return result;
}
-
+
protected TestResult checkAddedSameNameParameter(PortletContext context,
PortletRequest request,
PortletResponse response)
@@ -160,25 +159,25 @@
.append(KEY_TARGET).append("=").append(TARGET_ADDED_SAME_NAME_PARAM)
.append("&").append(KEY_RENDER).append("=").append(VALUE_ADDED1)
.append("&").append(KEY_RENDER).append("=").append(VALUE_ADDED2);
-
+
if (LOG.isDebugEnabled()) {
LOG.debug("Dispatching to: " + buffer.toString());
}
PortletRequestDispatcher dispatcher = context.getRequestDispatcher(
buffer.toString());
dispatcher.include((RenderRequest) request, (RenderResponse) response);
-
+
// Retrieve test result returned by the companion servlet.
TestResult result = (TestResult) request.getAttribute(RESULT_KEY);
request.removeAttribute(RESULT_KEY);
return result;
}
-
+
protected TestResult checkInvalidParameters(PortletContext context,
PortletRequest request,
PortletResponse response)
throws IOException, PortletException {
-
+
// Dispatch to the companion servlet: call checkInvalidParameters().
StringBuffer buffer = new StringBuffer();
buffer.append(SERVLET_PATH).append("?")
@@ -192,29 +191,27 @@
PortletRequestDispatcher dispatcher = context.getRequestDispatcher(
buffer.toString());
dispatcher.include((RenderRequest) request, (RenderResponse) response);
-
+
// Retrieve test result returned by the companion servlet.
TestResult result = (TestResult) request.getAttribute(RESULT_KEY);
request.removeAttribute(RESULT_KEY);
return result;
}
-
-
+
+
// Nested Companion Servlet Class ------------------------------------------
-
+
/**
* Nested static companion servlet class.
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
*/
public static class CompanionServlet extends GenericServlet {
// GenericServlet Impl -------------------------------------------------
-
+
public String getServletInfo() {
return getClass().getName();
}
-
+
/**
* Services the servlet request dispatched from the test portlet.
* This method checks the 'target' parameter to determine which test
@@ -240,10 +237,10 @@
}
request.setAttribute(RESULT_KEY, result);
}
-
-
+
+
// Private Methods -----------------------------------------------------
-
+
/**
* Check that parameters A and B are available in the dispatching
* request.
@@ -264,7 +261,7 @@
}
return result;
}
-
+
/**
* Check that parameter C has three values.
* @param request the servlet reqeust.
@@ -283,7 +280,7 @@
}
return result;
}
-
+
/**
* Check that parameter RENDER has three values: one is the render
* parameter, while the other two are appended in the dispatch URI.
@@ -304,7 +301,7 @@
}
return result;
}
-
+
/**
* Check that invalid parameter A is ignored, parameter B is attached
* to the dispatching request with the correct value, and parameter C
@@ -329,7 +326,7 @@
}
return result;
}
-
+
private TestResult failOnUnknownTarget(ServletRequest request) {
TestResult result = new TestResult();
result.setReturnCode(TestResult.FAILED);
@@ -337,8 +334,8 @@
+ KEY_TARGET + ": " + request.getParameter(KEY_TARGET));
return result;
}
-
+
}
-
+
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRequestTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRequestTest.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRequestTest.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/DispatcherRequestTest.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * 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
*
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExpectedResults.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExpectedResults.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExpectedResults.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExpectedResults.java Sat Sep 1 05:51:24 2007
@@ -1,18 +1,19 @@
/*
- * 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
- *
+ * 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;
@@ -26,26 +27,24 @@
/**
* A Singleton which loads a properties file containing data expected by the
* tests in the testsuite.
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
*/
public class ExpectedResults {
-
+
/** The file name of properties holding expected results. */
public static final String PROPERTY_FILENAME = "expectedResults.properties";
-
+
/** The static singleton instance. */
- private static ExpectedResults instance = null;
-
-
+ private static ExpectedResults instance;
+
+
// Private Member Variables ------------------------------------------------
-
+
/** The nested properties. */
- private Properties properties = null;
-
-
+ private Properties properties;
+
+
// Constructor -------------------------------------------------------------
-
+
/**
* Private constructor that prevents external instantiation.
* @throws IOException if fail to load properties from file.
@@ -60,7 +59,7 @@
throw new IOException("Could not find " + PROPERTY_FILENAME);
}
}
-
+
/**
* Returns the singleton expected results instance.
* @return the singleton expected results instance.
@@ -70,7 +69,7 @@
throws InvalidConfigurationException {
if (instance == null) {
try {
- instance = new ExpectedResults();
+ instance = new ExpectedResults();
} catch (IOException ex) {
throw new InvalidConfigurationException("Error reading file "
+ PROPERTY_FILENAME + ": " + ex.getMessage());
@@ -78,34 +77,34 @@
}
return instance;
}
-
-
+
+
// Public Methods ----------------------------------------------------------
-
+
public String getMajorVersion() {
return properties.getProperty("expected.version.major");
}
-
+
public String getMinorVersion() {
return properties.getProperty("expected.version.minor");
}
-
+
public String getServerInfo() {
- return properties.getProperty("expected.serverInfo");
+ return properties.getProperty("expected.serverInfo");
}
-
+
public String getPortalInfo() {
return properties.getProperty("expected.portalInfo");
}
-
+
public String getMappedSecurityRole() {
return properties.getProperty("expected.security.role.mapped");
}
-
+
public String getUnmappedSecurityRole() {
return properties.getProperty("expected.security.role");
}
-
+
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTest.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTest.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/ExternalAppScopedAttributeTest.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * 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
*
@@ -29,24 +30,22 @@
import javax.servlet.http.HttpSession;
/**
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</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.";
-
-
+
+
// Test Methods ------------------------------------------------------------
-
+
protected TestResult checkSetAppScopedAttributeHereSeenElsewhere(
PortletSession session) {
TestResult result = new TestResult();
result.setDescription("Ensure application scoped attributes set here "
+ "in portlet session can be seen elsewhere.");
-
+
session.setAttribute(INT_KEY, VALUE, PortletSession.APPLICATION_SCOPE);
result.setReturnCode(TestResult.WARNING);
result.setResultMessage("Click the provided link to validate test.");
@@ -58,7 +57,7 @@
TestResult result = new TestResult();
result.setDescription("Ensure application scoped attributes set "
+ "elsewhere in portlet session can be seen here.");
-
+
Object value = session.getAttribute(EXT_KEY,
PortletSession.APPLICATION_SCOPE);
if (VALUE.equals(value)) {
@@ -70,10 +69,10 @@
}
return result;
}
-
-
+
+
// Nested Servlet Class ----------------------------------------------------
-
+
/**
* The companion servlet that cooperates with this portlet test.
*/
@@ -88,12 +87,12 @@
request.setAttribute("passed", new Boolean(true));
session.setAttribute(EXT_KEY, VALUE);
}
-
+
RequestDispatcher dispatcher = request.getRequestDispatcher(
"/jsp/ExternalAppScopedAttributeTest_companion.jsp");
dispatcher.forward(request, response);
}
-
+
}
-
+
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/MiscTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/MiscTest.java?rev=571792&r1=571791&r2=571792&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/MiscTest.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/MiscTest.java Sat Sep 1 05:51:24 2007
@@ -1,9 +1,10 @@
/*
- * 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
+ * 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
*
@@ -29,17 +30,15 @@
import org.apache.pluto.testsuite.TestUtils;
/**
- * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
- * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
*/
public class MiscTest extends AbstractReflectivePortletTest {
// Test Methods ------------------------------------------------------------
-
+
protected TestResult checkContextMajorVersion(PortletContext context) {
TestResult result = new TestResult();
result.setDescription("Ensure the expected major version number is returned.");
-
+
String majorVersion = String.valueOf(context.getMajorVersion());
ExpectedResults expectedResults = ExpectedResults.getInstance();
String expected = expectedResults.getMajorVersion();
@@ -54,7 +53,7 @@
protected TestResult checkContextMinorVersion(PortletContext context) {
TestResult result = new TestResult();
result.setDescription("Ensure the expected minor version number is returned.");
-
+
String minorVersion = String.valueOf(context.getMinorVersion());
ExpectedResults expectedResults = ExpectedResults.getInstance();
String expected = expectedResults.getMinorVersion();
@@ -65,11 +64,11 @@
}
return result;
}
-
+
protected TestResult checkContextServerInfo(PortletContext context) {
TestResult result = new TestResult();
result.setDescription("Ensure the expected server info is returned.");
-
+
String serverInfo = context.getServerInfo();
ExpectedResults expectedResults = ExpectedResults.getInstance();
String expected = expectedResults.getServerInfo();
@@ -84,7 +83,7 @@
protected TestResult checkPortalInfo(PortletRequest request) {
TestResult result = new TestResult();
result.setDescription("Ensure the expected portal info is returned.");
-
+
String portalInfo = request.getPortalContext().getPortalInfo();
ExpectedResults expectedResults = ExpectedResults.getInstance();
String expected = expectedResults.getPortalInfo();
@@ -105,7 +104,7 @@
protected TestResult checkSupportedModes(PortletRequest request) {
TestResult result = new TestResult();
result.setDescription("Ensure the expected portlet modes are returned.");
-
+
List requiredPortletModes = new ArrayList();
requiredPortletModes.add(PortletMode.VIEW);
requiredPortletModes.add(PortletMode.EDIT);
@@ -116,7 +115,7 @@
PortletMode portletMode = (PortletMode) en.nextElement();
requiredPortletModes.remove(portletMode);
}
-
+
if (requiredPortletModes.isEmpty()) {
result.setReturnCode(TestResult.PASSED);
} else {
@@ -135,18 +134,18 @@
protected TestResult checkSupportedWindowSates(PortletRequest request) {
TestResult result = new TestResult();
result.setDescription("Ensure the expected window states are returned.");
-
+
List requiredWindowStates = new ArrayList();
requiredWindowStates.add(WindowState.MINIMIZED);
requiredWindowStates.add(WindowState.MAXIMIZED);
requiredWindowStates.add(WindowState.NORMAL);
-
+
for (Enumeration en = request.getPortalContext().getSupportedWindowStates();
en.hasMoreElements(); ) {
WindowState windowState = (WindowState) en.nextElement();
requiredWindowStates.remove(windowState);
}
-
+
if (requiredWindowStates.isEmpty()) {
result.setReturnCode(TestResult.PASSED);
} else {