Author: julien(a)jboss.com
Date: 2007-11-07 09:52:33 -0500 (Wed, 07 Nov 2007)
New Revision: 8836
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/InlineValuesNotInResourceBundleTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/InlineValuesWithNoResourceBundleDefinedTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/AccessSameSetOfResourcesTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/ContextAttributesTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/InitializationParametersTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/TempDirTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/ExceptionsDuringRequestHandlingTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/ExceptionsOnInitTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InitializeBeforeHandleTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InvokeActionFirstTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InvokeRenderAfterActionURLTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InvokeRenderAfterRenderURLTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/SendRedirectDuringActionTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/NotInvokeModeDeclaredForNotSupportedMarkupTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/RequestDispatchingDependingOnModeTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ActionToRenderParametersTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ActionToRequestParametersNotPropagatedTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/AuthTypeTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ContentTypeTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ContextPathTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ObtainingInputStreamAndReaderTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ParameterAccessMethodTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ParametersDuringRenderNotTargetedTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/BufferResetTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/BufferSizeTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/GetContentTypeTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/IllegalStateExceptionAfterSendRedirectTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/NamespaceEncodingTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/NotAllowedModeTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/NotSupportedWindowStateTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/OutputStreamOrWriterTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/ParametersSetAfterSendRedirectTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/RenderParametersTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SendRedirectAfterChangeStateMethodsTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SendRedirectWithRelativeURLTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SetContentTypeBeforeOutputStreamOrWriterTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SetNotSupportedContentTypeTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/StateChangesAfterRedirectionSendTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/HTTPSessionInvalidatesPortletSessionTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/HTTPSessionRelationsTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionInvalidatesHTTPSessionTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/SessionAttributesTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/SessionCreateTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/SessionInvalidationTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLParametersTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLWithNotSupportedModeTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLWithNotSupportedStateTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/RenderURLNotInvokeActionTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/SecurityLevelTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/CanModifyNonReadOnlyPreferenceTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ChangesMadeButNotStoredAreDiscardedTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/CreateASingleInstanceOfValidatorTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/DynamicPreferenceTreatedLikeModifiablePreferenceTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/InvalidationCancelsStoreTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesCanBeSetToNullTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesMapModificationDoesNotModifyPreferencesValuesTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ReadOnlyPreferenceCannotBeModifiedTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ResetPreferenceHavingNoDefaultValueDeletesItTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/StoreCalledDuringRenderThrowsIllegalArgumentExceptionTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ValidationStoresTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/CustomStateNotMappedNotInvokedTestCase.java
Removed:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/PortletConfigTestSuite.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/PortletContextTestSuite.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/PortletInterfaceSequenceBuilder.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/PortletModeSequenceBuilder.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/PortletModeTestSuite.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestTestSuite.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestsSequenceBuilder.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesSequenceBuilder.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesTestSuite.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionSequenceBuilder.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionTestSuite.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLTestSuite.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletUrlSequenceBuilder.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesSequenceBuilder.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesTestSuite.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/WindowStatesSequenceBuilder.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/WindowStatesTestSuite.java
Modified:
modules/portlet/trunk/portlet/build.xml
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestSuite.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractTestGenericPortlet.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/PortletConfigSequenceBuilder.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/PortletContextSequenceBuilder.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/spec/ExceptionsDuringRequestHandlingControllerPortlet.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/spec/MinimizedStateDontRenderPortlet.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/spec/RequestDispatchingDependingOnModePortlet.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/unit/TCKAssertion.java
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletconfig-war/WEB-INF/web.xml
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletcontext-war/WEB-INF/web.xml
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletinterface-war/WEB-INF/web.xml
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletmode-war/WEB-INF/web.xml
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletrequests-war/WEB-INF/web.xml
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletresponses-war/WEB-INF/web.xml
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletsession-war/WEB-INF/web.xml
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portleturl-war/WEB-INF/web.xml
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/preferences-war/WEB-INF/web.xml
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/windowstates-war/WEB-INF/web.xml
Log:
- migrated TCK tests to new structure, still need to do API and EXT test cases
Modified: modules/portlet/trunk/portlet/build.xml
===================================================================
--- modules/portlet/trunk/portlet/build.xml 2007-11-06 18:11:32 UTC (rev 8835)
+++ modules/portlet/trunk/portlet/build.xml 2007-11-07 14:52:33 UTC (rev 8836)
@@ -161,6 +161,7 @@
<!-- Portlet test framework lib jar -->
<jar jarfile="${build.lib}/portal-portlet-test-framework-lib.jar"
manifest="${build.etc}/portal-portlet-lib-jar.mf">
<fileset dir="${build.classes}"
includes="org/jboss/portal/test/framework/portlet/**"/>
+ <fileset dir="${build.classes}"
includes="org/jboss/portal/unit/**"/>
</jar>
</target>
Modified:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestSuite.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestSuite.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestSuite.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -27,6 +27,8 @@
import org.jboss.portal.common.net.URLNavigator;
import org.jboss.portal.common.net.URLVisitor;
import org.jboss.portal.common.net.URLFilter;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
@@ -36,6 +38,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Constructor;
+import java.lang.reflect.AnnotatedElement;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
@@ -126,17 +129,37 @@
{
for (Class clazz : getClasses(event.getServletContext()))
{
- try
+ TCK tck = ((AnnotatedElement)clazz).getAnnotation(TCK.class);
+
+ //
+ boolean active = true;
+ if (tck != null)
{
- Constructor ctor = clazz.getConstructor(PortletTest.class);
- PortletTest testCase = new PortletTest();
- ctor.newInstance(testCase);
- String testCaseName = clazz.getSimpleName();
- driver.addSequence(testCaseName, testCase);
+ for (TCKAssertion assertion : tck.value())
+ {
+ if (assertion.getStatus() instanceof TCKAssertion.Inactive)
+ {
+ active = false;
+ log.error("Skip test case " + clazz.getName() +
" because the assertion " + assertion.getId() + " is not enabled");
+ }
+ }
}
- catch (Exception e)
+
+ //
+ if (active)
{
- log.error("Cannot obtain test case constructor " + clazz,
e);
+ try
+ {
+ Constructor ctor = clazz.getConstructor(PortletTest.class);
+ PortletTest testCase = new PortletTest();
+ ctor.newInstance(testCase);
+ String testCaseName = clazz.getSimpleName();
+ driver.addSequence(testCaseName, testCase);
+ }
+ catch (Exception e)
+ {
+ log.error("Cannot obtain test case constructor " +
clazz, e);
+ }
}
}
}
@@ -156,12 +179,12 @@
protected List<Class> getClasses(ServletContext ctx) throws IOException
{
- ClassCollector collector = new ClassCollector(loader, ctx);
+ TestCaseScanner collector = new TestCaseScanner(loader, ctx);
collector.collect();
return collector.classes;
}
- private static class ClassCollector implements URLVisitor, URLFilter
+ private static class TestCaseScanner implements URLVisitor, URLFilter
{
/** . */
@@ -176,7 +199,7 @@
/** . */
private URL classesURL;
- public ClassCollector(ClassLoader loader, ServletContext ctx) throws
MalformedURLException
+ public TestCaseScanner(ClassLoader loader, ServletContext ctx) throws
MalformedURLException
{
this.loader = loader;
@@ -221,9 +244,6 @@
// Append class name
tmp.append(name.substring(0, name.length() - ".class".length()));
-
- System.out.println("tmp = " + tmp);
-
//
String classname = tmp.toString();
Class clazz = loader.loadClass(classname);
Modified:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractTestGenericPortlet.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractTestGenericPortlet.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractTestGenericPortlet.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -50,18 +50,11 @@
/** The test id. */
private final String testName;
- /** Construct a test portlet with a test name computed with the method
<code>getTestId(Class)</code>. */
- public AbstractTestGenericPortlet()
+ public AbstractTestGenericPortlet(Class testCase)
{
- testName = createTestName(getClass());
+ testName = testCase.getSimpleName();
}
- /** Get the test id from the class name. It can be overriden. */
- protected String createTestName(Class clazz)
- {
- return Tools.getShortNameOf(clazz);
- }
-
public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, IOException
{
PortletTestContext context = PortletTestDriver.getPortletTestContext();
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/InlineValuesNotInResourceBundleTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/InlineValuesNotInResourceBundleTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/InlineValuesNotInResourceBundleTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,72 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletconfig;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.components.AbstractUniversalTestPortlet;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import
org.jboss.portal.test.portlet.jsr168.tck.portletconfig.spec.InlineValuesNotInResourceBundlePortlet;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletConfig;
+import java.util.ResourceBundle;
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_24})
+public class InlineValuesNotInResourceBundleTestCase
+{
+ public InlineValuesNotInResourceBundleTestCase(PortletTest seq)
+ {
+ seq.addAction(0, InlineValuesNotInResourceBundlePortlet.RENDER_JOINPOINT, new
PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletConfig cfg =
((AbstractUniversalTestPortlet)portlet).getPortletConfig();
+
+ ResourceBundle bundle_en = cfg.getResourceBundle(Locale.ENGLISH);
+
+ assertEquals(Locale.ENGLISH, bundle_en.getLocale());
+
+ assertEquals("bar", bundle_en.getString("foo"));
+
+ //These are not defined in bundle but inline in portelt.xml
+ assertEquals("title",
bundle_en.getString("javax.portlet.title"));
+ assertEquals("short-title",
bundle_en.getString("javax.portlet.short-title"));
+ assertEquals("keywords",
bundle_en.getString("javax.portlet.keywords"));
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/InlineValuesWithNoResourceBundleDefinedTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/InlineValuesWithNoResourceBundleDefinedTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/InlineValuesWithNoResourceBundleDefinedTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,80 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletconfig;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.components.AbstractUniversalTestPortlet;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import
org.jboss.portal.test.portlet.jsr168.tck.portletconfig.spec.InlineValuesWithNoResourceBundleDefinedPortlet;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.fail;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletConfig;
+import java.util.ResourceBundle;
+import java.util.Locale;
+import java.util.MissingResourceException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_24})
+public class InlineValuesWithNoResourceBundleDefinedTestCase
+{
+ public InlineValuesWithNoResourceBundleDefinedTestCase(PortletTest seq)
+ {
+ seq.addAction(0, InlineValuesWithNoResourceBundleDefinedPortlet.RENDER_JOINPOINT,
new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletConfig cfg =
((AbstractUniversalTestPortlet)portlet).getPortletConfig();
+
+ ResourceBundle bundle_en = cfg.getResourceBundle(Locale.ENGLISH);
+
+ //dummy assert that we don't have resouce bundle defined...
+ try
+ {
+ bundle_en.getString("foo");
+ fail();
+ }
+ catch (MissingResourceException expected)
+ {
+ }
+
+ //These defined inline in portelt.xml and there is no bundle defined there
+ assertEquals("title",
bundle_en.getString("javax.portlet.title"));
+ assertEquals("short-title",
bundle_en.getString("javax.portlet.short-title"));
+ assertEquals("keywords",
bundle_en.getString("javax.portlet.keywords"));
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/PortletConfigSequenceBuilder.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/PortletConfigSequenceBuilder.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/PortletConfigSequenceBuilder.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -54,25 +54,6 @@
PortletTest seq = new PortletTest();
registry.addSequence("InlineValuesNotInResourceBundle", seq);
- seq.addAction(0, InlineValuesNotInResourceBundlePortlet.RENDER_JOINPOINT, new
PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletConfig cfg =
((AbstractUniversalTestPortlet)portlet).getPortletConfig();
-
- ResourceBundle bundle_en = cfg.getResourceBundle(Locale.ENGLISH);
-
- assertEquals(Locale.ENGLISH, bundle_en.getLocale());
-
- assertEquals("bar", bundle_en.getString("foo"));
-
- //These are not defined in bundle but inline in portelt.xml
- assertEquals("title",
bundle_en.getString("javax.portlet.title"));
- assertEquals("short-title",
bundle_en.getString("javax.portlet.short-title"));
- assertEquals("keywords",
bundle_en.getString("javax.portlet.keywords"));
- return new EndTestResponse();
- }
- });
}
public void createInlineValuesWithNoResourceBundleDefined(PortletTestDriver registry)
@@ -80,31 +61,6 @@
PortletTest seq = new PortletTest();
registry.addSequence("InlineValuesWithNoResourceBundleDefined", seq);
- seq.addAction(0, InlineValuesWithNoResourceBundleDefinedPortlet.RENDER_JOINPOINT,
new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletConfig cfg =
((AbstractUniversalTestPortlet)portlet).getPortletConfig();
-
- ResourceBundle bundle_en = cfg.getResourceBundle(Locale.ENGLISH);
-
- //dummy assert that we don't have resouce bundle defined...
- try
- {
- bundle_en.getString("foo");
- fail();
- }
- catch (MissingResourceException expected)
- {
- }
-
- //These defined inline in portelt.xml and there is no bundle defined there
- assertEquals("title",
bundle_en.getString("javax.portlet.title"));
- assertEquals("short-title",
bundle_en.getString("javax.portlet.short-title"));
- assertEquals("keywords",
bundle_en.getString("javax.portlet.keywords"));
- return new EndTestResponse();
- }
- });
}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/PortletConfigTestSuite.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/PortletConfigTestSuite.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletconfig/PortletConfigTestSuite.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,50 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.portletconfig;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.com">Boleslaw
Dawidowicz</a>
- * @version $Revision: 5510 $
- */
-public class PortletConfigTestSuite
-{
-
- public static void suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-portletconfig.war");
-//
-// /**
-// * SPEC:24 Testable= true Section=PLT.6.2
-// * - InlineValuesNotInResourcesBundlePortlet
-// */
-// suite.addTest(new TestCase("InlineValuesNotInResourceBundle"));
-//
-// /**
-// * SPEC:24 Testable= true Section=PLT.6.2
-// * - InlineValuesWithNoResourceBundleDefinedPortlet
-// */
-// suite.addTest(new
TestCase("InlineValuesWithNoResourceBundleDefined"));
-// return suite;
- }
-}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/AccessSameSetOfResourcesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/AccessSameSetOfResourcesTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/AccessSameSetOfResourcesTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,125 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletcontext;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.components.AbstractUniversalTestPortlet;
+import org.jboss.portal.test.framework.portlet.components.AbstractUniversalTestServlet;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.ServletServiceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Arrays;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_45})
+public class AccessSameSetOfResourcesTestCase
+{
+ public AccessSameSetOfResourcesTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ AbstractUniversalTestPortlet aport = (AbstractUniversalTestPortlet)portlet;
+ //we get resource and pass it to servlet
+ URL url =
aport.getPortletContext().getResource("/simple_resource.txt");
+ assertNotNull(url);
+ aport.getPortletContext().setAttribute("resource", url);
+
+ //and we construct resource content and pass to servlet
+ InputStream is =
aport.getPortletContext().getResourceAsStream("/simple_resource.txt");
+ assertNotNull(is);
+ byte[] byteArray = new byte[is.available()];
+ is.read(byteArray);
+ aport.getPortletContext().setAttribute("content", byteArray);
+
+ //then we dispatch to servlet
+ PortletRequestDispatcher dispatcher =
aport.getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+
+ dispatcher.include(request, response);
+ Object o = (Boolean)UTP1.local.get();
+ //assert out assertion was correct in Servlet
+ assertEquals(Boolean.TRUE, o);
+
+
+ return new EndTestResponse();
+ }
+ });
+
+ seq.addAction(0, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
+ {
+ public DriverResponse execute(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
+ {
+ AbstractUniversalTestServlet serv = ((AbstractUniversalTestServlet)servlet);
+ URL portletUrl =
(URL)serv.getServletContext().getAttribute("resource");
+ URL url =
serv.getServletContext().getResource("/simple_resource.txt");
+
+ byte[] portletByteArray =
(byte[])serv.getServletContext().getAttribute("content");
+ InputStream is =
serv.getServletContext().getResourceAsStream("/simple_resource.txt");
+ byte[] byteArray = new byte[is.available()];
+ is.read(byteArray);
+
+ if (portletUrl.equals(url) &&
+ Arrays.equals(portletByteArray, byteArray))
+ {
+ UTP1.local.set(Boolean.TRUE);
+ }
+ else
+ {
+ UTP1.local.set(Boolean.FALSE);
+ }
+ return null;
+ }
+
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
+ {
+ return null;
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/ContextAttributesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/ContextAttributesTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/ContextAttributesTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,101 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletcontext;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.components.AbstractUniversalTestPortlet;
+import org.jboss.portal.test.framework.portlet.components.AbstractUniversalTestServlet;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.ServletServiceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertTrue;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_44})
+public class ContextAttributesTestCase
+{
+ public ContextAttributesTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ AbstractUniversalTestPortlet aport = (AbstractUniversalTestPortlet)portlet;
+ aport.getPortletContext().setAttribute("sharedObject",
"sharedObjectValue");
+
+ PortletRequestDispatcher dispatcher =
aport.getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+
+
+ dispatcher.include(request, response);
+ Object o = (Boolean)UTP1.local.get();
+ //assert out object was accessible in ServletContext
+ assertEquals(Boolean.TRUE, o);
+
+ //assert we can access object which was set in ServletContext
+
assertTrue(aport.getPortletContext().getAttribute("sharedObject2").equals("sharedObjectValue2"));
+
+
+ return new EndTestResponse();
+ }
+ });
+
+ seq.addAction(0, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
+ {
+ public DriverResponse execute(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
+ {
+ AbstractUniversalTestServlet serv = ((AbstractUniversalTestServlet)servlet);
+
UTP1.local.set(serv.getServletContext().getAttribute("sharedObject").equals("sharedObjectValue")
? Boolean.TRUE : Boolean.FALSE);
+
((AbstractUniversalTestServlet)servlet).getServletContext().setAttribute("sharedObject2",
"sharedObjectValue2");
+ return null;
+ }
+
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
+ {
+ return null;
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/InitializationParametersTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/InitializationParametersTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/InitializationParametersTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,110 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletcontext;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.components.AbstractUniversalTestPortlet;
+import org.jboss.portal.test.framework.portlet.components.AbstractUniversalTestServlet;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.ServletServiceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_43})
+public class InitializationParametersTestCase
+{
+ public InitializationParametersTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ AbstractUniversalTestPortlet aport = (AbstractUniversalTestPortlet)portlet;
+ Enumeration enumeration = aport.getPortletContext().getInitParameterNames();
+ aport.getPortletContext().setAttribute("initParams", enumeration);
+
+ PortletRequestDispatcher dispatcher =
aport.getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+
+ dispatcher.include(request, response);
+ Object o = (Boolean)UTP1.local.get();
+ //assert that paths were compared successfully in Servlet
+ assertEquals(Boolean.TRUE, o);
+
+
+ return new EndTestResponse();
+ }
+ });
+
+ seq.addAction(0, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
+ {
+ return null;
+ }
+
+ public DriverResponse execute(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
+ {
+ AbstractUniversalTestServlet serv = ((AbstractUniversalTestServlet)servlet);
+ Enumeration portletEnumeration =
(Enumeration)serv.getServletContext().getAttribute("initParams");
+ Enumeration enumeration = serv.getServletContext().getInitParameterNames();
+
+ UTP1.local.set(compare(enumeration, portletEnumeration) ? Boolean.TRUE :
Boolean.FALSE);
+ return null;
+ }
+ });
+ }
+
+ /** Simple compare of two Enumerationss */
+ private boolean compare(Enumeration a, Enumeration b)
+ {
+ List al = Tools.toList(a);
+ List bl = Tools.toList(b);
+ return al.equals(bl);
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/PortletContextSequenceBuilder.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/PortletContextSequenceBuilder.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/PortletContextSequenceBuilder.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -64,232 +64,13 @@
/**
- * @portlet.specification assert="SPEC:43 - The initialization parameters
accessible through the PortletContext must
- * be the same that are accessible through the ServletContext of the portlet
application."
+ * @portlet.specification assert="SPEC:46 - "
*/
- public void createInitializationParametersCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("InitializationParameters", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- AbstractUniversalTestPortlet aport = (AbstractUniversalTestPortlet)portlet;
- Enumeration enumeration = aport.getPortletContext().getInitParameterNames();
- aport.getPortletContext().setAttribute("initParams", enumeration);
-
- PortletRequestDispatcher dispatcher =
aport.getPortletContext().getNamedDispatcher("UniversalServletA");
- assertNotNull(dispatcher);
-
- dispatcher.include(request, response);
- Object o = (Boolean)UTP1.local.get();
- //assert that paths were compared successfully in Servlet
- assertEquals(Boolean.TRUE, o);
-
-
- return new EndTestResponse();
- }
- });
-
- seq.addAction(0, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
- {
- protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
- {
- return null;
- }
-
- public DriverResponse execute(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
- {
- AbstractUniversalTestServlet serv = ((AbstractUniversalTestServlet)servlet);
- Enumeration portletEnumeration =
(Enumeration)serv.getServletContext().getAttribute("initParams");
- Enumeration enumeration = serv.getServletContext().getInitParameterNames();
-
- UTP1.local.set(compare(enumeration, portletEnumeration) ? Boolean.TRUE :
Boolean.FALSE);
- return null;
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:44 - Context attributes set using the
PortletContext must be stored in the
- * ServletContext of the portlet application. A direct consequence of this is that
data stored in the ServletContext
- * by servlets or JSPs is accessible to portlets through the PortletContext and vice
versa."
- */
- public void createContextAttributesCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ContextAttributes", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- AbstractUniversalTestPortlet aport = (AbstractUniversalTestPortlet)portlet;
- aport.getPortletContext().setAttribute("sharedObject",
"sharedObjectValue");
-
- PortletRequestDispatcher dispatcher =
aport.getPortletContext().getNamedDispatcher("UniversalServletA");
- assertNotNull(dispatcher);
-
-
- dispatcher.include(request, response);
- Object o = (Boolean)UTP1.local.get();
- //assert out object was accessible in ServletContext
- assertEquals(Boolean.TRUE, o);
-
- //assert we can access object which was set in ServletContext
-
assertTrue(aport.getPortletContext().getAttribute("sharedObject2").equals("sharedObjectValue2"));
-
-
- return new EndTestResponse();
- }
- });
-
- seq.addAction(0, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
- {
- public DriverResponse execute(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
- {
- AbstractUniversalTestServlet serv = ((AbstractUniversalTestServlet)servlet);
-
UTP1.local.set(serv.getServletContext().getAttribute("sharedObject").equals("sharedObjectValue")
? Boolean.TRUE : Boolean.FALSE);
-
((AbstractUniversalTestServlet)servlet).getServletContext().setAttribute("sharedObject2",
"sharedObjectValue2");
- return null;
- }
-
- protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
- {
- return null;
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:45 - The PortletContext must offer access
to the same set of resources the
- * ServletContext exposes."
- */
- public void createAccessSameSetOfResourcesCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("AccessSameSetOfResources", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- AbstractUniversalTestPortlet aport = (AbstractUniversalTestPortlet)portlet;
- //we get resource and pass it to servlet
- URL url =
aport.getPortletContext().getResource("/simple_resource.txt");
- assertNotNull(url);
- aport.getPortletContext().setAttribute("resource", url);
-
- //and we construct resource content and pass to servlet
- InputStream is =
aport.getPortletContext().getResourceAsStream("/simple_resource.txt");
- assertNotNull(is);
- byte[] byteArray = new byte[is.available()];
- is.read(byteArray);
- aport.getPortletContext().setAttribute("content", byteArray);
-
- //then we dispatch to servlet
- PortletRequestDispatcher dispatcher =
aport.getPortletContext().getNamedDispatcher("UniversalServletA");
- assertNotNull(dispatcher);
-
- dispatcher.include(request, response);
- Object o = (Boolean)UTP1.local.get();
- //assert out assertion was correct in Servlet
- assertEquals(Boolean.TRUE, o);
-
-
- return new EndTestResponse();
- }
- });
-
- seq.addAction(0, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
- {
- public DriverResponse execute(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
- {
- AbstractUniversalTestServlet serv = ((AbstractUniversalTestServlet)servlet);
- URL portletUrl =
(URL)serv.getServletContext().getAttribute("resource");
- URL url =
serv.getServletContext().getResource("/simple_resource.txt");
-
- byte[] portletByteArray =
(byte[])serv.getServletContext().getAttribute("content");
- InputStream is =
serv.getServletContext().getResourceAsStream("/simple_resource.txt");
- byte[] byteArray = new byte[is.available()];
- is.read(byteArray);
-
- if (portletUrl.equals(url) &&
- Arrays.equals(portletByteArray, byteArray))
- {
- UTP1.local.set(Boolean.TRUE);
- }
- else
- {
- UTP1.local.set(Boolean.FALSE);
- }
- return null;
- }
-
- protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
- {
- return null;
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:46 - The PortletContext must handle the
same temporary working directory the
- * ServletContext handles. It must be accessible as a context attribute using the same
constant defined in the
- * Servlet Specification 2.3 SVR 3 Servlet Context Chapter,
javax.servlet.context.tempdir."
- */
public void createTempDirCase(PortletTestDriver registry)
{
PortletTest seq = new PortletTest();
registry.addSequence("TempDir", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- AbstractUniversalTestPortlet aport = (AbstractUniversalTestPortlet)portlet;
- File tempDir =
(File)aport.getPortletContext().getAttribute("javax.servlet.context.tempdir");
- assertNotNull(tempDir);
- aport.getPortletContext().setAttribute("tempDirPath",
tempDir.getAbsolutePath());
- PortletRequestDispatcher dispatcher =
aport.getPortletContext().getNamedDispatcher("UniversalServletA");
- assertNotNull(dispatcher);
-
-
- dispatcher.include(request, response);
- Object o = (Boolean)UTP1.local.get();
- //assert that paths were compared successfully in Servlet
- assertEquals(Boolean.TRUE, o);
-
-
- return new EndTestResponse();
- }
- });
-
- seq.addAction(0, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
- {
- public DriverResponse execute(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
- {
- AbstractUniversalTestServlet serv = ((AbstractUniversalTestServlet)servlet);
- String path =
(String)serv.getServletContext().getAttribute("tempDirPath");
- File tempDir =
(File)serv.getServletContext().getAttribute("javax.servlet.context.tempdir");
- if (path != null && tempDir != null)
- {
- UTP1.local.set(path.equals(tempDir.getAbsolutePath()) ? Boolean.TRUE :
Boolean.FALSE);
- }
- return null;
- }
-
- protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
- {
- return null;
- }
- });
}
- /** Simple compare of two Enumerationss */
- private boolean compare(Enumeration a, Enumeration b)
- {
- List al = Tools.toList(a);
- List bl = Tools.toList(b);
- return al.equals(bl);
- }
}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/PortletContextTestSuite.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/PortletContextTestSuite.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/PortletContextTestSuite.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,64 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.portletcontext;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.com">Boleslaw
Dawidowicz</a>
- * @version $Revision: 5510 $
- */
-public class PortletContextTestSuite
-{
-
- public static void suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-portletcontext.war");
-//
-// /**
-// * SPEC:43 Testable=true Section=PLT.10.3
-// */
-// suite.addTest(new TestCase("InitializationParameters"));
-//
-// /**
-// * SPEC:44 Testable=true Section=PLT.10.3
-// */
-// suite.addTest(new TestCase("ContextAttributes"));
-//
-// /**
-// * SPEC:45 Testable=true Section=PLT.10.3
-// */
-// suite.addTest(new TestCase("AccessSameSetOfResources"));
-//
-// /**
-// * SPEC:46 Testable=true Section=PLT.10.3
-// */
-// suite.addTest(new TestCase("TempDir"));
-//
-// /**
-// * SPEC:47 Testable=true Section=PLT.10.3(servlet spec)
-// * NOT DONE - POSTPONED
-// */
-//
-// return suite;
- }
-}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/TempDirTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/TempDirTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletcontext/TempDirTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletcontext;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.components.AbstractUniversalTestPortlet;
+import org.jboss.portal.test.framework.portlet.components.AbstractUniversalTestServlet;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.ServletServiceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.File;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_46})
+public class TempDirTestCase
+{
+ public TempDirTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ AbstractUniversalTestPortlet aport = (AbstractUniversalTestPortlet)portlet;
+ File tempDir =
(File)aport.getPortletContext().getAttribute("javax.servlet.context.tempdir");
+ assertNotNull(tempDir);
+ aport.getPortletContext().setAttribute("tempDirPath",
tempDir.getAbsolutePath());
+ PortletRequestDispatcher dispatcher =
aport.getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+
+
+ dispatcher.include(request, response);
+ Object o = (Boolean)UTP1.local.get();
+ //assert that paths were compared successfully in Servlet
+ assertEquals(Boolean.TRUE, o);
+
+
+ return new EndTestResponse();
+ }
+ });
+
+ seq.addAction(0, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
+ {
+ public DriverResponse execute(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
+ {
+ AbstractUniversalTestServlet serv = ((AbstractUniversalTestServlet)servlet);
+ String path =
(String)serv.getServletContext().getAttribute("tempDirPath");
+ File tempDir =
(File)serv.getServletContext().getAttribute("javax.servlet.context.tempdir");
+ if (path != null && tempDir != null)
+ {
+ UTP1.local.set(path.equals(tempDir.getAbsolutePath()) ? Boolean.TRUE :
Boolean.FALSE);
+ }
+ return null;
+ }
+
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
+ {
+ return null;
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/ExceptionsDuringRequestHandlingTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/ExceptionsDuringRequestHandlingTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/ExceptionsDuringRequestHandlingTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletinterface;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+
+/**
+ * This case is based on:
+ * - ExceptionsDuringRequestHandlingControllerPortlet
+ * - PortletExceptionDuringRequestHandlingPortlet
+ * - RuntimeExceptionDuringRequestHandlingPortlet
+ * - UnavailableExceptionDuringProcessActionPortlet
+ * - UnavailableExceptionDuringRenderPortlet
+ *
+ * This test is disabled. Specification doesn't defined strictly portal behaviour
when
+ * one of the portlets throws PortletException. Currently in JBoss Portal if one portlet
+ * throws an PortletException than the rest of portlet of the page is not rendered - code
500
+ * is returned. Tests are based on different behaviour where rest of portlets are
rendered.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_17,TCKAssertion.JSR168_18,TCKAssertion.JSR168_19})
+public class ExceptionsDuringRequestHandlingTestCase
+{
+ public ExceptionsDuringRequestHandlingTestCase(PortletTest seq)
+ {
+ // suite.addTest(new
PortletTestCase("ExceptionsDuringRequestHandlingPortlet"));
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/ExceptionsOnInitTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/ExceptionsOnInitTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/ExceptionsOnInitTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,116 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletinterface;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import
org.jboss.portal.test.portlet.jsr168.tck.portletinterface.spec.PortletExceptionDuringInitPortlet;
+import
org.jboss.portal.test.portlet.jsr168.tck.portletinterface.spec.RuntimeExceptionDuringInitPortlet;
+import
org.jboss.portal.test.portlet.jsr168.tck.portletinterface.spec.UnavailableExceptionDuringInitPortlet;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_5,TCKAssertion.JSR168_6,TCKAssertion.JSR168_8})
+public class ExceptionsOnInitTestCase
+{
+ public ExceptionsOnInitTestCase(PortletTest seq)
+ {
+ //PortletExceptionDuringInitPortlet
+ seq.addAction(0, PortletExceptionDuringInitPortlet.RENDER_JOINPOINT, new
PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletExceptionDuringInitPortlet.rendered = true;
+ return null;
+ }
+ });
+
+ //RuntimeExceptionDuringInitPortlet
+ seq.addAction(0, RuntimeExceptionDuringInitPortlet.RENDER_JOINPOINT, new
PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ RuntimeExceptionDuringInitPortlet.rendered = true;
+ return null;
+ }
+ });
+
+ //UnavailableExceptionDuringInitPortlet
+ seq.addAction(0, UnavailableExceptionDuringInitPortlet.RENDER_JOINPOINT, new
PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ UnavailableExceptionDuringInitPortlet.rendered = true;
+ return null;
+ }
+ });
+
+ //ControllerPortlet
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //portlets shouldn't render itself
+ assertEquals(false, PortletExceptionDuringInitPortlet.rendered);
+ assertEquals(false, UnavailableExceptionDuringInitPortlet.rendered);
+ assertEquals(false, RuntimeExceptionDuringInitPortlet.rendered);
+
+ //and shouldn't be destroyed as Exceptions on init() were throwed
+ assertEquals(false, PortletExceptionDuringInitPortlet.destroyed);
+ assertEquals(false, UnavailableExceptionDuringInitPortlet.destroyed);
+ assertEquals(false, RuntimeExceptionDuringInitPortlet.destroyed);
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InitializeBeforeHandleTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InitializeBeforeHandleTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InitializeBeforeHandleTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletinterface;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import
org.jboss.portal.test.portlet.jsr168.tck.portletinterface.spec.InitializeBeforeHandlePortlet;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertTrue;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_4})
+public class InitializeBeforeHandleTestCase
+{
+ public InitializeBeforeHandleTestCase(PortletTest seq)
+ {
+ seq.addAction(0, InitializeBeforeHandlePortlet.RENDER_JOINPOINT, new
PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ assertTrue(InitializeBeforeHandlePortlet.init);
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InvokeActionFirstTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InvokeActionFirstTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InvokeActionFirstTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,80 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletinterface;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_9})
+public class InvokeActionFirstTestCase
+{
+
+ boolean actionInvoked;
+
+ public InvokeActionFirstTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ actionInvoked = true;
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ assertEquals(true, actionInvoked);
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InvokeRenderAfterActionURLTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InvokeRenderAfterActionURLTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InvokeRenderAfterActionURLTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,123 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletinterface;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTP2;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_10})
+public class InvokeRenderAfterActionURLTestCase
+{
+
+ boolean actionInvoked;
+
+ public InvokeRenderAfterActionURLTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.addAction(0, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //pass action url
+ UTP2.holder = response.createActionURL().toString();
+ return null;
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //get portlet b action url and invoke
+ assertNotNull(UTP2.holder);
+ return new InvokeGetResponse((String)UTP2.holder);
+ }
+ });
+
+ seq.addAction(2, UTP2.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ //mark action phase invokation
+ actionInvoked = true;
+ }
+ });
+
+ seq.addAction(2, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //assert that render is after Portlet B action
+ assertEquals(true, actionInvoked);
+ return null;
+ }
+ });
+
+ seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //assert that render is after Portlet B action
+ assertEquals(true, actionInvoked);
+ //and reinvoke itself
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.addAction(3, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InvokeRenderAfterRenderURLTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InvokeRenderAfterRenderURLTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/InvokeRenderAfterRenderURLTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletinterface;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTP2;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_11})
+public class InvokeRenderAfterRenderURLTestCase
+{
+ public InvokeRenderAfterRenderURLTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //mark that Portlet B was invoked after portlet A render url
+ UTP2.holder = Boolean.TRUE;
+ return null;
+ }
+ });
+
+ seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //assert Portlet B was invoked
+ assertEquals(Boolean.TRUE, (Object)UTP2.holder);
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/PortletInterfaceSequenceBuilder.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/PortletInterfaceSequenceBuilder.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/PortletInterfaceSequenceBuilder.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,394 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.portletinterface;
-
-import org.jboss.portal.test.framework.portlet.PortletTest;
-import org.jboss.portal.test.framework.portlet.PortletTestDriver;
-import org.jboss.portal.test.framework.portlet.PortletTestSuite;
-import org.jboss.portal.test.framework.portlet.PortletTestContext;
-import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
-import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
-import org.jboss.portal.test.framework.portlet.actions.ServletServiceTestAction;
-import org.jboss.portal.test.portlet.framework.UTP1;
-import org.jboss.portal.test.portlet.framework.UTP2;
-import org.jboss.portal.test.portlet.framework.UTS1;
-import
org.jboss.portal.test.portlet.jsr168.tck.portletinterface.spec.InitializeBeforeHandlePortlet;
-import
org.jboss.portal.test.portlet.jsr168.tck.portletinterface.spec.PortletExceptionDuringInitPortlet;
-import
org.jboss.portal.test.portlet.jsr168.tck.portletinterface.spec.RuntimeExceptionDuringInitPortlet;
-import
org.jboss.portal.test.portlet.jsr168.tck.portletinterface.spec.UnavailableExceptionDuringInitPortlet;
-import org.jboss.unit.driver.DriverResponse;
-import org.jboss.unit.driver.response.EndTestResponse;
-import org.jboss.unit.driver.response.FailureResponse;
-
-import static org.jboss.unit.api.Assert.*;
-import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
-import org.jboss.unit.Failure;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.Portlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
- * @version $Revision: 7954 $
- */
-public class PortletInterfaceSequenceBuilder extends PortletTestSuite
-{
-
- /**
- * @portlet.specification assert="SPEC:4 - After the portlet object is
instantiated, the portlet container must
- * initialize the portlet before invoking it to handle requests"
- */
- public void createInitializeBeforeHandleCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("InitializeBeforeHandle", seq);
- seq.addAction(0, InitializeBeforeHandlePortlet.RENDER_JOINPOINT, new
PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- assertTrue(InitializeBeforeHandlePortlet.init);
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:5 - During initialization, the portlet
object may throw an
- * UnavailableException or a PortletException. In this case, the portlet container
must not place the portlet object
- * into active service and it must release the portlet object."
- * @portlet.specification assert="SPEC:6 - The destroy method must not be called
because the initialization is
- * considered unsuccessful."
- * @portlet.specification assert="SPEC:8 - A RuntimeException thrown during
initialization must be handled as a
- * PortletException."
- */
- public void createExceptionsOnInitCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ExceptionsOnInit", seq);
- //PortletExceptionDuringInitPortlet
- seq.addAction(0, PortletExceptionDuringInitPortlet.RENDER_JOINPOINT, new
PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletExceptionDuringInitPortlet.rendered = true;
- return null;
- }
- });
-
- //RuntimeExceptionDuringInitPortlet
- seq.addAction(0, RuntimeExceptionDuringInitPortlet.RENDER_JOINPOINT, new
PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- RuntimeExceptionDuringInitPortlet.rendered = true;
- return null;
- }
- });
-
- //UnavailableExceptionDuringInitPortlet
- seq.addAction(0, UnavailableExceptionDuringInitPortlet.RENDER_JOINPOINT, new
PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- UnavailableExceptionDuringInitPortlet.rendered = true;
- return null;
- }
- });
-
- //ControllerPortlet
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //portlets shouldn't render itself
- assertEquals(false, PortletExceptionDuringInitPortlet.rendered);
- assertEquals(false, UnavailableExceptionDuringInitPortlet.rendered);
- assertEquals(false, RuntimeExceptionDuringInitPortlet.rendered);
-
- //and shouldn't be destroyed as Exceptions on init() were throwed
- assertEquals(false, PortletExceptionDuringInitPortlet.destroyed);
- assertEquals(false, UnavailableExceptionDuringInitPortlet.destroyed);
- assertEquals(false, RuntimeExceptionDuringInitPortlet.destroyed);
- return new EndTestResponse();
- }
- });
-
- }
-
- /**
- * @portlet.specification assert="SPEC:9 - If the client request is triggered by
an action URL, the
- * portal/portlet-container must first trigger the action request by invoking the
processAction method of the
- * targeted portlet."
- */
- public void createInvokeActionFirstCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("InvokeActionFirst", seq);
- final Boolean[] actionInvoked= new Boolean[1];
-
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- actionInvoked[0] = Boolean.TRUE;
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- assertEquals(Boolean.TRUE, actionInvoked[0]);
- return new EndTestResponse();
- }
- });
- }
-
-
- /**
- * @portlet.specification assert="SPEC:10 - The portal/portlet-container must
wait until the action request finishes.
- * Then, the portal/portlet-container must trigger the render request by invoking the
render method for all the
- * portlets in the portal page with the possible exception of portlets for which their
content is being cached."
- */
- public void createInvokeRenderAfterActionURLCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("InvokeRenderAfterActionURL", seq);
- final Boolean[] actionInvoked= new Boolean[1];
-
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- seq.addAction(0, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //pass action url
- UTP2.holder = response.createActionURL().toString();
- return null;
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //get portlet b action url and invoke
- assertNotNull(UTP2.holder);
- return new InvokeGetResponse((String)UTP2.holder);
- }
- });
-
- seq.addAction(2, UTP2.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- //mark action phase invokation
- actionInvoked[0] = Boolean.TRUE;
- }
- });
-
- seq.addAction(2, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //assert that render is after Portlet B action
- assertEquals(Boolean.TRUE, actionInvoked[0]);
- return null;
- }
- });
-
- seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //assert that render is after Portlet B action
- assertEquals(Boolean.TRUE, actionInvoked[0]);
- //and reinvoke itself
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- seq.addAction(3, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:11 - If the client request is triggered by
a render URL, the
- * portal/portlet-container must invoke the render method for all the portlets in the
portal page with the possible
- * exception of portlets for which their content is being cached."
- */
- public void createInvokeRenderAfterRenderURLCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("InvokeRenderAfterRenderURL", seq);
-
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- seq.addAction(1, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //mark that Portlet B was invoked after portlet A render url
- UTP2.holder = Boolean.TRUE;
- return null;
- }
- });
-
- seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //assert Portlet B was invoked
- assertEquals(Boolean.TRUE, (Object)UTP2.holder);
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:12 - While processing an action request,
the portlet may instruct the
- * portal/portlet-container to redirect the user to a specific URL. If the portlet
issues a redirection, when the
- * processAction method concludes, the portal/portlet-container must send the
redirection back to the user agent"
- */
- public void createSendRedirectDuringActionCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("SendRedirectDuringAction", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws PortletException, PortletSecurityException,
IOException
- {
- String path = request.getContextPath() + "/universalServletA";
- response.sendRedirect(path);
- }
- });
-
- seq.addAction(1, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
- {
- protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
- {
- return new EndTestResponse();
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //We shouldn't be here
- return new FailureResponse(Failure.createAssertionFailure("Render
wasn't expected to be invoked"));
- }
- });
- }
-
- public void createMinimizedStateDontRenderPortlet(PortletTestDriver registry)
- {
- registry.addSequence("MinimizedStateDontRenderPortlet", new
PortletTest());
- }
-
- /**
- * SPEC:17 Testable=true Section=PLT.5.2.4.4
- * SPEC:18 Testable=false Section=PLT.5.2.4.4
- * SPEC:19 Testable=true Section=PLT.5.2.4.4
- * This case is based on:
- * - ExceptionsDuringRequestHandlingControllerPortlet
- * - PortletExceptionDuringRequestHandlingPortlet
- * - RuntimeExceptionDuringRequestHandlingPortlet
- * - UnavailableExceptionDuringProcessActionPortlet
- * - UnavailableExceptionDuringRenderPortlet
- *
- * This test is disabled. Specification doesn't defined strictly portal behaviour
when
- * one of the portlets throws PortletException. Currently in JBoss Portal if one
portlet
- * throws an PortletException than the rest of portlet of the page is not rendered -
code 500
- * is returned. Tests are based on different behaviour where rest of portlets are
rendered.
- */
- /////suite.addTest(new
PortletTestCase("ExceptionsDuringRequestHandlingPortlet"));
-
-}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/SendRedirectDuringActionTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/SendRedirectDuringActionTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/SendRedirectDuringActionTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,96 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletinterface;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.framework.portlet.actions.ServletServiceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import org.jboss.unit.Failure;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_12})
+public class SendRedirectDuringActionTestCase
+{
+ public SendRedirectDuringActionTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws PortletException, PortletSecurityException,
IOException
+ {
+ String path = request.getContextPath() + "/universalServletA";
+ response.sendRedirect(path);
+ }
+ });
+
+ seq.addAction(1, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
+ {
+ return new EndTestResponse();
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //We shouldn't be here
+ return new FailureResponse(Failure.createAssertionFailure("Render
wasn't expected to be invoked"));
+ }
+ });
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/spec/ExceptionsDuringRequestHandlingControllerPortlet.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/spec/ExceptionsDuringRequestHandlingControllerPortlet.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/spec/ExceptionsDuringRequestHandlingControllerPortlet.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -42,15 +42,9 @@
*
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
* @version $Revision: 7954 $
- * @portlet.specification assert="SPEC:17 -"A PortletException signals that an
error has occurred during the processing
- * of the request and that the portlet container should take appropriate measures to
clean up the request. If a portlet
- * throws an exception in the processAction method, all operations on the ActionResponse
must be ignored and the render
- * method must not be invoked within the current client request"
- * @portlet.specification assert="SPEC:18 - If a permanent unavailability is
indicated by the UnavailableException, the
- * portlet container must remove the portlet from service immediately, call the portlet�s
destroy method, and release
- * the portlet object."
- * @portlet.specification assert="SPEC:19 - "A RuntimeException thrown during
the request handling must be handled as a
- * PortletException"
+ * @portlet.specification assert="SPEC:17 -""
+ * @portlet.specification assert="SPEC:18 - "
+ * @portlet.specification assert="SPEC:19 - ""
*/
public class ExceptionsDuringRequestHandlingControllerPortlet extends
AbstractTestPortlet
{
Modified:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/spec/MinimizedStateDontRenderPortlet.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/spec/MinimizedStateDontRenderPortlet.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletinterface/spec/MinimizedStateDontRenderPortlet.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -51,6 +51,16 @@
private String rendered;
+ // Error on purpose this does not seem used for now as it is hard to test
+ // so if it will be used we'll be aware of that
+ public MinimizedStateDontRenderPortlet()
+ {
+ super(MinimizedStateDontRenderPortlet.class);
+
+ //
+ throw new Error("");
+ }
+
protected void doView(final RenderRequest request, RenderResponse response) throws
PortletException, IOException
{
// Shouldn't be here
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/NotInvokeModeDeclaredForNotSupportedMarkupTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/NotInvokeModeDeclaredForNotSupportedMarkupTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/NotInvokeModeDeclaredForNotSupportedMarkupTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,115 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletmode;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import
org.jboss.portal.test.portlet.jsr168.tck.portletmode.spec.NotInvokeModeDeclaredForNotSupportedMarkupHelperPortlet;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertNull;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletModeException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletURL;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK(TCKAssertion.JSR168_38)
+public class NotInvokeModeDeclaredForNotSupportedMarkupTestCase
+{
+ public NotInvokeModeDeclaredForNotSupportedMarkupTestCase(PortletTest seq)
+ {
+ seq.addAction(0,
NotInvokeModeDeclaredForNotSupportedMarkupHelperPortlet.RENDER_JOINPOINT, new
PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletModeException
+ {
+ NotInvokeModeDeclaredForNotSupportedMarkupHelperPortlet.url =
response.createRenderURL();
+
NotInvokeModeDeclaredForNotSupportedMarkupHelperPortlet.url.setPortletMode(PortletMode.EDIT);
+ return null;
+ }
+ });
+
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //just repost so other portlet can create url in first render
+ PortletURL url = response.createRenderURL();
+ return new InvokeGetResponse(url.toString());
+
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //invoke render url from different portlet to be able to call specific mode
for it
+ //it has Mode set to EDIT
+ return new
InvokeGetResponse(NotInvokeModeDeclaredForNotSupportedMarkupHelperPortlet.url.toString());
+ }
+ });
+
+ seq.addAction(2,
NotInvokeModeDeclaredForNotSupportedMarkupHelperPortlet.RENDER_JOINPOINT, new
PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletModeException
+ {
+ if (request.getPortletMode().equals(PortletMode.EDIT))
+ {
+ //mark that we were invoked
+ UTP1.holder = Boolean.TRUE;
+ }
+ return null;
+ }
+ });
+
+ seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.addAction(3, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //check that other portlet wasn't invoked
+ assertNull(UTP1.holder);
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/PortletModeSequenceBuilder.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/PortletModeSequenceBuilder.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/PortletModeSequenceBuilder.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,128 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.portletmode;
-
-import org.jboss.portal.test.framework.portlet.PortletTest;
-import org.jboss.portal.test.framework.portlet.PortletTestDriver;
-import org.jboss.portal.test.framework.portlet.PortletTestSuite;
-import org.jboss.portal.test.framework.portlet.PortletTestContext;
-import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
-import org.jboss.portal.test.portlet.framework.UTP1;
-import
org.jboss.portal.test.portlet.jsr168.tck.portletmode.spec.NotInvokeModeDeclaredForNotSupportedMarkupHelperPortlet;
-import org.jboss.unit.driver.DriverResponse;
-import org.jboss.unit.driver.response.EndTestResponse;
-import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
-
-import static org.jboss.unit.api.Assert.*;
-
-import javax.portlet.Portlet;
-import javax.portlet.PortletMode;
-import javax.portlet.PortletModeException;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
- * @version $Revision: 7954 $
- */
-public class PortletModeSequenceBuilder extends PortletTestSuite
-{
- /**
- * @portlet.specification assert="SPEC:38 - The portlet must not be invoked in a
portlet mode that has not been
- * declared as supported for a given markup type"
- */
- public void createNotInvokeModeDeclaredForNotSupportedMarkupCase(PortletTestDriver
registry)
- {
- PortletTest seq = new PortletTest();
-
- seq.addAction(0,
NotInvokeModeDeclaredForNotSupportedMarkupHelperPortlet.RENDER_JOINPOINT, new
PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletModeException
- {
- NotInvokeModeDeclaredForNotSupportedMarkupHelperPortlet.url =
response.createRenderURL();
-
NotInvokeModeDeclaredForNotSupportedMarkupHelperPortlet.url.setPortletMode(PortletMode.EDIT);
- return null;
- }
- });
-
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //just repost so other portlet can create url in first render
- PortletURL url = response.createRenderURL();
- return new InvokeGetResponse(url.toString());
-
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //invoke render url from different portlet to be able to call specific mode
for it
- //it has Mode set to EDIT
- return new
InvokeGetResponse(NotInvokeModeDeclaredForNotSupportedMarkupHelperPortlet.url.toString());
- }
- });
-
- seq.addAction(2,
NotInvokeModeDeclaredForNotSupportedMarkupHelperPortlet.RENDER_JOINPOINT, new
PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletModeException
- {
- if (request.getPortletMode().equals(PortletMode.EDIT))
- {
- //mark that we were invoked
- UTP1.holder = Boolean.TRUE;
- }
- return null;
- }
- });
-
- seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- seq.addAction(3, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //check that other portlet wasn't invoked
- assertNull(UTP1.holder);
- return new EndTestResponse();
- }
- });
-
-// registry.addSequence("NotInvokeModeDeclaredForNotSupportedMarkup",
seq);
- }
-
- public void createRequestDispatchingDependingOnModePortlet(PortletTestDriver
registry)
- {
- registry.addSequence("RequestDispatchingDependingOnModePortlet", new
PortletTest());
- }
-}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/PortletModeTestSuite.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/PortletModeTestSuite.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/PortletModeTestSuite.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,56 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.portletmode;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.com">Boleslaw
Dawidowicz</a>
- * @version $Revision: 5510 $
- */
-public class PortletModeTestSuite
-{
- public static void suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-portletmode.war");
-//
-// /**
-// * SPEC:36 Testable=true Section=PLT.8.5
-// * - RequestDispatchingDependingOnModePortlet
-// */
-// suite.addTest(new
TestCase("RequestDispatchingDependingOnModePortlet"));
-//
-// /**
-// * SPEC:37 Testable=true Section=PLT.8.6
-// * Tested in SPEC:36 - RequestDispatchingDependingOnModePortlet as VIEW mode
isn't specified in descriptor
-// */
-//
-// /**
-// * SPEC:38 Testable=true Section=PLT.8.6
-// * - NotInvokeModeDeclaredForNotSupportedMarkupPortlet
-// * - NotInvokeModeDeclaredForNotSupportedMarkupHelperPortlet
-// */
-// //suite.addTest(new
TestCase("NotInvokeModeDeclaredForNotSupportedMarkup"));
-//
-// return suite;
- }
-}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/RequestDispatchingDependingOnModeTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/RequestDispatchingDependingOnModeTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/RequestDispatchingDependingOnModeTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,41 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletmode;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import
org.jboss.portal.test.portlet.jsr168.tck.portletmode.spec.RequestDispatchingDependingOnModePortlet;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_36,TCKAssertion.JSR168_37})
+public class RequestDispatchingDependingOnModeTestCase
+{
+ public RequestDispatchingDependingOnModeTestCase(PortletTest seq)
+ {
+ // RequestDispatchingDependingOnModePortlet will do all the job
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/spec/RequestDispatchingDependingOnModePortlet.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/spec/RequestDispatchingDependingOnModePortlet.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletmode/spec/RequestDispatchingDependingOnModePortlet.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -24,6 +24,7 @@
import org.jboss.portal.test.framework.portlet.components.AbstractTestGenericPortlet;
import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import
org.jboss.portal.test.portlet.jsr168.tck.portletmode.RequestDispatchingDependingOnModeTestCase;
import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
@@ -42,9 +43,7 @@
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
* @version $Revision: 7954 $
- * @portlet.specification assert="SPEC:36 - The GenericPortlet class implementation
of the render method dispatches
- * requests to the doView, doEdit or doHelp method depending on the portlet mode
indicated in the request using the
- * doDispatch method."
+ * @portlet.specification assert="SPEC:36 - ."
*/
public class RequestDispatchingDependingOnModePortlet extends AbstractTestGenericPortlet
{
@@ -52,8 +51,14 @@
/** . */
private String methodCall;
+ /** . */
private PortletTestContext context;
+ public RequestDispatchingDependingOnModePortlet()
+ {
+ super(RequestDispatchingDependingOnModeTestCase.class);
+ }
+
protected void doView(final RenderRequest request, RenderResponse response) throws
PortletException, IOException
{
if (context.getRequestCount() == 1)
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ActionToRenderParametersTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ActionToRenderParametersTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ActionToRenderParametersTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletrequests;
+
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK(TCKAssertion.JSR168_52)
+public class ActionToRenderParametersTestCase
+{
+ public ActionToRenderParametersTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ //set parameters for render phase
+ response.setRenderParameter("key1", "k1value1");
+ response.setRenderParameter("key2", new
String[]{"k2value1", "k2value2", "k2value3"});
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //assert that we received parameters from action phase
+ assertEquals("k1value1", request.getParameter("key1"));
+ assertEquals(new String[]{"k2value1", "k2value2",
"k2value3"}, request.getParameterValues("key2"));
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ActionToRequestParametersNotPropagatedTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ActionToRequestParametersNotPropagatedTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ActionToRequestParametersNotPropagatedTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletrequests;
+
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertNull;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK(TCKAssertion.JSR168_50)
+public class ActionToRequestParametersNotPropagatedTestCase
+{
+ public ActionToRequestParametersNotPropagatedTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ url.setParameter("key1", "k1value1");
+ url.setParameter("key2", new String[]{"k2value1",
"k2value2", "k2value3"});
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ //assert that we received parameters from render
+ assertEquals("k1value1", request.getParameter("key1"));
+ assertEquals(new String[]{"k2value1", "k2value2",
"k2value3"}, request.getParameterValues("key2"));
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //assert that parameters weren't propagated from Action phase
+ assertNull(request.getParameter("key1"));
+ assertNull(request.getParameter("key2"));
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/AuthTypeTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/AuthTypeTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/AuthTypeTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletrequests;
+
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertNull;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK(TCKAssertion.JSR168_60)
+public class AuthTypeTestCase
+{
+ public AuthTypeTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ //in current testsuite there is no user authentication
+ assertNull(request.getAuthType());
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //in current testsuite there is no user authentication
+ assertNull(request.getAuthType());
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ContentTypeTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ContentTypeTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ContentTypeTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,82 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletrequests;
+
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import java.util.Enumeration;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK(TCKAssertion.JSR168_61)
+public class ContentTypeTestCase
+{
+ public ContentTypeTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ Enumeration types = request.getResponseContentTypes();
+
+ //assert that first element is retrieved as defined in spec
+ assertEquals((String)types.nextElement(), request.getResponseContentType());
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ContextPathTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ContextPathTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ContextPathTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,96 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletrequests;
+
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertTrue;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_58,TCKAssertion.JSR168_59})
+public class ContextPathTestCase
+{
+ public ContextPathTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ String path = request.getContextPath();
+ //empty string is allowed by spec if portlet is based in server root
+ if (!path.equals(""))
+ {
+ //if not it should meet following constraints
+ assertTrue(!path.equals("/"));
+ assertTrue(path.subSequence(0, 1).equals("/"));
+ assertTrue(!path.subSequence(path.length() - 1,
path.length()).equals("/"));
+ }
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //and we test the same for RenderRequest
+
+ String path = request.getContextPath();
+ //empty string is allowed by spec if portlet is based in server root
+ if (!path.equals(""))
+ {
+ //if not it should meet following constraints
+ assertTrue(path.subSequence(0, 1).equals("/"));
+ assertTrue(!path.subSequence(path.length() - 1,
path.length()).equals("/"));
+ }
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ObtainingInputStreamAndReaderTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ObtainingInputStreamAndReaderTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ObtainingInputStreamAndReaderTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,116 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletrequests;
+
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.fail;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK(TCKAssertion.JSR168_63)
+public class ObtainingInputStreamAndReaderTestCase
+{
+ public ObtainingInputStreamAndReaderTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException
+ {
+ request.getPortletInputStream();
+ try
+ {
+ //obtaining Reader after InputStream should cause exception
+ request.getReader();
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(2, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException
+ {
+ request.getReader();
+ try
+ {
+ //obtaining InputStream after Reader should cause exception
+ request.getPortletInputStream();
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
+ }
+ });
+
+ seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ParameterAccessMethodTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ParameterAccessMethodTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ParameterAccessMethodTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletrequests;
+
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_55,TCKAssertion.JSR168_56})
+public class ParameterAccessMethodTestCase
+{
+ public ParameterAccessMethodTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ //set some parameters for testing
+ url.setParameter("key1", "k1value1");
+ url.setParameter("key2", new String[]{"k2value1",
"k2value2", "k2value3"});
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ assertEquals("k1value1", request.getParameter("key1"));
+ //assert it returns one element array
+ assertEquals(new String[]{"k1value1"},
request.getParameterValues("key1"));
+
+ assertEquals(new String[]{"k2value1", "k2value2",
"k2value3"}, request.getParameterValues("key2"));
+ //assert it returns first array element
+ assertEquals("k2value1", request.getParameter("key2"));
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ParametersDuringRenderNotTargetedTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ParametersDuringRenderNotTargetedTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/ParametersDuringRenderNotTargetedTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,131 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletrequests;
+
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP2;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertNull;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_51,TCKAssertion.JSR168_54})
+public class ParametersDuringRenderNotTargetedTestCase
+{
+
+ String url;
+
+ public ParametersDuringRenderNotTargetedTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL portletURL = response.createRenderURL();
+ portletURL.setParameter("portlet2key1", "p2k1value1");
+ portletURL.setParameter("portlet2key2", new
String[]{"p2k2value1", "p2k2value2", "p2k2value3"});
+ url = portletURL.toString();
+ return null;
+ }
+ });
+
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //just repost so other portlet can create url in first render
+ PortletURL url = response.createRenderURL();
+
+ //we are setting params to ourselves to test if they will last while request
to another porltet
+ url.setParameter("portlet1key1", "p1k1value1");
+ url.setParameter("portlet1key2", new
String[]{"p1k2value1", "p1k2value2", "p1k2value3"});
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //invoke render url from different portlet to be able to pass some params to
it
+ return new InvokeGetResponse(url);
+ }
+ });
+
+ seq.addAction(2, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ assertEquals("p2k1value1",
request.getParameter("portlet2key1"));
+ assertEquals(new String[]{"p2k2value1", "p2k2value2",
"p2k2value3"}, request.getParameterValues("portlet2key2"));
+ return null;
+ }
+ });
+
+ seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //we test if we have params set during requestCount==0, becouse our portlet
+ //wasn't targeted in current render request
+
+ //assert that we didn't received params targeted to other portlet
+ assertNull(request.getParameter("portlet2key1"));
+ assertNull(request.getParameter("portlet2key2"));
+
+ assertEquals("p1k1value1",
request.getParameter("portlet1key1"));
+ assertEquals(new String[]{"p1k2value1", "p1k2value2",
"p1k2value3"}, request.getParameterValues("portlet1key2"));
+
+ //and just repost so other portlet render invokation can be finished
+ PortletURL url = response.createRenderURL();
+ return new InvokeGetResponse(url.toString());
+
+ }
+ });
+
+ seq.addAction(3, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //second portlet asserted if it received correct parameters during render
request
+ //we simply end test
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestTestSuite.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestTestSuite.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestTestSuite.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,105 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.portletrequests;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5510 $
- */
-public class PortletRequestTestSuite
-{
- public static void suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-portletrequests.war");
-//
-// /**
-// * SPEC:48 Testable=true Section=PLT.11.1.1
-// * SPEC:49 Testable=true Section=PLT.11.1.1
-// * NOT TESTABLE - POSTPONED
-// */
-// /**
-// * SPEC:50 Testable= true Section=PLT.11.1.1
-// */
-// suite.addTest(new TestCase("ActionToRequestParametersNotPropagated"));
-//
-// /**
-// * SPEC:52 Testable=true Section=PLT.11.1.1
-// */
-// suite.addTest(new TestCase("ActionToRenderParameters"));
-//
-// /**
-// * SPEC:51 Testable=true Section=PLT.11.1.1
-// * SPEC:54 Testable=true Section=PLT.11.1.1
-// */
-// suite.addTest(new TestCase("ParametersDuringRenderNotTargeted"));
-//
-// /**
-// * SPEC:53 Testable= true Section=PLT.11.1.1
-// * NOT TESTABLE - Postponed
-// */
-//
-// /**
-// * SPEC:55 Testable=true Section=PLT.11.1.1
-// * SPEC:56 Testable=true Section=PLT.11.1.1
-// */
-// suite.addTest(new TestCase("ParameterAccessMethodst"));
-//
-// /**
-// * SPEC:57 Testable=false Section=PLT.11.1.2
-// * Testable=fale
-// */
-//
-// /**
-// * SPEC:58 Testable= true Section=PLT.11.1.5
-// * SPEC:59 Testable=true Section=PLT.11.1.5
-// */
-// suite.addTest(new TestCase("ContextPath"));
-//
-// /**
-// * SPEC:60 Testable=true Section=PLT.11.1.7
-// */
-// suite.addTest(new TestCase("AuthType"));
-//
-// /**
-// * SPEC:61 Testable=true Section=PLT.11.1.7
-// */
-// suite.addTest(new TestCase("ContentType"));
-//
-// /**
-// * SPEC:62 Testable=true Section=PLT.11.1.7
-// * NOT TESTABLE NOW AS PORTAL DOESN'T SUPPORT ADDITIONAL CONTENT TYPES
-// */
-//
-// /**
-// * SPEC:63 Testable=true Section=PLT.11.2.1
-// */
-// suite.addTest(new TestCase("ObtainingInputStreamAndReader"));
-//
-// /**
-// * SPEC:64 Testable=true Section=PLT.11.2.1
-// * NOT TESTABLE - Postponed
-// */
-//
-// return suite;
- }
-}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestsSequenceBuilder.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestsSequenceBuilder.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletrequests/PortletRequestsSequenceBuilder.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,480 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.portletrequests;
-
-import org.jboss.portal.test.framework.portlet.PortletTest;
-import org.jboss.portal.test.framework.portlet.PortletTestDriver;
-import org.jboss.portal.test.framework.portlet.PortletTestSuite;
-import org.jboss.portal.test.framework.portlet.PortletTestContext;
-import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
-import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
-import org.jboss.portal.test.portlet.framework.UTP1;
-import org.jboss.portal.test.portlet.framework.UTP2;
-import org.jboss.unit.driver.response.EndTestResponse;
-import org.jboss.unit.driver.DriverResponse;
-import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
-
-import static org.jboss.unit.api.Assert.*;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.Portlet;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.util.Enumeration;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
- * @version $Revision: 7954 $
- */
-public class PortletRequestsSequenceBuilder extends PortletTestSuite
-{
-
- private final byte[] byteContent = {65, 66, 67, 68, 69, 70};
-
- /**
- * @portlet.specification assert="SPEC:50 - The portlet-container must not
propagate parameters received in an action
- * request to subsequent render requests of the portlet."
- */
- public void createActionToRequestParametersNotPropagatedCase(PortletTestDriver
registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ActionToRequestParametersNotPropagated", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- url.setParameter("key1", "k1value1");
- url.setParameter("key2", new String[]{"k2value1",
"k2value2", "k2value3"});
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- //assert that we received parameters from render
- assertEquals("k1value1", request.getParameter("key1"));
- assertEquals(new String[]{"k2value1", "k2value2",
"k2value3"}, request.getParameterValues("key2"));
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //assert that parameters weren't propagated from Action phase
- assertNull(request.getParameter("key1"));
- assertNull(request.getParameter("key2"));
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:52 - If a portlet receives a render
request following an action request as
- * part of the same client request, the parameters received with render request must
be the render parameters set
- * during the action request."
- */
- public void createActionToRenderParametersCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ActionToRenderParameters", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- //set parameters for render phase
- response.setRenderParameter("key1", "k1value1");
- response.setRenderParameter("key2", new
String[]{"k2value1", "k2value2", "k2value3"});
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //assert that we received parameters from action phase
- assertEquals("k1value1", request.getParameter("key1"));
- assertEquals(new String[]{"k2value1", "k2value2",
"k2value3"}, request.getParameterValues("key2"));
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:51 - If a portlet receives a render
request that is the result of a client
- * request targeted to another portlet in the portal page, the parameters must be the
same parameters as of the
- * previous render request."
- * @portlet.specification assert="SPEC:54 - A portlet must not see any parameter
targeted to other portlets."
- */
- public void createParametersDuringRenderNotTargetedCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ParametersDuringRenderNotTargeted", seq);
- final String[] urls = new String[1];
- seq.addAction(0, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createRenderURL();
- url.setParameter("portlet2key1", "p2k1value1");
- url.setParameter("portlet2key2", new
String[]{"p2k2value1", "p2k2value2", "p2k2value3"});
- urls[0] = url.toString();
- return null;
- }
- });
-
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //just repost so other portlet can create url in first render
- PortletURL url = response.createRenderURL();
-
- //we are setting params to ourselves to test if they will last while request
to another porltet
- url.setParameter("portlet1key1", "p1k1value1");
- url.setParameter("portlet1key2", new
String[]{"p1k2value1", "p1k2value2", "p1k2value3"});
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //invoke render url from different portlet to be able to pass some params to
it
- return new InvokeGetResponse(urls[0]);
- }
- });
-
- seq.addAction(2, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- assertEquals("p2k1value1",
request.getParameter("portlet2key1"));
- assertEquals(new String[]{"p2k2value1", "p2k2value2",
"p2k2value3"}, request.getParameterValues("portlet2key2"));
- return null;
- }
- });
-
- seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //we test if we have params set during requestCount==0, becouse our portlet
- //wasn't targeted in current render request
-
- //assert that we didn't received params targeted to other portlet
- assertNull(request.getParameter("portlet2key1"));
- assertNull(request.getParameter("portlet2key2"));
-
- assertEquals("p1k1value1",
request.getParameter("portlet1key1"));
- assertEquals(new String[]{"p1k2value1", "p1k2value2",
"p1k2value3"}, request.getParameterValues("portlet1key2"));
-
- //and just repost so other portlet render invokation can be finished
- PortletURL url = response.createRenderURL();
- return new InvokeGetResponse(url.toString());
-
- }
- });
-
- seq.addAction(3, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //second portlet asserted if it received correct parameters during render
request
- //we simply end test
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:55 - The getParameterValues method returns
an array of String objects
- * containing all the parameter values associated with a parameter name. The value
returned from the getParameter
- * method must be the first value in the array of String objects returned by
getParameterValues"
- * @portlet.specification assert="SPEC:56 - If there is a single parameter value
associated with a parameter name the
- * method returns must return an array of size one containing the parameter
value"
- */
- public void createParameterAccessMethodstCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ParameterAccessMethodst", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- //set some parameters for testing
- url.setParameter("key1", "k1value1");
- url.setParameter("key2", new String[]{"k2value1",
"k2value2", "k2value3"});
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- assertEquals("k1value1", request.getParameter("key1"));
- //assert it returns one element array
- assertEquals(new String[]{"k1value1"},
request.getParameterValues("key1"));
-
- assertEquals(new String[]{"k2value1", "k2value2",
"k2value3"}, request.getParameterValues("key2"));
- //assert it returns first array element
- assertEquals("k2value1", request.getParameter("key2"));
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:58 - The context path of a request is
exposed via the request object. The
- * context path is the path prefix associated with the deployed portlet application.
If the portlet application is
- * rooted at the base of the web server URL namespace (also known as
"default" context), this path must be an empty
- * string"
- * @portlet.specification assert="SPEC:59 - "Otherwise, it must be the path
the portlet application is rooted to, the
- * path must start with a '/' and it must not end with a '/'
character."
- */
- public void createContextPathCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ContextPath", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- String path = request.getContextPath();
- //empty string is allowed by spec if portlet is based in server root
- if (!path.equals(""))
- {
- //if not it should meet following constraints
- assertTrue(!path.equals("/"));
- assertTrue(path.subSequence(0, 1).equals("/"));
- assertTrue(!path.subSequence(path.length() - 1,
path.length()).equals("/"));
- }
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //and we test the same for RenderRequest
-
- String path = request.getContextPath();
- //empty string is allowed by spec if portlet is based in server root
- if (!path.equals(""))
- {
- //if not it should meet following constraints
- assertTrue(path.subSequence(0, 1).equals("/"));
- assertTrue(!path.subSequence(path.length() - 1,
path.length()).equals("/"));
- }
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:60 - If the user is not authenticated the
getAuthType method must return
- * null"
- */
- public void createAuthTypeCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("AuthType", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- //in current testsuite there is no user authentication
- assertNull(request.getAuthType());
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //in current testsuite there is no user authentication
- assertNull(request.getAuthType());
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:61 - If the portlet container supports
additional content types for the
- * portlet�s output, it must declare the additional content types through the
getResponseContentTypes method of the
- * request object. The returned Enumeration of strings should contain the content
types the portlet container
- * supports in order of preference. The first element of the enumeration must be the
same content type returned by
- * the getResponseContentType method."
- */
- public void createContentTypeCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ContentType", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- Enumeration types = request.getResponseContentTypes();
-
- //assert that first element is retrieved as defined in spec
- assertEquals((String)types.nextElement(), request.getResponseContentType());
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
-
- }
-
- /**
- * @portlet.specification assert="SPEC:63 - Only one of the two methods,
getPortletInputStream or getReader, can be
- * used during an action request. If the input stream is obtained, a call to the
getReader must throw an
- * IllegalStateException. Similarly, if the reader is obtained, a call to the
getPortletInputStream must throw an
- * IllegalStateException."
- */
- public void createObtainingInputStreamAndReaderCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ObtainingInputStreamAndReader", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException
- {
- request.getPortletInputStream();
- try
- {
- //obtaining Reader after InputStream should cause exception
- request.getReader();
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected
- }
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(2, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException
- {
- request.getReader();
- try
- {
- //obtaining InputStream after Reader should cause exception
- request.getPortletInputStream();
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected
- }
- }
- });
-
- seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
-
-
- }
-}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/BufferResetTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/BufferResetTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/BufferResetTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,82 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.fail;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_83})
+public class BufferResetTestCase
+{
+ public BufferResetTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //here we should test if after resetBuffer() response properties were
cleared
+ //but it's rather hard to do this now as there is no getProperty()
method.
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException
+ {
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+ writer.flush();
+ writer.close();
+ try
+ {
+ response.resetBuffer();
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/BufferSizeTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/BufferSizeTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/BufferSizeTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertTrue;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_80,TCKAssertion.JSR168_81})
+public class BufferSizeTestCase
+{
+ public BufferSizeTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ // No buffering is defined
+ assertEquals(0, response.getBufferSize());
+
+ // We define buffer size
+ response.setBufferSize(1000000);
+
+ // And assert that buffer size is at least what we set
+ assertTrue(response.getBufferSize() >= 1000000);
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/GetContentTypeTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/GetContentTypeTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/GetContentTypeTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertNull;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_78})
+public class GetContentTypeTestCase
+{
+ public GetContentTypeTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ try
+ {
+ //content type wasn't set
+ assertNull(response.getContentType());
+
+ response.setContentType("text/html");
+
+ assertEquals("text/html", response.getContentType());
+
+ }
+ catch (IllegalStateException e)
+ {
+ //expected as no content type was set
+ }
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/IllegalStateExceptionAfterSendRedirectTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/IllegalStateExceptionAfterSendRedirectTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/IllegalStateExceptionAfterSendRedirectTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,98 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.framework.portlet.actions.ServletServiceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS2;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import org.jboss.unit.Failure;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_71})
+public class IllegalStateExceptionAfterSendRedirectTestCase
+{
+ public IllegalStateExceptionAfterSendRedirectTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException
+ {
+ response.sendRedirect(request.getContextPath() +
"/universalServletB");
+ //this should be propagated to the portlet to not invoke redirection
+ throw new IllegalStateException();
+ }
+ });
+
+ seq.addAction(1, UTS2.SERVICE_JOINPOINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
+ {
+ return new FailureResponse(Failure.createAssertionFailure("Redirection
shouldn't be made"));
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //if redirect wasn't called we should be here. Alternatively we should
use other portlet
+ //with same test id to render the response.
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/NamespaceEncodingTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/NamespaceEncodingTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/NamespaceEncodingTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,85 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertTrue;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_86,TCKAssertion.JSR168_87,TCKAssertion.JSR168_88})
+public class NamespaceEncodingTestCase
+{
+ public NamespaceEncodingTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ String namespace = response.getNamespace();
+
+ //assert it is valid Java identifier
+ assertTrue(isJavaIdentifier(namespace));
+
+ //check if it always return same value in scope of render request
+ assertEquals(namespace, response.getNamespace());
+
+ assertEquals(namespace, response.getNamespace());
+
+ assertEquals(namespace, response.getNamespace());
+ return new EndTestResponse();
+ }
+ });
+ }
+
+ /** Checks if string is valid java identifier as defined in 'Java Language
Specification' */
+ public static boolean isJavaIdentifier(String s)
+ {
+ if (s.length() == 0 || !Character.isJavaIdentifierStart(s.charAt(0)))
+ {
+ return false;
+ }
+ for (int i = 1; i < s.length(); i++)
+ {
+ if (!Character.isJavaIdentifierPart(s.charAt(i)))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/NotAllowedModeTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/NotAllowedModeTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/NotAllowedModeTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.fail;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_67})
+public class NotAllowedModeTestCase
+{
+ public NotAllowedModeTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ try
+ {
+ response.setPortletMode(PortletMode.EDIT);
+ fail();
+ }
+ catch (PortletModeException e)
+ {
+ //expected
+ }
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/NotSupportedWindowStateTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/NotSupportedWindowStateTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/NotSupportedWindowStateTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.fail;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.WindowState;
+import javax.portlet.WindowStateException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_68})
+public class NotSupportedWindowStateTestCase
+{
+ public NotSupportedWindowStateTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ try
+ {
+ response.setWindowState(new WindowState("UnsupportedState"));
+ fail();
+ }
+ catch (WindowStateException e)
+ {
+ //expected
+ }
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/OutputStreamOrWriterTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/OutputStreamOrWriterTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/OutputStreamOrWriterTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,99 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.fail;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_79})
+public class OutputStreamOrWriterTestCase
+{
+ public OutputStreamOrWriterTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException
+ {
+ response.setContentType("text/html");
+ response.getWriter();
+ try
+ {
+ response.getPortletOutputStream();
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException
+ {
+ //we need this to be able to marshal the result
+ response.setContentType("text/html");
+ OutputStream os = response.getPortletOutputStream();
+
+ //and now the test
+ try
+ {
+ response.getWriter();
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
+
+ //workaroud to correctly end this test:
+ //we can't use AbstractTestPortet.marshalle() because we cannot obtain
+ //writer from response as OutputStream was used.
+// Writer writer = new OutputStreamWriter(os);
+// ServerResultMarshaller.marshall(, writer,
TestCaseContext.getCurrentTestCaseId());
+// writer.close();
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/ParametersSetAfterSendRedirectTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/ParametersSetAfterSendRedirectTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/ParametersSetAfterSendRedirectTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,119 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.framework.portlet.actions.ServletServiceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.fail;
+import org.jboss.unit.Failure;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_74,TCKAssertion.JSR168_75})
+public class ParametersSetAfterSendRedirectTestCase
+{
+ public ParametersSetAfterSendRedirectTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException
+ {
+ response.sendRedirect(request.getContextPath() +
"/universalServletA");
+
+ try
+ {
+ response.setRenderParameter("key", "value");
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
+
+ try
+ {
+ Map map = new HashMap();
+ map.put("key", new String[]{"value"});
+ response.setRenderParameters(map);
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
+ }
+ });
+
+ seq.addAction(1, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
+ {
+ return new EndTestResponse();
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new FailureResponse(Failure.createAssertionFailure("Render
wasn't expected"));
+ }
+ });
+ }
+}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesSequenceBuilder.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesSequenceBuilder.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesSequenceBuilder.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,848 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
-
-import org.jboss.portal.test.framework.portlet.PortletTest;
-import org.jboss.portal.test.framework.portlet.PortletTestDriver;
-import org.jboss.portal.test.framework.portlet.PortletTestSuite;
-import org.jboss.portal.test.framework.portlet.PortletTestContext;
-import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
-import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
-import org.jboss.portal.test.framework.portlet.actions.ServletServiceTestAction;
-import org.jboss.portal.test.portlet.framework.UTP1;
-import org.jboss.portal.test.portlet.framework.UTS1;
-import org.jboss.portal.test.portlet.framework.UTS2;
-import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
-import org.jboss.unit.driver.DriverResponse;
-import org.jboss.unit.driver.response.EndTestResponse;
-import org.jboss.unit.driver.response.FailureResponse;
-
-import static org.jboss.unit.api.Assert.*;
-import org.jboss.unit.Failure;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.Portlet;
-import javax.portlet.PortletMode;
-import javax.portlet.PortletModeException;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.WindowState;
-import javax.portlet.WindowStateException;
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
- * @version $Revision: 7954 $
- */
-public class PortletResponsesSequenceBuilder extends PortletTestSuite
-{
- /**
- * @portlet.specification assert="SPEC:65 - The sendRedirect method instructs the
portal/portlet-container to set the
- * appropriate headers and content body to redirect the user to a different URL. A
fully qualified URL or a full path
- * URL must be specified. If a relative path URL is given, an IllegalArgumentException
must be thrown."
- */
- public void createSendRedirectWithRelativeURLCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("SendRedirectWithRelativeURL", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException
- {
- try
- {
- response.sendRedirect("relative_url");
- fail();
- }
- catch (IllegalArgumentException e)
- {
- //expected
- }
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:66 - If the sendRedirect method is called
after the setPortletMode,
- * setWindowState, setRenderParameter or setRenderParameters methods of the
ActionResponse interface, an
- * IllegalStateException must be thrown and the redirection must not be
executed"
- */
- public void createSendRedirectAfterChangeStateMethodsCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("SendRedirectAfterChangeStateMethods", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws PortletModeException, IOException
- {
- response.setPortletMode(PortletMode.VIEW);
- try
- {
- response.sendRedirect(request.getContextPath());
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected
- }
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(2, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException, WindowStateException
- {
- response.setWindowState(WindowState.NORMAL);
- try
- {
- response.sendRedirect(request.getContextPath());
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected
- }
- }
- });
-
- seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(3, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException
- {
- response.setRenderParameter("key", "value");
- try
- {
- response.sendRedirect(request.getContextPath());
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected
- }
- }
- });
-
- seq.addAction(3, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(4, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException
- {
- Map map = new HashMap();
- map.put("key", new String[]{"value"});
- response.setRenderParameters(map);
- try
- {
- response.sendRedirect(request.getContextPath());
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected
- }
- }
- });
-
- seq.addAction(4, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:67 - The setPortletMode method allows a
portlet to change its current portlet
- * mode. The new portlet mode would be effective in the following render request. If a
portlet attempts to set a
- * portlet mode that is not allowed to switch to, a PortletModeException must be
thrown."
- */
- public void createNotAllowedModeCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("NotAllowedMode", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- try
- {
- response.setPortletMode(PortletMode.EDIT);
- fail();
- }
- catch (PortletModeException e)
- {
- //expected
- }
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:68 - The setWindowState method allows a
portlet to change its current window
- * state. The new window state would be effective in the following render request. If
a portlet attempts to set a
- * window state that it is not allowed to switch to, a WindowStateException must be
thrown."
- */
- public void createNotSupportedWindowStateCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("NotSupportedWindowState", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- try
- {
- response.setWindowState(new WindowState("UnsupportedState"));
- fail();
- }
- catch (WindowStateException e)
- {
- //expected
- }
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:69 - If the setPortletMode or
setWindowState methods are called after the
- * sendRedirect method has been called an IllegalStateException must be thrown."
- * @portlet.specification assert="SPEC:70 - If the exception is caught by the
portlet, the redirection must be
- * executed."
- */
- public void createStateChangesAfterRedirectionSendCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("StateChangesAfterRedirectionSend", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException, PortletModeException,
WindowStateException
- {
- response.sendRedirect(request.getContextPath() +
"/universalServletA");
-
- try
- {
- response.setPortletMode(PortletMode.VIEW);
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected
- }
-
- try
- {
- response.setWindowState(WindowState.NORMAL);
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected
- }
- }
- });
-
- seq.addAction(1, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
- {
- protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
- {
- return new EndTestResponse();
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new FailureResponse(Failure.createAssertionFailure("Render
wasn't expected to be called"));
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:72 - Using the setRenderParameter and
setRenderParameters methods of the
- * ActionResponse interface portlets may set render parameters during an action
request. A call to any of the
- * setRenderParameter methods must replace any parameter with the same name previously
set."
- * @portlet.specification assert="SPEC:73 - If no render parameters are set
during the processAction invocation, the
- * render request must not contain any request parameters."
- */
- public void createRenderParametersCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("RenderParameters", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- response.setRenderParameter("key1", "some strange value to
overwrite");
- response.setRenderParameter("key2", "some strange value to
overwrite 2");
- response.setRenderParameter("key1", "k1value1");
- response.setRenderParameter("key2", new
String[]{"k2value1", "k2value2", "k2value3"});
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //we should receive overwrite values
- assertEquals("k1value1", request.getParameter("key1"));
- assertEquals(new String[]{"k2value1", "k2value2",
"k2value3"}, request.getParameterValues("key2"));
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(2, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- // Don't set any parameter
- }
- });
-
- seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- // We shouldn't receive anything as no parameters were set during action
phase
- assertEquals(Collections.EMPTY_MAP, request.getParameterMap());
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:74 - If the setRenderParameter or
setRenderParameters methods are called after
- * the sendRedirect method has been called an IllegalStateException must be
thrown"
- * @portlet.specification assert="SPEC:75 - If the exception is caught by the
portlet, the redirection must be
- * executed. If the exception is propagated back to the portlet-container, the
redirection must not be executed."
- */
- public void createParametersSetAfterSendRedirectCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ParametersSetAfterSendRedirect", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException
- {
- response.sendRedirect(request.getContextPath() +
"/universalServletA");
-
- try
- {
- response.setRenderParameter("key", "value");
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected
- }
-
- try
- {
- Map map = new HashMap();
- map.put("key", new String[]{"value"});
- response.setRenderParameters(map);
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected
- }
- }
- });
-
- seq.addAction(1, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
- {
- protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
- {
- return new EndTestResponse();
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new FailureResponse(Failure.createAssertionFailure("Render
wasn't expected"));
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:76 - A portlet must set the content type
of the response using the
- * setContentType method of the RenderResponse interface. The setContentType method
must throw an
- * IllegalArgumentException if the content type set does not match (including wildcard
matching) any of the content
- * types returned by the getResponseContentType method of the PortleRequest
object"
- */
- public void createSetNotSupportedContentTypeCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("SetNotSupportedContentType", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- try
- {
-
response.setContentType("unsupported_content/unsupported_content");
- fail();
- }
- catch (IllegalArgumentException e)
- {
- //expected
- }
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:77 - If the getWriter or
getPortletOutputStream methods are called before the
- * setContentType method, they must throw an IllegalStateException."
- */
- public void createSetContentTypeBeforeOutputStreamOrWriterCase(PortletTestDriver
registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("SetContentTypeBeforeOutputStreamOrWriter", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException
- {
- try
- {
- response.getWriter();
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected as no content type was set
- }
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException
- {
- try
- {
- response.getPortletOutputStream();
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected as no content type was set
- }
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:78 - If the portlet has set a content
type, the getContentType method must
- * return it. Otherwise, the getContentType method must return null."
- */
- public void createGetContentTypeCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("GetContentType", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- try
- {
- //content type wasn't set
- assertNull(response.getContentType());
-
- response.setContentType("text/html");
-
- assertEquals("text/html", response.getContentType());
-
- }
- catch (IllegalStateException e)
- {
- //expected as no content type was set
- }
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:79 - A portlet may generate its content by
writing to the OutputStream or to
- * the Writer of the RenderResponse object. A portlet must use only one of these
objects. The portlet container must
- * throw an IllegalStateException if a portlet attempts to use both."
- */
- public void createOutputStreamOrWriterCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("OutputStreamOrWriter", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException
- {
- response.setContentType("text/html");
- response.getWriter();
- try
- {
- response.getPortletOutputStream();
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected
- }
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException
- {
- //we need this to be able to marshal the result
- response.setContentType("text/html");
- OutputStream os = response.getPortletOutputStream();
-
- //and now the test
- try
- {
- response.getWriter();
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected
- }
-
- //workaroud to correctly end this test:
- //we can't use AbstractTestPortet.marshalle() because we cannot obtain
- //writer from response as OutputStream was used.
-// Writer writer = new OutputStreamWriter(os);
-// ServerResultMarshaller.marshall(, writer,
TestCaseContext.getCurrentTestCaseId());
-// writer.close();
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:86 - The getNamespace method must provide
the portlet with a mechanism that
- * ensures the uniqueness of the returned string in the whole portal page"
- * @portlet.specification assert="SPEC:87 - The getNamespace method must return
the same value if invoked multiple
- * times within a render request."
- * @portlet.specification assert="SPEC:88 - The getNamespace method must return a
valid identifier as defined in the
- * 3.8 Identifier Section of the Java Language Specification Second Edition."
- */
- public void createNamespaceEncodingCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("NamespaceEncoding", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- String namespace = response.getNamespace();
-
- //assert it is valid Java identifier
- assertTrue(isJavaIdentifier(namespace));
-
- //check if it always return same value in scope of render request
- assertEquals(namespace, response.getNamespace());
-
- assertEquals(namespace, response.getNamespace());
-
- assertEquals(namespace, response.getNamespace());
- return new EndTestResponse();
- }
- });
- }
-
- /** Checks if string is valid java identifier as defined in 'Java Language
Specification' */
- public static boolean isJavaIdentifier(String s)
- {
- if (s.length() == 0 || !Character.isJavaIdentifierStart(s.charAt(0)))
- {
- return false;
- }
- for (int i = 1; i < s.length(); i++)
- {
- if (!Character.isJavaIdentifierPart(s.charAt(i)))
- {
- return false;
- }
- }
- return true;
- }
-
- /**
- * TEST CASES THAT ARE CURRENTLY DISABLED
- */
-
-
- /**
- * todo : it cannot pass as of today
- *
- * @portlet.specification assert="SPEC:71 - If the setPortletMode or
setWindowState methods are called after the
- * sendRedirect method has been called an IllegalStateException must be thrown. (...)
If the exception is propagated
- * back to the portlet-container, the redirection must not be executed."
- */
- public void _createIllegalStateExceptionAfterSendRedirectCase(PortletTestDriver
registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("IllegalStateExceptionAfterSendRedirect", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException
- {
- response.sendRedirect(request.getContextPath() +
"/universalServletB");
- //this should be propagated to the portlet to not invoke redirection
- throw new IllegalStateException();
- }
- });
-
- seq.addAction(1, UTS2.SERVICE_JOINPOINT, new ServletServiceTestAction()
- {
- protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
- {
- return new FailureResponse(Failure.createAssertionFailure("Redirection
shouldn't be made"));
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //if redirect wasn't called we should be here. Alternatively we should
use other portlet
- //with same test id to render the response.
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:80 - The getBufferSize method returns the
size of the underlying buffer being
- * used. If no buffering is being used, this method must return the int value of 0
(zero)"
- * @portlet.specification assert="SPEC:81 - The portlet can request a preferred
buffer size by using the
- * setBufferSize method. The buffer assigned is not required to be the size requested
by the portlet, but must be at
- * least as large as the size requested."
- */
- public void createBufferSizeCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("BufferSize", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- // No buffering is defined
- assertEquals(0, response.getBufferSize());
-
- // We define buffer size
- response.setBufferSize(1000000);
-
- // And assert that buffer size is at least what we set
- assertTrue(response.getBufferSize() >= 1000000);
-
- //
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:83 - If the response is committed and the
reset or resetBuffer method is
- * called, an IllegalStateException must be thrown."
- */
- public void createBufferResetCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("BufferReset", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //here we should test if after resetBuffer() response properties were
cleared
- //but it's rather hard to do this now as there is no getProperty()
method.
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException
- {
- response.setContentType("text/html");
- PrintWriter writer = response.getWriter();
- writer.flush();
- writer.close();
- try
- {
- response.resetBuffer();
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected
- }
- return new EndTestResponse();
- }
- });
- }
-
-
-}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesTestSuite.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesTestSuite.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesTestSuite.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,138 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.com">Boleslaw
Dawidowicz</a>
- * @version $Revision: 5510 $
- */
-public class PortletResponsesTestSuite
-{
- public static void suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-portletresponses.war");
-//
-// /**
-// * SPEC:65 Testable=true Section=PLT.12.2.1
-// */
-// suite.addTest(new TestCase("SendRedirectWithRelativeURL"));
-//
-// /**
-// * SPEC:66 Testable=true Section=PLT.12.2.1
-// */
-// suite.addTest(new TestCase("SendRedirectAfterChangeStateMethods"));
-//
-// /**
-// * SPEC:67 Testable=true Section=PLT.12.2.2
-// */
-// suite.addTest(new TestCase("NotAllowedMode"));
-//
-// /**
-// * SPEC:68 Testable=true Section=PLT.12.2.2
-// */
-// suite.addTest(new TestCase("NotSupportedWindowState"));
-//
-// /**
-// * SPEC:69 Testable= true Section=PLT.12.2.2
-// * SPEC:70 Testable= true Section=PLT.12.2.2
-// */
-// suite.addTest(new TestCase("StateChangesAfterRedirectionSend"));
-//
-// /**
-// * SPEC:71 Testable=true Section=PLT.12.2.2
-// *
-// * This is dissabled as after propagating IllegalStateException to
PortletContainer
-// * '500' code is returned which doesn't allow us to end test
properly
-// */
-// //suite.addTest(new
PortletTestCase("IllegalStateExceptionAfterSendRedirect"));
-//
-// /**
-// * SPEC:72 Testable= true Section=PLT.12.2.3
-// * SPEC:73 Testable= true Section=PLT.12.2.3
-// */
-// suite.addTest(new TestCase("RenderParameters"));
-//
-// /**
-// * SPEC:74 Testable= true Section=PLT.12.2.3
-// * SPEC:75 Testable= true Section=PLT.12.2.3
-// *
-// * SPEC:75 done only partially - see SPEC:71 comment for the reason
-// */
-// suite.addTest(new TestCase("ParametersSetAfterSendRedirect"));
-//
-// /**
-// * SPEC:76 Testable=true Section=PLT.12.3.1
-// */
-// suite.addTest(new TestCase("SetNotSupportedContentType"));
-//
-// /**
-// * SPEC:77 Testable= true Section=PLT.12.3.1
-// */
-// suite.addTest(new
TestCase("SetContentTypeBeforeOutputStreamOrWriter"));
-//
-// /**
-// * SPEC:78 Testable= true Section=PLT.12.3.1
-// */
-// suite.addTest(new TestCase("GetContentType"));
-//
-// /**
-// * SPEC:79 Testable= true Section=PLT.12.3.2
-// */
-// suite.addTest(new TestCase("OutputStreamOrWriter"));
-//
-// /**
-// * SPEC:80 Testable=true Section=PLT.12.3.3
-// * SPEC:81 Testable=true Section=PLT.12.3.3
-// *
-// * This is commented as no buffering is implemented yet
-// */
-// //suite.addTest(new TestCase("BufferSize"));
-//
-// /**
-// * SPEC:82 Testable=true Section=PLT.12.3.3
-// * NOT TESTABLE - Postponed
-// */
-//
-// /**
-// * SPEC:83 Testable=true Section=PLT.12.3.3
-// *
-// * This is commented as no buffering is implemented yet
-// */
-// //suite.addTest(new TestCase("BufferReset"));
-//
-// /**
-// * SPEC:84 Testable=true Section=PLT.12.3.3
-// * SPEC:85 Testable=true Section=PLT.12.3.3
-// * NOT TESTABLE - Postponed
-// */
-//
-// /**
-// * SPEC:86 Testable= true Section=PLT.12.3.4
-// * SPEC:87 Testable= true Section=PLT.12.3.4
-// * SPEC:88 Testable= true Section=PLT.12.3.4
-// */
-// suite.addTest(new TestCase("NamespaceEncoding"));
-// return suite;
- }
-}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/RenderParametersTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/RenderParametersTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/RenderParametersTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_72,TCKAssertion.JSR168_73})
+public class RenderParametersTestCase
+{
+ public RenderParametersTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ response.setRenderParameter("key1", "some strange value to
overwrite");
+ response.setRenderParameter("key2", "some strange value to
overwrite 2");
+ response.setRenderParameter("key1", "k1value1");
+ response.setRenderParameter("key2", new
String[]{"k2value1", "k2value2", "k2value3"});
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //we should receive overwrite values
+ assertEquals("k1value1", request.getParameter("key1"));
+ assertEquals(new String[]{"k2value1", "k2value2",
"k2value3"}, request.getParameterValues("key2"));
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(2, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ // Don't set any parameter
+ }
+ });
+
+ seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ // We shouldn't receive anything as no parameters were set during action
phase
+ assertEquals(Collections.EMPTY_MAP, request.getParameterMap());
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SendRedirectAfterChangeStateMethodsTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SendRedirectAfterChangeStateMethodsTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SendRedirectAfterChangeStateMethodsTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,174 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.fail;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletModeException;
+import javax.portlet.PortletMode;
+import javax.portlet.WindowStateException;
+import javax.portlet.WindowState;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_66})
+public class SendRedirectAfterChangeStateMethodsTestCase
+{
+ public SendRedirectAfterChangeStateMethodsTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws PortletModeException, IOException
+ {
+ response.setPortletMode(PortletMode.VIEW);
+ try
+ {
+ response.sendRedirect(request.getContextPath());
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(2, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException, WindowStateException
+ {
+ response.setWindowState(WindowState.NORMAL);
+ try
+ {
+ response.sendRedirect(request.getContextPath());
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
+ }
+ });
+
+ seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(3, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException
+ {
+ response.setRenderParameter("key", "value");
+ try
+ {
+ response.sendRedirect(request.getContextPath());
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
+ }
+ });
+
+ seq.addAction(3, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(4, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException
+ {
+ Map map = new HashMap();
+ map.put("key", new String[]{"value"});
+ response.setRenderParameters(map);
+ try
+ {
+ response.sendRedirect(request.getContextPath());
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
+ }
+ });
+
+ seq.addAction(4, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SendRedirectWithRelativeURLTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SendRedirectWithRelativeURLTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SendRedirectWithRelativeURLTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.fail;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_65})
+public class SendRedirectWithRelativeURLTestCase
+{
+ public SendRedirectWithRelativeURLTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException
+ {
+ try
+ {
+ response.sendRedirect("relative_url");
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ //expected
+ }
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SetContentTypeBeforeOutputStreamOrWriterTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SetContentTypeBeforeOutputStreamOrWriterTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SetContentTypeBeforeOutputStreamOrWriterTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.fail;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_77})
+public class SetContentTypeBeforeOutputStreamOrWriterTestCase
+{
+ public SetContentTypeBeforeOutputStreamOrWriterTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException
+ {
+ try
+ {
+ response.getWriter();
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ //expected as no content type was set
+ }
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException
+ {
+ try
+ {
+ response.getPortletOutputStream();
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ //expected as no content type was set
+ }
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SetNotSupportedContentTypeTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SetNotSupportedContentTypeTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SetNotSupportedContentTypeTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.fail;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_76})
+public class SetNotSupportedContentTypeTestCase
+{
+ public SetNotSupportedContentTypeTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ try
+ {
+
response.setContentType("unsupported_content/unsupported_content");
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ //expected
+ }
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/StateChangesAfterRedirectionSendTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/StateChangesAfterRedirectionSendTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/StateChangesAfterRedirectionSendTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,119 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.framework.portlet.actions.ServletServiceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.fail;
+import org.jboss.unit.Failure;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletModeException;
+import javax.portlet.WindowStateException;
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_69,TCKAssertion.JSR168_70})
+public class StateChangesAfterRedirectionSendTestCase
+{
+ public StateChangesAfterRedirectionSendTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws IOException, PortletModeException,
WindowStateException
+ {
+ response.sendRedirect(request.getContextPath() +
"/universalServletA");
+
+ try
+ {
+ response.setPortletMode(PortletMode.VIEW);
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
+
+ try
+ {
+ response.setWindowState(WindowState.NORMAL);
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
+ }
+ });
+
+ seq.addAction(1, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
+ {
+ return new EndTestResponse();
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new FailureResponse(Failure.createAssertionFailure("Render
wasn't expected to be called"));
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/HTTPSessionInvalidatesPortletSessionTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/HTTPSessionInvalidatesPortletSessionTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/HTTPSessionInvalidatesPortletSessionTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,91 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletsession;
+
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.components.AbstractUniversalTestPortlet;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertNull;
+import static org.jboss.unit.api.Assert.fail;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSession;
+import javax.portlet.PortletRequestDispatcher;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_115})
+public class HTTPSessionInvalidatesPortletSessionTestCase
+{
+ public HTTPSessionInvalidatesPortletSessionTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ PortletSession session = request.getPortletSession();
+ assertNotNull(session);
+ assertNull(session.getAttribute("doesnotexist"));
+
+ // Request dispatch to a servlet to invalidate the http session
+ PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("HttpSessionInvalidationServlet");
+ dispatcher.include(request, response);
+
+ //
+ try
+ {
+ session.getAttribute("doesnotexist");
+ fail();
+ }
+ catch (IllegalStateException expected)
+ {
+ }
+
+ //
+ session = request.getPortletSession(false);
+ assertNull(session);
+
+ // Test we have a new valid session
+ session = request.getPortletSession();
+ assertNotNull(session);
+ assertNull(session.getAttribute("doesnotexist"));
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/HTTPSessionRelationsTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/HTTPSessionRelationsTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/HTTPSessionRelationsTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,96 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletsession;
+
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.ServletServiceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletSession;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_113,TCKAssertion.JSR168_114})
+public class HTTPSessionRelationsTestCase
+{
+ public HTTPSessionRelationsTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ UTP1.holder = response.createRenderURL().toString();
+
+ request.getPortletSession().setAttribute("key1",
"k1value1", PortletSession.APPLICATION_SCOPE);
+
+ String path = request.getContextPath();
+ return new InvokeGetResponse(path + "/universalServletA");
+ }
+ });
+
+ seq.addAction(1, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
+ {
+ //assert that we can access attributest stored in PortletSession
+ assertEquals("k1value1",
request.getSession().getAttribute("key1"));
+
+ //set some attributes in HttpSession to assert them in Portlet
+ request.getSession().setAttribute("key2", "k2value1");
+
+ //invoke portlet
+ return new InvokeGetResponse((String)UTP1.holder);
+ }
+ });
+
+
+ seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //assert that we can access attributest stored in HttpSession
+ assertEquals("k2value1",
request.getPortletSession().getAttribute("key2",
PortletSession.APPLICATION_SCOPE));
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionInvalidatesHTTPSessionTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionInvalidatesHTTPSessionTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionInvalidatesHTTPSessionTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,91 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletsession;
+
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSession;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_116})
+public class PortletSessionInvalidatesHTTPSessionTestCase
+{
+ public PortletSessionInvalidatesHTTPSessionTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ try
+ {
+ HttpSessionEvents.activate();
+ PortletSession session = request.getPortletSession();
+ assertNotNull(session);
+ String sessionId = session.getId();
+ List events = HttpSessionEvents.getEvents();
+ assertEquals(1, events.size());
+ HttpSessionEvents.Event createdEvent =
(HttpSessionEvents.Event)events.get(0);
+ assertEquals(sessionId, createdEvent.getSessionId());
+ assertEquals(HttpSessionEvents.Event.CREATED, createdEvent.getType());
+ HttpSessionEvents.desactivate();
+
+ //
+ HttpSessionEvents.activate();
+ session.invalidate();
+ events = HttpSessionEvents.getEvents();
+ assertEquals(1, events.size());
+ HttpSessionEvents.Event destroyedEvent =
(HttpSessionEvents.Event)events.get(0);
+ assertEquals(sessionId, destroyedEvent.getSessionId());
+ assertEquals(HttpSessionEvents.Event.DESTROYED,
destroyedEvent.getType());
+ HttpSessionEvents.desactivate();
+ }
+ finally
+ {
+ // Cleanup
+ HttpSessionEvents.desactivate();
+ }
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionSequenceBuilder.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionSequenceBuilder.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionSequenceBuilder.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,415 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.portletsession;
-
-import org.jboss.portal.test.framework.portlet.PortletTest;
-import org.jboss.portal.test.framework.portlet.PortletTestDriver;
-import org.jboss.portal.test.framework.portlet.PortletTestSuite;
-import org.jboss.portal.test.framework.portlet.PortletTestContext;
-import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
-import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
-import org.jboss.portal.test.framework.portlet.actions.ServletServiceTestAction;
-import org.jboss.portal.test.framework.portlet.components.AbstractUniversalTestPortlet;
-import org.jboss.portal.test.portlet.framework.UTP1;
-import org.jboss.portal.test.portlet.framework.UTP2;
-import org.jboss.portal.test.portlet.framework.UTS1;
-import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
-import org.jboss.unit.driver.DriverResponse;
-import org.jboss.unit.driver.response.EndTestResponse;
-
-import static org.jboss.unit.api.Assert.*;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.Portlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletRequestDispatcher;
-import javax.portlet.PortletSession;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.regex.Pattern;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
- * @version $Revision: 7954 $
- */
-public class PortletSessionSequenceBuilder extends PortletTestSuite
-{
-
- /**
- * @portlet.specification assert="SPEC:106 - For portlets within the same portlet
application, a portlet container
- * must ensure that every portlet request generated as result of a group of requests
originated from the portal to
- * complete a single client request receive or acquire the same session"
- * @portlet.specification assert="SPEC:107 - In addition, if within these portlet
requests more than one portlet
- * creates a session, the session object must be the same for all the portlets in the
same portlet application"
- */
- public void createSessionCreateCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("SessionCreate", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //we ensure that session is ceated
- UTP1.holder = request.getPortletSession();
- assertNotNull(UTP1.holder);
- PortletURL url = response.createRenderURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(0, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- UTP2.holder = request.getPortletSession();
- return null;
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //assert that during same request it was the same object
-
assertTrue(((PortletSession)UTP1.holder).getId().equals(((PortletSession)UTP2.holder).getId()));
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:110 - Any object stored in the session
using the APPLICATION_SCOPE is
- * available to any other portlet that belongs to the same portlet application and
that handles a request identified
- * as being a part of the same session."
- * @portlet.specification assert="SPEC:111 - Objects stored in the session using
the PORTLET_SCOPE must be available
- * to the portlet during requests for the same portlet window that the objects where
stored from."
- * @portlet.specification assert="SPEC:112 - The object must be stored in the
APPLICATION_SCOPE with the following
- * fabricated attribute name �javax.portlet.p.<ID>?<ATTRIBUTE_NAME>�.
<ID> is a unique identification for the portlet
- * window (assigned by the portal/portlet-container) that must not contain a �?�
character."
- * @portlet.specification assert="SPEC:117 - The attribute names must be the same
if APPLICATION_SCOPE scope is
- * used."
- * @portlet.specification assert="SPEC:118 - The attribute name has to conform
with the specified prefixing if
- * PORTLET_SCOPE is used"
- * @portlet.specification assert="SPEC:119 - The variant of these methods that
does not receive a scope must be
- * treated as PORTLET_SCOPE."
- */
- public void createSessionAttributesCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("SessionAttributes", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- request.getPortletSession(true).setAttribute("key1",
"k1value1", PortletSession.APPLICATION_SCOPE);
- request.getPortletSession().setAttribute("key2",
"k2value1", PortletSession.PORTLET_SCOPE);
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- assertEquals("k1value1",
request.getPortletSession().getAttribute("key1",
PortletSession.APPLICATION_SCOPE));
- assertEquals("k2value1",
request.getPortletSession().getAttribute("key2"));
- }
- });
-
- seq.addAction(1, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //assert that we have access to APLICATION_SCOPE and not to PORTLET_SCOPE
attributes
- assertEquals("k1value1",
request.getPortletSession().getAttribute("key1",
PortletSession.APPLICATION_SCOPE));
- assertNull(request.getPortletSession().getAttribute("key2"));
- return null;
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //in this request count we do an assert in SessionAttributesHelperPortlet
- //so just repaint to let it finish
- PortletURL url = response.createRenderURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //invoke servlet
- String path = request.getContextPath();
- return new InvokeGetResponse(path + "/universalServletA");
- }
- });
-
- seq.addAction(3, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
- {
- protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
- {
- //assert that we have access to APLICATION_SCOPE and not to PORTLET_SCOPE
attributes
- assertEquals("k1value1",
request.getSession().getAttribute("key1"));
- assertNull(request.getSession().getAttribute("key2"));
-
- Enumeration names = request.getSession().getAttributeNames();
-
- //first we must get our PORTLET_SCOPE name from APPLICATION_SCOPE names
- //it should look like 'javax.portlet.p.<ID>?key2'
- String name = null;
- while (names.hasMoreElements())
- {
- String s = (String)names.nextElement();
- if (s.endsWith("key2"))
- {
- name = s;
- break;
- }
- }
- //assert there was one
- assertNotNull(name);
- //and we access correct content using it
- assertEquals("k2value1", request.getSession().getAttribute(name));
- System.out.println("value: " + name);
-
- //then we must assert it is namespaced correctly
- assertTrue(Pattern.matches("javax.portlet.p.[^\\?]*\\?key2",
name));
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:113 - The PortletSession must store all
attributes in the HttpSession of the
- * portlet application. A direct consequence of this is that data stored in the
HttpSession by servlets or JSPs is
- * accessible to portlets through the PortletSession in the portlet application
scope."
- * @portlet.specification assert="SPEC:114 - Conversely, data stored by portlets
in the PortletSession in the portlet
- * application scope is accessible to servlets and JSPs through the
HttpSession."
- */
- public void createHttpSessionRelationsCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("HttpSessionRelations", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- UTP1.holder = response.createRenderURL().toString();
-
- request.getPortletSession().setAttribute("key1",
"k1value1", PortletSession.APPLICATION_SCOPE);
-
- String path = request.getContextPath();
- return new InvokeGetResponse(path + "/universalServletA");
- }
- });
-
- seq.addAction(1, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
- {
- protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
- {
- //assert that we can access attributest stored in PortletSession
- assertEquals("k1value1",
request.getSession().getAttribute("key1"));
-
- //set some attributes in HttpSession to assert them in Portlet
- request.getSession().setAttribute("key2", "k2value1");
-
- //invoke portlet
- return new InvokeGetResponse((String)UTP1.holder);
- }
- });
-
-
- seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //assert that we can access attributest stored in HttpSession
- assertEquals("k2value1",
request.getPortletSession().getAttribute("key2",
PortletSession.APPLICATION_SCOPE));
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:115 - If the HttpSession object is
invalidated, the PortletSession object must
- * also be invalidated by the portlet container."
- */
- public void createHttpSessionInvalidatesPortletSession(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("HttpSessionInvalidatesPortletSession", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- PortletSession session = request.getPortletSession();
- assertNotNull(session);
- assertNull(session.getAttribute("doesnotexist"));
-
- // Request dispatch to a servlet to invalidate the http session
- PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("HttpSessionInvalidationServlet");
- dispatcher.include(request, response);
-
- //
- try
- {
- session.getAttribute("doesnotexist");
- fail();
- }
- catch (IllegalStateException expected)
- {
- }
-
- //
- session = request.getPortletSession(false);
- assertNull(session);
-
- // Test we have a new valid session
- session = request.getPortletSession();
- assertNotNull(session);
- assertNull(session.getAttribute("doesnotexist"));
-
- //
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:116 - If the PortletSession object is
invalidated by a portlet, the portlet
- * container must invalidate the associated HttpSession object."
- */
- public void createPortletSessionInvalidatesHttpSession(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("PortletSessionInvalidatesHttpSession", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- try
- {
- HttpSessionEvents.activate();
- PortletSession session = request.getPortletSession();
- assertNotNull(session);
- String sessionId = session.getId();
- List events = HttpSessionEvents.getEvents();
- assertEquals(1, events.size());
- HttpSessionEvents.Event createdEvent =
(HttpSessionEvents.Event)events.get(0);
- assertEquals(sessionId, createdEvent.getSessionId());
- assertEquals(HttpSessionEvents.Event.CREATED, createdEvent.getType());
- HttpSessionEvents.desactivate();
-
- //
- HttpSessionEvents.activate();
- session.invalidate();
- events = HttpSessionEvents.getEvents();
- assertEquals(1, events.size());
- HttpSessionEvents.Event destroyedEvent =
(HttpSessionEvents.Event)events.get(0);
- assertEquals(sessionId, destroyedEvent.getSessionId());
- assertEquals(HttpSessionEvents.Event.DESTROYED,
destroyedEvent.getType());
- HttpSessionEvents.desactivate();
- }
- finally
- {
- // Cleanup
- HttpSessionEvents.desactivate();
- }
-
- //
- return new EndTestResponse();
- }
- });
- }
-
-// public void createSessionInvalidationCase(SequenceRegistry registry)
-// {
-// Sequence seq = new Sequence();
-// registry.addSequence("SessionInvalidation", seq);
-// seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
-// {
-// protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response)
-// {
-// UTP1.holder = response.createRenderURL().toString();
-//
-// request.getPortletSession().setAttribute("key1",
"k1value1", PortletSession.APPLICATION_SCOPE);
-//
-// //invalidate session
-// request.getPortletSession().invalidate();
-//
-// request.getPortletSession().setAttribute("key2",
"k2value1", PortletSession.APPLICATION_SCOPE);
-//
-// String path = request.getContextPath();
-// return new InvokeGetResult(path + "/universalServletA");
-// }
-// });
-//
-// seq.addAction(1, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
-// {
-// protected Result run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
-// {
-// //assert that we can't access attributest stored in PortletSession as
it was invalidated
-// assertNull(request.getSession().getAttribute("key1"));
-//
-// //set some attributes in HttpSession to assert them in Portlet
-// request.getSession().setAttribute("key3", "k2value1");
-//
-// request.getSession().invalidate();
-//
-// request.getSession().setAttribute("key4", "k4value1");
-//
-// //invoke portlet
-// return new InvokeGetResult((String)UTP1.holder);
-// }
-// });
-//
-// seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
-// {
-// protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response)
-// {
-// //assert that we can't access attributest stored in HttpSession as it
was invalidated
-// assertNull(request.getPortletSession().getAttribute("key1",
PortletSession.APPLICATION_SCOPE));
-// assertNull(request.getPortletSession().getAttribute("key2",
PortletSession.APPLICATION_SCOPE));
-// assertNull(request.getPortletSession().getAttribute("key3",
PortletSession.APPLICATION_SCOPE));
-// assertEquals("k4value1",
request.getPortletSession().getAttribute("key4",
PortletSession.APPLICATION_SCOPE));
-//
-// return new EndTestResult();
-// }
-// });
-// }
-}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionTestSuite.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionTestSuite.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/PortletSessionTestSuite.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,78 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.portletsession;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5510 $
- */
-public class PortletSessionTestSuite
-{
- public static void suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-portletsession.war");
-//
-// /**
-// * SPEC:106 Testable=true Section=PLT.15.1
-// * SPEC:107 Testable=true Section=PLT.15.1
-// */
-// suite.addTest(new TestCase("SessionCreate"));
-//
-// /**
-// * SPEC:108 Testable=true Section=PLT.15.2
-// * SPEC:109 Testable=true Section=PLT.15.2
-// * NOT TESTABLE - Postponed
-// */
-//
-// /**
-// * SPEC:110 Testable=true Section=PLT.15.3
-// * SPEC:111 Testable=true Section=PLT.15.3
-// * SPEC:112 Testable=true Section=PLT.15.3
-// * SPEC:117 Testable=true Section=PLT.15.4.1
-// * SPEC:118 Testable=true Section=PLT.15.4.1
-// * SPEC:119 Testable=true Section=PLT.15.4.1
-// */
-// suite.addTest(new TestCase("SessionAttributes"));
-//
-// /**
-// * SPEC:113 Testable=true Section=PLT.15.4
-// * SPEC:114 Testable=true Section=PLT.15.4
-// */
-// suite.addTest(new TestCase("HttpSessionRelations"));
-//
-// /**
-// * SPEC:115 Testable=true Section=PLT.15.4
-// * SPEC:116 Testable=true Section=PLT.15.4
-// */
-//// suite.addTest(new TestCase("SessionInvalidation"));
-// suite.addTest(new TestCase("HttpSessionInvalidatesPortletSession"));
-// suite.addTest(new TestCase("PortletSessionInvalidatesHttpSession"));
-//
-// /**
-// * SPEC:120 Testable=true Section=PLT.15.8
-// * NOT TESTABLE - Postponed
-// */
-//
-// return suite;
- }
-}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/SessionAttributesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/SessionAttributesTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/SessionAttributesTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,153 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletsession;
+
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.framework.portlet.actions.ServletServiceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTP2;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertNull;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertTrue;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletSession;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.regex.Pattern;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_110,TCKAssertion.JSR168_111,TCKAssertion.JSR168_112,TCKAssertion.JSR168_117,TCKAssertion.JSR168_118,TCKAssertion.JSR168_119})
+public class SessionAttributesTestCase
+{
+ public SessionAttributesTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ request.getPortletSession(true).setAttribute("key1",
"k1value1", PortletSession.APPLICATION_SCOPE);
+ request.getPortletSession().setAttribute("key2",
"k2value1", PortletSession.PORTLET_SCOPE);
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ assertEquals("k1value1",
request.getPortletSession().getAttribute("key1",
PortletSession.APPLICATION_SCOPE));
+ assertEquals("k2value1",
request.getPortletSession().getAttribute("key2"));
+ }
+ });
+
+ seq.addAction(1, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //assert that we have access to APLICATION_SCOPE and not to PORTLET_SCOPE
attributes
+ assertEquals("k1value1",
request.getPortletSession().getAttribute("key1",
PortletSession.APPLICATION_SCOPE));
+ assertNull(request.getPortletSession().getAttribute("key2"));
+ return null;
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //in this request count we do an assert in SessionAttributesHelperPortlet
+ //so just repaint to let it finish
+ PortletURL url = response.createRenderURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //invoke servlet
+ String path = request.getContextPath();
+ return new InvokeGetResponse(path + "/universalServletA");
+ }
+ });
+
+ seq.addAction(3, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
+ {
+ //assert that we have access to APLICATION_SCOPE and not to PORTLET_SCOPE
attributes
+ assertEquals("k1value1",
request.getSession().getAttribute("key1"));
+ assertNull(request.getSession().getAttribute("key2"));
+
+ Enumeration names = request.getSession().getAttributeNames();
+
+ //first we must get our PORTLET_SCOPE name from APPLICATION_SCOPE names
+ //it should look like 'javax.portlet.p.<ID>?key2'
+ String name = null;
+ while (names.hasMoreElements())
+ {
+ String s = (String)names.nextElement();
+ if (s.endsWith("key2"))
+ {
+ name = s;
+ break;
+ }
+ }
+ //assert there was one
+ assertNotNull(name);
+ //and we access correct content using it
+ assertEquals("k2value1", request.getSession().getAttribute(name));
+ System.out.println("value: " + name);
+
+ //then we must assert it is namespaced correctly
+ assertTrue(Pattern.matches("javax.portlet.p.[^\\?]*\\?key2",
name));
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/SessionCreateTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/SessionCreateTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/SessionCreateTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletsession;
+
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTP2;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertTrue;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.PortletSession;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_106,TCKAssertion.JSR168_107})
+public class SessionCreateTestCase
+{
+ public SessionCreateTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //we ensure that session is ceated
+ UTP1.holder = request.getPortletSession();
+ assertNotNull(UTP1.holder);
+ PortletURL url = response.createRenderURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(0, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ UTP2.holder = request.getPortletSession();
+ return null;
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //assert that during same request it was the same object
+
assertTrue(((PortletSession)UTP1.holder).getId().equals(((PortletSession)UTP2.holder).getId()));
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/SessionInvalidationTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/SessionInvalidationTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletsession/SessionInvalidationTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,89 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portletsession;
+
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.portal.test.framework.portlet.PortletTest;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_120})
+public class SessionInvalidationTestCase
+{
+ public SessionInvalidationTestCase(PortletTest seq)
+ {
+// seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+// {
+// protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response)
+// {
+// UTP1.holder = response.createRenderURL().toString();
+//
+// request.getPortletSession().setAttribute("key1",
"k1value1", PortletSession.APPLICATION_SCOPE);
+//
+// //invalidate session
+// request.getPortletSession().invalidate();
+//
+// request.getPortletSession().setAttribute("key2",
"k2value1", PortletSession.APPLICATION_SCOPE);
+//
+// String path = request.getContextPath();
+// return new InvokeGetResult(path + "/universalServletA");
+// }
+// });
+//
+// seq.addAction(1, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
+// {
+// protected Result run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
+// {
+// //assert that we can't access attributest stored in PortletSession as
it was invalidated
+// assertNull(request.getSession().getAttribute("key1"));
+//
+// //set some attributes in HttpSession to assert them in Portlet
+// request.getSession().setAttribute("key3", "k2value1");
+//
+// request.getSession().invalidate();
+//
+// request.getSession().setAttribute("key4", "k4value1");
+//
+// //invoke portlet
+// return new InvokeGetResult((String)UTP1.holder);
+// }
+// });
+//
+// seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+// {
+// protected Result run(Portlet portlet, RenderRequest request, RenderResponse
response)
+// {
+// //assert that we can't access attributest stored in HttpSession as it
was invalidated
+// assertNull(request.getPortletSession().getAttribute("key1",
PortletSession.APPLICATION_SCOPE));
+// assertNull(request.getPortletSession().getAttribute("key2",
PortletSession.APPLICATION_SCOPE));
+// assertNull(request.getPortletSession().getAttribute("key3",
PortletSession.APPLICATION_SCOPE));
+// assertEquals("k4value1",
request.getPortletSession().getAttribute("key4",
PortletSession.APPLICATION_SCOPE));
+//
+// return new EndTestResult();
+// }
+// });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLParametersTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLParametersTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLParametersTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,152 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portleturl;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertNull;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_27,TCKAssertion.JSR168_28,TCKAssertion.JSR168_29})
+public class PortletURLParametersTestCase
+{
+ public PortletURLParametersTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+
+ //set some render parameters to test
+ url.setParameter("key1", "some strange value to
overwrite");
+ url.setParameter("key2", "some strange value to overwrite
2");
+ url.setParameter("key1", "k1value1");
+ url.setParameter("key2", new String[]{"k2value1",
"k2value2", "k2value3"});
+
+
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ assertEquals("k1value1", request.getParameter("key1"));
+ assertEquals(new String[]{"k2value1", "k2value2",
"k2value3"}, request.getParameterValues("key2"));
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createActionURL();
+
+ //
+ url.setParameter("key3", "some strange value to
overwrite");
+ url.setParameter("key4", "some strange value to overwrite
2");
+
+ //
+ Map map = new HashMap();
+ map.put("key3", new String[]{"k3value1"});
+ map.put("key4", new String[]{"k4value1",
"k4value2", "k4value3"});
+ url.setParameters(map);
+
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(2, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ //what was in previous request
+ assertNull(request.getParameter("key1"));
+ assertNull(request.getParameter("key2"));
+
+ //what is now
+ assertEquals("k3value1", request.getParameter("key3"));
+ assertEquals(new String[]{"k4value1", "k4value2",
"k4value3"}, request.getParameterValues("key4"));
+ }
+ });
+
+ seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createRenderURL();
+
+ Map map = new HashMap();
+ url.setParameter("key5", "some strange value to
overwrite");
+ url.setParameter("key6", "some strange value to overwrite
2");
+ map.put("key5", new String[]{"k5value1"});
+ map.put("key6", new String[]{"k6value1",
"k6value2", "k6value3"});
+ url.setParameters(map);
+ url.setParameter("key7", new String[]{"k7value1",
"k7value2"});
+
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(3, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //what was in previous request
+ assertNull(request.getParameter("key1"));
+ assertNull(request.getParameter("key2"));
+ assertNull(request.getParameter("key3"));
+ assertNull(request.getParameter("key4"));
+
+ //what is now
+ assertEquals("k5value1", request.getParameter("key5"));
+ assertEquals(new String[]{"k6value1", "k6value2",
"k6value3"}, request.getParameterValues("key6"));
+ assertEquals(new String[]{"k7value1", "k7value2"},
request.getParameterValues("key7"));
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLTestSuite.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLTestSuite.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLTestSuite.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,77 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.portleturl;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5510 $
- */
-public class PortletURLTestSuite
-{
- public static void suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-portleturl.war");
-//
-// /**
-// * SPEC:26 Testable= true Section=PLT.7.1
-// */
-// suite.addTest(new TestCase("RenderURLNotInvokeAction"));
-//
-// /**
-// * SPEC:27 Testable= true Section=PLT.7.1
-// * SPEC:28 Testable= true Section=PLT.7.1
-// * SPEC:29 Testable= true Section=PLT.7.1
-// */
-// suite.addTest(new TestCase("PortletURLParameters"));
-//
-// /**
-// * SPEC:30 Testable= true Section=PLT.7.1
-// * SPEC:31 Testable= true Section=PLT.7.1
-// * NOTTESTABLE - POSTPONED
-// */
-//
-// /**
-// * SPEC:32 Testable= true Section=PLT.7.1.1
-// */
-// suite.addTest(new TestCase("PortletURLWithNotSupportedMode"));
-//
-// /**
-// * SPEC:33 Testable= true Section=PLT.7.1.1
-// *
-// * TESTED IN SPEC:36 - portletmode/RequestDispatchingDependingOnModePortlet
-// */
-//
-// /**
-// * SPEC:34 Testable= true Section=PLT.7.1.1
-// */
-// suite.addTest(new TestCase("PortletURLWithNotSupportedState"));
-//
-// /**
-// * SPEC:35 Testable= true Section=PLT.7.1.2
-// */
-// suite.addTest(new TestCase("SecurityLevel"));
-//
-//
-// return suite;
- }
-}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLWithNotSupportedModeTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLWithNotSupportedModeTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLWithNotSupportedModeTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portleturl;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.fail;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_32})
+public class PortletURLWithNotSupportedModeTestCase
+{
+ public PortletURLWithNotSupportedModeTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createRenderURL();
+ try
+ {
+ url.setPortletMode(new PortletMode("UNSUPORTED_ONE"));
+ fail();
+ }
+ catch (PortletModeException e)
+ {
+ //expected
+ }
+
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLWithNotSupportedStateTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLWithNotSupportedStateTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletURLWithNotSupportedStateTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portleturl;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.fail;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.WindowState;
+import javax.portlet.WindowStateException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_34})
+public class PortletURLWithNotSupportedStateTestCase
+{
+ public PortletURLWithNotSupportedStateTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createRenderURL();
+ try
+ {
+ url.setWindowState(new WindowState("UNSUPORTED_ONE"));
+ fail();
+ }
+ catch (WindowStateException e)
+ {
+ //expected
+ }
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletUrlSequenceBuilder.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletUrlSequenceBuilder.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/PortletUrlSequenceBuilder.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,297 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.portleturl;
-
-import org.jboss.portal.test.framework.portlet.PortletTest;
-import org.jboss.portal.test.framework.portlet.PortletTestDriver;
-import org.jboss.portal.test.framework.portlet.PortletTestSuite;
-import org.jboss.portal.test.framework.portlet.PortletTestContext;
-import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
-import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
-import org.jboss.portal.test.portlet.framework.UTP1;
-import org.jboss.unit.driver.DriverResponse;
-import org.jboss.unit.driver.response.EndTestResponse;
-import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
-
-import static org.jboss.unit.api.Assert.*;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.Portlet;
-import javax.portlet.PortletMode;
-import javax.portlet.PortletModeException;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.WindowState;
-import javax.portlet.WindowStateException;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
- * @version $Revision: 7954 $
- */
-public class PortletUrlSequenceBuilder extends PortletTestSuite
-{
- /**
- * @portlet.specification assert="SPEC:26 - A render URL is an optimization for a
special type of action URLs. The
- * portal/portletcontainer must not invoke the processAction method of the targeted
portlet."
- */
- public void createRenderURLNotInvokeActionCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("RenderURLNotInvokeAction", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createRenderURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- //this shouldn't be invoked
- UTP1.local.set(Boolean.TRUE);
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- assertNull(UTP1.local.get());
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:27 - The portal/portlet-container must
ensure that all the parameters set when
- * constructing the render URL become render parameters of the subsequent render
requests for the portlet."
- * @portlet.specification assert="SPEC:28 - Portlets can add application specific
parameters to the PortletURL
- * objects using the setParameter and setParameters methods. A call to any of the
setParameter methods must replace
- * any parameter with the same name previously set."
- * @portlet.specification assert="SPEC:29 - All the parameters a portlet adds to
a PortletURL object must be made
- * available to the portlet as request parameters"
- */
- public void createPortletURLParametersCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("PortletURLParameters", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
-
- //set some render parameters to test
- url.setParameter("key1", "some strange value to
overwrite");
- url.setParameter("key2", "some strange value to overwrite
2");
- url.setParameter("key1", "k1value1");
- url.setParameter("key2", new String[]{"k2value1",
"k2value2", "k2value3"});
-
-
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- assertEquals("k1value1", request.getParameter("key1"));
- assertEquals(new String[]{"k2value1", "k2value2",
"k2value3"}, request.getParameterValues("key2"));
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createActionURL();
-
- //
- url.setParameter("key3", "some strange value to
overwrite");
- url.setParameter("key4", "some strange value to overwrite
2");
-
- //
- Map map = new HashMap();
- map.put("key3", new String[]{"k3value1"});
- map.put("key4", new String[]{"k4value1",
"k4value2", "k4value3"});
- url.setParameters(map);
-
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(2, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- //what was in previous request
- assertNull(request.getParameter("key1"));
- assertNull(request.getParameter("key2"));
-
- //what is now
- assertEquals("k3value1", request.getParameter("key3"));
- assertEquals(new String[]{"k4value1", "k4value2",
"k4value3"}, request.getParameterValues("key4"));
- }
- });
-
- seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createRenderURL();
-
- Map map = new HashMap();
- url.setParameter("key5", "some strange value to
overwrite");
- url.setParameter("key6", "some strange value to overwrite
2");
- map.put("key5", new String[]{"k5value1"});
- map.put("key6", new String[]{"k6value1",
"k6value2", "k6value3"});
- url.setParameters(map);
- url.setParameter("key7", new String[]{"k7value1",
"k7value2"});
-
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(3, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //what was in previous request
- assertNull(request.getParameter("key1"));
- assertNull(request.getParameter("key2"));
- assertNull(request.getParameter("key3"));
- assertNull(request.getParameter("key4"));
-
- //what is now
- assertEquals("k5value1", request.getParameter("key5"));
- assertEquals(new String[]{"k6value1", "k6value2",
"k6value3"}, request.getParameterValues("key6"));
- assertEquals(new String[]{"k7value1", "k7value2"},
request.getParameterValues("key7"));
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:32 - A portlet cannot create a portlet URL
using a portlet mode that is not
- * defined as supported by the portlet or that the user it is not allowed to use. The
setPortletMode methods must
- * throw a PortletModeException in that situation."
- */
- public void createPortletURLWithNotSupportedModeCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("PortletURLWithNotSupportedMode", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createRenderURL();
- try
- {
- url.setPortletMode(new PortletMode("UNSUPORTED_ONE"));
- fail();
- }
- catch (PortletModeException e)
- {
- //expected
- }
-
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:34 - A portlet cannot create a portlet URL
using a window state that is not
- * supported by the portlet container. The setWindowState method must throw a
WindowStateException if that is the
- * case"
- */
- public void createPortletURLWithNotSupportedStateCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("PortletURLWithNotSupportedState", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- PortletURL url = response.createRenderURL();
- try
- {
- url.setWindowState(new WindowState("UNSUPORTED_ONE"));
- fail();
- }
- catch (WindowStateException e)
- {
- //expected
- }
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:35 - The setSecure method of the
PortletURL interface allows a portlet to
- * indicate if the portlet URL has to be a secure URL or not (i.e. HTTPS or HTTP). If
the setSecure method is not
- * used, the portlet URL must be of the same security level of the current
request."
- */
- public void createSecurityLevelCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("SecurityLevel", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- UTP1.holder = new Boolean(request.isSecure());
- PortletURL url = response.createActionURL();
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- assertEquals(((Boolean)UTP1.holder).booleanValue(), request.isSecure());
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- assertEquals(((Boolean)UTP1.holder).booleanValue(), request.isSecure());
- return new EndTestResponse();
- }
- });
- }
-
-}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/RenderURLNotInvokeActionTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/RenderURLNotInvokeActionTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/RenderURLNotInvokeActionTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,80 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portleturl;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertNull;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_26})
+public class RenderURLNotInvokeActionTestCase
+{
+ public RenderURLNotInvokeActionTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ PortletURL url = response.createRenderURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ //this shouldn't be invoked
+ UTP1.local.set(Boolean.TRUE);
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ assertNull(UTP1.local.get());
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/SecurityLevelTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/SecurityLevelTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portleturl/SecurityLevelTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,80 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.portleturl;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_35})
+public class SecurityLevelTestCase
+{
+ public SecurityLevelTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ UTP1.holder = new Boolean(request.isSecure());
+ PortletURL url = response.createActionURL();
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ assertEquals(((Boolean)UTP1.holder).booleanValue(), request.isSecure());
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ assertEquals(((Boolean)UTP1.holder).booleanValue(), request.isSecure());
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/CanModifyNonReadOnlyPreferenceTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/CanModifyNonReadOnlyPreferenceTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/CanModifyNonReadOnlyPreferenceTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.preferences;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.ReadOnlyException;
+import javax.portlet.ValidatorException;
+import javax.portlet.PortletPreferences;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_99})
+public class CanModifyNonReadOnlyPreferenceTestCase
+{
+ public CanModifyNonReadOnlyPreferenceTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException,
ValidatorException
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test the initial value is ok
+ assertEquals("single_pref_value",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"},
+ prefs.getValues("multi_pref", new
String[]{"other"}));
+
+ // Set with new values
+ prefs.setValue("single_pref", "new_single_pref");
+ prefs.setValues("multi_pref", new
String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"});
+
+ // Test with new values
+ assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
+
+ // Trigger store
+ prefs.store();
+
+ // Test with new values after store
+ assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(2, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test with new values
+ assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
+ }
+ });
+
+ seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ChangesMadeButNotStoredAreDiscardedTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ChangesMadeButNotStoredAreDiscardedTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ChangesMadeButNotStoredAreDiscardedTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,120 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.preferences;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP3;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.ReadOnlyException;
+import javax.portlet.PortletPreferences;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_96})
+public class ChangesMadeButNotStoredAreDiscardedTestCase
+{
+ public ChangesMadeButNotStoredAreDiscardedTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP3.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Check the initial value are good
+ assertEquals("static_single_pref_value",
prefs.getValue("static_single_pref", "other"));
+ assertEquals(new String[]{"static_multi_pref_value_1",
"static_multi_pref_value_2"}, prefs.getValues("static_multi_pref", new
String[]{"other"}));
+ assertEquals("other",
prefs.getValue("dynamic_single_pref", "other"));
+ assertEquals(new String[]{"other"},
prefs.getValues("dynamic_multi_pref", new String[]{"other"}));
+
+ // Set values
+ prefs.setValue("static_single_pref",
"new_static_single_pref_value");
+ prefs.setValues("static_multi_pref", new
String[]{"new_static_multi_pref_value_1",
"new_static_multi_pref_value_2"});
+ prefs.setValue("dynamic_single_pref",
"new_dynamic_single_pref_value");
+ prefs.setValues("dynamic_multi_pref", new
String[]{"new_dynamic_multi_pref_value_1",
"new_dynamic_multi_pref_value_2"});
+
+ // Check wit new values
+ assertEquals("new_static_single_pref_value",
prefs.getValue("static_single_pref", "other"));
+ assertEquals(new String[]{"new_static_multi_pref_value_1",
"new_static_multi_pref_value_2"}, prefs.getValues("static_multi_pref",
new String[]{"other"}));
+ assertEquals("new_dynamic_single_pref_value",
prefs.getValue("dynamic_single_pref", "other"));
+ assertEquals(new String[]{"new_dynamic_multi_pref_value_1",
"new_dynamic_multi_pref_value_2"},
prefs.getValues("dynamic_multi_pref", new String[]{"other"}));
+ }
+ });
+
+ seq.addAction(1, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(2, UTP3.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Check we have the original values back
+ assertEquals("static_single_pref_value",
prefs.getValue("static_single_pref", "other"));
+ assertEquals(new String[]{"static_multi_pref_value_1",
"static_multi_pref_value_2"}, prefs.getValues("static_multi_pref", new
String[]{"other"}));
+ assertEquals("other",
prefs.getValue("dynamic_single_pref", "other"));
+ assertEquals(new String[]{"other"},
prefs.getValues("dynamic_multi_pref", new String[]{"other"}));
+ }
+ });
+
+ seq.addAction(2, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/CreateASingleInstanceOfValidatorTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/CreateASingleInstanceOfValidatorTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/CreateASingleInstanceOfValidatorTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.preferences;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP6;
+import
org.jboss.portal.test.portlet.jsr168.tck.preferences.spec.CreateASingleInstanceOfValidatorValidator;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_101})
+public class CreateASingleInstanceOfValidatorTestCase
+{
+ public CreateASingleInstanceOfValidatorTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP6.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ assertEquals(1,
CreateASingleInstanceOfValidatorValidator.getCreatedCount());
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/DynamicPreferenceTreatedLikeModifiablePreferenceTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/DynamicPreferenceTreatedLikeModifiablePreferenceTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/DynamicPreferenceTreatedLikeModifiablePreferenceTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,157 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.preferences;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP4;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.ReadOnlyException;
+import javax.portlet.ValidatorException;
+import javax.portlet.PortletPreferences;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_100})
+public class DynamicPreferenceTreatedLikeModifiablePreferenceTestCase
+{
+ public DynamicPreferenceTreatedLikeModifiablePreferenceTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException,
ValidatorException
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test the initial values does not exist
+ assertEquals("other", prefs.getValue("single_pref",
"other"));
+ assertEquals(new String[]{"other"},
prefs.getValues("multi_pref", new String[]{"other"}));
+
+ // Set with new values
+ prefs.setValue("single_pref", "new_single_pref");
+ prefs.setValues("multi_pref", new
String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"});
+
+ // Test the values are good
+ assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
+
+ // Trigger store
+ prefs.store();
+
+ // Test the value are good after store
+ assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
+ }
+ });
+
+ seq.addAction(1, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(2, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException,
ValidatorException
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test the values have been store in the persistent store
+ assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
+
+ // Reset
+ prefs.reset("single_pref");
+ prefs.reset("multi_pref");
+
+ // Test does not exist
+ assertEquals("other", prefs.getValue("single_pref",
"other"));
+ assertEquals(new String[]{"other"},
prefs.getValues("multi_pref", new String[]{"other"}));
+
+ // Trigger store
+ prefs.store();
+
+ // Test does not exist after store
+ assertEquals("other", prefs.getValue("single_pref",
"other"));
+ assertEquals(new String[]{"other"},
prefs.getValues("multi_pref", new String[]{"other"}));
+ }
+ });
+
+ seq.addAction(2, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(3, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test the values does not exist
+ assertEquals("other", prefs.getValue("single_pref",
"other"));
+ assertEquals(new String[]{"other"},
prefs.getValues("multi_pref", new String[]{"other"}));
+ }
+ });
+
+ seq.addAction(3, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/InvalidationCancelsStoreTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/InvalidationCancelsStoreTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/InvalidationCancelsStoreTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,125 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.preferences;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP7;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertFalse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.ReadOnlyException;
+import javax.portlet.PortletPreferences;
+import javax.portlet.ValidatorException;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_104})
+public class InvalidationCancelsStoreTestCase
+{
+ public InvalidationCancelsStoreTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP7.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP7.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test the initial value is ok
+ assertEquals("single_pref_value",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"},
+ prefs.getValues("multi_pref", new
String[]{"other"}));
+
+ // Set the value to something else
+ prefs.setValue("single_pref", "new_single_pref");
+ prefs.setValues("multi_pref", new
String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"});
+
+ // Trigger store
+ try
+ {
+ prefs.store();
+ }
+ catch (ValidatorException e)
+ {
+ // Expected
+ assertEquals("message", e.getMessage());
+ assertFalse(e.getFailedKeys().hasMoreElements());
+ }
+ }
+ });
+
+ seq.addAction(1, UTP7.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(2, UTP7.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test the initial value is back
+ assertEquals("single_pref_value",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"},
+ prefs.getValues("multi_pref", new
String[]{"other"}));
+ }
+ });
+
+ seq.addAction(2, UTP7.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesCanBeSetToNullTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesCanBeSetToNullTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesCanBeSetToNullTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.preferences;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP2;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.ReadOnlyException;
+import javax.portlet.ValidatorException;
+import javax.portlet.PortletPreferences;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_90})
+public class PreferencesCanBeSetToNullTestCase
+{
+ public PreferencesCanBeSetToNullTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP2.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException,
ValidatorException
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test the initial value is ok
+ assertEquals("action_single_pref_value",
prefs.getValue("action_single_pref", "other"));
+ assertEquals(new String[]{"action_multi_pref_value_1",
"action_multi_pref_value_2"},
+ prefs.getValues("action_multi_pref", new String[0]));
+
+ // Set the values to null
+ prefs.setValue("action_single_pref", null);
+ prefs.setValues("action_multi_pref", null);
+
+ // Test with new valus
+ assertEquals(null, prefs.getValue("action_single_pref",
"other"));
+ assertEquals(null, prefs.getValue("action_multi_pref",
"other"));
+
+ // Trigger store
+ prefs.store();
+
+ // Test with new value after store
+ assertEquals(null, prefs.getValue("action_single_pref",
"other"));
+ assertEquals(null, prefs.getValue("action_multi_pref",
"other"));
+ }
+ });
+
+ seq.addAction(1, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(2, UTP2.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test with new values
+ assertEquals(null, prefs.getValue("action_single_pref",
"other"));
+ assertEquals(null, prefs.getValue("action_multi_pref",
"other"));
+ }
+ });
+
+ seq.addAction(2, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesMapModificationDoesNotModifyPreferencesValuesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesMapModificationDoesNotModifyPreferencesValuesTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesMapModificationDoesNotModifyPreferencesValuesTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.preferences;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletPreferences;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_91})
+public class PreferencesMapModificationDoesNotModifyPreferencesValuesTestCase
+{
+ public PreferencesMapModificationDoesNotModifyPreferencesValuesTestCase(PortletTest
seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ // Get prefs map
+ PortletPreferences prefs = request.getPreferences();
+ Map map = prefs.getMap();
+
+ //
+ String[] singlePref = (String[])map.get("single_pref");
+ String[] multiPref = (String[])map.get("multi_pref");
+ assertEquals(new String[]{"single_pref_value"}, singlePref);
+ assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"}, multiPref);
+
+ // Modify prefs
+ singlePref[0] = "new_single_pref_value";
+ multiPref[0] = "new_multi_pref_value_1";
+ multiPref[1] = "new_multi_pref_value_2";
+
+ //
+ assertEquals("single_pref_value",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesSequenceBuilder.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesSequenceBuilder.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesSequenceBuilder.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,868 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.preferences;
-
-import org.jboss.portal.test.framework.portlet.PortletTest;
-import org.jboss.portal.test.framework.portlet.PortletTestDriver;
-import org.jboss.portal.test.framework.portlet.PortletTestSuite;
-import org.jboss.portal.test.framework.portlet.PortletTestContext;
-import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
-import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
-import org.jboss.portal.test.portlet.framework.UTP1;
-import org.jboss.portal.test.portlet.framework.UTP2;
-import org.jboss.portal.test.portlet.framework.UTP3;
-import org.jboss.portal.test.portlet.framework.UTP4;
-import org.jboss.portal.test.portlet.framework.UTP5;
-import org.jboss.portal.test.portlet.framework.UTP6;
-import org.jboss.portal.test.portlet.framework.UTP7;
-import org.jboss.portal.test.portlet.framework.UTP8;
-import
org.jboss.portal.test.portlet.jsr168.tck.preferences.spec.CreateASingleInstanceOfValidatorValidator;
-import
org.jboss.portal.test.portlet.jsr168.tck.preferences.spec.ValidationStoresValidator;
-import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
-import org.jboss.unit.driver.DriverResponse;
-import org.jboss.unit.driver.response.EndTestResponse;
-
-import static org.jboss.unit.api.Assert.*;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.Portlet;
-import javax.portlet.PortletPreferences;
-import javax.portlet.ReadOnlyException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.ValidatorException;
-import java.io.IOException;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
- * @version $Revision: 7954 $
- */
-public class PreferencesSequenceBuilder extends PortletTestSuite
-{
-
-
- /**
- * @portlet.specification assert="SPEC:90 Preference attributes are String array
objects. Preferences attributes can
- * be set to null."
- */
- public void createPreferencesCanBeSetToNullCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("PreferencesCanBeSetToNull", seq);
-
- seq.addAction(0, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(1, UTP2.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException,
ValidatorException
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test the initial value is ok
- assertEquals("action_single_pref_value",
prefs.getValue("action_single_pref", "other"));
- assertEquals(new String[]{"action_multi_pref_value_1",
"action_multi_pref_value_2"},
- prefs.getValues("action_multi_pref", new String[0]));
-
- // Set the values to null
- prefs.setValue("action_single_pref", null);
- prefs.setValues("action_multi_pref", null);
-
- // Test with new valus
- assertEquals(null, prefs.getValue("action_single_pref",
"other"));
- assertEquals(null, prefs.getValue("action_multi_pref",
"other"));
-
- // Trigger store
- prefs.store();
-
- // Test with new value after store
- assertEquals(null, prefs.getValue("action_single_pref",
"other"));
- assertEquals(null, prefs.getValue("action_multi_pref",
"other"));
- }
- });
-
- seq.addAction(1, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(2, UTP2.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test with new values
- assertEquals(null, prefs.getValue("action_single_pref",
"other"));
- assertEquals(null, prefs.getValue("action_multi_pref",
"other"));
- }
- });
-
- seq.addAction(2, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:91 - The getMap method returns an
immutable Map of String keys and String[]
- * values containing all current preference values. Preferences values must not be
modified if the values in the Map
- * are altered."
- */
- public void
createPreferencesMapModificationDoesNotModifyPreferencesValuesCase(PortletTestDriver
registry)
- {
- PortletTest seq = new PortletTest();
-
registry.addSequence("PreferencesMapModificationDoesNotModifyPreferencesValues",
seq);
-
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- // Get prefs map
- PortletPreferences prefs = request.getPreferences();
- Map map = prefs.getMap();
-
- //
- String[] singlePref = (String[])map.get("single_pref");
- String[] multiPref = (String[])map.get("multi_pref");
- assertEquals(new String[]{"single_pref_value"}, singlePref);
- assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"}, multiPref);
-
- // Modify prefs
- singlePref[0] = "new_single_pref_value";
- multiPref[0] = "new_multi_pref_value_1";
- multiPref[1] = "new_multi_pref_value_2";
-
- //
- assertEquals("single_pref_value",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:92 - The reset method must reset a
preference attribute to its default value.
- * If there is no default value, the preference attribute must be deleted."
- * <p/>
- * Does not cover restore to default test yet.
- */
- public void createResetPreferenceHavingNoDefaultValueDeletesItCase(PortletTestDriver
registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ResetPreferenceHavingNoDefaultValueDeletesIt",
seq);
-
- seq.addAction(0, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(1, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException,
ValidatorException
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test the initial value does not exist
- assertEquals("other", prefs.getValue("pref",
"other"));
-
- // Set the value
- prefs.setValue("pref", "dynamic");
-
- // Store
- prefs.store();
-
- // Test with new value
- assertEquals("dynamic", prefs.getValue("pref",
"other"));
- }
- });
-
- seq.addAction(1, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(2, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException,
ValidatorException
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test with new value
- assertEquals("dynamic", prefs.getValue("pref",
"other"));
-
- // Reset the value and store
- prefs.reset("pref");
-
- // Test the value does not exist anymore
- assertEquals("other", prefs.getValue("pref",
"other"));
-
- // Store
- prefs.store();
-
- // Test the value does not exist anymore
- assertEquals("other", prefs.getValue("pref",
"other"));
- }
- });
-
- seq.addAction(2, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(3, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test the value does not exist anymore
- assertEquals("other", prefs.getValue("pref",
"other"));
- }
- });
-
- seq.addAction(3, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:93 - If a preference attribute is read
only, the setValue, setValues and reset
- * methods must throw a ReadOnlyException when the portlet is in any of the standard
modes"
- */
- public void createReadOnlyPreferenceCannotBeModifiedCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ReadOnlyPreferenceCannotBeModified", seq);
-
- seq.addAction(0, UTP5.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(1, UTP5.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test the initial values are ok
- assertEquals("single_pref_value",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
-
- // Try to modify
- try
- {
- prefs.setValue("single_pref", "");
- fail();
- }
- catch (ReadOnlyException e)
- {
- // expected
- }
- try
- {
- prefs.setValues("single_pref", new String[]{""});
- fail();
- }
- catch (ReadOnlyException e)
- {
- // expected
- }
- try
- {
- prefs.reset("single_pref");
- fail();
- }
- catch (ReadOnlyException e)
- {
- // expected
- }
- try
- {
- prefs.setValue("multi_pref", "");
- fail();
- }
- catch (ReadOnlyException e)
- {
- // expected
- }
- try
- {
- prefs.setValues("multi_pref", new String[]{""});
- fail();
- }
- catch (ReadOnlyException e)
- {
- // expected
- }
- try
- {
- prefs.reset("multi_pref");
- fail();
- }
- catch (ReadOnlyException e)
- {
- // expected
- }
-
- // Test values have not changed
- assertEquals("single_pref_value",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
- }
- });
-
- seq.addAction(1, UTP5.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:96 - All changes made to
PortletPreferences object not followed by a call to
- * the store method must be discarded when the portlet finishes the 20 processAction
method."
- */
- public void createChangesMadeButNotStoredAreDiscardedCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ChangesMadeButNotStoredAreDiscarded", seq);
-
- seq.addAction(0, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(1, UTP3.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Check the initial value are good
- assertEquals("static_single_pref_value",
prefs.getValue("static_single_pref", "other"));
- assertEquals(new String[]{"static_multi_pref_value_1",
"static_multi_pref_value_2"}, prefs.getValues("static_multi_pref", new
String[]{"other"}));
- assertEquals("other",
prefs.getValue("dynamic_single_pref", "other"));
- assertEquals(new String[]{"other"},
prefs.getValues("dynamic_multi_pref", new String[]{"other"}));
-
- // Set values
- prefs.setValue("static_single_pref",
"new_static_single_pref_value");
- prefs.setValues("static_multi_pref", new
String[]{"new_static_multi_pref_value_1",
"new_static_multi_pref_value_2"});
- prefs.setValue("dynamic_single_pref",
"new_dynamic_single_pref_value");
- prefs.setValues("dynamic_multi_pref", new
String[]{"new_dynamic_multi_pref_value_1",
"new_dynamic_multi_pref_value_2"});
-
- // Check wit new values
- assertEquals("new_static_single_pref_value",
prefs.getValue("static_single_pref", "other"));
- assertEquals(new String[]{"new_static_multi_pref_value_1",
"new_static_multi_pref_value_2"}, prefs.getValues("static_multi_pref",
new String[]{"other"}));
- assertEquals("new_dynamic_single_pref_value",
prefs.getValue("dynamic_single_pref", "other"));
- assertEquals(new String[]{"new_dynamic_multi_pref_value_1",
"new_dynamic_multi_pref_value_2"},
prefs.getValues("dynamic_multi_pref", new String[]{"other"}));
- }
- });
-
- seq.addAction(1, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(2, UTP3.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Check we have the original values back
- assertEquals("static_single_pref_value",
prefs.getValue("static_single_pref", "other"));
- assertEquals(new String[]{"static_multi_pref_value_1",
"static_multi_pref_value_2"}, prefs.getValues("static_multi_pref", new
String[]{"other"}));
- assertEquals("other",
prefs.getValue("dynamic_single_pref", "other"));
- assertEquals(new String[]{"other"},
prefs.getValues("dynamic_multi_pref", new String[]{"other"}));
- }
- });
-
- seq.addAction(2, UTP3.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:97 - If the store method is invoked within
the scope of a render method
- * invocation, it must throw an IllegalStateException."
- */
- public void
createStoreCalledDuringRenderThrowsIllegalArgumentExceptionCase(PortletTestDriver
registry)
- {
- PortletTest seq = new PortletTest();
-
registry.addSequence("StoreCalledDuringRenderThrowsIllegalArgumentException",
seq);
- seq.addAction(0, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException,
ValidatorException
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test the store call throws IllegalArgumentException
- try
- {
- prefs.store();
- fail();
- }
- catch (IllegalStateException e)
- {
- }
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:99 - If a preference attribute definition
does not contain the read-only
- * element set to true, the preference attribute is modifiable when the portlet is
processing an action request in
- * any of the standard portlet modes (VIEW, EDIT or HELP)."
- */
- public void createCanModifyNonReadOnlyPreferenceCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("CanModifyNonReadOnlyPreference", seq);
-
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(1, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException,
ValidatorException
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test the initial value is ok
- assertEquals("single_pref_value",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"},
- prefs.getValues("multi_pref", new
String[]{"other"}));
-
- // Set with new values
- prefs.setValue("single_pref", "new_single_pref");
- prefs.setValues("multi_pref", new
String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"});
-
- // Test with new values
- assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
-
- // Trigger store
- prefs.store();
-
- // Test with new values after store
- assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(2, UTP1.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test with new values
- assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
- }
- });
-
- seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:100 - Portlets are not restricted to use
preference attributes defined in the
- * deployment descriptor. They can programmatically add preference attributes using
names not defined in the
- * deployment descriptor. These preferences attributes must be treated as modifiable
attributes."
- */
- public void
createDynamicPreferenceTreatedLikeModifiablePreferenceCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("DynamicPreferenceTreatedLikeModifiablePreference",
seq);
-
- seq.addAction(0, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(1, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException,
ValidatorException
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test the initial values does not exist
- assertEquals("other", prefs.getValue("single_pref",
"other"));
- assertEquals(new String[]{"other"},
prefs.getValues("multi_pref", new String[]{"other"}));
-
- // Set with new values
- prefs.setValue("single_pref", "new_single_pref");
- prefs.setValues("multi_pref", new
String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"});
-
- // Test the values are good
- assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
-
- // Trigger store
- prefs.store();
-
- // Test the value are good after store
- assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
- }
- });
-
- seq.addAction(1, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(2, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException,
ValidatorException
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test the values have been store in the persistent store
- assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
-
- // Reset
- prefs.reset("single_pref");
- prefs.reset("multi_pref");
-
- // Test does not exist
- assertEquals("other", prefs.getValue("single_pref",
"other"));
- assertEquals(new String[]{"other"},
prefs.getValues("multi_pref", new String[]{"other"}));
-
- // Trigger store
- prefs.store();
-
- // Test does not exist after store
- assertEquals("other", prefs.getValue("single_pref",
"other"));
- assertEquals(new String[]{"other"},
prefs.getValues("multi_pref", new String[]{"other"}));
- }
- });
-
- seq.addAction(2, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(3, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test the values does not exist
- assertEquals("other", prefs.getValue("single_pref",
"other"));
- assertEquals(new String[]{"other"},
prefs.getValues("multi_pref", new String[]{"other"}));
- }
- });
-
- seq.addAction(3, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:101 - If a portlet definition includes a
validator, the portlet container must
- * create a single validator instance per portlet definition. (according to spec:
Testable=false ;)"
- */
- public void createCreateASingleInstanceOfValidatorCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("CreateASingleInstanceOfValidator", seq);
- seq.addAction(0, UTP6.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- assertEquals(1,
CreateASingleInstanceOfValidatorValidator.getCreatedCount());
- return new EndTestResponse();
- }
- });
- }
-
-
- /**
- * @portlet.specification assert="SPEC:103 - When a validator is associated with
the preferences of a portlet
- * definition, the store method of the PortletPreferences implementation must invoke
the validate method of the
- * validator before writing the changes to the persistent store."
- * @portlet.specification assert="SPEC:105 - If the validation is successful, the
store operation must be completed"
- */
- public void createValidationStoresCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ValidationStores", seq);
-
- seq.addAction(0, UTP8.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(1, UTP8.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException,
ValidatorException
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test the initial value is ok
- assertEquals("single_pref_value",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"},
- prefs.getValues("multi_pref", new
String[]{"other"}));
-
- // Set with new values
- prefs.setValue("single_pref", "new_single_pref");
- prefs.setValues("multi_pref", new
String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"});
-
- // Test with new values
- assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
-
- // Trigger store
- prefs.store();
-
- // Check the validator has been invoked
- assertTrue(ValidationStoresValidator.isValidateInvoked());
-
- // Test with new values after store
- assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
- }
- });
-
- seq.addAction(1, UTP8.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(2, UTP8.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test with new values
- assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
- }
- });
-
- seq.addAction(2, UTP8.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:104 - If the validation fails, the
PreferencesValidator implementation must
- * throw a ValidatorException. If a ValidatorException is thrown, the portlet
container must cancel the store
- * operation and it must propagate the exception to the portlet"
- */
- public void createInvalidationCancelsStoreCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("InvalidationCancelsStore", seq);
-
- seq.addAction(0, UTP7.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(1, UTP7.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test the initial value is ok
- assertEquals("single_pref_value",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"},
- prefs.getValues("multi_pref", new
String[]{"other"}));
-
- // Set the value to something else
- prefs.setValue("single_pref", "new_single_pref");
- prefs.setValues("multi_pref", new
String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"});
-
- // Trigger store
- try
- {
- prefs.store();
- }
- catch (ValidatorException e)
- {
- // Expected
- assertEquals("message", e.getMessage());
- assertFalse(e.getFailedKeys().hasMoreElements());
- }
- }
- });
-
- seq.addAction(1, UTP7.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new InvokeGetResponse(response.createActionURL().toString());
- }
- });
-
- seq.addAction(2, UTP7.ACTION_JOINPOINT, new PortletActionTestAction()
- {
- protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
- {
- // Get prefs
- PortletPreferences prefs = request.getPreferences();
-
- // Test the initial value is back
- assertEquals("single_pref_value",
prefs.getValue("single_pref", "other"));
- assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"},
- prefs.getValues("multi_pref", new
String[]{"other"}));
- }
- });
-
- seq.addAction(2, UTP7.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-
-
-}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesTestSuite.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesTestSuite.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/PreferencesTestSuite.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,118 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.preferences;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.com">Boleslaw
Dawidowicz</a>
- * @version $Revision: 5510 $
- */
-public class PreferencesTestSuite
-{
- public static void suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-preferences.war");
-//
-// /**
-// * SPEC:90 Testable= true Section=PLT.14.1
-// */
-// suite.addTest(new TestCase("PreferencesCanBeSetToNull"));
-//
-// /**
-// * SPEC:91 Testable= true Section=PLT.14.1
-// */
-// suite.addTest(new
TestCase("PreferencesMapModificationDoesNotModifyPreferencesValues"));
-//
-// /**
-// * SPEC:92 Testable=true Section=PLT.14.1
-// */
-// suite.addTest(new
TestCase("ResetPreferenceHavingNoDefaultValueDeletesIt"));
-//
-// /**
-// * SPEC:93 Testable=true Section=PLT.14.1
-// */
-// suite.addTest(new TestCase("ReadOnlyPreferenceCannotBeModified"));
-//
-// /**
-// * SPEC:94 Testable=true Section=PLT.14.1
-// * Tested in every over case in this chapter... DONE
-// */
-//
-// /**
-// * SPEC:95 Testable=true Section=PLT.14.1
-// * NOT TESTED - Postponed
-// */
-//
-// /**
-// * SPEC:96 Testable=true Section=PLT.14.1
-// */
-// suite.addTest(new TestCase("ChangesMadeButNotStoredAreDiscarded"));
-//
-// /**
-// * SPEC:97 Testable= true Section=PLT.14.1
-// */
-// suite.addTest(new
TestCase("StoreCalledDuringRenderThrowsIllegalArgumentException"));
-//
-// /**
-// * SPEC:98 Testable=true Section=PLT.14.1
-// * NOT TESTED - Postponed
-// */
-//
-// /**
-// * SPEC:99 Testable=true Section=PLT.14.3
-// */
-// suite.addTest(new TestCase("CanModifyNonReadOnlyPreference"));
-//
-// /**
-// * SPEC:100 Testable=true Section=PLT.14.3
-// */
-// suite.addTest(new
TestCase("DynamicPreferenceTreatedLikeModifiablePreference"));
-//
-// /**
-// * SPEC:101 Testable=false Section=PLT.14.4
-// * - CreateASingleInstanceOfValidatorValidator
-// */
-// suite.addTest(new TestCase("CreateASingleInstanceOfValidator"));
-//
-// /**
-// * SPEC:102 Testable=false Section=PLT.14.4
-// * Testable=fales
-// */
-//
-// /**
-// * SPEC:103 Testable=true Section=PLT.14.4
-// * SPEC:105 Testable=true Section=PLT.14.4
-// * - ValidationStoresValidator
-// */
-// suite.addTest(new TestCase("ValidationStores"));
-//
-// /**
-// * SPEC:104 Testable=true Section=PLT.14.4
-// * - InvalidationCancelsStoreValidator
-// */
-// suite.addTest(new TestCase("InvalidationCancelsStore"));
-//
-//
-// return suite;
- }
-}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ReadOnlyPreferenceCannotBeModifiedTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ReadOnlyPreferenceCannotBeModifiedTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ReadOnlyPreferenceCannotBeModifiedTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,144 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.preferences;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP5;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.fail;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletPreferences;
+import javax.portlet.ReadOnlyException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_93})
+public class ReadOnlyPreferenceCannotBeModifiedTestCase
+{
+ public ReadOnlyPreferenceCannotBeModifiedTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP5.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP5.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test the initial values are ok
+ assertEquals("single_pref_value",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
+
+ // Try to modify
+ try
+ {
+ prefs.setValue("single_pref", "");
+ fail();
+ }
+ catch (ReadOnlyException e)
+ {
+ // expected
+ }
+ try
+ {
+ prefs.setValues("single_pref", new String[]{""});
+ fail();
+ }
+ catch (ReadOnlyException e)
+ {
+ // expected
+ }
+ try
+ {
+ prefs.reset("single_pref");
+ fail();
+ }
+ catch (ReadOnlyException e)
+ {
+ // expected
+ }
+ try
+ {
+ prefs.setValue("multi_pref", "");
+ fail();
+ }
+ catch (ReadOnlyException e)
+ {
+ // expected
+ }
+ try
+ {
+ prefs.setValues("multi_pref", new String[]{""});
+ fail();
+ }
+ catch (ReadOnlyException e)
+ {
+ // expected
+ }
+ try
+ {
+ prefs.reset("multi_pref");
+ fail();
+ }
+ catch (ReadOnlyException e)
+ {
+ // expected
+ }
+
+ // Test values have not changed
+ assertEquals("single_pref_value",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
+ }
+ });
+
+ seq.addAction(1, UTP5.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ResetPreferenceHavingNoDefaultValueDeletesItTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ResetPreferenceHavingNoDefaultValueDeletesItTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ResetPreferenceHavingNoDefaultValueDeletesItTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,145 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.preferences;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP4;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.ReadOnlyException;
+import javax.portlet.ValidatorException;
+import javax.portlet.PortletPreferences;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_92})
+public class ResetPreferenceHavingNoDefaultValueDeletesItTestCase
+{
+ public ResetPreferenceHavingNoDefaultValueDeletesItTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException,
ValidatorException
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test the initial value does not exist
+ assertEquals("other", prefs.getValue("pref",
"other"));
+
+ // Set the value
+ prefs.setValue("pref", "dynamic");
+
+ // Store
+ prefs.store();
+
+ // Test with new value
+ assertEquals("dynamic", prefs.getValue("pref",
"other"));
+ }
+ });
+
+ seq.addAction(1, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(2, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException,
ValidatorException
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test with new value
+ assertEquals("dynamic", prefs.getValue("pref",
"other"));
+
+ // Reset the value and store
+ prefs.reset("pref");
+
+ // Test the value does not exist anymore
+ assertEquals("other", prefs.getValue("pref",
"other"));
+
+ // Store
+ prefs.store();
+
+ // Test the value does not exist anymore
+ assertEquals("other", prefs.getValue("pref",
"other"));
+ }
+ });
+
+ seq.addAction(2, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(3, UTP4.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test the value does not exist anymore
+ assertEquals("other", prefs.getValue("pref",
"other"));
+ }
+ });
+
+ seq.addAction(3, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/StoreCalledDuringRenderThrowsIllegalArgumentExceptionTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/StoreCalledDuringRenderThrowsIllegalArgumentExceptionTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/StoreCalledDuringRenderThrowsIllegalArgumentExceptionTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.preferences;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP4;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.fail;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ValidatorException;
+import javax.portlet.PortletPreferences;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_97})
+public class StoreCalledDuringRenderThrowsIllegalArgumentExceptionTestCase
+{
+ public StoreCalledDuringRenderThrowsIllegalArgumentExceptionTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP4.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException,
ValidatorException
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test the store call throws IllegalArgumentException
+ try
+ {
+ prefs.store();
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ }
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ValidationStoresTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ValidationStoresTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/preferences/ValidationStoresTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,127 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.preferences;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.framework.portlet.actions.PortletActionTestAction;
+import org.jboss.portal.test.portlet.framework.UTP8;
+import
org.jboss.portal.test.portlet.jsr168.tck.preferences.spec.ValidationStoresValidator;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertTrue;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.ReadOnlyException;
+import javax.portlet.ValidatorException;
+import javax.portlet.PortletPreferences;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_103,TCKAssertion.JSR168_105})
+public class ValidationStoresTestCase
+{
+ public ValidationStoresTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP8.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(1, UTP8.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws ReadOnlyException, IOException,
ValidatorException
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test the initial value is ok
+ assertEquals("single_pref_value",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"multi_pref_value_1",
"multi_pref_value_2"},
+ prefs.getValues("multi_pref", new
String[]{"other"}));
+
+ // Set with new values
+ prefs.setValue("single_pref", "new_single_pref");
+ prefs.setValues("multi_pref", new
String[]{"new_multi_pref_value_1", "new_multi_pref_value_2"});
+
+ // Test with new values
+ assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
+
+ // Trigger store
+ prefs.store();
+
+ // Check the validator has been invoked
+ assertTrue(ValidationStoresValidator.isValidateInvoked());
+
+ // Test with new values after store
+ assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
+ }
+ });
+
+ seq.addAction(1, UTP8.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ seq.addAction(2, UTP8.ACTION_JOINPOINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context)
+ {
+ // Get prefs
+ PortletPreferences prefs = request.getPreferences();
+
+ // Test with new values
+ assertEquals("new_single_pref",
prefs.getValue("single_pref", "other"));
+ assertEquals(new String[]{"new_multi_pref_value_1",
"new_multi_pref_value_2"}, prefs.getValues("multi_pref", new
String[]{"other"}));
+ }
+ });
+
+ seq.addAction(2, UTP8.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/CustomStateNotMappedNotInvokedTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/CustomStateNotMappedNotInvokedTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/CustomStateNotMappedNotInvokedTestCase.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.tck.windowstates;
+
+import org.jboss.portal.test.framework.portlet.PortletTest;
+import org.jboss.portal.test.framework.portlet.PortletTestContext;
+import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTP2;
+import org.jboss.portal.unit.annotations.TCK;
+import org.jboss.portal.unit.TCKAssertion;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.FailureResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import org.jboss.unit.Failure;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowStateException;
+import javax.portlet.PortletURL;
+import javax.portlet.WindowState;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)TCK({TCKAssertion.JSR168_40})
+public class CustomStateNotMappedNotInvokedTestCase
+{
+ public CustomStateNotMappedNotInvokedTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws WindowStateException
+ {
+ PortletURL url = response.createRenderURL();
+ url.setWindowState(new WindowState("UNMAPPED_STATE"));
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ //if portlet was invoked we will have failure
+ return new FailureResponse(Failure.createAssertionFailure("Render
wasn't expected"));
+ }
+ });
+
+ seq.addAction(1, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/WindowStatesSequenceBuilder.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/WindowStatesSequenceBuilder.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/WindowStatesSequenceBuilder.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,89 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.windowstates;
-
-import org.jboss.portal.test.framework.portlet.PortletTest;
-import org.jboss.portal.test.framework.portlet.PortletTestDriver;
-import org.jboss.portal.test.framework.portlet.PortletTestSuite;
-import org.jboss.portal.test.framework.portlet.PortletTestContext;
-import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
-import org.jboss.portal.test.portlet.framework.UTP1;
-import org.jboss.portal.test.portlet.framework.UTP2;
-import org.jboss.unit.driver.DriverResponse;
-import org.jboss.unit.driver.response.FailureResponse;
-import org.jboss.unit.driver.response.EndTestResponse;
-import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
-
-import static org.jboss.unit.api.Assert.*;
-import org.jboss.unit.Failure;
-
-import javax.portlet.Portlet;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.WindowState;
-import javax.portlet.WindowStateException;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
- * @version $Revision: 7954 $
- */
-public class WindowStatesSequenceBuilder extends PortletTestSuite
-{
-
- /**
- * @portlet.specification assert="SPEC:40 - If a custom window state defined in
the deployment descriptor is not
- * mapped to a custom window state provided by the portal, portlets must not be
invoked in that window state."
- */
- public void _createCustomStateNotMappedNotInvokedCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("CustomStateNotMappedNotInvoked", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws WindowStateException
- {
- PortletURL url = response.createRenderURL();
- url.setWindowState(new WindowState("UNMAPPED_STATE"));
- return new InvokeGetResponse(url.toString());
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- //if portlet was invoked we will have failure
- return new FailureResponse(Failure.createAssertionFailure("Render
wasn't expected"));
- }
- });
-
- seq.addAction(1, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
- {
- return new EndTestResponse();
- }
- });
- }
-}
Deleted:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/WindowStatesTestSuite.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/WindowStatesTestSuite.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/WindowStatesTestSuite.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -1,46 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.windowstates;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.com">Boleslaw
Dawidowicz</a>
- * @version $Revision: 5510 $
- */
-public class WindowStatesTestSuite
-{
- public static void suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-windowstates.war");
-//
-// /**
-// * SPEC:40 Testable=true Section=PLT.9.4
-// *
-// * Disabled as feature is not supported by portal yet
-// */
-// //suite.addTest(new
TestCase("CustomStateNotMappedNotInvokedPortlet"));
-//
-//
-// return suite;
- }
-}
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/unit/TCKAssertion.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/org/jboss/portal/unit/TCKAssertion.java 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/main/org/jboss/portal/unit/TCKAssertion.java 2007-11-07
14:52:33 UTC (rev 8836)
@@ -31,6 +31,333 @@
public enum TCKAssertion
{
+ JSR168_4(4, "After the portlet object is instantiated, the portlet container
must" +
+ " initialize the portlet before invoking it to handle requests"),
+
+ JSR168_5(5, "During initialization, the portlet object may throw an" +
+ " UnavailableException or a PortletException. In this case, the portlet
container must not place the portlet object" +
+ " into active service and it must release the portlet object."),
+
+ JSR168_6(6, "The destroy method must not be called because the initialization
is" +
+ " considered unsuccessful."),
+
+ JSR168_8(8, "A RuntimeException thrown during initialization must be handled as
a" +
+ " PortletException."),
+
+ JSR168_9(9, "If the client request is triggered by an action URL, the" +
+ " portal/portlet-container must first trigger the action request by invoking
the processAction method of the" +
+ " targeted portlet."),
+
+ JSR168_10(10, "The portal/portlet-container must wait until the action request
finishes." +
+ " Then, the portal/portlet-container must trigger the render request by
invoking the render method for all the" +
+ " portlets in the portal page with the possible exception of portlets for
which their content is being cached."),
+
+ JSR168_11(11, "If the client request is triggered by a render URL, the" +
+ " portal/portlet-container must invoke the render method for all the portlets
in the portal page with the possible" +
+ " exception of portlets for which their content is being cached."),
+
+ JSR168_12(12, "While processing an action request, the portlet may instruct
the" +
+ " portal/portlet-container to redirect the user to a specific URL. If the
portlet issues a redirection, when the" +
+ " processAction method concludes, the portal/portlet-container must send the
redirection back to the user agent"),
+
+ JSR168_17(17, "A PortletException signals that an error has occurred during the
processing" +
+ " of the request and that the portlet container should take appropriate
measures to clean up the request. If a portlet" +
+ " throws an exception in the processAction method, all operations on the
ActionResponse must be ignored and the render" +
+ " method must not be invoked within the current client request",
Status.disabled("spec?")),
+
+ JSR168_18(18, "If a permanent unavailability is indicated by the
UnavailableException, the" +
+ " portlet container must remove the portlet from service immediately, call the
portlet�s destroy method, and release" +
+ " the portlet object.", Status.disabled("spec?")),
+
+ JSR168_19(19, "A RuntimeException thrown during the request handling must be
handled as a" +
+ " PortletException", Status.disabled("spec?")),
+
+ JSR168_24(24, ""),
+
+ JSR168_26(26, "A render URL is an optimization for a special type of action URLs.
The" +
+ " portal/portletcontainer must not invoke the processAction method of the
targeted portlet."),
+
+ JSR168_27(27, "The portal/portlet-container must ensure that all the parameters
set when" +
+ " constructing the render URL become render parameters of the subsequent
render requests for the portlet."),
+
+ JSR168_28(28, "Portlets can add application specific parameters to the
PortletURL" +
+ " objects using the setParameter and setParameters methods. A call to any of
the setParameter methods must replace" +
+ " any parameter with the same name previously set."),
+
+ JSR168_30(30, "", Status.jbossUntestable("why?")),
+
+ JSR168_31(31, "", Status.jbossUntestable("why?")),
+
+ JSR168_29(29, "All the parameters a portlet adds to a PortletURL object must be
made" +
+ " available to the portlet as request parameters"),
+
+ JSR168_32(32, "A portlet cannot create a portlet URL using a portlet mode that is
not" +
+ " defined as supported by the portlet or that the user it is not allowed to
use. The setPortletMode methods must" +
+ " throw a PortletModeException in that situation."),
+
+ JSR168_34(34, "A portlet cannot create a portlet URL using a window state that is
not" +
+ " supported by the portlet container. The setWindowState method must throw a
WindowStateException if that is the" +
+ " case"),
+
+ JSR168_35(35, "The setSecure method of the PortletURL interface allows a portlet
to" +
+ " indicate if the portlet URL has to be a secure URL or not (i.e. HTTPS or
HTTP). If the setSecure method is not" +
+ " used, the portlet URL must be of the same security level of the current
request."),
+
+ JSR168_36(36, "The GenericPortlet class implementation of the render method
dispatches" +
+ " requests to the doView, doEdit or doHelp method depending on the portlet
mode indicated in the request using the" +
+ " doDispatch method"),
+
+ JSR168_33(33, "", Status.duplicate(JSR168_36, "")),
+
+ JSR168_37(37, "", Status.duplicate(JSR168_36,
"RequestDispatchingDependingOnModePortlet as VIEW mode isn't specified in
descriptor")),
+
+ JSR168_38(38, "The portlet must not be invoked in a portlet mode that has not
been" +
+ " declared as supported for a given markup type",
Status.disabled("spec?")),
+
+ JSR168_40(40, "If a custom window state defined in the deployment descriptor is
not" +
+ " mapped to a custom window state provided by the portal, portlets must not be
invoked in that window state."),
+
+ JSR168_43(43, "The initialization parameters accessible through the
PortletContext must" +
+ " be the same that are accessible through the ServletContext of the portlet
application."),
+
+ JSR168_44(44, "Context attributes set using the PortletContext must be stored in
the" +
+ " ServletContext of the portlet application. A direct consequence of this is
that data stored in the ServletContext" +
+ " by servlets or JSPs is accessible to portlets through the PortletContext and
vice versa."),
+
+ JSR168_45(45, "The PortletContext must offer access to the same set of resources
the" +
+ " ServletContext exposes."),
+
+ JSR168_46(46, "The PortletContext must handle the same temporary working
directory the" +
+ " ServletContext handles. It must be accessible as a context attribute using
the same constant defined in the" +
+ " Servlet Specification 2.3 SVR 3 Servlet Context Chapter,
javax.servlet.context.tempdir."),
+
+ JSR168_47(47, "", Status.postponed("spec?")),
+
+ JSR168_48(48, "", Status.postponed("spec?")),
+
+ JSR168_49(49, "", Status.postponed("spec?")),
+
+ JSR168_50(50, "The portlet-container must not propagate parameters received in an
action" +
+ " request to subsequent render requests of the portlet."),
+
+ JSR168_51(51, "If a portlet receives a render request that is the result of a
client" +
+ " request targeted to another portlet in the portal page, the parameters must
be the same parameters as of the" +
+ " previous render request."),
+
+ JSR168_52(52, "If a portlet receives a render request following an action request
as" +
+ " part of the same client request, the parameters received with render request
must be the render parameters set" +
+ " during the action request."),
+
+ JSR168_53(53, "", Status.postponed("spec?")),
+
+ JSR168_54(54, "A portlet must not see any parameter targeted to other
portlets."),
+
+ JSR168_55(55, "The getParameterValues method returns an array of String
objects" +
+ " containing all the parameter values associated with a parameter name. The
value returned from the getParameter" +
+ " method must be the first value in the array of String objects returned by
getParameterValues"),
+
+ JSR168_56(56, "If there is a single parameter value associated with a parameter
name the" +
+ " method returns must return an array of size one containing the parameter
value"),
+
+ JSR168_57(57, "", Status.specUntestable("")),
+
+ JSR168_58(58, "The context path of a request is exposed via the request object.
The" +
+ " context path is the path prefix associated with the deployed portlet
application. If the portlet application is" +
+ " rooted at the base of the web server URL namespace (also known as
\"default\" context), this path must be an empty" +
+ " string"),
+
+ JSR168_59(59, "Otherwise, it must be the path the portlet application is rooted
to, the" +
+ " path must start with a '/' and it must not end with a '/'
character."),
+
+ JSR168_60(60, "If the user is not authenticated the getAuthType method must
return null"),
+
+ JSR168_61(61, "If the portlet container supports additional content types for
the" +
+ " portlet�s output, it must declare the additional content types through the
getResponseContentTypes method of the" +
+ " request object. The returned Enumeration of strings should contain the
content types the portlet container" +
+ " supports in order of preference. The first element of the enumeration must
be the same content type returned by" +
+ " the getResponseContentType method."),
+
+ JSR168_62(62, "", Status.jbossUntestable("PORTAL DOESN'T SUPPORT
ADDITIONAL CONTENT TYPES")),
+
+ JSR168_63(63, "Only one of the two methods, getPortletInputStream or getReader,
can be" +
+ " used during an action request. If the input stream is obtained, a call to
the getReader must throw an" +
+ " IllegalStateException. Similarly, if the reader is obtained, a call to the
getPortletInputStream must throw an" +
+ " IllegalStateException."),
+
+ JSR168_64(64, "", Status.postponed("")),
+
+ JSR168_65(65, "The sendRedirect method instructs the portal/portlet-container to
set the" +
+ " appropriate headers and content body to redirect the user to a different
URL. A fully qualified URL or a full path" +
+ " URL must be specified. If a relative path URL is given, an
IllegalArgumentException must be thrown."),
+
+ JSR168_66(66, "If the sendRedirect method is called after the
setPortletMode," +
+ " setWindowState, setRenderParameter or setRenderParameters methods of the
ActionResponse interface, an" +
+ " IllegalStateException must be thrown and the redirection must not be
executed"),
+
+ JSR168_67(67, "The setPortletMode method allows a portlet to change its current
portlet" +
+ " mode. The new portlet mode would be effective in the following render
request. If a portlet attempts to set a" +
+ " portlet mode that is not allowed to switch to, a PortletModeException must
be thrown."),
+
+ JSR168_68(68, "The setWindowState method allows a portlet to change its current
window" +
+ " state. The new window state would be effective in the following render
request. If a portlet attempts to set a" +
+ " window state that it is not allowed to switch to, a WindowStateException
must be thrown."),
+
+ JSR168_69(69, "If the setPortletMode or setWindowState methods are called after
the" +
+ " sendRedirect method has been called an IllegalStateException must be
thrown."),
+
+ JSR168_70(70, "If the exception is caught by the portlet, the redirection must
be" +
+ " executed."),
+
+ JSR168_71(71, "If the setPortletMode or setWindowState methods are called after
the" +
+ " sendRedirect method has been called an IllegalStateException must be thrown.
(...) If the exception is propagated" +
+ " back to the portlet-container, the redirection must not be executed.",
Status.disabled("This is disabled as after propagating IllegalStateException to
PortletContainer" +
+ " '500' code is returned which doesn't allow us to end test
properly")),
+
+ JSR168_72(72, "Using the setRenderParameter and setRenderParameters methods of
the" +
+ " ActionResponse interface portlets may set render parameters during an action
request. A call to any of the" +
+ " setRenderParameter methods must replace any parameter with the same name
previously set."),
+
+ JSR168_73(73, "If no render parameters are set during the processAction
invocation, the" +
+ " render request must not contain any request parameters."),
+
+ JSR168_74(74, "If the setRenderParameter or setRenderParameters methods are
called after" +
+ " the sendRedirect method has been called an IllegalStateException must be
thrown"),
+
+ // done only partially - see SPEC:71 comment for the reason
+ JSR168_75(75, "If the exception is caught by the portlet, the redirection must
be" +
+ " executed. If the exception is propagated back to the portlet-container, the
redirection must not be executed."),
+
+ JSR168_76(76, "A portlet must set the content type of the response using
the" +
+ " setContentType method of the RenderResponse interface. The setContentType
method must throw an" +
+ " IllegalArgumentException if the content type set does not match (including
wildcard matching) any of the content" +
+ " types returned by the getResponseContentType method of the PortleRequest
object"),
+
+ JSR168_77(77, "If the getWriter or getPortletOutputStream methods are called
before the" +
+ " setContentType method, they must throw an IllegalStateException."),
+
+ JSR168_78(78, "If the portlet has set a content type, the getContentType method
must" +
+ " return it. Otherwise, the getContentType method must return null."),
+
+ JSR168_79(79, "A portlet may generate its content by writing to the OutputStream
or to" +
+ " the Writer of the RenderResponse object. A portlet must use only one of
these objects. The portlet container must" +
+ " throw an IllegalStateException if a portlet attempts to use both."),
+
+ JSR168_80(80, "The getBufferSize method returns the size of the underlying buffer
being" +
+ " used. If no buffering is being used, this method must return the int value
of 0 (zero)", Status.disabled("no buffering is implemented yet")),
+
+ JSR168_81(81, "The portlet can request a preferred buffer size by using the"
+
+ " setBufferSize method. The buffer assigned is not required to be the size
requested by the portlet, but must be at" +
+ " least as large as the size requested.", Status.disabled("no
buffering is implemented yet")),
+
+ JSR168_82(82, "", Status.postponed("")),
+
+ JSR168_83(83, "If the response is committed and the reset or resetBuffer method
is" +
+ " called, an IllegalStateException must be thrown.",
Status.disabled("no buffering is implemented yet")),
+
+ JSR168_84(84, "", Status.postponed("")),
+
+ JSR168_85(85, "", Status.postponed("")),
+
+ JSR168_86(86, "The getNamespace method must provide the portlet with a mechanism
that" +
+ " ensures the uniqueness of the returned string in the whole portal
page"),
+
+ JSR168_87(87, "The getNamespace method must return the same value if invoked
multiple" +
+ " times within a render request."),
+
+ JSR168_88(88, "The getNamespace method must return a valid identifier as defined
in the" +
+ " 3.8 Identifier Section of the Java Language Specification Second
Edition."),
+
+ JSR168_90(90, "Preference attributes are String array objects. Preferences
attributes can" +
+ " be set to null."),
+
+ JSR168_91(91, "The getMap method returns an immutable Map of String keys and
String[]" +
+ " values containing all current preference values. Preferences values must not
be modified if the values in the Map" +
+ " are altered."),
+
+ // Does not cover restore to default test yet.
+ JSR168_92(92, "The reset method must reset a preference attribute to its default
value." +
+ " If there is no default value, the preference attribute must be
deleted."),
+
+ JSR168_93(93, "If a preference attribute is read only, the setValue, setValues
and reset" +
+ " methods must throw a ReadOnlyException when the portlet is in any of the
standard modes"),
+
+ JSR168_94(94, "", Status.disabled("Tested in every over case in this
chapter... DONE")),
+
+ JSR168_95(95, "", Status.postponed("why?")),
+
+ JSR168_96(96, "All changes made to PortletPreferences object not followed by a
call to" +
+ " the store method must be discarded when the portlet finishes the 20
processAction method."),
+
+ JSR168_97(97, "If the store method is invoked within the scope of a render
method" +
+ " invocation, it must throw an IllegalStateException."),
+
+ JSR168_98(98, "", Status.postponed("why?")),
+
+ JSR168_99(99, "If a preference attribute definition does not contain the
read-only" +
+ " element set to true, the preference attribute is modifiable when the portlet
is processing an action request in" +
+ " any of the standard portlet modes (VIEW, EDIT or HELP)."),
+
+ JSR168_100(100, "Portlets are not restricted to use preference attributes defined
in the" +
+ " deployment descriptor. They can programmatically add preference attributes
using names not defined in the" +
+ " deployment descriptor. These preferences attributes must be treated as
modifiable attributes."),
+
+ JSR168_101(101, "If a portlet definition includes a validator, the portlet
container must" +
+ " create a single validator instance per portlet definition. (according to
spec: Testable=false ;)"),
+
+ JSR168_102(102, "", Status.specUntestable("")),
+
+ JSR168_103(103, "When a validator is associated with the preferences of a
portlet" +
+ " definition, the store method of the PortletPreferences implementation must
invoke the validate method of the" +
+ " validator before writing the changes to the persistent store."),
+
+ JSR168_104(104, "If the validation fails, the PreferencesValidator implementation
must" +
+ " throw a ValidatorException. If a ValidatorException is thrown, the portlet
container must cancel the store" +
+ " operation and it must propagate the exception to the portlet"),
+
+ JSR168_105(105, "If the validation is successful, the store operation must be
completed"),
+
+ JSR168_106(106, "For portlets within the same portlet application, a portlet
container" +
+ " must ensure that every portlet request generated as result of a group of
requests originated from the portal to" +
+ " complete a single client request receive or acquire the same
session"),
+
+ JSR168_107(107, "In addition, if within these portlet requests more than one
portlet" +
+ " creates a session, the session object must be the same for all the portlets
in the same portlet application"),
+
+ JSR168_110(110, "Any object stored in the session using the APPLICATION_SCOPE
is" +
+ " available to any other portlet that belongs to the same portlet application
and that handles a request identified" +
+ " as being a part of the same session."),
+
+ JSR168_111(111, "Objects stored in the session using the PORTLET_SCOPE must be
available" +
+ " to the portlet during requests for the same portlet window that the objects
where stored from."),
+
+ JSR168_112(112, "The object must be stored in the APPLICATION_SCOPE with the
following" +
+ " fabricated attribute name
'javax.portlet.p.<ID>?<ATTRIBUTE_NAME>'. <ID> is a unique
identification for the portlet" +
+ " window (assigned by the portal/portlet-container) that must not contain a
'?' character."),
+
+ JSR168_113(113, "The PortletSession must store all attributes in the HttpSession
of the" +
+ " portlet application. A direct consequence of this is that data stored in the
HttpSession by servlets or JSPs is" +
+ " accessible to portlets through the PortletSession in the portlet application
scope."),
+
+ JSR168_114(114, "Conversely, data stored by portlets in the PortletSession in the
portlet" +
+ " application scope is accessible to servlets and JSPs through the
HttpSession."),
+
+ JSR168_115(115, "If the HttpSession object is invalidated, the PortletSession
object must" +
+ " also be invalidated by the portlet container."),
+
+ JSR168_116(116, "If the PortletSession object is invalidated by a portlet, the
portlet" +
+ " container must invalidate the associated HttpSession object."),
+
+ JSR168_117(117, "The attribute names must be the same if APPLICATION_SCOPE scope
is" +
+ " used."),
+
+ JSR168_118(118, "The attribute name has to conform with the specified prefixing
if" +
+ " PORTLET_SCOPE is used"),
+
+ JSR168_119(119, "The variant of these methods that does not receive a scope must
be" +
+ " treated as PORTLET_SCOPE."),
+
+ JSR168_120(120, "", Status.jbossUntestable("why?")),
+
JSR168_121(121, "The getRequestDispatcher method takes a String argument
describing a" +
" path within the scope of the PortletContext of a portlet application. This
path must begin with a �/� and it is" +
" relative to the PortletContext root."),
@@ -99,16 +426,149 @@
;
+ public abstract static class Status
+ {
+ protected Status()
+ {
+ }
+
+ private static Inactive disabled(String cause)
+ {
+ return new Inactive(Inactive.Type.DISABLED, cause);
+ }
+
+ private static Inactive todo(String cause)
+ {
+ return new Inactive(Inactive.Type.TODO, cause);
+ }
+
+ private static Inactive postponed(String cause)
+ {
+ return new Inactive(Inactive.Type.POSTPONED, cause);
+ }
+
+ private static Inactive specUntestable(String cause)
+ {
+ return new Untestable(Untestable.Kind.SPEC, cause);
+ }
+
+ private static Inactive jbossUntestable(String cause)
+ {
+ return new Untestable(Untestable.Kind.JBOSS, cause);
+ }
+
+ private static Duplicate duplicate(TCKAssertion target, String description)
+ {
+ return new Duplicate(target, description);
+ }
+ }
+
+ public static class Active extends Status
+ {
+
+ }
+
+ public static class Inactive extends Status
+ {
+
+ /** . */
+ private final Type type;
+
+ /** . */
+ private final String msg;
+
+ public enum Type
+ {
+ POSTPONED, TODO, DISABLED, UNTESTABLE
+ }
+
+ public Inactive(Type type, String msg)
+ {
+ this.type = type;
+ this.msg = msg;
+ }
+
+ public Type getType()
+ {
+ return type;
+ }
+
+ public String getMessage()
+ {
+ return msg;
+ }
+ }
+
+ public static class Untestable extends Inactive
+ {
+
+ public enum Kind
+ {
+ JBOSS, SPEC
+ }
+
+ /** . */
+ private final Kind kind;
+
+ public Untestable(Kind kind, String msg)
+ {
+ super(Inactive.Type.UNTESTABLE, msg);
+
+ //
+ this.kind = kind;
+ }
+
+ public Kind getKind()
+ {
+ return kind;
+ }
+ }
+
+ public static class Duplicate extends Active
+ {
+
+ /** . */
+ private final TCKAssertion target;
+
+ /** . */
+ private final String description;
+
+ private Duplicate(TCKAssertion target, String description)
+ {
+ this.target = target;
+ this.description = description;
+ }
+
+ public TCKAssertion getTarget()
+ {
+ return target;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+ }
+
/** . */
private final int id;
/** . */
private final String description;
+ /** . */
+ private Status status;
+
TCKAssertion(int id, String description)
{
+ this(id, description, new Active());
+ }
+
+ TCKAssertion(int id, String description, Status status)
+ {
this.id = id;
this.description = description;
+ this.status = status;
}
public int getId()
@@ -120,4 +580,9 @@
{
return description;
}
+
+ public Status getStatus()
+ {
+ return status;
+ }
}
Modified:
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletconfig-war/WEB-INF/web.xml
===================================================================
---
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletconfig-war/WEB-INF/web.xml 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletconfig-war/WEB-INF/web.xml 2007-11-07
14:52:33 UTC (rev 8836)
@@ -27,6 +27,6 @@
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<listener>
-
<listener-class>org.jboss.portal.test.portlet.jsr168.tck.portletconfig.PortletConfigSequenceBuilder</listener-class>
+
<listener-class>org.jboss.portal.test.framework.portlet.PortletTestSuite</listener-class>
</listener>
</web-app>
Modified:
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletcontext-war/WEB-INF/web.xml
===================================================================
---
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletcontext-war/WEB-INF/web.xml 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletcontext-war/WEB-INF/web.xml 2007-11-07
14:52:33 UTC (rev 8836)
@@ -28,7 +28,7 @@
<web-app>
<listener>
-
<listener-class>org.jboss.portal.test.portlet.jsr168.tck.portletcontext.PortletContextSequenceBuilder</listener-class>
+
<listener-class>org.jboss.portal.test.framework.portlet.PortletTestSuite</listener-class>
</listener>
<servlet>
Modified:
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletinterface-war/WEB-INF/web.xml
===================================================================
---
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletinterface-war/WEB-INF/web.xml 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletinterface-war/WEB-INF/web.xml 2007-11-07
14:52:33 UTC (rev 8836)
@@ -28,7 +28,7 @@
<web-app>
<listener>
-
<listener-class>org.jboss.portal.test.portlet.jsr168.tck.portletinterface.PortletInterfaceSequenceBuilder</listener-class>
+
<listener-class>org.jboss.portal.test.framework.portlet.PortletTestSuite</listener-class>
</listener>
<servlet>
Modified:
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletmode-war/WEB-INF/web.xml
===================================================================
---
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletmode-war/WEB-INF/web.xml 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletmode-war/WEB-INF/web.xml 2007-11-07
14:52:33 UTC (rev 8836)
@@ -27,6 +27,6 @@
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<listener>
-
<listener-class>org.jboss.portal.test.portlet.jsr168.tck.portletmode.PortletModeSequenceBuilder</listener-class>
+
<listener-class>org.jboss.portal.test.framework.portlet.PortletTestSuite</listener-class>
</listener>
</web-app>
Modified:
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletrequests-war/WEB-INF/web.xml
===================================================================
---
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletrequests-war/WEB-INF/web.xml 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletrequests-war/WEB-INF/web.xml 2007-11-07
14:52:33 UTC (rev 8836)
@@ -27,6 +27,6 @@
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<listener>
-
<listener-class>org.jboss.portal.test.portlet.jsr168.tck.portletrequests.PortletRequestsSequenceBuilder</listener-class>
+
<listener-class>org.jboss.portal.test.framework.portlet.PortletTestSuite</listener-class>
</listener>
</web-app>
Modified:
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletresponses-war/WEB-INF/web.xml
===================================================================
---
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletresponses-war/WEB-INF/web.xml 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletresponses-war/WEB-INF/web.xml 2007-11-07
14:52:33 UTC (rev 8836)
@@ -28,7 +28,7 @@
<web-app>
<listener>
-
<listener-class>org.jboss.portal.test.portlet.jsr168.tck.portletresponses.PortletResponsesSequenceBuilder</listener-class>
+
<listener-class>org.jboss.portal.test.framework.portlet.PortletTestSuite</listener-class>
</listener>
<servlet>
Modified:
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletsession-war/WEB-INF/web.xml
===================================================================
---
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletsession-war/WEB-INF/web.xml 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portletsession-war/WEB-INF/web.xml 2007-11-07
14:52:33 UTC (rev 8836)
@@ -28,7 +28,7 @@
<web-app>
<listener>
-
<listener-class>org.jboss.portal.test.portlet.jsr168.tck.portletsession.PortletSessionSequenceBuilder</listener-class>
+
<listener-class>org.jboss.portal.test.framework.portlet.PortletTestSuite</listener-class>
</listener>
<listener>
Modified:
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portleturl-war/WEB-INF/web.xml
===================================================================
---
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portleturl-war/WEB-INF/web.xml 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/portleturl-war/WEB-INF/web.xml 2007-11-07
14:52:33 UTC (rev 8836)
@@ -27,6 +27,6 @@
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<listener>
-
<listener-class>org.jboss.portal.test.portlet.jsr168.tck.portleturl.PortletUrlSequenceBuilder</listener-class>
+
<listener-class>org.jboss.portal.test.framework.portlet.PortletTestSuite</listener-class>
</listener>
</web-app>
Modified:
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/preferences-war/WEB-INF/web.xml
===================================================================
---
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/preferences-war/WEB-INF/web.xml 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/preferences-war/WEB-INF/web.xml 2007-11-07
14:52:33 UTC (rev 8836)
@@ -27,6 +27,6 @@
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<listener>
-
<listener-class>org.jboss.portal.test.portlet.jsr168.tck.preferences.PreferencesSequenceBuilder</listener-class>
+
<listener-class>org.jboss.portal.test.framework.portlet.PortletTestSuite</listener-class>
</listener>
</web-app>
Modified:
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/windowstates-war/WEB-INF/web.xml
===================================================================
---
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/windowstates-war/WEB-INF/web.xml 2007-11-06
18:11:32 UTC (rev 8835)
+++
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/windowstates-war/WEB-INF/web.xml 2007-11-07
14:52:33 UTC (rev 8836)
@@ -27,6 +27,6 @@
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<listener>
-
<listener-class>org.jboss.portal.test.portlet.jsr168.tck.windowstates.WindowStatesSequenceBuilder</listener-class>
+
<listener-class>org.jboss.portal.test.framework.portlet.PortletTestSuite</listener-class>
</listener>
</web-app>