JBoss Portal SVN: r8836 - in modules/portlet/trunk/portlet: src/main/org/jboss/portal/test/framework/portlet and 24 other directories.
by portal-commits@lists.jboss.org
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>
16 years, 11 months
JBoss Portal SVN: r8835 - in branches/UIServer/uiserver/src: main/org/jboss/portal/uiserver/ajax/client/protocol and 4 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-11-06 13:11:32 -0500 (Tue, 06 Nov 2007)
New Revision: 8835
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/layout/
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/protocol/
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/protocol/Page.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/protocol/Window.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalEntryPoint.java
Removed:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Page.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Window.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalRPCImpl.java
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/AsyncPages.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PartialRefresh.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Portal.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortalLayout.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletService.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletServiceAsync.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletWindowPanel.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPC.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPCAsync.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPoint.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPointImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/GWTClientFilter.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortalEntryPoint.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/HostedModeProxy.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortletServiceImpl.java
branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml
Log:
some refactoring/documentation
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/AsyncPages.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/AsyncPages.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/AsyncPages.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -1,3 +1,25 @@
+/******************************************************************************
+ * 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.uiserver.ajax.client;
@@ -24,8 +46,14 @@
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import org.jboss.portal.uiserver.ajax.client.protocol.Page;
+import org.jboss.portal.uiserver.ajax.client.protocol.Window;
+
/**
- * Entry point classes define <code>onModuleLoad()</code>.
+ * Used for Prototyping Async Page Management
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
*/
public class AsyncPages implements EntryPoint
{
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Page.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Page.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Page.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -1,45 +0,0 @@
-package org.jboss.portal.uiserver.ajax.client;
-
-import com.google.gwt.user.client.rpc.IsSerializable;
-
-public class Page implements IsSerializable
-{
- private String name = null;
- private Window[] windows = null;
-
- /**
- *
- * @return
- */
- public String getName()
- {
- return name;
- }
-
- /**
- *
- * @param name
- */
- public void setName(String name)
- {
- this.name = name;
- }
-
- /**
- *
- * @return
- */
- public Window[] getWindows()
- {
- return windows;
- }
-
- /**
- *
- * @param windows
- */
- public void setWindows(Window[] windows)
- {
- this.windows = windows;
- }
-}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PartialRefresh.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PartialRefresh.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PartialRefresh.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -1,3 +1,25 @@
+/******************************************************************************
+ * 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.uiserver.ajax.client;
import com.google.gwt.core.client.GWT;
@@ -20,8 +42,14 @@
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import org.jboss.portal.uiserver.ajax.client.protocol.Page;
+import org.jboss.portal.uiserver.ajax.client.protocol.Window;
+
/**
- * Entry point classes define <code>onModuleLoad()</code>.
+ * Used for Prototyping Partial Refresh feature
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
*/
public class PartialRefresh implements EntryPoint
{
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Portal.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Portal.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Portal.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -1,3 +1,25 @@
+/******************************************************************************
+ * 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.uiserver.ajax.client;
@@ -17,15 +39,21 @@
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.jboss.portal.uiserver.ajax.client.service.PortalRPC;
import org.jboss.portal.uiserver.ajax.client.service.PortalRPCAsync;
+import org.jboss.portal.uiserver.ajax.client.protocol.Page;
+import org.jboss.portal.uiserver.ajax.client.protocol.Window;
/**
- * Entry point classes define <code>onModuleLoad()</code>.
+ * This is the Entry Point of the client-side Ajax agent of the Presentation Framework
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
*/
public class Portal implements EntryPoint
{
@@ -34,8 +62,11 @@
*/
public void onModuleLoad()
{
- HorizontalPanel page = new HorizontalPanel();
+ //HorizontalPanel page = new HorizontalPanel();
+ //RootPanel.get("currentPage").add(page);
+ FlexTable page = new FlexTable();
RootPanel.get("currentPage").add(page);
+
this.loadPortal();
}
@@ -143,7 +174,7 @@
//Dispalying the fully aggregated page
Window[] windows = portalPage.getWindows();
- HorizontalPanel page = (HorizontalPanel)RootPanel.get("currentPage").getWidget(0);
+ FlexTable page = (FlexTable)RootPanel.get("currentPage").getWidget(0);
page.clear();
for(int i=0; i<windows.length; i++)
{
@@ -180,7 +211,7 @@
windowContent.addClickListener(contentListener);*/
//Add this window to the Page
- page.add(window);
+ page.setWidget(0,0,window);
}
}
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortalLayout.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortalLayout.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortalLayout.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -1,3 +1,25 @@
+/******************************************************************************
+ * 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.uiserver.ajax.client;
import com.google.gwt.core.client.GWT;
@@ -15,7 +37,10 @@
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
- * Entry point classes define <code>onModuleLoad()</code>.
+ * Prototyping some client side layout concepts
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
*/
public class PortalLayout implements EntryPoint
{
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletService.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletService.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletService.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -1,3 +1,25 @@
+/******************************************************************************
+ * 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.uiserver.ajax.client;
import com.google.gwt.user.client.rpc.RemoteService;
@@ -2,3 +24,6 @@
+import org.jboss.portal.uiserver.ajax.client.protocol.Page;
+
/**
+ * A Protototype RPC service
*
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletServiceAsync.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletServiceAsync.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletServiceAsync.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -1,3 +1,25 @@
+/******************************************************************************
+ * 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.uiserver.ajax.client;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -2,2 +24,8 @@
+/**
+ * A Prototype RPC Service
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
public interface PortletServiceAsync
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletWindowPanel.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletWindowPanel.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletWindowPanel.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -1,3 +1,25 @@
+/******************************************************************************
+ * 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.uiserver.ajax.client;
import com.google.gwt.user.client.ui.HTMLPanel;
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Window.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Window.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Window.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -1,108 +0,0 @@
-package org.jboss.portal.uiserver.ajax.client;
-
-import com.google.gwt.user.client.rpc.IsSerializable;
-
-public class Window implements IsSerializable
-{
- public static final String NORMAL = "NORMAL";
- public static final String MAXIMIZED = "MAXIMIZED";
- public static final String MINIMIZED = "MINIMIZED";
- public static final String EDIT = "EDIT";
- public static final String VIEW = "VIEW";
-
- private String name = null;
- private String content = null;
- private String mode = VIEW;
- private String state = NORMAL;
- private boolean isVisible = true;
-
- /**
- *
- * @return
- */
- public String getContent()
- {
- return content;
- }
-
- /**
- *
- * @param content
- */
- public void setContent(String content)
- {
- this.content = content;
- }
-
- /**
- *
- * @return
- */
- public boolean isVisible()
- {
- return isVisible;
- }
-
- /**
- *
- * @param isVisible
- */
- public void setVisible(boolean isVisible)
- {
- this.isVisible = isVisible;
- }
-
- /**
- *
- * @return
- */
- public String getMode()
- {
- return mode;
- }
-
- /**
- *
- * @param mode
- */
- public void setMode(String mode)
- {
- this.mode = mode;
- }
-
- /**
- *
- * @return
- */
- public String getName()
- {
- return name;
- }
-
- /**
- *
- * @param name
- */
- public void setName(String name)
- {
- this.name = name;
- }
-
- /**
- *
- * @return
- */
- public String getState()
- {
- return state;
- }
-
- /**
- *
- * @param state
- */
- public void setState(String state)
- {
- this.state = state;
- }
-}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/protocol/Page.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/protocol/Page.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/protocol/Page.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * 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.uiserver.ajax.client.protocol;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+/**
+ * Represents the concept of a Portal Page on the client-side Ajax agent
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class Page implements IsSerializable
+{
+ private String name = null;
+ private Window[] windows = null;
+
+ /**
+ *
+ * @return
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ *
+ * @param name
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Window[] getWindows()
+ {
+ return windows;
+ }
+
+ /**
+ *
+ * @param windows
+ */
+ public void setWindows(Window[] windows)
+ {
+ this.windows = windows;
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/protocol/Window.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/protocol/Window.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/protocol/Window.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -0,0 +1,136 @@
+/******************************************************************************
+ * 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.uiserver.ajax.client.protocol;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+/**
+ * Represents the concept of a Portal Window on the client-side Ajax agent
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class Window implements IsSerializable
+{
+ public static final String NORMAL = "NORMAL";
+ public static final String MAXIMIZED = "MAXIMIZED";
+ public static final String MINIMIZED = "MINIMIZED";
+ public static final String EDIT = "EDIT";
+ public static final String VIEW = "VIEW";
+
+ private String name = null;
+ private String content = null;
+ private String mode = VIEW;
+ private String state = NORMAL;
+ private boolean isVisible = true;
+
+ /**
+ *
+ * @return
+ */
+ public String getContent()
+ {
+ return content;
+ }
+
+ /**
+ *
+ * @param content
+ */
+ public void setContent(String content)
+ {
+ this.content = content;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public boolean isVisible()
+ {
+ return isVisible;
+ }
+
+ /**
+ *
+ * @param isVisible
+ */
+ public void setVisible(boolean isVisible)
+ {
+ this.isVisible = isVisible;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getMode()
+ {
+ return mode;
+ }
+
+ /**
+ *
+ * @param mode
+ */
+ public void setMode(String mode)
+ {
+ this.mode = mode;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ *
+ * @param name
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getState()
+ {
+ return state;
+ }
+
+ /**
+ *
+ * @param state
+ */
+ public void setState(String state)
+ {
+ this.state = state;
+ }
+}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPC.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPC.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPC.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -1,3 +1,25 @@
+/******************************************************************************
+ * 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.uiserver.ajax.client.service;
import com.google.gwt.user.client.rpc.RemoteService;
@@ -2,5 +24,6 @@
-import org.jboss.portal.uiserver.ajax.client.Page;
+import org.jboss.portal.uiserver.ajax.client.protocol.Page;
/**
+ * RPC service used for Asynchronous communication between the client-side agent and the Portal Server
*
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPCAsync.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPCAsync.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPCAsync.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -1,3 +1,25 @@
+/******************************************************************************
+ * 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.uiserver.ajax.client.service;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -2,2 +24,8 @@
+/**
+ * RPC service used for Asynchronous communication between the client-side agent and the Portal Server
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
public interface PortalRPCAsync
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPoint.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPoint.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPoint.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -27,6 +27,8 @@
import org.jboss.portal.common.invocation.InterceptorStackFactory;
/**
+ * A Utility Service used by different Portal Server Entry Points
+ *
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
*/
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPointImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPointImpl.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPointImpl.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -28,6 +28,8 @@
import org.jboss.portal.jems.as.system.AbstractJBossService;
/**
+ * Implementation of an Entry Point Utility
+ *
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
*/
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/GWTClientFilter.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/GWTClientFilter.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/GWTClientFilter.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -35,6 +35,8 @@
import javax.servlet.http.HttpServletResponse;
/**
+ * This filter is activated or deactivated depending on whether the Portal needs to runs in Ajax mode or Classic Html mode
+ *
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
*/
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortalEntryPoint.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortalEntryPoint.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortalEntryPoint.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -72,6 +72,8 @@
import org.jboss.portal.uiserver.processor.ProcessorResponse;
/**
+ * The Portal Server Entry Point for classic html mode
+ *
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
*/
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/HostedModeProxy.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/HostedModeProxy.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/HostedModeProxy.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -36,7 +36,7 @@
/**
- * This is a RPC Proxy Service that is used only during development. This lets the GWT client integrate with the Portal server while running in
+ * This is a RPC Proxy Service that is used only during development. This lets the GWT client-side agent integrate with the Portal server while running in
* Hosted Mode. It is very efficient to debug/develop client side GWT code in Hosted Mode.
*
* This service is never deployed in a production setting and Portal components *do not* have any compile time or run time dependency on this Proxy.
Copied: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalEntryPoint.java (from rev 8829, branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalRPCImpl.java)
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalEntryPoint.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalEntryPoint.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -0,0 +1,224 @@
+package org.jboss.portal.uiserver.service.ajax;
+
+
+import java.util.Map;
+import java.util.List;
+import java.util.HashMap;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import javax.servlet.ServletException;
+import javax.servlet.UnavailableException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanServerLocator;
+
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.server.RequestControllerFactory;
+import org.jboss.portal.server.Server;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.impl.ServerInvocationContextImpl;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.server.ServerRequest;
+import org.jboss.portal.server.ServerResponse;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.RequestControllerDispatcher;
+
+import org.jboss.portal.uiserver.ajax.client.service.PortalRPC;
+import org.jboss.portal.uiserver.ajax.client.protocol.Page;
+import org.jboss.portal.uiserver.ajax.client.protocol.Window;
+import org.jboss.portal.uiserver.processor.ProcessorResponse;
+import org.jboss.portal.uiserver.service.EntryPoint;
+
+import com.google.gwt.user.client.rpc.SerializationException;
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+
+/**
+ * This serves as the Portal Entry Point for AJAX (Asynchronous) RPC calls being made by the
+ * client-side Ajax agent of the Presentation Framework
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PortalEntryPoint extends RemoteServiceServlet implements
+PortalRPC
+{
+ /** The logger. */
+ private Logger log = Logger.getLogger(getClass());
+
+ /**
+ *
+ */
+ private EntryPoint entryPoint = null;
+
+ /** Configure the as default servlet. */
+ public void init() throws ServletException
+ {
+ try
+ {
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+ this.entryPoint = (EntryPoint) MBeanProxy.get(EntryPoint.class, new ObjectName(
+ this.getInitParameter("entryPointServiceName")),
+ mbeanServer);
+ }
+ catch (Exception e)
+ {
+ this.entryPoint = null;
+ String msg = "Portal Entry Point could not be created";
+ log.error(msg, e);
+ throw new UnavailableException(msg);
+ }
+ }
+
+ /**
+ *
+ */
+ public String processCall(String payload) throws SerializationException
+ {
+ HttpServletRequest request = this.getThreadLocalRequest();
+
+ //Perform the remote procedure call
+ String returnVal = super.processCall(payload);
+
+ //Perform any post-processing after calling the actual remote method that will perform
+ //the functionality for this particular remote procedure call
+ if(request.getAttribute("processorResponse") != null)
+ {
+ ProcessorResponse processorResponse = (ProcessorResponse)request.getAttribute("processorResponse");
+ request.getSession().setAttribute("processorResponse", processorResponse);
+ }
+
+ return returnVal;
+ }
+ // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Loads the initial Portal Page at the start of a Portal session
+ *
+ * @return The Initial Portal Page
+ */
+ public Page loadPortal()
+ {
+ try
+ {
+ Page display = null;
+ HttpServletRequest request = this.getThreadLocalRequest();
+ this.callPortalServer();
+ display = this.getDisplay((ProcessorResponse)request.getAttribute("processorResponse"));
+ return display;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * @return The Page of the Portal that should be currently displayed
+ */
+ public Page getCurrentPage()
+ {
+ Page currentPage = null;
+
+ HttpServletRequest request = this.getThreadLocalRequest();
+
+ ProcessorResponse processorResponse = (ProcessorResponse) request.getSession().getAttribute("processorResponse");
+
+ currentPage = this.getDisplay(processorResponse);
+
+ return currentPage;
+ }
+
+ /**
+ *
+ * @param processorResponse
+ * @return
+ */
+ private Page getDisplay(ProcessorResponse processorResponse)
+ {
+ Page display = null;
+
+ org.jboss.portal.uiserver.protocol.Page portalPage = processorResponse
+ .findDisplayedPage();
+
+ // Construct the ajax currentPage object from the portalPage that has been
+ // chosen to be displayed
+ if (portalPage != null)
+ {
+ display = new Page();
+ display.setName(portalPage.getName());
+ List pageWindows = portalPage.getWindows();
+ if(pageWindows != null && pageWindows.size()>0)
+ {
+ Window[] windows = new Window[pageWindows.size()];
+ display.setWindows(windows);
+ for(int i=0; i<pageWindows.size(); i++)
+ {
+ org.jboss.portal.uiserver.protocol.Window pageWindow = (org.jboss.portal.uiserver.protocol.Window)pageWindows.get(i);
+ Window window = new Window();
+ window.setName(pageWindow.getName());
+ window.setContent(pageWindow.getContent());
+ windows[i] = window;
+ }
+ }
+ }
+
+ return display;
+ }
+
+ /**
+ *
+ *
+ */
+ private void callPortalServer() throws Exception
+ {
+ HttpServletRequest req = this.getThreadLocalRequest();
+ HttpServletResponse resp = this.getThreadLocalResponse();
+ String requestURI = req.getRequestURI();
+ String contextPath = req.getContextPath();
+ String portalHost = req.getServerName();
+ String portalRequestPath = requestURI.substring(contextPath.length());
+ String portalContextPath = requestURI.substring(0, contextPath.length());
+ Map queryParameterMap = new HashMap();
+ URLContext urlContext = URLContext.newInstance(req.isSecure(), req.getRemoteUser() != null);
+
+ Server server = this.entryPoint.getPortalServer();
+
+ //
+ ServerInvocationContext invocationCtx = new ServerInvocationContextImpl(
+ req,
+ resp,
+ portalHost,
+ portalRequestPath,
+ portalContextPath,
+ queryParameterMap,
+ null, //body parameter map is not applicable for asynchronous RPC calls
+ urlContext,
+ null //media type information is not applicable for asynchronous RPC calls
+ );
+
+ //
+ ServerRequest request = new ServerRequest(invocationCtx);
+ request.setServer(server);
+
+ //
+ ServerResponse response = new ServerResponse(request, invocationCtx);
+
+ //
+ ServerInvocation invocation = new ServerInvocation(invocationCtx);
+ invocation.setRequest(request);
+ invocation.setResponse(response);
+
+ //
+ RequestControllerFactory controllerFactory = this.entryPoint.getControllerFactory();
+ RequestController controller = controllerFactory.createRequestController(invocation);
+ invocation.setHandler(new RequestControllerDispatcher(controller));
+
+ InterceptorStackFactory stack = this.entryPoint.getInterceptorStackFactory();
+ invocation.invoke(stack.getInterceptorStack());
+ }
+}
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalRPCImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalRPCImpl.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalRPCImpl.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -1,224 +0,0 @@
-package org.jboss.portal.uiserver.service.ajax;
-
-
-import java.util.Map;
-import java.util.List;
-import java.util.HashMap;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import javax.servlet.ServletException;
-import javax.servlet.UnavailableException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.log4j.Logger;
-import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanServerLocator;
-
-import org.jboss.portal.common.invocation.InterceptorStackFactory;
-import org.jboss.portal.server.RequestControllerFactory;
-import org.jboss.portal.server.Server;
-import org.jboss.portal.server.ServerInvocationContext;
-import org.jboss.portal.server.impl.ServerInvocationContextImpl;
-import org.jboss.portal.server.request.URLContext;
-import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.ServerResponse;
-import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.RequestController;
-import org.jboss.portal.server.RequestControllerDispatcher;
-
-import org.jboss.portal.uiserver.ajax.client.service.PortalRPC;
-import org.jboss.portal.uiserver.ajax.client.Page;
-import org.jboss.portal.uiserver.ajax.client.Window;
-import org.jboss.portal.uiserver.processor.ProcessorResponse;
-import org.jboss.portal.uiserver.service.EntryPoint;
-
-import com.google.gwt.user.client.rpc.SerializationException;
-import com.google.gwt.user.server.rpc.RemoteServiceServlet;
-
-/**
- * This serves as the Portal Entry Point for AJAX (Asynchronous) RPC calls being made by the
- * Ajax client of the Portal
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class PortalRPCImpl extends RemoteServiceServlet implements
-PortalRPC
-{
- /** The logger. */
- private Logger log = Logger.getLogger(getClass());
-
- /**
- *
- */
- private EntryPoint entryPoint = null;
-
- /** Configure the as default servlet. */
- public void init() throws ServletException
- {
- try
- {
- MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
- this.entryPoint = (EntryPoint) MBeanProxy.get(EntryPoint.class, new ObjectName(
- this.getInitParameter("entryPointServiceName")),
- mbeanServer);
- }
- catch (Exception e)
- {
- this.entryPoint = null;
- String msg = "Portal Entry Point could not be created";
- log.error(msg, e);
- throw new UnavailableException(msg);
- }
- }
-
- /**
- *
- */
- public String processCall(String payload) throws SerializationException
- {
- HttpServletRequest request = this.getThreadLocalRequest();
-
- //Perform the remote procedure call
- String returnVal = super.processCall(payload);
-
- //Perform any post-processing after calling the actual remote method that will perform
- //the functionality for this particular remote procedure call
- if(request.getAttribute("processorResponse") != null)
- {
- ProcessorResponse processorResponse = (ProcessorResponse)request.getAttribute("processorResponse");
- request.getSession().setAttribute("processorResponse", processorResponse);
- }
-
- return returnVal;
- }
- // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- * Loads the initial Portal Page at the start of a Portal session
- *
- * @return The Initial Portal Page
- */
- public Page loadPortal()
- {
- try
- {
- Page display = null;
- HttpServletRequest request = this.getThreadLocalRequest();
- this.callPortalServer();
- display = this.getDisplay((ProcessorResponse)request.getAttribute("processorResponse"));
- return display;
- }
- catch(Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @return The Page of the Portal that should be currently displayed
- */
- public Page getCurrentPage()
- {
- Page currentPage = null;
-
- HttpServletRequest request = this.getThreadLocalRequest();
-
- ProcessorResponse processorResponse = (ProcessorResponse) request.getSession().getAttribute("processorResponse");
-
- currentPage = this.getDisplay(processorResponse);
-
- return currentPage;
- }
-
- /**
- *
- * @param processorResponse
- * @return
- */
- private Page getDisplay(ProcessorResponse processorResponse)
- {
- Page display = null;
-
- org.jboss.portal.uiserver.protocol.Page portalPage = processorResponse
- .findDisplayedPage();
-
- // Construct the ajax currentPage object from the portalPage that has been
- // chosen to be displayed
- if (portalPage != null)
- {
- display = new Page();
- display.setName(portalPage.getName());
- List pageWindows = portalPage.getWindows();
- if(pageWindows != null && pageWindows.size()>0)
- {
- Window[] windows = new Window[pageWindows.size()];
- display.setWindows(windows);
- for(int i=0; i<pageWindows.size(); i++)
- {
- org.jboss.portal.uiserver.protocol.Window pageWindow = (org.jboss.portal.uiserver.protocol.Window)pageWindows.get(i);
- Window window = new Window();
- window.setName(pageWindow.getName());
- window.setContent(pageWindow.getContent());
- windows[i] = window;
- }
- }
- }
-
- return display;
- }
-
- /**
- *
- *
- */
- private void callPortalServer() throws Exception
- {
- HttpServletRequest req = this.getThreadLocalRequest();
- HttpServletResponse resp = this.getThreadLocalResponse();
- String requestURI = req.getRequestURI();
- String contextPath = req.getContextPath();
- String portalHost = req.getServerName();
- String portalRequestPath = requestURI.substring(contextPath.length());
- String portalContextPath = requestURI.substring(0, contextPath.length());
- Map queryParameterMap = new HashMap();
- URLContext urlContext = URLContext.newInstance(req.isSecure(), req.getRemoteUser() != null);
-
- Server server = this.entryPoint.getPortalServer();
-
- //
- ServerInvocationContext invocationCtx = new ServerInvocationContextImpl(
- req,
- resp,
- portalHost,
- portalRequestPath,
- portalContextPath,
- queryParameterMap,
- null, //body parameter map is not applicable for asynchronous RPC calls
- urlContext,
- null //media type information is not applicable for asynchronous RPC calls
- );
-
- //
- ServerRequest request = new ServerRequest(invocationCtx);
- request.setServer(server);
-
- //
- ServerResponse response = new ServerResponse(request, invocationCtx);
-
- //
- ServerInvocation invocation = new ServerInvocation(invocationCtx);
- invocation.setRequest(request);
- invocation.setResponse(response);
-
- //
- RequestControllerFactory controllerFactory = this.entryPoint.getControllerFactory();
- RequestController controller = controllerFactory.createRequestController(invocation);
- invocation.setHandler(new RequestControllerDispatcher(controller));
-
- InterceptorStackFactory stack = this.entryPoint.getInterceptorStackFactory();
- invocation.invoke(stack.getInterceptorStack());
- }
-}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortletServiceImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortletServiceImpl.java 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortletServiceImpl.java 2007-11-06 18:11:32 UTC (rev 8835)
@@ -5,8 +5,8 @@
import javax.servlet.http.HttpServletRequest;
import org.jboss.portal.uiserver.ajax.client.PortletService;
-import org.jboss.portal.uiserver.ajax.client.Page;
-import org.jboss.portal.uiserver.ajax.client.Window;
+import org.jboss.portal.uiserver.ajax.client.protocol.Page;
+import org.jboss.portal.uiserver.ajax.client.protocol.Window;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@@ -14,8 +14,7 @@
* This is just a STUB server side component to test the client side components
* of the GWT-based AJAX UI
*
- * In real implementation this functionality will be provided by the UIServer
- * interfacing with the Portal Core
+ * Only used for Prototyping stuff
*
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
Modified: branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml
===================================================================
--- branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml 2007-11-06 15:05:30 UTC (rev 8834)
+++ branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml 2007-11-06 18:11:32 UTC (rev 8835)
@@ -73,8 +73,8 @@
<!-- Asynchronous service request processor -->
<servlet>
- <servlet-name>PortalRPC</servlet-name>
- <servlet-class>org.jboss.portal.uiserver.service.ajax.PortalRPCImpl</servlet-class>
+ <servlet-name>AjaxPortalEntryPoint</servlet-name>
+ <servlet-class>org.jboss.portal.uiserver.service.ajax.PortalEntryPoint</servlet-class>
<init-param>
<param-name>asDefaultServlet</param-name>
<param-value>false</param-value>
@@ -88,7 +88,7 @@
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
- <servlet-name>PortalRPC</servlet-name>
+ <servlet-name>AjaxPortalEntryPoint</servlet-name>
<url-pattern>/portalrpc/*</url-pattern>
</servlet-mapping>
</web-app>
16 years, 11 months
JBoss Portal SVN: r8834 - in modules/portlet/trunk/portlet/src/main/org/jboss/portal: test/portlet/jsr168/tck/dispatcher and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-06 10:05:30 -0500 (Tue, 06 Nov 2007)
New Revision: 8834
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/unit/
modules/portlet/trunk/portlet/src/main/org/jboss/portal/unit/TCKAssertion.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/unit/annotations/
modules/portlet/trunk/portlet/src/main/org/jboss/portal/unit/annotations/TCK.java
Removed:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatcherTestSuite.java
Modified:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatchedRequestTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ErrorHandlingTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/GETMethodTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestAttributesTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestParametersTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ObtainingDispatcherTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/QueryStringInRequestDispatcherTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/RequestObjectTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ResponseObjectTestCase.java
Log:
- added TCK annotation for documenting TCK related tests
- use TCK annotation in the migrated test package
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatchedRequestTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatchedRequestTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatchedRequestTestCase.java 2007-11-06 15:05:30 UTC (rev 8834)
@@ -29,6 +29,8 @@
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;
@@ -46,15 +48,10 @@
import java.io.IOException;
/**
- * @portlet.specification assert="SPEC:124 - To include a servlet or a JSP, a portlet calls the include method of the
- * PortletRequestDispatcher interface. The parameters to these methods must be the request and response arguments
- * that were passed in via the render method of the Portlet interface."
- * @portlet.specification assert="SPEC:125 - The portlet container must ensure that the servlet or JSP called through
- * a PortletRequestDispatcher is called in the same thread as the PortletRequestDispatcher include invocation."
- *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
+(a)TCK({TCKAssertion.JSR168_124,TCKAssertion.JSR168_125})
public class DispatchedRequestTestCase
{
public DispatchedRequestTestCase(PortletTest seq)
Deleted: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatcherTestSuite.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatcherTestSuite.java 2007-11-06 14:04:11 UTC (rev 8833)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatcherTestSuite.java 2007-11-06 15:05:30 UTC (rev 8834)
@@ -1,34 +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.dispatcher;
-
-import org.jboss.portal.test.framework.portlet.PortletTestSuite;
-
-/**
- * @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 DispatcherTestSuite extends PortletTestSuite
-{
-}
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ErrorHandlingTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ErrorHandlingTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ErrorHandlingTestCase.java 2007-11-06 15:05:30 UTC (rev 8834)
@@ -29,6 +29,8 @@
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;
@@ -47,15 +49,10 @@
import java.io.IOException;
/**
- * @portlet.specification assert="SPEC:142 - If the servlet or JSP that is the target of a request dispatcher throws
- * a runtime exception or a checked exception of type IOException, it must be propagated to the calling portlet."
- * @portlet.specification assert="SPEC:143 - All other exceptions, including a ServletException, must be wrapped with
- * a PortletException. The root cause of the exception must be set to the original exception before being
- * propagated."
- *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
+(a)TCK({TCKAssertion.JSR168_142,TCKAssertion.JSR168_143})
public class ErrorHandlingTestCase
{
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/GETMethodTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/GETMethodTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/GETMethodTestCase.java 2007-11-06 15:05:30 UTC (rev 8834)
@@ -29,6 +29,8 @@
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;
@@ -46,12 +48,10 @@
import java.io.IOException;
/**
- * @portlet.specification assert="SPEC:126 - Servlets and JSPs included from portlets must be handled as HTTP GET
- * requests."
- *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
+(a)TCK({TCKAssertion.JSR168_126})
public class GETMethodTestCase
{
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestAttributesTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestAttributesTestCase.java 2007-11-06 15:05:30 UTC (rev 8834)
@@ -29,6 +29,8 @@
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;
@@ -46,12 +48,10 @@
import java.io.IOException;
/**
- * @portlet.specification assert="SPEC:128 - javax.portlet.config, javax.portlet.request, javax.portlet.response.
- * These attributes must be the same Portlet API objects accessible to the portlet doing the include call."
- *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
+(a)TCK({TCKAssertion.JSR168_128})
public class IncludedRequestAttributesTestCase
{
public IncludedRequestAttributesTestCase(PortletTest seq)
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestParametersTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestParametersTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestParametersTestCase.java 2007-11-06 15:05:30 UTC (rev 8834)
@@ -29,6 +29,8 @@
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;
@@ -47,15 +49,10 @@
import java.io.IOException;
/**
- * @portlet.specification assert="SPEC:127 - Except for servlets obtained by using the getNamedDispatcher method, a
- * servlet or JSP being used from within an include call has access to the path used to obtain the
- * PortletRequestDispatcher. The following request attributes must be set: javax.servlet.include.request_uri,
- * javax.servlet.include.context_path javax.servlet.include.servlet_path, javax.servlet.include.path_info,
- * javax.servlet.include.query_string"
- *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
+(a)TCK({TCKAssertion.JSR168_127})
public class IncludedRequestParametersTestCase
{
public IncludedRequestParametersTestCase(PortletTest seq)
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ObtainingDispatcherTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ObtainingDispatcherTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ObtainingDispatcherTestCase.java 2007-11-06 15:05:30 UTC (rev 8834)
@@ -27,6 +27,8 @@
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.assertNotNull;
@@ -38,16 +40,10 @@
import javax.portlet.PortletRequestDispatcher;
/**
- * @portlet.specification assert="SPEC: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."
- * @portlet.specification assert="SPEC:122 - The getNamedDispatcher method takes a String argument indicating the
- * name of a servlet known to the PortletContext of the portlet application. If no resource can be resolved based on
- * the given path or name the methods must return null"
- *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
+(a)TCK({TCKAssertion.JSR168_121,TCKAssertion.JSR168_122})
public class ObtainingDispatcherTestCase
{
public ObtainingDispatcherTestCase(PortletTest seq)
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/QueryStringInRequestDispatcherTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/QueryStringInRequestDispatcherTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/QueryStringInRequestDispatcherTestCase.java 2007-11-06 15:05:30 UTC (rev 8834)
@@ -30,6 +30,8 @@
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.remote.driver.handler.http.response.InvokeGetResponse;
@@ -51,12 +53,10 @@
import java.io.IOException;
/**
- * @portlet.specification assert="SPEC:123 - The parameters associated with a PortletRequestDispatcher are scoped to
- * apply only for the duration of the include call."
- *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
+(a)TCK({TCKAssertion.JSR168_123})
public class QueryStringInRequestDispatcherTestCase
{
public QueryStringInRequestDispatcherTestCase(PortletTest seq)
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/RequestObjectTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/RequestObjectTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/RequestObjectTestCase.java 2007-11-06 15:05:30 UTC (rev 8834)
@@ -29,6 +29,8 @@
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;
@@ -52,27 +54,10 @@
import java.util.Map;
/**
- * @portlet.specification assert="SPEC:129 - The following methods of the HttpServletRequest must return null:
- * getProtocol, getRemoteAddr, getRemoteHost, getRealPath, and getRequestURL."
- * @portlet.specification assert="SPEC:130 - The following methods of the HttpServletRequest must return the path and
- * query string information used to obtain the PortletRequestDispatcher object: getPathInfo, getPathTranslated,
- * getQueryString, getRequestURI and getServletPath"
- * @portlet.specification assert="SPEC:131 - The following methods of the HttpServletRequest must be equivalent to
- * the methods of the PortletRequest of similar name: getScheme, getServerName,getServerPort, getAttribute,
- * getAttributeNames, setAttribute,removeAttribute, getLocale, getLocales, isSecure, getAuthType, getContextPath,
- * getRemoteUser, getUserPrincipal, getRequestedSessionId, isRequestedSessionIdValid"
- * @portlet.specification assert="SPEC:132 - The following methods of the HttpServletRequest must be equivalent to
- * the methods of the PortletRequest of similar name with the provision defined in PLT.16.1.1 Query Strings in
- * Request Dispatcher Paths Section: getParameter, getParameterNames, getParameterValues and getParameterMap."
- * @portlet.specification assert="SPEC:133 - The following methods of the HttpServletRequest must do no operations
- * and return null: getCharacterEncoding, setCharacterEncoding, getContentType, getInputStream and getReader."
- * @portlet.specification assert="SPEC:134 - The getContentLength method of the HttpServletRequest must return 0."
- * @portlet.specification assert="SPEC:137 - The getMethod method of the HttpServletRequest must always return
- * �GET�"
- *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
+(a)TCK({TCKAssertion.JSR168_129,TCKAssertion.JSR168_130,TCKAssertion.JSR168_131,TCKAssertion.JSR168_132,TCKAssertion.JSR168_133,TCKAssertion.JSR168_134,TCKAssertion.JSR168_137})
public class RequestObjectTestCase
{
public RequestObjectTestCase(PortletTest seq)
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ResponseObjectTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ResponseObjectTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ResponseObjectTestCase.java 2007-11-06 15:05:30 UTC (rev 8834)
@@ -29,6 +29,8 @@
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;
@@ -47,14 +49,10 @@
import java.io.IOException;
/**
- * @portlet.specification assert="SPEC:138 - The following methods of the HttpServletResponse must return
- * null:encodeRedirectURL and encodeRedirectUrl"
- * @portlet.specification assert="SPEC:141 - The getLocale method of the HttpServletResponse must be based on the
- * getLocale method of the RenderResponse."
- *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
+(a)TCK({TCKAssertion.JSR168_138,TCKAssertion.JSR168_141})
public class ResponseObjectTestCase
{
public ResponseObjectTestCase(PortletTest seq)
Added: modules/portlet/trunk/portlet/src/main/org/jboss/portal/unit/TCKAssertion.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/unit/TCKAssertion.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/unit/TCKAssertion.java 2007-11-06 15:05:30 UTC (rev 8834)
@@ -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.unit;
+
+/**
+ * Define TCK assertions.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public enum TCKAssertion
+{
+
+ 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."),
+
+ JSR168_122(122, "The getNamedDispatcher method takes a String argument indicating the" +
+ " name of a servlet known to the PortletContext of the portlet application. If no resource can be resolved based on" +
+ " the given path or name the methods must return null"),
+
+ JSR168_123(123, "The parameters associated with a PortletRequestDispatcher are scoped to" +
+ " apply only for the duration of the include call."),
+
+ JSR168_124(124, "To include a servlet or a JSP, a portlet calls the include method of the" +
+ " PortletRequestDispatcher interface. The parameters to these methods must be the request and response arguments" +
+ " that were passed in via the render method of the Portlet interface."),
+
+ JSR168_125(125, "The portlet container must ensure that the servlet or JSP called through" +
+ " a PortletRequestDispatcher is called in the same thread as the PortletRequestDispatcher include invocation."),
+
+ JSR168_126(126, "Servlets and JSPs included from portlets must be handled as HTTP GET requests."),
+
+ JSR168_127(127, "Except for servlets obtained by using the getNamedDispatcher method, a" +
+ " servlet or JSP being used from within an include call has access to the path used to obtain the" +
+ " PortletRequestDispatcher. The following request attributes must be set: javax.servlet.include.request_uri," +
+ " javax.servlet.include.context_path javax.servlet.include.servlet_path, javax.servlet.include.path_info," +
+ " javax.servlet.include.query_string"),
+
+ JSR168_128(128, "javax.portlet.config, javax.portlet.request, javax.portlet.response." +
+ " These attributes must be the same Portlet API objects accessible to the portlet doing the include call."),
+
+ JSR168_129(129, "The following methods of the HttpServletRequest must return null:" +
+ " getProtocol, getRemoteAddr, getRemoteHost, getRealPath, and getRequestURL."),
+
+ JSR168_130(130, "The following methods of the HttpServletRequest must return the path and"+
+ " query string information used to obtain the PortletRequestDispatcher object: getPathInfo, getPathTranslated,"+
+ " getQueryString, getRequestURI and getServletPath"),
+
+ JSR168_131(131, "The following methods of the HttpServletRequest must be equivalent to" +
+ " the methods of the PortletRequest of similar name: getScheme, getServerName,getServerPort, getAttribute," +
+ " getAttributeNames, setAttribute,removeAttribute, getLocale, getLocales, isSecure, getAuthType, getContextPath," +
+ " getRemoteUser, getUserPrincipal, getRequestedSessionId, isRequestedSessionIdValid"),
+
+ JSR168_132(132, "The following methods of the HttpServletRequest must be equivalent to" +
+ " the methods of the PortletRequest of similar name with the provision defined in PLT.16.1.1 Query Strings in" +
+ " Request Dispatcher Paths Section: getParameter, getParameterNames, getParameterValues and getParameterMap."),
+
+ JSR168_133(133, "The following methods of the HttpServletRequest must do no operations" +
+ " and return null: getCharacterEncoding, setCharacterEncoding, getContentType, getInputStream and getReader."),
+
+ JSR168_134(134, "The getContentLength method of the HttpServletRequest must return 0."),
+
+
+ JSR168_137(137, "The getMethod method of the HttpServletRequest must always return 'GET'"),
+
+ JSR168_138(138, "The following methods of the HttpServletResponse must return" +
+ " null:encodeRedirectURL and encodeRedirectUrl"),
+
+ JSR168_141(141, "The getLocale method of the HttpServletResponse must be based on the" +
+ " getLocale method of the RenderResponse."),
+
+ JSR168_142(142, "If the servlet or JSP that is the target of a request dispatcher throws" +
+ " a runtime exception or a checked exception of type IOException, it must be propagated to the calling portlet."),
+
+ JSR168_143(143, "All other exceptions, including a ServletException, must be wrapped with" +
+ " a PortletException. The root cause of the exception must be set to the original exception before being" +
+ " propagated."),
+
+ ;
+
+ /** . */
+ private final int id;
+
+ /** . */
+ private final String description;
+
+ TCKAssertion(int id, String description)
+ {
+ this.id = id;
+ this.description = description;
+ }
+
+ public int getId()
+ {
+ return id;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/org/jboss/portal/unit/annotations/TCK.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/unit/annotations/TCK.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/unit/annotations/TCK.java 2007-11-06 15:05:30 UTC (rev 8834)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * 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.unit.annotations;
+
+import org.jboss.portal.unit.TCKAssertion;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+/**
+ * Annotates a portlet test for documenting its purpose with respect to the Java Portlet TCK.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.TYPE)
+public @interface TCK
+{
+ TCKAssertion[] value();
+}
16 years, 11 months
JBoss Portal SVN: r8833 - in modules/portlet/trunk/portlet/src: main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-06 09:04:11 -0500 (Tue, 06 Nov 2007)
New Revision: 8833
Added:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatchedRequestTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ErrorHandlingTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/GETMethodTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestAttributesTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestParametersTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ObtainingDispatcherTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/QueryStringInRequestDispatcherTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/RequestObjectTestCase.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ResponseObjectTestCase.java
Removed:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatcherSequenceBuilder.java
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/portlet/jsr168/tck/dispatcher/DispatcherTestSuite.java
modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/dispatcher-war/WEB-INF/web.xml
Log:
- started to uncluster the portlet container test cases by using one single class for a portlet container test case, for now only the TCK request dispatcher tests have been migrated as proof of concept
- current implementation not yet using annotations
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 10:17:40 UTC (rev 8832)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestSuite.java 2007-11-06 14:04:11 UTC (rev 8833)
@@ -24,6 +24,9 @@
import org.apache.log4j.Logger;
import org.jboss.unit.remote.driver.RemoteTestDriverServer;
+import org.jboss.portal.common.net.URLNavigator;
+import org.jboss.portal.common.net.URLVisitor;
+import org.jboss.portal.common.net.URLFilter;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
@@ -32,10 +35,17 @@
import javax.servlet.ServletContext;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.Iterator;
import java.util.regex.Pattern;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.io.IOException;
+import java.io.File;
/**
* Builder is invoked when web application initialization process is starting. It builds sequence of tests for this
@@ -44,7 +54,7 @@
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision: 6989 $
*/
-public abstract class PortletTestSuite implements ServletContextListener, ServletContextAttributeListener
+public class PortletTestSuite implements ServletContextListener, ServletContextAttributeListener
{
/** . */
@@ -56,7 +66,10 @@
/** . */
private PortletTestDriver driver;
- protected PortletTestSuite()
+ /** . */
+ private ClassLoader loader;
+
+ public PortletTestSuite()
{
}
@@ -81,7 +94,7 @@
}
catch (Exception e)
{
- log.info("Cannot get application context path", e);
+ log.error("Cannot get application context path", e);
}
//
@@ -109,6 +122,30 @@
}
//
+ try
+ {
+ for (Class clazz : getClasses(event.getServletContext()))
+ {
+ 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);
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ log.error("Cannot get load test cases", e);
+ }
+
+ //
driver.start();
//
@@ -117,6 +154,98 @@
}
}
+ protected List<Class> getClasses(ServletContext ctx) throws IOException
+ {
+ ClassCollector collector = new ClassCollector(loader, ctx);
+ collector.collect();
+ return collector.classes;
+ }
+
+ private static class ClassCollector implements URLVisitor, URLFilter
+ {
+
+ /** . */
+ private List<Class> classes = new ArrayList<Class>();
+
+ /** . */
+ private LinkedList<String> packages = new LinkedList<String>();
+
+ /** . */
+ private ClassLoader loader;
+
+ /** . */
+ private URL classesURL;
+
+ public ClassCollector(ClassLoader loader, ServletContext ctx) throws MalformedURLException
+ {
+ this.loader = loader;
+
+ // Need to use that because tomcat use a jndi based implementation for resources that will not
+ // be accepted by the URLNavigator. 2 solutions either rely on JBoss new VFS or implement jndi
+ // in URLNavigator
+ this.classesURL = new File(ctx.getRealPath("/WEB-INF/classes/")).toURL();
+ }
+
+ public void collect() throws IOException
+ {
+ URLNavigator.visit(classesURL, this, this);
+ }
+
+ public void startDir(URL url, String name)
+ {
+ packages.addLast(name);
+ }
+
+ public void endDir(URL url, String name)
+ {
+ packages.removeLast();
+ }
+
+ public void file(URL url, String name)
+ {
+ try
+ {
+ StringBuffer tmp = new StringBuffer();
+ Iterator<String> i = packages.iterator();
+
+ // Skip "classes"
+ i.next();
+
+ // Iterate package names
+ while (i.hasNext())
+ {
+ tmp.append(i.next());
+ tmp.append('.');
+ }
+
+ // 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);
+ classes.add(clazz);
+ }
+ catch (ClassNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public boolean acceptFile(URL url)
+ {
+ return url.getFile().endsWith("TestCase.class");
+ }
+
+ public boolean acceptDir(URL url)
+ {
+ return true;
+ }
+ }
+
public void attributeRemoved(ServletContextAttributeEvent event)
{
@@ -129,6 +258,7 @@
public void contextInitialized(ServletContextEvent sce)
{
+ loader = Thread.currentThread().getContextClassLoader();
}
public void contextDestroyed(ServletContextEvent sce)
Added: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatchedRequestTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatchedRequestTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatchedRequestTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
@@ -0,0 +1,92 @@
+/******************************************************************************
+ * 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.dispatcher;
+
+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.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 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;
+
+/**
+ * @portlet.specification assert="SPEC:124 - To include a servlet or a JSP, a portlet calls the include method of the
+ * PortletRequestDispatcher interface. The parameters to these methods must be the request and response arguments
+ * that were passed in via the render method of the Portlet interface."
+ * @portlet.specification assert="SPEC:125 - The portlet container must ensure that the servlet or JSP called through
+ * a PortletRequestDispatcher is called in the same thread as the PortletRequestDispatcher include invocation."
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class DispatchedRequestTestCase
+{
+ public DispatchedRequestTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+ try
+ {
+ dispatcher.include(request, response);
+ Object o = UTP1.local.get();
+ assertEquals(Boolean.TRUE, o);
+ }
+ finally
+ {
+ UTP1.local.set(null);
+ }
+ 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
+ {
+ StringBuffer buffer = request.getRequestURL();
+ UTP1.local.set(buffer == null ? Boolean.TRUE : Boolean.FALSE);
+ return null;
+ }
+ });
+ }
+}
Deleted: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatcherSequenceBuilder.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatcherSequenceBuilder.java 2007-11-06 10:17:40 UTC (rev 8832)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatcherSequenceBuilder.java 2007-11-06 14:04:11 UTC (rev 8833)
@@ -1,751 +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.dispatcher;
-
-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.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.*;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.Portlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletRequestDispatcher;
-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.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
- * @version $Revision: 7954 $
- */
-public class DispatcherSequenceBuilder extends PortletTestSuite
-{
-
- public static final String SERVLET_A_URI = "/test-jsr168-dispatcher/universalServletA";
- public static final String SERVLET_B_URI = "/test-jsr168-dispatcher/universalServletB";
-
- /**
- * @portlet.specification assert="SPEC: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."
- * @portlet.specification assert="SPEC:122 - The getNamedDispatcher method takes a String argument indicating the
- * name of a servlet known to the PortletContext of the portlet application. If no resource can be resolved based on
- * the given path or name the methods must return null"
- */
- public void createObtainingDispatcherCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ObtainingDispatcher", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
- {
- UTP1 p = (UTP1)portlet;
- //correct
- PortletRequestDispatcher dispatcher = p.getPortletContext().getNamedDispatcher("UniversalServletA");
- assertNotNull(dispatcher);
-
- //incorrect
- dispatcher = p.getPortletContext().getNamedDispatcher("FAKE_NAME_SERVLET");
- assertNull(dispatcher);
-
- //incorrect
- dispatcher = p.getPortletContext().getNamedDispatcher("/");
- assertNull(dispatcher);
-
- //incorrect
- dispatcher = p.getPortletContext().getNamedDispatcher("/universalServletA");
- assertNull(dispatcher);
-
- //incorrect
- dispatcher = p.getPortletContext().getRequestDispatcher("UniversalServletA");
- assertNull(dispatcher);
-
- //incorrect
- dispatcher = p.getPortletContext().getRequestDispatcher("universalServletA");
- assertNull(dispatcher);
-
- //incorrect
- //dispatcher = getPortletContext().getRequestDispatcher("/UniversalServletA");
- //assertNull(dispatcher);
-
- //incorrect
- //dispatcher = getPortletContext().getRequestDispatcher("/");
- //assertNull(dispatcher);
-
- //correct
- dispatcher = p.getPortletContext().getRequestDispatcher("/universalServletA");
- assertNotNull(dispatcher);
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:123 - The parameters associated with a PortletRequestDispatcher are scoped to
- * apply only for the duration of the include call."
- */
- public void createQueryStringInRequestDispatcherCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("QueryStringInRequestDispatcher", 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)
- {
- //set some render params to test them in dispatcher include (precedense)
- response.setRenderParameter("key1", "differentValue");
- response.setRenderParameter("key3", "k3value1");
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- String path = "/universalServletA";
- path += "?key1=k1value1&key2=k2value1";
- PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher(path);
- assertNotNull(dispatcher);
-
- dispatcher.include(request, response);
-
- //assert that params from query string doesn't last longer then in include call
- assertEquals("differentValue", request.getParameter("key1"));
- assertNull(request.getParameter("key2"));
- return new EndTestResponse();
- }
- });
-
- seq.addAction(1, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
- {
- protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
- {
- assertEquals("k1value1", request.getParameter("key1"));
- assertEquals("k2value1", request.getParameter("key2"));
- assertEquals("k3value1", request.getParameter("key3"));
- return null;
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:124 - To include a servlet or a JSP, a portlet calls the include method of the
- * PortletRequestDispatcher interface. The parameters to these methods must be the request and response arguments
- * that were passed in via the render method of the Portlet interface."
- * @portlet.specification assert="SPEC:125 - The portlet container must ensure that the servlet or JSP called through
- * a PortletRequestDispatcher is called in the same thread as the PortletRequestDispatcher include invocation."
- */
- public void createDispatchedRequestCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("DispatchedRequest", seq);
-
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
- assertNotNull(dispatcher);
- try
- {
- dispatcher.include(request, response);
- Object o = UTP1.local.get();
- assertEquals(Boolean.TRUE, o);
- }
- finally
- {
- UTP1.local.set(null);
- }
- 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
- {
- StringBuffer buffer = request.getRequestURL();
- UTP1.local.set(buffer == null ? Boolean.TRUE : Boolean.FALSE);
- return null;
- }
- });
- }
-
-
- /**
- * @portlet.specification assert="SPEC:126 - Servlets and JSPs included from portlets must be handled as HTTP GET
- * requests."
- */
- public void createGETMethodCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("GETMethod", seq);
-
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
- assertNotNull(dispatcher);
-
-
- dispatcher.include(request, response);
-
- //assert that servlet handle this as GET
- assertEquals(Boolean.TRUE, (Boolean)UTP1.local.get());
- 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
- {
- if (request.getMethod().equals("GET"))
- {
- UTP1.local.set(Boolean.TRUE);
- }
- return null;
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:127 - Except for servlets obtained by using the getNamedDispatcher method, a
- * servlet or JSP being used from within an include call has access to the path used to obtain the
- * PortletRequestDispatcher. The following request attributes must be set: javax.servlet.include.request_uri,
- * javax.servlet.include.context_path javax.servlet.include.servlet_path, javax.servlet.include.path_info,
- * javax.servlet.include.query_string"
- */
- public void createIncludedRequestParametersCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("IncludedRequestParameters", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA/pathinfo?foo=bar");
- assertNotNull(dispatcher);
-
- //assert that servlet HAS access to specific request attributes
- try
- {
- dispatcher.include(request, response);
- assertEquals("/test-jsr168-dispatcher/universalServletA/pathinfo", UTP1.local1.get());
- assertEquals("/test-jsr168-dispatcher", UTP1.local2.get());
- assertEquals("/universalServletA", UTP1.local3.get());
- assertEquals("/pathinfo", UTP1.local4.get());
- assertEquals("foo=bar", UTP1.local5.get());
- }
- finally
- {
- UTP1.local1.set(null);
- UTP1.local2.set(null);
- UTP1.local3.set(null);
- UTP1.local4.set(null);
- UTP1.local5.set(null);
- }
-
- //
- dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
- assertNotNull(dispatcher);
-
- // Assert that servlet has NO access to specific request attributes
- // it shouldn't access that attributes because getNamedDispatcher was used
- try
- {
- dispatcher.include(request, response);
- assertNull(UTP1.local1.get());
- assertNull(UTP1.local2.get());
- assertNull(UTP1.local3.get());
- assertNull(UTP1.local4.get());
- assertNull(UTP1.local5.get());
- }
- finally
- {
- UTP1.local1.set(null);
- UTP1.local2.set(null);
- UTP1.local3.set(null);
- UTP1.local4.set(null);
- UTP1.local5.set(null);
- }
-
- 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
- {
- UTP1.local1.set(request.getAttribute("javax.servlet.include.request_uri"));
- UTP1.local2.set(request.getAttribute("javax.servlet.include.context_path"));
- UTP1.local3.set(request.getAttribute("javax.servlet.include.servlet_path"));
- UTP1.local4.set(request.getAttribute("javax.servlet.include.path_info"));
- UTP1.local5.set(request.getAttribute("javax.servlet.include.query_string"));
- return null;
- }
- });
-
- }
-
- /**
- * @portlet.specification assert="SPEC:128 - javax.portlet.config, javax.portlet.request, javax.portlet.response.
- * These attributes must be the same Portlet API objects accessible to the portlet doing the include call."
- */
- public void createIncludedRequestAttributesCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("IncludedRequestAttributes", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA");
- assertNotNull(dispatcher);
- dispatcher.include(request, response);
- //assert that servlet has access to correct objects via attributes
- assertAttributes((AbstractUniversalTestPortlet)portlet, request, response);
-
- dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
- assertNotNull(dispatcher);
- dispatcher.include(request, response);
- //assert that servlet has access to correct objects via attributes
- assertAttributes((AbstractUniversalTestPortlet)portlet, request, response);
-
- return new EndTestResponse();
-
- }
-
- public void assertAttributes(AbstractUniversalTestPortlet portlet, RenderRequest request, RenderResponse response)
- {
- try
- {
- assertNotNull(UTP1.local1.get());
- assertNotNull(UTP1.local2.get());
- assertNotNull(UTP1.local3.get());
-
- assertEquals(UTP1.local1.get(), portlet.getPortletConfig());
- assertEquals(UTP1.local2.get(), request);
- assertEquals(UTP1.local3.get(), response);
-
- }
- finally
- {
- UTP1.local1.set(null);
- UTP1.local2.set(null);
- UTP1.local3.set(null);
- }
- }
- });
-
- seq.addAction(0, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
- {
- protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
- {
- UTP1.local1.set(request.getAttribute("javax.portlet.config"));
- UTP1.local2.set(request.getAttribute("javax.portlet.request"));
- UTP1.local3.set(request.getAttribute("javax.portlet.response"));
- return null;
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:129 - The following methods of the HttpServletRequest must return null:
- * getProtocol, getRemoteAddr, getRemoteHost, getRealPath, and getRequestURL."
- * @portlet.specification assert="SPEC:130 - The following methods of the HttpServletRequest must return the path and
- * query string information used to obtain the PortletRequestDispatcher object: getPathInfo, getPathTranslated,
- * getQueryString, getRequestURI and getServletPath"
- * @portlet.specification assert="SPEC:131 - The following methods of the HttpServletRequest must be equivalent to
- * the methods of the PortletRequest of similar name: getScheme, getServerName,getServerPort, getAttribute,
- * getAttributeNames, setAttribute,removeAttribute, getLocale, getLocales, isSecure, getAuthType, getContextPath,
- * getRemoteUser, getUserPrincipal, getRequestedSessionId, isRequestedSessionIdValid"
- * @portlet.specification assert="SPEC:132 - The following methods of the HttpServletRequest must be equivalent to
- * the methods of the PortletRequest of similar name with the provision defined in PLT.16.1.1 Query Strings in
- * Request Dispatcher Paths Section: getParameter, getParameterNames, getParameterValues and getParameterMap."
- * @portlet.specification assert="SPEC:133 - The following methods of the HttpServletRequest must do no operations
- * and return null: getCharacterEncoding, setCharacterEncoding, getContentType, getInputStream and getReader."
- * @portlet.specification assert="SPEC:134 - The getContentLength method of the HttpServletRequest must return 0."
- * @portlet.specification assert="SPEC:137 - The getMethod method of the HttpServletRequest must always return
- * �GET�"
- */
- public void createRequestObjectCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("RequestObject", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- //we dispatch to servlet and assertions will be done there
- String queryString = "?key1=k1value1&key2=k2value1";
- PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA" + queryString);
- response.setContentType("text/html");
- dispatcher.include(request, response);
- return null;
- }
- });
-
-
- seq.addAction(0, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
- {
- protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
- {
- //we get this object to assert some of it's method compare wieth http request methods
- RenderRequest portletRequest = (RenderRequest)request.getAttribute("javax.portlet.request");
-
- assertNotNull(portletRequest);
-
- //SPEC:129
- assertNull(request.getProtocol());
- assertNull(request.getRemoteAddr());
- assertNull(request.getRemoteHost());
- assertNull(request.getRealPath("blah"));
- assertNull(request.getRequestURL());
-
- //SPEC:130
- assertEquals(null, request.getPathInfo());
- //TODO:I'm not sure what this should return - but it's not implemented now so it fails
- //assertEquals("",request.getPathTranslated());
- assertEquals("key1=k1value1&key2=k2value1", request.getQueryString());
- //assertEquals("/requestObjectServlet",request.getRequestURI());
- assertEquals("/universalServletA", request.getServletPath());
-
- //SPEC:131
- assertEquals(portletRequest.getScheme(), request.getScheme());
- assertEquals(portletRequest.getServerName(), request.getServerName());
- assertEquals(portletRequest.getServerPort(), request.getServerPort());
-
- request.setAttribute("key1", "k1atrr1");
- request.setAttribute("key2", "k2attr2");
- List attrNames = new LinkedList();
- Enumeration attrEnum = request.getAttributeNames();
- while (attrEnum.hasMoreElements())
- {
- attrNames.add(attrEnum.nextElement());
- }
- assertNotNull(request.getAttribute("key1"));
- assertNotNull(request.getAttribute("key2"));
-
- assertTrue(attrNames.contains("key1"));
- assertTrue(attrNames.contains("key2"));
-
- request.removeAttribute("key1");
- assertNull(request.getAttribute("key1"));
- assertNotNull(request.getAttribute("key2"));
-
- assertEquals(portletRequest.getLocale(), request.getLocale());
-
- List portletLocales = new LinkedList();
- List servletLocales = new LinkedList();
- Enumeration pl = portletRequest.getLocales();
- while (pl.hasMoreElements())
- {
- portletLocales.add(pl.nextElement());
- }
- Enumeration sl = request.getLocales();
- while (sl.hasMoreElements())
- {
- servletLocales.add(sl.nextElement());
- }
-
- assertTrue(portletLocales.equals(servletLocales));
-
- assertEquals(portletRequest.isSecure(), request.isSecure());
- assertEquals(portletRequest.getAuthType(), request.getAuthType());
- assertEquals(portletRequest.getContextPath(), request.getContextPath());
- assertEquals(portletRequest.getRemoteUser(), request.getRemoteUser());
- assertEquals(portletRequest.getUserPrincipal(), request.getUserPrincipal());
- assertEquals(portletRequest.getRequestedSessionId(), request.getRequestedSessionId());
- assertEquals(portletRequest.isRequestedSessionIdValid(), request.isRequestedSessionIdValid());
-
- //SPEC:132
- //in this assertions we use parameters passed in query string of dispatcher
- List paramNames = new LinkedList();
- Enumeration paramEnum = request.getParameterNames();
- while (paramEnum.hasMoreElements())
- {
- paramNames.add(paramEnum.nextElement());
- }
- assertTrue(paramNames.contains("key1"));
- assertTrue(paramNames.contains("key2"));
-
- assertEquals("k1value1", request.getParameter("key1"));
- assertEquals(new String[]{"k1value1"}, request.getParameterValues("key1"));
-
- Map paramNamesMap = request.getParameterMap();
- assertTrue(paramNamesMap.containsKey("key1"));
- assertTrue(paramNamesMap.containsKey("key2"));
-
- //SPEC:133
- request.setCharacterEncoding("utf8");
- assertNull(request.getCharacterEncoding());
- assertNull(request.getContentType());
- assertNull(request.getInputStream());
- assertNull(request.getReader());
-
- //SPEC:134
- assertEquals(0, request.getContentLength());
-
- //SPEC:137
- assertEquals("GET", request.getMethod());
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:138 - The following methods of the HttpServletResponse must return
- * null:encodeRedirectURL and encodeRedirectUrl"
- * @portlet.specification assert="SPEC:141 - The getLocale method of the HttpServletResponse must be based on the
- * getLocale method of the RenderResponse."
- */
- public void createResponseObjectCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ResponseObject", seq);
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- //we dispatch to servlet and assertions will be done there
- PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA");
- //hack for testing dispatched servlet
- response.setContentType("text/html");
- dispatcher.include(request, response);
- return null;
- }
- });
-
- seq.addAction(0, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
- {
- protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
- {
- //we get this object to assert some of it's method compare wieth http request methods
- RenderResponse portletResponse = (RenderResponse)request.getAttribute("javax.portlet.response");
-
- assertNotNull(portletResponse);
-
- //SPEC:138
- assertNull(response.encodeRedirectURL("blah"));
- assertNull(response.encodeRedirectUrl("blah"));
-
- //not defined spec assert
- assertEquals(false, response.containsHeader("blah"));
-
- //SPEC:141
- assertEquals(portletResponse.getLocale(), response.getLocale());
- return new EndTestResponse();
- }
- });
- }
-
- /**
- * @portlet.specification assert="SPEC:142 - If the servlet or JSP that is the target of a request dispatcher throws
- * a runtime exception or a checked exception of type IOException, it must be propagated to the calling portlet."
- * @portlet.specification assert="SPEC:143 - All other exceptions, including a ServletException, must be wrapped with
- * a PortletException. The root cause of the exception must be set to the original exception before being
- * propagated."
- */
- public void createErrorHandlingCase(PortletTestDriver registry)
- {
- PortletTest seq = new PortletTest();
- registry.addSequence("ErrorHandling", seq);
-
- seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
-
- PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
- assertNotNull(dispatcher);
- try
- {
- dispatcher.include(request, response);
- fail();
- }
- catch (RuntimeException e)
- {
- //expected
- }
-
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- 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
- {
- //SPEC:142 - RuntimeException
- throw new RuntimeException();
- }
- });
-
- seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException
- {
- PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
- assertNotNull(dispatcher);
- try
- {
- dispatcher.include(request, response);
- fail();
- }
- catch (IOException e)
- {
- //expected
- }
-
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- seq.addAction(1, 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
- {
- //SPEC:142 - checked exception of type IOException
- throw new IOException();
- }
- });
-
- seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException
- {
-
- PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
- assertNotNull(dispatcher);
- try
- {
- dispatcher.include(request, response);
- fail();
- }
- catch (PortletException e)
- {
- //expected
- if (!(e.getCause() instanceof ServletException))
- {
- fail();
- }
- }
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- seq.addAction(2, 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
- {
- //SPEC:143 - ServletException
- throw new ServletException();
- }
- });
-
- seq.addAction(3, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException
- {
- /*PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
- assertNotNull(dispatcher);
- try
- {
- dispatcher.include(request,response);
- fail();
- }
- catch(Error e)
- {
- //expected
- }*/
-
- return new EndTestResponse();
- }
- });
-
- seq.addAction(3, 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
- {
- //SPEC:143 - 'other' exception
- throw new Error();
- }
- });
-
- }
-
-}
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatcherTestSuite.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatcherTestSuite.java 2007-11-06 10:17:40 UTC (rev 8832)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/DispatcherTestSuite.java 2007-11-06 14:04:11 UTC (rev 8833)
@@ -22,106 +22,13 @@
******************************************************************************/
package org.jboss.portal.test.portlet.jsr168.tck.dispatcher;
+import org.jboss.portal.test.framework.portlet.PortletTestSuite;
+
/**
* @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 DispatcherTestSuite
+public class DispatcherTestSuite extends PortletTestSuite
{
- public static void suite()
- {
-// TestSuite suite = new TestSuite("test-jsr168-dispatcher.war");
-//
-// /**
-// * SPEC:121 Testable=true Section=PLT.16.1
-// * SPEC:122 Testable=true Section=PLT.16.1
-// * - ObtainingDispatcherPortlet
-// * - ObtainingDispatcherServlet
-// */
-// suite.addTest(new TestCase("ObtainingDispatcher"));
-//
-// /**
-// * SPEC:123 Testable= true Section=PLT.16.1.1
-// * - QueryStringInRequestDispatcherPortlet
-// * - QueryStringInRequestDispatcherServlet
-// */
-// suite.addTest(new TestCase("QueryStringInRequestDispatcher"));
-//
-// /**
-// * SPEC:124 Testable=true Section=PLT.16.2
-// * SPEC:125 Testable=true Section=PLT.16.2
-// * - DispatchedRequestPortlet
-// * - DispatchedRequestServlet
-// */
-// suite.addTest(new TestCase("DispatchedRequest"));
-//
-// /**
-// * SPEC:126 Testable=true Section=PLT.16.3
-// * - GETMethodPortlet
-// * - GETMethodServlet
-// */
-// suite.addTest(new TestCase("GETMethod"));
-//
-// /**
-// * SPEC:127 Testable=true Section=PLT.16.3.1
-// * - IncludedRequestParametersPortlet
-// * - IncludedRequestParametersDispatchedServlet
-// * - IncludedRequestParametersNamedDispatchedServlet
-// */
-// suite.addTest(new TestCase("IncludedRequestParameters"));
-//
-// /**
-// * SPEC:128 Testable=true Section=PLT.16.3.2
-// * - IncludedRequestAttributesPortlet
-// * - IncludedRequestAttributesDispatchedServlet
-// */
-// suite.addTest(new TestCase("IncludedRequestAttributes"));
-//
-// /**
-// * SPEC:129 Testable=true Section=PLT.16.3.3
-// * SPEC:130 Testable=true Section=PLT.16.3.3
-// * SPEC:131 Testable=true Section=PLT.16.3.3
-// * SPEC:132 Testable=true Section=PLT.16.3.3
-// * SPEC:133 Testable=true Section=PLT.16.3.3
-// * SPEC:134 Testable=true Section=PLT.16.3.3
-// * SPEC:137 Testable=true Section=PLT.16.3.3
-// * - RequestObjectPortlet
-// * - RequestObjectServlet
-// */
-// suite.addTest(new TestCase("RequestObject"));
-//
-// /**
-// * SPEC:135 Testable=true Section=PLT.16.3.3
-// * SPEC:136 Testable=true Section=PLT.16.3.3
-// * POSTPONED
-// */
-//
-// /**
-// * SPEC:138 Testable=true Section= PLT.16.3.3
-// * SPEC:141 Testable=true Section= PLT.16.3.3
-// */
-// suite.addTest(new TestCase("ResponseObject"));
-//
-// /**
-// * SPEC:139 Testable=true Section= PLT.16.3.3
-// * NOT DONE YET
-// */
-//
-// /**
-// * SPEC:140 Testable=false(impl) Section= PLT.16.3.3
-// * Testable=false(impl)!
-// */
-//
-// /**
-// * SPEC:142 Testable=true Section=PLT.16.3.4
-// * SPEC:143 Testable=true Section=PLT.16.3.4
-// * - ErrorHandlingPortlet
-// * - ErrorHandlingServlet
-// * - SampleException
-// */
-// suite.addTest(new TestCase("ErrorHandling"));
-//
-// return suite;
- }
}
Added: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ErrorHandlingTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ErrorHandlingTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ErrorHandlingTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
@@ -0,0 +1,205 @@
+/******************************************************************************
+ * 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.dispatcher;
+
+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.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 static org.jboss.unit.api.Assert.assertNotNull;
+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 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;
+
+/**
+ * @portlet.specification assert="SPEC:142 - If the servlet or JSP that is the target of a request dispatcher throws
+ * a runtime exception or a checked exception of type IOException, it must be propagated to the calling portlet."
+ * @portlet.specification assert="SPEC:143 - All other exceptions, including a ServletException, must be wrapped with
+ * a PortletException. The root cause of the exception must be set to the original exception before being
+ * propagated."
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ErrorHandlingTestCase
+{
+
+ public ErrorHandlingTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+ try
+ {
+ dispatcher.include(request, response);
+ fail();
+ }
+ catch (RuntimeException e)
+ {
+ //expected
+ }
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ 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
+ {
+ //SPEC:142 - RuntimeException
+ throw new RuntimeException();
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException
+ {
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+ try
+ {
+ dispatcher.include(request, response);
+ fail();
+ }
+ catch (IOException e)
+ {
+ //expected
+ }
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.addAction(1, 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
+ {
+ //SPEC:142 - checked exception of type IOException
+ throw new IOException();
+ }
+ });
+
+ seq.addAction(2, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException
+ {
+
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+ try
+ {
+ dispatcher.include(request, response);
+ fail();
+ }
+ catch (PortletException e)
+ {
+ //expected
+ if (!(e.getCause() instanceof ServletException))
+ {
+ fail();
+ }
+ }
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.addAction(2, 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
+ {
+ //SPEC:143 - ServletException
+ throw new ServletException();
+ }
+ });
+
+ seq.addAction(3, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException
+ {
+ /*PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+ try
+ {
+ dispatcher.include(request,response);
+ fail();
+ }
+ catch(Error e)
+ {
+ //expected
+ }*/
+
+ return new EndTestResponse();
+ }
+ });
+
+ seq.addAction(3, 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
+ {
+ //SPEC:143 - 'other' exception
+ throw new Error();
+ }
+ });
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/GETMethodTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/GETMethodTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/GETMethodTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
@@ -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.dispatcher;
+
+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.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 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;
+
+/**
+ * @portlet.specification assert="SPEC:126 - Servlets and JSPs included from portlets must be handled as HTTP GET
+ * requests."
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class GETMethodTestCase
+{
+
+ public GETMethodTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+
+
+ dispatcher.include(request, response);
+
+ //assert that servlet handle this as GET
+ assertEquals(Boolean.TRUE, (Boolean)UTP1.local.get());
+ 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
+ {
+ if (request.getMethod().equals("GET"))
+ {
+ UTP1.local.set(Boolean.TRUE);
+ }
+ return null;
+ }
+ });
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestAttributesTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestAttributesTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
@@ -0,0 +1,112 @@
+/******************************************************************************
+ * 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.dispatcher;
+
+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.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 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;
+
+/**
+ * @portlet.specification assert="SPEC:128 - javax.portlet.config, javax.portlet.request, javax.portlet.response.
+ * These attributes must be the same Portlet API objects accessible to the portlet doing the include call."
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class IncludedRequestAttributesTestCase
+{
+ public IncludedRequestAttributesTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA");
+ assertNotNull(dispatcher);
+ dispatcher.include(request, response);
+ //assert that servlet has access to correct objects via attributes
+ assertAttributes((AbstractUniversalTestPortlet)portlet, request, response);
+
+ dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+ dispatcher.include(request, response);
+ //assert that servlet has access to correct objects via attributes
+ assertAttributes((AbstractUniversalTestPortlet)portlet, request, response);
+
+ return new EndTestResponse();
+
+ }
+
+ public void assertAttributes(AbstractUniversalTestPortlet portlet, RenderRequest request, RenderResponse response)
+ {
+ try
+ {
+ assertNotNull(UTP1.local1.get());
+ assertNotNull(UTP1.local2.get());
+ assertNotNull(UTP1.local3.get());
+
+ assertEquals(UTP1.local1.get(), portlet.getPortletConfig());
+ assertEquals(UTP1.local2.get(), request);
+ assertEquals(UTP1.local3.get(), response);
+
+ }
+ finally
+ {
+ UTP1.local1.set(null);
+ UTP1.local2.set(null);
+ UTP1.local3.set(null);
+ }
+ }
+ });
+
+ seq.addAction(0, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
+ {
+ UTP1.local1.set(request.getAttribute("javax.portlet.config"));
+ UTP1.local2.set(request.getAttribute("javax.portlet.request"));
+ UTP1.local3.set(request.getAttribute("javax.portlet.response"));
+ return null;
+ }
+ });
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestParametersTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestParametersTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/IncludedRequestParametersTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
@@ -0,0 +1,130 @@
+/******************************************************************************
+ * 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.dispatcher;
+
+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.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 static org.jboss.unit.api.Assert.assertNotNull;
+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.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;
+
+/**
+ * @portlet.specification assert="SPEC:127 - Except for servlets obtained by using the getNamedDispatcher method, a
+ * servlet or JSP being used from within an include call has access to the path used to obtain the
+ * PortletRequestDispatcher. The following request attributes must be set: javax.servlet.include.request_uri,
+ * javax.servlet.include.context_path javax.servlet.include.servlet_path, javax.servlet.include.path_info,
+ * javax.servlet.include.query_string"
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class IncludedRequestParametersTestCase
+{
+ public IncludedRequestParametersTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA/pathinfo?foo=bar");
+ assertNotNull(dispatcher);
+
+ //assert that servlet HAS access to specific request attributes
+ try
+ {
+ dispatcher.include(request, response);
+ assertEquals("/test-jsr168-dispatcher/universalServletA/pathinfo", UTP1.local1.get());
+ assertEquals("/test-jsr168-dispatcher", UTP1.local2.get());
+ assertEquals("/universalServletA", UTP1.local3.get());
+ assertEquals("/pathinfo", UTP1.local4.get());
+ assertEquals("foo=bar", UTP1.local5.get());
+ }
+ finally
+ {
+ UTP1.local1.set(null);
+ UTP1.local2.set(null);
+ UTP1.local3.set(null);
+ UTP1.local4.set(null);
+ UTP1.local5.set(null);
+ }
+
+ //
+ dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+
+ // Assert that servlet has NO access to specific request attributes
+ // it shouldn't access that attributes because getNamedDispatcher was used
+ try
+ {
+ dispatcher.include(request, response);
+ assertNull(UTP1.local1.get());
+ assertNull(UTP1.local2.get());
+ assertNull(UTP1.local3.get());
+ assertNull(UTP1.local4.get());
+ assertNull(UTP1.local5.get());
+ }
+ finally
+ {
+ UTP1.local1.set(null);
+ UTP1.local2.set(null);
+ UTP1.local3.set(null);
+ UTP1.local4.set(null);
+ UTP1.local5.set(null);
+ }
+
+ 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
+ {
+ UTP1.local1.set(request.getAttribute("javax.servlet.include.request_uri"));
+ UTP1.local2.set(request.getAttribute("javax.servlet.include.context_path"));
+ UTP1.local3.set(request.getAttribute("javax.servlet.include.servlet_path"));
+ UTP1.local4.set(request.getAttribute("javax.servlet.include.path_info"));
+ UTP1.local5.set(request.getAttribute("javax.servlet.include.query_string"));
+ return null;
+ }
+ });
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ObtainingDispatcherTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ObtainingDispatcherTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ObtainingDispatcherTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
@@ -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.dispatcher;
+
+import org.jboss.portal.test.framework.portlet.PortletTestDriver;
+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.assertNull;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletRequestDispatcher;
+
+/**
+ * @portlet.specification assert="SPEC: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."
+ * @portlet.specification assert="SPEC:122 - The getNamedDispatcher method takes a String argument indicating the
+ * name of a servlet known to the PortletContext of the portlet application. If no resource can be resolved based on
+ * the given path or name the methods must return null"
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ObtainingDispatcherTestCase
+{
+ public ObtainingDispatcherTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ UTP1 p = (UTP1)portlet;
+ //correct
+ PortletRequestDispatcher dispatcher = p.getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+
+ //incorrect
+ dispatcher = p.getPortletContext().getNamedDispatcher("FAKE_NAME_SERVLET");
+ assertNull(dispatcher);
+
+ //incorrect
+ dispatcher = p.getPortletContext().getNamedDispatcher("/");
+ assertNull(dispatcher);
+
+ //incorrect
+ dispatcher = p.getPortletContext().getNamedDispatcher("/universalServletA");
+ assertNull(dispatcher);
+
+ //incorrect
+ dispatcher = p.getPortletContext().getRequestDispatcher("UniversalServletA");
+ assertNull(dispatcher);
+
+ //incorrect
+ dispatcher = p.getPortletContext().getRequestDispatcher("universalServletA");
+ assertNull(dispatcher);
+
+ //incorrect
+ //dispatcher = getPortletContext().getRequestDispatcher("/UniversalServletA");
+ //assertNull(dispatcher);
+
+ //incorrect
+ //dispatcher = getPortletContext().getRequestDispatcher("/");
+ //assertNull(dispatcher);
+
+ //correct
+ dispatcher = p.getPortletContext().getRequestDispatcher("/universalServletA");
+ assertNotNull(dispatcher);
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/QueryStringInRequestDispatcherTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/QueryStringInRequestDispatcherTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/QueryStringInRequestDispatcherTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
@@ -0,0 +1,111 @@
+/******************************************************************************
+ * 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.dispatcher;
+
+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.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.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 static org.jboss.unit.api.Assert.assertNull;
+
+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.PortletRequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @portlet.specification assert="SPEC:123 - The parameters associated with a PortletRequestDispatcher are scoped to
+ * apply only for the duration of the include call."
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class QueryStringInRequestDispatcherTestCase
+{
+ public QueryStringInRequestDispatcherTestCase(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)
+ {
+ //set some render params to test them in dispatcher include (precedense)
+ response.setRenderParameter("key1", "differentValue");
+ response.setRenderParameter("key3", "k3value1");
+ }
+ });
+
+ seq.addAction(1, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ String path = "/universalServletA";
+ path += "?key1=k1value1&key2=k2value1";
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher(path);
+ assertNotNull(dispatcher);
+
+ dispatcher.include(request, response);
+
+ //assert that params from query string doesn't last longer then in include call
+ assertEquals("differentValue", request.getParameter("key1"));
+ assertNull(request.getParameter("key2"));
+ return new EndTestResponse();
+ }
+ });
+
+ seq.addAction(1, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
+ {
+ assertEquals("k1value1", request.getParameter("key1"));
+ assertEquals("k2value1", request.getParameter("key2"));
+ assertEquals("k3value1", request.getParameter("key3"));
+ return null;
+ }
+ });
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/RequestObjectTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/RequestObjectTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/RequestObjectTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
@@ -0,0 +1,200 @@
+/******************************************************************************
+ * 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.dispatcher;
+
+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.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 static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertNull;
+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;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Enumeration;
+import java.util.Map;
+
+/**
+ * @portlet.specification assert="SPEC:129 - The following methods of the HttpServletRequest must return null:
+ * getProtocol, getRemoteAddr, getRemoteHost, getRealPath, and getRequestURL."
+ * @portlet.specification assert="SPEC:130 - The following methods of the HttpServletRequest must return the path and
+ * query string information used to obtain the PortletRequestDispatcher object: getPathInfo, getPathTranslated,
+ * getQueryString, getRequestURI and getServletPath"
+ * @portlet.specification assert="SPEC:131 - The following methods of the HttpServletRequest must be equivalent to
+ * the methods of the PortletRequest of similar name: getScheme, getServerName,getServerPort, getAttribute,
+ * getAttributeNames, setAttribute,removeAttribute, getLocale, getLocales, isSecure, getAuthType, getContextPath,
+ * getRemoteUser, getUserPrincipal, getRequestedSessionId, isRequestedSessionIdValid"
+ * @portlet.specification assert="SPEC:132 - The following methods of the HttpServletRequest must be equivalent to
+ * the methods of the PortletRequest of similar name with the provision defined in PLT.16.1.1 Query Strings in
+ * Request Dispatcher Paths Section: getParameter, getParameterNames, getParameterValues and getParameterMap."
+ * @portlet.specification assert="SPEC:133 - The following methods of the HttpServletRequest must do no operations
+ * and return null: getCharacterEncoding, setCharacterEncoding, getContentType, getInputStream and getReader."
+ * @portlet.specification assert="SPEC:134 - The getContentLength method of the HttpServletRequest must return 0."
+ * @portlet.specification assert="SPEC:137 - The getMethod method of the HttpServletRequest must always return
+ * �GET�"
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RequestObjectTestCase
+{
+ public RequestObjectTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ //we dispatch to servlet and assertions will be done there
+ String queryString = "?key1=k1value1&key2=k2value1";
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA" + queryString);
+ response.setContentType("text/html");
+ dispatcher.include(request, response);
+ return null;
+ }
+ });
+
+
+ seq.addAction(0, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
+ {
+ //we get this object to assert some of it's method compare wieth http request methods
+ RenderRequest portletRequest = (RenderRequest)request.getAttribute("javax.portlet.request");
+
+ assertNotNull(portletRequest);
+
+ //SPEC:129
+ assertNull(request.getProtocol());
+ assertNull(request.getRemoteAddr());
+ assertNull(request.getRemoteHost());
+ assertNull(request.getRealPath("blah"));
+ assertNull(request.getRequestURL());
+
+ //SPEC:130
+ assertEquals(null, request.getPathInfo());
+ //TODO:I'm not sure what this should return - but it's not implemented now so it fails
+ //assertEquals("",request.getPathTranslated());
+ assertEquals("key1=k1value1&key2=k2value1", request.getQueryString());
+ //assertEquals("/requestObjectServlet",request.getRequestURI());
+ assertEquals("/universalServletA", request.getServletPath());
+
+ //SPEC:131
+ assertEquals(portletRequest.getScheme(), request.getScheme());
+ assertEquals(portletRequest.getServerName(), request.getServerName());
+ assertEquals(portletRequest.getServerPort(), request.getServerPort());
+
+ request.setAttribute("key1", "k1atrr1");
+ request.setAttribute("key2", "k2attr2");
+ List attrNames = new LinkedList();
+ Enumeration attrEnum = request.getAttributeNames();
+ while (attrEnum.hasMoreElements())
+ {
+ attrNames.add(attrEnum.nextElement());
+ }
+ assertNotNull(request.getAttribute("key1"));
+ assertNotNull(request.getAttribute("key2"));
+
+ assertTrue(attrNames.contains("key1"));
+ assertTrue(attrNames.contains("key2"));
+
+ request.removeAttribute("key1");
+ assertNull(request.getAttribute("key1"));
+ assertNotNull(request.getAttribute("key2"));
+
+ assertEquals(portletRequest.getLocale(), request.getLocale());
+
+ List portletLocales = new LinkedList();
+ List servletLocales = new LinkedList();
+ Enumeration pl = portletRequest.getLocales();
+ while (pl.hasMoreElements())
+ {
+ portletLocales.add(pl.nextElement());
+ }
+ Enumeration sl = request.getLocales();
+ while (sl.hasMoreElements())
+ {
+ servletLocales.add(sl.nextElement());
+ }
+
+ assertTrue(portletLocales.equals(servletLocales));
+
+ assertEquals(portletRequest.isSecure(), request.isSecure());
+ assertEquals(portletRequest.getAuthType(), request.getAuthType());
+ assertEquals(portletRequest.getContextPath(), request.getContextPath());
+ assertEquals(portletRequest.getRemoteUser(), request.getRemoteUser());
+ assertEquals(portletRequest.getUserPrincipal(), request.getUserPrincipal());
+ assertEquals(portletRequest.getRequestedSessionId(), request.getRequestedSessionId());
+ assertEquals(portletRequest.isRequestedSessionIdValid(), request.isRequestedSessionIdValid());
+
+ //SPEC:132
+ //in this assertions we use parameters passed in query string of dispatcher
+ List paramNames = new LinkedList();
+ Enumeration paramEnum = request.getParameterNames();
+ while (paramEnum.hasMoreElements())
+ {
+ paramNames.add(paramEnum.nextElement());
+ }
+ assertTrue(paramNames.contains("key1"));
+ assertTrue(paramNames.contains("key2"));
+
+ assertEquals("k1value1", request.getParameter("key1"));
+ assertEquals(new String[]{"k1value1"}, request.getParameterValues("key1"));
+
+ Map paramNamesMap = request.getParameterMap();
+ assertTrue(paramNamesMap.containsKey("key1"));
+ assertTrue(paramNamesMap.containsKey("key2"));
+
+ //SPEC:133
+ request.setCharacterEncoding("utf8");
+ assertNull(request.getCharacterEncoding());
+ assertNull(request.getContentType());
+ assertNull(request.getInputStream());
+ assertNull(request.getReader());
+
+ //SPEC:134
+ assertEquals(0, request.getContentLength());
+
+ //SPEC:137
+ assertEquals("GET", request.getMethod());
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ResponseObjectTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ResponseObjectTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/dispatcher/ResponseObjectTestCase.java 2007-11-06 14:04:11 UTC (rev 8833)
@@ -0,0 +1,97 @@
+/******************************************************************************
+ * 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.dispatcher;
+
+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.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 static org.jboss.unit.api.Assert.assertNotNull;
+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;
+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;
+
+/**
+ * @portlet.specification assert="SPEC:138 - The following methods of the HttpServletResponse must return
+ * null:encodeRedirectURL and encodeRedirectUrl"
+ * @portlet.specification assert="SPEC:141 - The getLocale method of the HttpServletResponse must be based on the
+ * getLocale method of the RenderResponse."
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ResponseObjectTestCase
+{
+ public ResponseObjectTestCase(PortletTest seq)
+ {
+ seq.addAction(0, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ //we dispatch to servlet and assertions will be done there
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA");
+ //hack for testing dispatched servlet
+ response.setContentType("text/html");
+ dispatcher.include(request, response);
+ return null;
+ }
+ });
+
+ seq.addAction(0, UTS1.SERVICE_JOINPOINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
+ {
+ //we get this object to assert some of it's method compare wieth http request methods
+ RenderResponse portletResponse = (RenderResponse)request.getAttribute("javax.portlet.response");
+
+ assertNotNull(portletResponse);
+
+ //SPEC:138
+ assertNull(response.encodeRedirectURL("blah"));
+ assertNull(response.encodeRedirectUrl("blah"));
+
+ //not defined spec assert
+ assertEquals(false, response.containsHeader("blah"));
+
+ //SPEC:141
+ assertEquals(portletResponse.getLocale(), response.getLocale());
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Modified: modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/dispatcher-war/WEB-INF/web.xml
===================================================================
--- modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/dispatcher-war/WEB-INF/web.xml 2007-11-06 10:17:40 UTC (rev 8832)
+++ modules/portlet/trunk/portlet/src/resources/test/jsr168/tck/dispatcher-war/WEB-INF/web.xml 2007-11-06 14:04:11 UTC (rev 8833)
@@ -28,7 +28,7 @@
<web-app>
<listener>
- <listener-class>org.jboss.portal.test.portlet.jsr168.tck.dispatcher.DispatcherSequenceBuilder</listener-class>
+ <listener-class>org.jboss.portal.test.framework.portlet.PortletTestSuite</listener-class>
</listener>
<servlet>
16 years, 11 months
JBoss Portal SVN: r8832 - modules/portlet/trunk/build/ide/intellij/idea60.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-06 05:17:40 -0500 (Tue, 06 Nov 2007)
New Revision: 8832
Modified:
modules/portlet/trunk/build/ide/intellij/idea60/jboss-portal-portlet.ipr
Log:
update intellij 6 project file
Modified: modules/portlet/trunk/build/ide/intellij/idea60/jboss-portal-portlet.ipr
===================================================================
--- modules/portlet/trunk/build/ide/intellij/idea60/jboss-portal-portlet.ipr 2007-11-06 10:16:30 UTC (rev 8831)
+++ modules/portlet/trunk/build/ide/intellij/idea60/jboss-portal-portlet.ipr 2007-11-06 10:17:40 UTC (rev 8832)
@@ -129,6 +129,32 @@
<option name="FILTER_INFO" value="true" />
<option name="CUSTOM_FILTER" />
</component>
+ <component name="MavenBuildProjectComponent">
+ <option name="mavenExecutable" value="" />
+ <option name="Settings File" value="" />
+ <option name="mavenCommandLineParams" value="" />
+ <option name="vmOptions" value="" />
+ <option name="useMavenEmbedder" value="false" />
+ <option name="useFilter" value="false" />
+ <option name="Batch Mode" value="false" />
+ <option name="Check Plugin Updates" value="false" />
+ <option name="Debug" value="false" />
+ <option name="Errors" value="false" />
+ <option name="Fail At End" value="false" />
+ <option name="Fail Fast" value="false" />
+ <option name="Fail Never" value="false" />
+ <option name="Lax Checksums" value="false" />
+ <option name="No Plugin Registry" value="false" />
+ <option name="No Plugin Updates" value="false" />
+ <option name="Non Recursive" value="false" />
+ <option name="Offline" value="false" />
+ <option name="Reactor" value="false" />
+ <option name="Strict Checksums" value="false" />
+ <option name="Update Plugins" value="false" />
+ <option name="Update Snapshots" value="false" />
+ <option name="Skip Tests" value="false" />
+ <pom-list />
+ </component>
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
@@ -255,12 +281,13 @@
<module fileurl="file://$PROJECT_DIR$/build/ide/intellij/idea60/modules/federation/federation.iml" filepath="$PROJECT_DIR$/build/ide/intellij/idea60/modules/federation/federation.iml" />
<module fileurl="file://$PROJECT_DIR$/build/ide/intellij/idea60/modules/jsr168api/jsr168api.iml" filepath="$PROJECT_DIR$/build/ide/intellij/idea60/modules/jsr168api/jsr168api.iml" />
<module fileurl="file://$PROJECT_DIR$/build/ide/intellij/idea60/modules/portlet/portlet.iml" filepath="$PROJECT_DIR$/build/ide/intellij/idea60/modules/portlet/portlet.iml" />
+ <module fileurl="file://$PROJECT_DIR$/build/ide/intellij/idea60/modules/test/test.iml" filepath="$PROJECT_DIR$/build/ide/intellij/idea60/modules/test/test.iml" />
<module fileurl="file://$PROJECT_DIR$/build/ide/intellij/idea60/modules/testsuite/testsuite.iml" filepath="$PROJECT_DIR$/build/ide/intellij/idea60/modules/testsuite/testsuite.iml" />
<module fileurl="file://$PROJECT_DIR$/build/ide/intellij/idea60/modules/thirdparty/thirdparty.iml" filepath="$PROJECT_DIR$/build/ide/intellij/idea60/modules/thirdparty/thirdparty.iml" />
<module fileurl="file://$PROJECT_DIR$/build/ide/intellij/idea60/modules/tools/tools.iml" filepath="$PROJECT_DIR$/build/ide/intellij/idea60/modules/tools/tools.iml" />
</modules>
</component>
- <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="false" project-jdk-name="1.5" project-jdk-type="JavaSDK">
+ <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="1.5" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/output" />
</component>
<component name="ProjectRunConfigurationManager" />
16 years, 11 months
JBoss Portal SVN: r8831 - modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-06 05:16:30 -0500 (Tue, 06 Nov 2007)
New Revision: 8831
Modified:
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletURLRenderer.java
Log:
update portlet module to use FastURLEncoder.getUTF8Instance() instead of FastURLEncoder.getInstance()
Modified: modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletURLRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletURLRenderer.java 2007-11-06 10:04:27 UTC (rev 8830)
+++ modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/PortletURLRenderer.java 2007-11-06 10:16:30 UTC (rev 8831)
@@ -137,9 +137,9 @@
{
String value = values[j];
buffer.append(first ? '?' : '&');
- buffer.append(name, FastURLEncoder.getInstance());
+ buffer.append(name, FastURLEncoder.getUTF8Instance());
buffer.append('=');
- buffer.append(value, FastURLEncoder.getInstance());
+ buffer.append(value, FastURLEncoder.getUTF8Instance());
first = false;
}
}
16 years, 11 months
JBoss Portal SVN: r8830 - modules/portlet/trunk.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-06 05:04:27 -0500 (Tue, 06 Nov 2007)
New Revision: 8830
Removed:
modules/portlet/trunk/jboss-portal-portlet.ipr
Log:
remove idea file at the top level
Deleted: modules/portlet/trunk/jboss-portal-portlet.ipr
===================================================================
--- modules/portlet/trunk/jboss-portal-portlet.ipr 2007-11-06 07:18:27 UTC (rev 8829)
+++ modules/portlet/trunk/jboss-portal-portlet.ipr 2007-11-06 10:04:27 UTC (rev 8830)
@@ -1,344 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4" relativePaths="false">
- <component name="AntConfiguration">
- <defaultAnt bundledAnt="true" />
- </component>
- <component name="BuildJarProjectSettings">
- <option name="BUILD_JARS_ON_MAKE" value="false" />
- </component>
- <component name="CodeStyleProjectProfileManger">
- <option name="PROJECT_PROFILE" />
- <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
- </component>
- <component name="CodeStyleSettingsManager">
- <option name="PER_PROJECT_SETTINGS" />
- <option name="USE_PER_PROJECT_SETTINGS" value="false" />
- </component>
- <component name="CompilerConfiguration">
- <option name="DEFAULT_COMPILER" value="Javac" />
- <option name="DEPLOY_AFTER_MAKE" value="0" />
- <resourceExtensions>
- <entry name=".+\.(properties|xml|html|dtd|tld)" />
- <entry name=".+\.(gif|png|jpeg|jpg)" />
- </resourceExtensions>
- <wildcardResourcePatterns>
- <entry name="?*.properties" />
- <entry name="?*.xml" />
- <entry name="?*.gif" />
- <entry name="?*.png" />
- <entry name="?*.jpeg" />
- <entry name="?*.jpg" />
- <entry name="?*.html" />
- <entry name="?*.dtd" />
- <entry name="?*.tld" />
- </wildcardResourcePatterns>
- </component>
- <component name="DataSourceManagerImpl" />
- <component name="DependenciesAnalyzeManager">
- <option name="myForwardDirection" value="false" />
- </component>
- <component name="DependencyValidationManager" />
- <component name="EclipseCompilerSettings">
- <option name="DEBUGGING_INFO" value="true" />
- <option name="GENERATE_NO_WARNINGS" value="true" />
- <option name="DEPRECATION" value="false" />
- <option name="ADDITIONAL_OPTIONS_STRING" value="" />
- <option name="MAXIMUM_HEAP_SIZE" value="128" />
- </component>
- <component name="EclipseEmbeddedCompilerSettings">
- <option name="DEBUGGING_INFO" value="true" />
- <option name="GENERATE_NO_WARNINGS" value="true" />
- <option name="DEPRECATION" value="false" />
- <option name="ADDITIONAL_OPTIONS_STRING" value="" />
- <option name="MAXIMUM_HEAP_SIZE" value="128" />
- </component>
- <component name="EntryPointsManager">
- <entry_points />
- </component>
- <component name="ExportToHTMLSettings">
- <option name="PRINT_LINE_NUMBERS" value="false" />
- <option name="OPEN_IN_BROWSER" value="false" />
- <option name="OUTPUT_DIRECTORY" />
- </component>
- <component name="GUI Designer component loader factory" />
- <component name="InspectionProjectProfileManager">
- <option name="PROJECT_PROFILE" value="Project Default" />
- <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
- <scopes />
- <profiles>
- <profile version="1.0" is_locked="false">
- <option name="myName" value="Project Default" />
- <option name="myLocal" value="false" />
- <used_levels>
- <error>
- <option name="myName" value="ERROR" />
- <option name="myVal" value="200" />
- </error>
- <warning>
- <option name="myName" value="WARNING" />
- <option name="myVal" value="100" />
- </warning>
- <information>
- <option name="myName" value="INFO" />
- <option name="myVal" value="100" />
- </information>
- <server>
- <option name="myName" value="SERVER PROBLEM" />
- <option name="myVal" value="100" />
- </server>
- </used_levels>
- <inspection_tool class="JavaDoc" level="WARNING" enabled="false">
- <option name="TOP_LEVEL_CLASS_OPTIONS">
- <value>
- <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
- <option name="REQUIRED_TAGS" value="" />
- </value>
- </option>
- <option name="INNER_CLASS_OPTIONS">
- <value>
- <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
- <option name="REQUIRED_TAGS" value="" />
- </value>
- </option>
- <option name="METHOD_OPTIONS">
- <value>
- <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
- <option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
- </value>
- </option>
- <option name="FIELD_OPTIONS">
- <value>
- <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
- <option name="REQUIRED_TAGS" value="" />
- </value>
- </option>
- <option name="IGNORE_DEPRECATED" value="false" />
- <option name="IGNORE_JAVADOC_PERIOD" value="true" />
- <option name="myAdditionalJavadocTags" value="" />
- </inspection_tool>
- <inspection_tool class="DuplicateThrows" level="WARNING" enabled="false" />
- </profile>
- </profiles>
- </component>
- <component name="JavacSettings">
- <option name="DEBUGGING_INFO" value="true" />
- <option name="GENERATE_NO_WARNINGS" value="false" />
- <option name="DEPRECATION" value="true" />
- <option name="ADDITIONAL_OPTIONS_STRING" value="" />
- <option name="MAXIMUM_HEAP_SIZE" value="128" />
- </component>
- <component name="JavadocGenerationManager">
- <option name="OUTPUT_DIRECTORY" />
- <option name="OPTION_SCOPE" value="protected" />
- <option name="OPTION_HIERARCHY" value="true" />
- <option name="OPTION_NAVIGATOR" value="true" />
- <option name="OPTION_INDEX" value="true" />
- <option name="OPTION_SEPARATE_INDEX" value="true" />
- <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
- <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
- <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
- <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
- <option name="OPTION_DEPRECATED_LIST" value="true" />
- <option name="OTHER_OPTIONS" value="" />
- <option name="HEAP_SIZE" />
- <option name="LOCALE" />
- <option name="OPEN_IN_BROWSER" value="true" />
- </component>
- <component name="JikesSettings">
- <option name="JIKES_PATH" value="" />
- <option name="DEBUGGING_INFO" value="true" />
- <option name="DEPRECATION" value="true" />
- <option name="GENERATE_NO_WARNINGS" value="false" />
- <option name="IS_EMACS_ERRORS_MODE" value="true" />
- <option name="ADDITIONAL_OPTIONS_STRING" value="" />
- </component>
- <component name="LogConsolePreferences">
- <option name="FILTER_ERRORS" value="false" />
- <option name="FILTER_WARNINGS" value="false" />
- <option name="FILTER_INFO" value="true" />
- <option name="CUSTOM_FILTER" />
- </component>
- <component name="MavenBuildProjectComponent">
- <option name="mavenExecutable" value="" />
- <option name="Settings File" value="" />
- <option name="mavenCommandLineParams" value="" />
- <option name="vmOptions" value="" />
- <option name="useMavenEmbedder" value="false" />
- <option name="useFilter" value="false" />
- <option name="Batch Mode" value="false" />
- <option name="Check Plugin Updates" value="false" />
- <option name="Debug" value="false" />
- <option name="Errors" value="false" />
- <option name="Fail At End" value="false" />
- <option name="Fail Fast" value="false" />
- <option name="Fail Never" value="false" />
- <option name="Lax Checksums" value="false" />
- <option name="No Plugin Registry" value="false" />
- <option name="No Plugin Updates" value="false" />
- <option name="Non Recursive" value="false" />
- <option name="Offline" value="false" />
- <option name="Reactor" value="false" />
- <option name="Strict Checksums" value="false" />
- <option name="Update Plugins" value="false" />
- <option name="Update Snapshots" value="false" />
- <option name="Skip Tests" value="false" />
- <pom-list />
- </component>
- <component name="Palette2">
- <group name="Swing">
- <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
- </item>
- <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
- </item>
- <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
- </item>
- <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
- <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
- </item>
- <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
- <initial-values>
- <property name="text" value="Button" />
- </initial-values>
- </item>
- <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
- <initial-values>
- <property name="text" value="RadioButton" />
- </initial-values>
- </item>
- <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
- <initial-values>
- <property name="text" value="CheckBox" />
- </initial-values>
- </item>
- <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
- <initial-values>
- <property name="text" value="Label" />
- </initial-values>
- </item>
- <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
- <preferred-size width="150" height="-1" />
- </default-constraints>
- </item>
- <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
- <preferred-size width="150" height="-1" />
- </default-constraints>
- </item>
- <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
- <preferred-size width="150" height="-1" />
- </default-constraints>
- </item>
- <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
- <preferred-size width="150" height="50" />
- </default-constraints>
- </item>
- <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
- <preferred-size width="150" height="50" />
- </default-constraints>
- </item>
- <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
- <preferred-size width="150" height="50" />
- </default-constraints>
- </item>
- <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
- </item>
- <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
- <preferred-size width="150" height="50" />
- </default-constraints>
- </item>
- <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
- <preferred-size width="150" height="50" />
- </default-constraints>
- </item>
- <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
- <preferred-size width="150" height="50" />
- </default-constraints>
- </item>
- <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
- <preferred-size width="200" height="200" />
- </default-constraints>
- </item>
- <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
- <preferred-size width="200" height="200" />
- </default-constraints>
- </item>
- <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
- <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
- </item>
- <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
- </item>
- <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
- </item>
- <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
- </item>
- <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
- <preferred-size width="-1" height="20" />
- </default-constraints>
- </item>
- <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
- <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
- </item>
- <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
- <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
- </item>
- </group>
- </component>
- <component name="ProjectModuleManager">
- <modules>
- <module fileurl="file://$PROJECT_DIR$/build/ide/intellij/idea60/modules/bridge/bridge.iml" filepath="$PROJECT_DIR$/build/ide/intellij/idea60/modules/bridge/bridge.iml" />
- <module fileurl="file://$PROJECT_DIR$/build/ide/intellij/idea60/modules/federation/federation.iml" filepath="$PROJECT_DIR$/build/ide/intellij/idea60/modules/federation/federation.iml" />
- <module fileurl="file://$PROJECT_DIR$/build/ide/intellij/idea60/modules/jsr168api/jsr168api.iml" filepath="$PROJECT_DIR$/build/ide/intellij/idea60/modules/jsr168api/jsr168api.iml" />
- <module fileurl="file://$PROJECT_DIR$/build/ide/intellij/idea60/modules/management/management.iml" filepath="$PROJECT_DIR$/build/ide/intellij/idea60/modules/management/management.iml" />
- <module fileurl="file://$PROJECT_DIR$/build/ide/intellij/idea60/modules/portlet/portlet.iml" filepath="$PROJECT_DIR$/build/ide/intellij/idea60/modules/portlet/portlet.iml" />
- <module fileurl="file://$PROJECT_DIR$/build/ide/intellij/idea60/modules/test/test.iml" filepath="$PROJECT_DIR$/build/ide/intellij/idea60/modules/test/test.iml" />
- </modules>
- </component>
- <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="1.5" project-jdk-type="JavaSDK">
- <output url="file://$PROJECT_DIR$/classes" />
- </component>
- <component name="ProjectRunConfigurationManager" />
- <component name="RmicSettings">
- <option name="IS_EANABLED" value="false" />
- <option name="DEBUGGING_INFO" value="true" />
- <option name="GENERATE_NO_WARNINGS" value="false" />
- <option name="GENERATE_IIOP_STUBS" value="false" />
- <option name="ADDITIONAL_OPTIONS_STRING" value="" />
- </component>
- <component name="com.intellij.jsf.UserDefinedFacesConfigs">
- <option name="USER_DEFINED_CONFIGS">
- <value>
- <list size="0" />
- </value>
- </option>
- </component>
- <component name="libraryTable" />
- <component name="uidesigner-configuration">
- <option name="INSTRUMENT_CLASSES" value="true" />
- <option name="COPY_FORMS_RUNTIME_TO_OUTPUT" value="true" />
- <option name="DEFAULT_LAYOUT_MANAGER" value="GridLayoutManager" />
- </component>
- <UsedPathMacros />
-</project>
-
16 years, 11 months
JBoss Portal SVN: r8829 - in branches/UIServer/uiserver: gwt-dev-env and 8 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-11-06 02:18:27 -0500 (Tue, 06 Nov 2007)
New Revision: 8829
Added:
branches/UIServer/uiserver/gwt-dev-env/Portal(uiserver).launch
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPC.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPCAsync.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPoint.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPointImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/HostedModeProxy.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalRPCImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortletServiceImpl.java
Removed:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortletServiceImpl.java
Modified:
branches/UIServer/uiserver/build.xml
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/AsyncPages.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Page.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PartialRefresh.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Portal.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletService.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletServiceAsync.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Window.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/GWTClientFilter.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortalEntryPoint.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java
branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/AsyncPages.gwt.xml
branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/PartialRefresh.gwt.xml
branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/Portal.gwt.xml
branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/PortalLayout.gwt.xml
branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/public/index.html
branches/UIServer/uiserver/src/resources/portal-uiserver.sar/META-INF/jboss-service.xml
branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml
Log:
GWT-based Ajax client/Presentation Framework integration
Modified: branches/UIServer/uiserver/build.xml
===================================================================
--- branches/UIServer/uiserver/build.xml 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/build.xml 2007-11-06 07:18:27 UTC (rev 8829)
@@ -92,6 +92,7 @@
<path refid="apache.log4j.classpath"/>
<path refid="junit.junit.classpath"/>
<path refid="gwt.gwt.classpath"/>
+ <path refid="httpunit.httpunit.classpath"/>
</path>
<!-- Configure modules -->
Added: branches/UIServer/uiserver/gwt-dev-env/Portal(uiserver).launch
===================================================================
--- branches/UIServer/uiserver/gwt-dev-env/Portal(uiserver).launch (rev 0)
+++ branches/UIServer/uiserver/gwt-dev-env/Portal(uiserver).launch 2007-11-06 07:18:27 UTC (rev 8829)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.GWTShell"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="UIServer" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/UIServer/uiserver/src/main" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/UIServer/uiserver/src/resources/client/ajax/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/UIServer/uiserver/gwt-dev-env/src" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="UIServer"/> </runtimeClasspathEntry> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry internalArchive="/UIServer/uiserver/gwt-dev-env/gwt-dev-linux.jar" path="3" type="2"/> "/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-out www org.jboss.portal.uiserver.ajax.Portal/index.html"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="UIServer"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/UIServer"/>
+</listAttribute>
+<mapAttribute key="org.eclipse.debug.core.environmentVariables">
+<mapEntry key="GWT_EXTERNAL_BROWSER" value="/home/soshah/firefox/firefox"/>
+</mapAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:UIServer/uiserver/gwt-dev-env}"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+</launchConfiguration>
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/AsyncPages.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/AsyncPages.java 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/AsyncPages.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -350,20 +350,20 @@
};
//Dispalying the fully aggregated page
- Window[] windows = portalPage.windows;
+ Window[] windows = portalPage.getWindows();
HorizontalPanel page = (HorizontalPanel)RootPanel.get("currentPage").getWidget(0);
page.clear();
for(int i=0; i<windows.length; i++)
{
Window pageWindow = windows[i];
- if(pageWindow.isVisible)
+ if(pageWindow.isVisible())
{
VerticalPanel window = new VerticalPanel();
window.setBorderWidth(2);
//Create the decoration panel
HorizontalPanel decoration = new HorizontalPanel();
- decoration.setTitle(pageWindow.name);
+ decoration.setTitle(pageWindow.getName());
Button normal = new Button("Normal");
Button minimized = new Button("Minimized");
@@ -377,7 +377,7 @@
window.add(decoration);
//Create the actual content of the portlet to be displayed inside the window
- HTML windowContent = new HTML(pageWindow.content);
+ HTML windowContent = new HTML(pageWindow.getContent());
window.add(windowContent);
//Event listeners for this Window
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Page.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Page.java 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Page.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -1,9 +1,45 @@
package org.jboss.portal.uiserver.ajax.client;
-import java.io.Serializable;
+import com.google.gwt.user.client.rpc.IsSerializable;
-public class Page implements Serializable
+public class Page implements IsSerializable
{
- public String name = null;
- public Window[] windows = null;
+ private String name = null;
+ private Window[] windows = null;
+
+ /**
+ *
+ * @return
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ *
+ * @param name
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Window[] getWindows()
+ {
+ return windows;
+ }
+
+ /**
+ *
+ * @param windows
+ */
+ public void setWindows(Window[] windows)
+ {
+ this.windows = windows;
+ }
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PartialRefresh.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PartialRefresh.java 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PartialRefresh.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -338,19 +338,19 @@
};
//Dispalying the fully aggregated page
- Window[] windows = portalPage.windows;
+ Window[] windows = portalPage.getWindows();
VerticalPanel page = (VerticalPanel)RootPanel.get("page").getWidget(0);
page.clear();
for(int i=0; i<windows.length; i++)
{
Window pageWindow = windows[i];
- if(pageWindow.isVisible)
+ if(pageWindow.isVisible())
{
VerticalPanel window = new VerticalPanel();
//Create the decoration panel
HorizontalPanel decoration = new HorizontalPanel();
- decoration.setTitle(pageWindow.name);
+ decoration.setTitle(pageWindow.getName());
Button normal = new Button("Normal");
Button minimized = new Button("Minimized");
@@ -364,7 +364,7 @@
window.add(decoration);
//Create the actual content of the portlet to be displayed inside the window
- HTML windowContent = new HTML(pageWindow.content);
+ HTML windowContent = new HTML(pageWindow.getContent());
window.add(windowContent);
//Event listeners for this Window
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Portal.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Portal.java 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Portal.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -17,13 +17,13 @@
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.TabBar;
-import com.google.gwt.user.client.ui.TabListener;
-import com.google.gwt.user.client.ui.SourcesTabEvents;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import org.jboss.portal.uiserver.ajax.client.service.PortalRPC;
+import org.jboss.portal.uiserver.ajax.client.service.PortalRPCAsync;
+
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
@@ -34,6 +34,8 @@
*/
public void onModuleLoad()
{
+ HorizontalPanel page = new HorizontalPanel();
+ RootPanel.get("currentPage").add(page);
this.loadPortal();
}
@@ -42,30 +44,9 @@
*
*/
private void loadPortal()
- {
- //Load the navigation bar....use a tabbed bar
- TabBar pageNavigator = new TabBar();
- pageNavigator.addTab("Page 1");
- pageNavigator.addTab("Page 2");
- pageNavigator.addTab("Page 3");
- pageNavigator.selectTab(0);
- pageNavigator.addTabListener(new TabListenerImpl());
- RootPanel.get("pageNavigator").add(pageNavigator);
-
- //Load the main page to be displayed
- HorizontalPanel page = new HorizontalPanel();
- RootPanel.get("currentPage").add(page);
- this.loadPartialRefreshPage("Page 1");
- }
-
- /**
- *
- *
- */
- private void loadPartialRefreshPage(String pageId)
- {
- PortletServiceAsync portletService = (PortletServiceAsync)GWT.create(PortletService.class);
- ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portletService");
+ {
+ PortalRPCAsync portalRPC = (PortalRPCAsync)GWT.create(PortalRPC.class);
+ ((ServiceDefTarget)portalRPC).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portalrpc");
AsyncCallback callback = new AsyncCallback()
{
@@ -80,18 +61,139 @@
}
};
- portletService.getPage(pageId, callback);
- }
+ portalRPC.loadPortal(callback);
+ }
/**
*
+ * @param portalPage
+ */
+ private void displayPortalPage(Page portalPage)
+ {
+ //Event Listener for the decoration components like
+ //Normal, Maximized, Minimized
+ /*ClickListener listener = new ClickListener()
+ {
+ public void onClick(Widget sender)
+ {
+ Button cour = (Button)sender;
+ String windowName = sender.getParent().getTitle();
+ if(cour.getText().equals("Normal"))
+ {
+ handleWindowStateChanged(windowName, Window.NORMAL);
+ }
+ else if(cour.getText().equals("Minimized"))
+ {
+ handleWindowStateChanged(windowName, Window.MINIMIZED);
+ }
+ else if(cour.getText().equals("Maximized"))
+ {
+ handleWindowStateChanged(windowName, Window.MAXIMIZED);
+ }
+ else if(cour.getText().equals("Edit"))
+ {
+ handleWindowModeChanged(windowName, Window.EDIT);
+ }
+ }
+ };
+
+ //Event Listener for actions perfomed inside the portlet window content
+ //itself.
+ ClickListener contentListener = new ClickListener()
+ {
+ public void onClick(Widget sender)
+ {
+ Event event = DOM.eventGetCurrentEvent();
+ Element target = DOM.eventGetTarget(event);
+
+ if(target.toString().toUpperCase().trim().indexOf("</A>") != -1)
+ {
+ String link = DOM.getElementAttribute(target, "HREF");
+
+ //A link inside the portlet window was clicked
+ //Load its content asynchronously inside this window
+ boolean isPartialRefreshAllowed = isPartialRefreshAllowed(link);
+ if(isPartialRefreshAllowed)
+ {
+ DOM.eventPreventDefault(event);
+ handlePartialRefreshLink(link, sender);
+ }
+ }
+ else if(target.toString().toUpperCase().trim().indexOf("INPUT") != -1 &&
+ target.toString().toUpperCase().trim().indexOf("SUBMIT") != -1
+ )
+ {
+ Element currentForm = DOM.getParent(target);
+ String enctype = DOM.getElementAttribute(currentForm, "enctype");
+ String action = DOM.getElementAttribute(currentForm, "action");
+ boolean isPartialRefreshAllowed = isPartialRefreshAllowed(action);
+ if((isPartialRefreshAllowed) && (enctype == null || !enctype.equals("multipart/form-data")))
+ {
+ DOM.eventPreventDefault(event);
+
+ //Call a native javascript function here
+ String method = DOM.getElementAttribute(currentForm, "method");
+ String serializedForm = serializeForm(currentForm);
+
+ handlePartialRefreshForm(action, method, serializedForm, sender);
+ }
+ }
+ }
+ };*/
+
+ //Dispalying the fully aggregated page
+ Window[] windows = portalPage.getWindows();
+ HorizontalPanel page = (HorizontalPanel)RootPanel.get("currentPage").getWidget(0);
+ page.clear();
+ for(int i=0; i<windows.length; i++)
+ {
+ Window pageWindow = windows[i];
+ if(pageWindow.isVisible())
+ {
+ VerticalPanel window = new VerticalPanel();
+ window.setBorderWidth(2);
+
+ //Create the decoration panel
+ HorizontalPanel decoration = new HorizontalPanel();
+ decoration.setTitle(pageWindow.getName());
+
+ Button normal = new Button("Normal");
+ Button minimized = new Button("Minimized");
+ Button maximized = new Button("Maximized");
+ Button edit = new Button("Edit");
+
+ decoration.add(normal);
+ decoration.add(minimized);
+ decoration.add(maximized);
+ decoration.add(edit);
+ window.add(decoration);
+
+ //Create the actual content of the portlet to be displayed inside the window
+ HTML windowContent = new HTML(pageWindow.getContent());
+ window.add(windowContent);
+
+ //Event listeners for this Window
+ /*normal.addClickListener(listener);
+ minimized.addClickListener(listener);
+ maximized.addClickListener(listener);
+ edit.addClickListener(listener);
+ windowContent.addClickListener(contentListener);*/
+
+ //Add this window to the Page
+ page.add(window);
+ }
+ }
+ }
+ //-------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
* @param window
* @param newState
*/
- private void handleWindowStateChanged(String window, String newState)
+ /*private void handleWindowStateChanged(String window, String newState)
{
PortletServiceAsync portletService = (PortletServiceAsync)GWT.create(PortletService.class);
- ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portletService");
+ ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portalrpc");
AsyncCallback callback = new AsyncCallback()
{
@@ -107,17 +209,17 @@
};
portletService.setState(window, newState, callback);
- }
+ }*/
/**
*
* @param window
* @param newState
*/
- private void handleWindowModeChanged(String window, String newMode)
+ /*private void handleWindowModeChanged(String window, String newMode)
{
PortletServiceAsync portletService = (PortletServiceAsync)GWT.create(PortletService.class);
- ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portletService");
+ ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portalrpc");
AsyncCallback callback = new AsyncCallback()
{
@@ -133,24 +235,24 @@
};
portletService.setMode(window, newMode, callback);
- }
+ }*/
/**
*
* @param url
* @param portletWindow
*/
- private void handlePartialRefreshLink(String url, Widget windowContent)
+ /*private void handlePartialRefreshLink(String url, Widget windowContent)
{
HTTPRequest.asyncGet(url, new ResponseTextHandlerImpl(windowContent));
- }
+ }*/
/**
*
* @param url
* @param portletWindow
*/
- private void handlePartialRefreshForm(String url, String method, String postData, Widget windowContent)
+ /*private void handlePartialRefreshForm(String url, String method, String postData, Widget windowContent)
{
if(method.equalsIgnoreCase("post"))
{
@@ -164,14 +266,14 @@
}
HTTPRequest.asyncGet(url, new ResponseTextHandlerImpl(windowContent));
}
- }
+ }*/
/**
*
* @author soshah
*
*/
- private class ResponseTextHandlerImpl implements ResponseTextHandler
+ /*private class ResponseTextHandlerImpl implements ResponseTextHandler
{
private Widget windowContent = null;
@@ -186,14 +288,14 @@
this.windowContent.removeFromParent();
window.add(html);
}
- }
+ }*/
/**
*
* @param url
* @return
*/
- private boolean isPartialRefreshAllowed(String url)
+ /*private boolean isPartialRefreshAllowed(String url)
{
String basePortalURL = GWT.getModuleBaseURL();
String portalContext = "org.jboss.portal.uiserver.Portal"; //This is hard coded for now, but must be populated from the Portal deployment environment
@@ -259,7 +361,7 @@
//If I get here, Async Page Refresh through the Portal should be allowed
return true;
}
- }
+ }*/
/**
*
@@ -270,160 +372,5 @@
/*-{
var formData = $wnd.Form.serialize(currentForm);
return formData;
- }-*/;
-
- /**
- *
- * @param portalPage
- */
- private void displayPortalPage(Page portalPage)
- {
- //Event Listener for the decoration components like
- //Normal, Maximized, Minimized
- ClickListener listener = new ClickListener()
- {
- public void onClick(Widget sender)
- {
- Button cour = (Button)sender;
- String windowName = sender.getParent().getTitle();
- if(cour.getText().equals("Normal"))
- {
- handleWindowStateChanged(windowName, Window.NORMAL);
- }
- else if(cour.getText().equals("Minimized"))
- {
- handleWindowStateChanged(windowName, Window.MINIMIZED);
- }
- else if(cour.getText().equals("Maximized"))
- {
- handleWindowStateChanged(windowName, Window.MAXIMIZED);
- }
- else if(cour.getText().equals("Edit"))
- {
- handleWindowModeChanged(windowName, Window.EDIT);
- }
- }
- };
-
- //Event Listener for actions perfomed inside the portlet window content
- //itself.
- ClickListener contentListener = new ClickListener()
- {
- public void onClick(Widget sender)
- {
- Event event = DOM.eventGetCurrentEvent();
- Element target = DOM.eventGetTarget(event);
-
- if(target.toString().toUpperCase().trim().indexOf("</A>") != -1)
- {
- String link = DOM.getElementAttribute(target, "HREF");
-
- //A link inside the portlet window was clicked
- //Load its content asynchronously inside this window
- boolean isPartialRefreshAllowed = isPartialRefreshAllowed(link);
- if(isPartialRefreshAllowed)
- {
- DOM.eventPreventDefault(event);
- handlePartialRefreshLink(link, sender);
- }
- }
- else if(target.toString().toUpperCase().trim().indexOf("INPUT") != -1 &&
- target.toString().toUpperCase().trim().indexOf("SUBMIT") != -1
- )
- {
- Element currentForm = DOM.getParent(target);
- String enctype = DOM.getElementAttribute(currentForm, "enctype");
- String action = DOM.getElementAttribute(currentForm, "action");
- boolean isPartialRefreshAllowed = isPartialRefreshAllowed(action);
- if((isPartialRefreshAllowed) && (enctype == null || !enctype.equals("multipart/form-data")))
- {
- DOM.eventPreventDefault(event);
-
- //Call a native javascript function here
- String method = DOM.getElementAttribute(currentForm, "method");
- String serializedForm = serializeForm(currentForm);
-
- handlePartialRefreshForm(action, method, serializedForm, sender);
- }
- }
- }
- };
-
- //Dispalying the fully aggregated page
- Window[] windows = portalPage.windows;
- HorizontalPanel page = (HorizontalPanel)RootPanel.get("currentPage").getWidget(0);
- page.clear();
- for(int i=0; i<windows.length; i++)
- {
- Window pageWindow = windows[i];
- if(pageWindow.isVisible)
- {
- VerticalPanel window = new VerticalPanel();
- window.setBorderWidth(2);
-
- //Create the decoration panel
- HorizontalPanel decoration = new HorizontalPanel();
- decoration.setTitle(pageWindow.name);
-
- Button normal = new Button("Normal");
- Button minimized = new Button("Minimized");
- Button maximized = new Button("Maximized");
- Button edit = new Button("Edit");
-
- decoration.add(normal);
- decoration.add(minimized);
- decoration.add(maximized);
- decoration.add(edit);
- window.add(decoration);
-
- //Create the actual content of the portlet to be displayed inside the window
- HTML windowContent = new HTML(pageWindow.content);
- window.add(windowContent);
-
- //Event listeners for this Window
- normal.addClickListener(listener);
- minimized.addClickListener(listener);
- maximized.addClickListener(listener);
- edit.addClickListener(listener);
- windowContent.addClickListener(contentListener);
-
- //Add this window to the Page
- page.add(window);
- }
- }
- }
-
- //------------Page Navigation related logic-----------------------------------------------------------------------------------------------------
- /**
- *
- */
- private class TabListenerImpl implements TabListener
- {
- /**
- *
- */
- public boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex)
- {
- return true;
- }
-
- /**
- *
- */
- public void onTabSelected(SourcesTabEvents sender, int tabIndex)
- {
- if(tabIndex == 0)
- {
- loadPartialRefreshPage("Page 1");
- }
- else if(tabIndex == 1)
- {
- loadPartialRefreshPage("Page 2");
- }
- else if(tabIndex == 2)
- {
- loadPartialRefreshPage("Page 3");
- }
- }
- }
+ }-*/;
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletService.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletService.java 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletService.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -37,5 +37,5 @@
* @param newMode
* @return
*/
- public Page setMode(String window, String newMode);
+ public Page setMode(String window, String newMode);
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletServiceAsync.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletServiceAsync.java 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/PortletServiceAsync.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -31,5 +31,5 @@
* @param newMode
* @return
*/
- public void setMode(String window, String newMode, AsyncCallback callback);
+ public void setMode(String window, String newMode, AsyncCallback callback);
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Window.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Window.java 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/Window.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -1,8 +1,8 @@
package org.jboss.portal.uiserver.ajax.client;
-import java.io.Serializable;
+import com.google.gwt.user.client.rpc.IsSerializable;
-public class Window implements Serializable
+public class Window implements IsSerializable
{
public static final String NORMAL = "NORMAL";
public static final String MAXIMIZED = "MAXIMIZED";
@@ -10,9 +10,99 @@
public static final String EDIT = "EDIT";
public static final String VIEW = "VIEW";
- public String name = null;
- public String content = null;
- public String mode = VIEW;
- public String state = NORMAL;
- public boolean isVisible = true;
+ private String name = null;
+ private String content = null;
+ private String mode = VIEW;
+ private String state = NORMAL;
+ private boolean isVisible = true;
+
+ /**
+ *
+ * @return
+ */
+ public String getContent()
+ {
+ return content;
+ }
+
+ /**
+ *
+ * @param content
+ */
+ public void setContent(String content)
+ {
+ this.content = content;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public boolean isVisible()
+ {
+ return isVisible;
+ }
+
+ /**
+ *
+ * @param isVisible
+ */
+ public void setVisible(boolean isVisible)
+ {
+ this.isVisible = isVisible;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getMode()
+ {
+ return mode;
+ }
+
+ /**
+ *
+ * @param mode
+ */
+ public void setMode(String mode)
+ {
+ this.mode = mode;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ *
+ * @param name
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getState()
+ {
+ return state;
+ }
+
+ /**
+ *
+ * @param state
+ */
+ public void setState(String state)
+ {
+ this.state = state;
+ }
}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPC.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPC.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPC.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -0,0 +1,25 @@
+package org.jboss.portal.uiserver.ajax.client.service;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+import org.jboss.portal.uiserver.ajax.client.Page;
+
+/**
+ *
+ * @author soshah
+ *
+ */
+public interface PortalRPC extends RemoteService
+{
+ /**
+ * Loads the initial Portal Page at the start of a Portal session
+ *
+ * @return The Initial Portal Page
+ */
+ public Page loadPortal();
+
+ /**
+ * @return The Page of the Portal that should be currently displayed
+ */
+ public Page getCurrentPage();
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPCAsync.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPCAsync.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/ajax/client/service/PortalRPCAsync.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -0,0 +1,16 @@
+package org.jboss.portal.uiserver.ajax.client.service;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+public interface PortalRPCAsync
+{
+ /**
+ * Loads the initial Portal Page at the start of a Portal session
+ */
+ public void loadPortal(AsyncCallback callback);
+
+ /**
+ * Loads the Page of the Portal that should be currently displayed
+ */
+ public void getCurrentPage(AsyncCallback callback);
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPoint.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPoint.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPoint.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.uiserver.service;
+
+import org.jboss.portal.server.RequestControllerFactory;
+import org.jboss.portal.server.Server;
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface EntryPoint
+{
+ /**
+ *
+ * @return
+ */
+ public Server getPortalServer();
+
+ /**
+ *
+ * @return
+ */
+ public RequestControllerFactory getControllerFactory();
+
+ /**
+ *
+ * @return
+ */
+ public InterceptorStackFactory getInterceptorStackFactory();
+
+ /**
+ *
+ * @param contentType
+ * @return
+ */
+ public String retrieveMediaType(String contentType);
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPointImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPointImpl.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/EntryPointImpl.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -0,0 +1,135 @@
+/******************************************************************************
+ * 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.uiserver.service;
+
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.server.RequestControllerFactory;
+import org.jboss.portal.server.Server;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class EntryPointImpl extends AbstractJBossService implements EntryPoint
+{
+ /** The interceptor stack. */
+ private InterceptorStackFactory interceptorStackFactory = null;
+
+ /** The controller for this servlet. */
+ private RequestControllerFactory controllerFactory = null;
+
+ /**
+ *
+ */
+ private Server portalServer = null;
+
+
+ /**
+ *
+ * @return
+ */
+ public RequestControllerFactory getControllerFactory()
+ {
+ return controllerFactory;
+ }
+
+
+ /**
+ *
+ * @param controllerFactory
+ */
+ public void setControllerFactory(RequestControllerFactory controllerFactory)
+ {
+ this.controllerFactory = controllerFactory;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public InterceptorStackFactory getInterceptorStackFactory()
+ {
+ return interceptorStackFactory;
+ }
+
+
+ /**
+ *
+ * @param interceptorStackFactory
+ */
+ public void setInterceptorStackFactory(
+ InterceptorStackFactory interceptorStackFactory)
+ {
+ this.interceptorStackFactory = interceptorStackFactory;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Server getPortalServer()
+ {
+ return portalServer;
+ }
+
+
+ /**
+ *
+ * @param portalServer
+ */
+ public void setPortalServer(Server portalServer)
+ {
+ this.portalServer = portalServer;
+ }
+
+
+ /**
+ *
+ * @param contentType
+ * @return
+ */
+ public String retrieveMediaType(String contentType)
+ {
+ String mediaType = contentType;
+
+ //
+ if (mediaType != null)
+ {
+ // Remove any parameters
+ int index = mediaType.indexOf(';');
+ if (index != -1)
+ {
+ mediaType = contentType.substring(0, index);
+ }
+
+ // Trim
+ mediaType = mediaType.trim();
+
+ // Media type matching is case insensitive, so we convert to lower case
+ mediaType = mediaType.toLowerCase();
+ }
+ return mediaType;
+ }
+}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/GWTClientFilter.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/GWTClientFilter.java 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/GWTClientFilter.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -55,6 +55,8 @@
HttpServletRequest request = (HttpServletRequest)servletRequest;
HttpServletResponse response = (HttpServletResponse)servletResponse;
String contextPath = request.getContextPath();
+
+ //Extract the resource that is being accessed
String resource = request.getRequestURI().replaceFirst(contextPath, "");
while(resource.startsWith("/"))
{
@@ -89,9 +91,6 @@
response.getOutputStream().flush();
return;
}
-
- //Propagate the request further
- filterChain.doFilter(servletRequest, servletResponse);
}
/**
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortalEntryPoint.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortalEntryPoint.java 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortalEntryPoint.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -23,11 +23,12 @@
package org.jboss.portal.uiserver.service;
import java.io.IOException;
-import java.io.InputStream;
+import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import javax.management.MBeanServer;
@@ -37,6 +38,7 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.UnavailableException;
import org.apache.log4j.Logger;
import org.jboss.mx.util.MBeanProxy;
@@ -58,6 +60,16 @@
import org.jboss.portal.server.ServerResponse;
import org.jboss.portal.server.impl.ServerInvocationContextImpl;
import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.uiserver.layout.LayoutManager;
+import org.jboss.portal.uiserver.layout.classic.FlexibleGrid;
+import org.jboss.portal.uiserver.layout.classic.FlexibleGridConstraints;
+import org.jboss.portal.uiserver.layout.classic.FlexibleGridLayoutManager;
+import org.jboss.portal.uiserver.layout.classic.RegionConstraints;
+import org.jboss.portal.uiserver.layout.classic.RegionLayoutManager;
+import org.jboss.portal.uiserver.protocol.Container;
+import org.jboss.portal.uiserver.protocol.Page;
+import org.jboss.portal.uiserver.protocol.Window;
+import org.jboss.portal.uiserver.processor.ProcessorResponse;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -65,6 +77,11 @@
*/
public class PortalEntryPoint extends HttpServlet
{
+ /**
+ *
+ */
+ private Logger log = Logger.getLogger(getClass());
+
/** . */
private static final int GET_METHOD = 0;
@@ -79,115 +96,38 @@
/** Describes a path mapping. */
private static final int PATH_MAPPING = 2;
-
- /** The logger. */
- protected Logger log = Logger.getLogger(getClass());
-
- /** The server. */
- private Server server;
-
- /** The interceptor stack. */
- private InterceptorStackFactory interceptorStack;
-
+
/** Are we or not the default servlet ? */
- private boolean asDefaultServlet;
-
- /** The controller for this servlet. */
- private RequestControllerFactory controllerFactory;
-
- /** The controller name. */
- private String controllerFactoryName;
-
+ private boolean asDefaultServlet = false;
+
+ /**
+ *
+ */
+ private EntryPoint entryPoint = null;
+
/** Configure the as default servlet. */
public void init() throws ServletException
{
asDefaultServlet = getAsDefaultServletInitValue();
- controllerFactoryName = getServletConfig().getInitParameter("controllerFactoryName");
- }
-
- /**
- *
- */
- protected final Server getServer()
- {
- if (server == null)
+ try
{
- try
- {
- MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
- server = (Server)MBeanProxy.get(Server.class, new ObjectName("portal:service=Server"), mbeanServer);
- }
- catch (Exception e)
- {
- String msg = "Cannot get portal server";
- log.error(msg, e);
- throw new IllegalStateException(msg);
- }
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+ this.entryPoint = (EntryPoint) MBeanProxy.get(EntryPoint.class, new ObjectName(
+ this.getInitParameter("entryPointServiceName")),
+ mbeanServer);
}
- return server;
- }
-
- protected final InterceptorStackFactory getInterceptorStackFactory()
- {
- if (interceptorStack == null)
+ catch (Exception e)
{
- try
- {
- MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
- interceptorStack = (InterceptorStackFactory)MBeanProxy.get(InterceptorStackFactory.class, new ObjectName("portal:service=InterceptorStackFactory,type=Server"), mbeanServer);
- }
- catch (Exception e)
- {
- String msg = "Cannot get interceptor stack";
- log.error(msg, e);
- throw new IllegalStateException(msg);
- }
+ this.entryPoint = null;
+ String msg = "Portal Entry Point could not be created";
+ log.error(msg, e);
+ throw new UnavailableException(msg);
}
- return interceptorStack;
}
-
- protected final RequestControllerFactory getControllerFactory()
- {
- if (controllerFactory == null)
- {
- try
- {
- MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
- controllerFactory = (RequestControllerFactory)MBeanProxy.get(RequestControllerFactory.class, new ObjectName(controllerFactoryName), mbeanServer);
- }
- catch (Exception e)
- {
- String msg = "Cannot get controller " + controllerFactoryName;
- log.error(msg, e);
- throw new IllegalStateException(msg);
- }
- }
- return controllerFactory;
- }
-
- private String retrieveMediaType(String contentType)
- {
- String mediaType = contentType;
-
- //
- if (mediaType != null)
- {
- // Remove any parameters
- int index = mediaType.indexOf(';');
- if (index != -1)
- {
- mediaType = contentType.substring(0, index);
- }
-
- // Trim
- mediaType = mediaType.trim();
-
- // Media type matching is case insensitive, so we convert to lower case
- mediaType = mediaType.toLowerCase();
- }
- return mediaType;
- }
-
+
+ /**
+ *
+ */
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
//
@@ -229,7 +169,7 @@
}
// Compute the media type in the content type
- String mediaType = retrieveMediaType(req.getContentType());
+ String mediaType = this.entryPoint.retrieveMediaType(req.getContentType());
// Only affect the charset encoding if the servlet container will decode the request
if (method == POST_METHOD && PortalConstants.APPLICATION_X_WWW_FORM_URLENCODED.equals(mediaType))
@@ -359,7 +299,7 @@
// ***************
//
- Server server = getServer();
+ Server server = this.entryPoint.getPortalServer();
//
ServerInvocationContext invocationCtx = new ServerInvocationContextImpl(
@@ -386,15 +326,25 @@
invocation.setResponse(response);
//
- RequestControllerFactory controllerFactory = getControllerFactory();
+ RequestControllerFactory controllerFactory = this.entryPoint.getControllerFactory();
RequestController controller = controllerFactory.createRequestController(invocation);
invocation.setHandler(new RequestControllerDispatcher(controller));
//
try
{
- InterceptorStackFactory stack = getInterceptorStackFactory();
+ InterceptorStackFactory stack = this.entryPoint.getInterceptorStackFactory();
invocation.invoke(stack.getInterceptorStack());
+ ProcessorResponse processorResponse = (ProcessorResponse)req.getAttribute("processorResponse");
+ if(processorResponse != null)
+ {
+ Page displayedPage = processorResponse.findDisplayedPage();
+ if(displayedPage != null)
+ {
+ this.render(invocation.getServerContext().getClientResponse().getWriter(),
+ displayedPage);
+ }
+ }
}
catch (ServerException e)
{
@@ -422,14 +372,13 @@
Throwable nested = Exceptions.unwrap(e);
throw new ServletException(nested);
}
- }
+ }
-
/**
- * Return the value for the servlet mapping. This implementation get the value from an init parameter of the servlet
- * called <b>asDefaultServlet</b>
+ * Return the value for the servlet mapping. This implementation get the
+ * value from an init parameter of the servlet called <b>asDefaultServlet</b>
*/
- protected boolean getAsDefaultServletInitValue()
+ private boolean getAsDefaultServletInitValue()
{
ServletConfig config = getServletConfig();
String value = config.getInitParameter("asDefaultServlet");
@@ -445,8 +394,238 @@
}
else
{
- log.warn("Servlet mapping cannot be determined with init parameter value=" + value);
+ log.warn("Servlet mapping cannot be determined with init parameter value="
+ + value);
return false;
}
+ }
+ // ---------All these are just helper methods for the prototype-----------------------------------------------------------------------------------------------
+ //----It containts mostly hard coded logic for the prototype-------------------------------------------------------------------------------------------------
+ /**
+ * Based on the latest design discussion, this method is not needed.
+ *
+ * This will be an implementation detail of the UIServer processing the Response that is sent back to it
+ * from the Core Portal Processor
+ *
+ * @param clientConnection
+ * @param page
+ */
+ private void render(PrintWriter clientConnection, Page pageResult)
+ {
+ /**
+ * Special Note: Currently this prototype code and layout configuration including page result creation is hard coded for the purpose
+ * of getting the architecture right
+ *
+ * In the real implementation, LayoutState would be fetched dynamically based on the Page State/Configuration being rendered
+ * Even type of Client considerations would be handled here
+ *
+ * Basically the UIServer would delegate functions to its various components and then send back the result to the client
+ *
+ */
+ //Some flexible grid layout testing code
+ Object[] gridData = this.getFlexibleGridLayoutManager(pageResult);
+ Page page = (Page)gridData[0];
+ LayoutManager layoutManager = (LayoutManager)gridData[1];
+
+ //Some region layout testing code
+ //Object[] regionData = this.getRegionBasedLayoutManager(pageResult);
+ //Page page = (Page)regionData[0];
+ //LayoutManager layoutManager = (LayoutManager)regionData[1];
+
+ //Peform Page Layout
+ String output = layoutManager.doLayout(page);
+
+
+ //Create the final output...Also hardcoded without any preprocessing/postprocessing etc
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>JBoss Portal UIServer</title><link rel=\"stylesheet\" id=\"dyna_css\" href=\"/portal-ajax/dyna/style.css\" type=\"text/css\"/><link rel=\"stylesheet\" type=\"text/css\" id=\"main_css\" href=\"/portal-core/themes/renaissance/portal_style.css\"/><link rel=\"shortcut icon\" href=\"/portal-core/themes/renaissance/images/favicon.ico\" /><link rel=\"icon\" type=\"image/gif\" href=\"/portal-core/themes/renaissance/images/animated_favicon1.gif\" /></head><body id=\"body\">\n");
+ buffer.append(output);
+ buffer.append("</body></html>\n");
+
+
+ //Sending the results back to the Client
+ clientConnection.write(buffer.toString());
+ clientConnection.flush();
}
+
+ /**
+ *
+ */
+ private Object[] getFlexibleGridLayoutManager(Page pageResult)
+ {
+ /**
+ * Hard coding the FlexibleGridLayout Management here
+ */
+ Page page = new Page();
+ Container header = new Container("header");
+ Container leftPanel = new Container("leftPanel");
+ Container mainPanel = new Container("mainPanel");
+ Window headerTabsWindow = new Window("header-tabs-window");
+ Window menuWindow = new Window("menu-window");
+ Window leftPanelWindow1 = new Window("left-panel-window1");
+ Window leftPanelWindow2 = new Window("left-panel-window2");
+ Window mainPanelWindow = new Window("main-panel-window");
+ header.addComponent(headerTabsWindow);
+ header.addComponent(menuWindow);
+ leftPanel.addComponent(leftPanelWindow1);
+ leftPanel.addComponent(leftPanelWindow2);
+ mainPanel.addComponent(mainPanelWindow);
+
+ //Setup the Grid for headerTabs container
+ page.addContainer(header);
+ FlexibleGrid headerGrid = this.getGrid("header", 1, 2);
+ FlexibleGridConstraints[] headerTabConstraints = { this.getConstraints("header-tabs-window", "100", 0, 0, 10, 0, 0, 0),
+ this.getConstraints("menu-window", "100", 0, 0, 0, 0, 0, 1) };
+ headerGrid.setConstraints(headerTabConstraints);
+
+ //Setup the Grid for left panel container
+ page.addContainer(leftPanel);
+ FlexibleGrid leftPanelGrid = this.getGrid("leftPanel", 2, 1);
+ FlexibleGridConstraints[] leftPanelConstraints = { this.getConstraints("left-panel-window1", "75", 0, 0, 0, 0, 0, 0),
+ this.getConstraints("left-panel-window2", "75", 0, 0, 0, 0, 1, 0) };
+ leftPanelGrid.setConstraints(leftPanelConstraints);
+
+ //Setup the Grid for main panel container
+ page.addContainer(mainPanel);
+ FlexibleGrid mainPanelGrid = this.getGrid("mainPanel", 1, 1);
+ FlexibleGridConstraints[] mainPanelConstraints = { this.getConstraints("main-panel-window", "100", 0, 0, 0, 0, 0, 0) };
+ mainPanelGrid.setConstraints(mainPanelConstraints);
+
+ //Setup the FlexibleGrid Layout Manager with the different grids
+ FlexibleGrid[] row1 = { headerGrid };
+ FlexibleGrid[] row2 = { leftPanelGrid, mainPanelGrid };
+ FlexibleGridLayoutManager layoutManager = new FlexibleGridLayoutManager();
+ layoutManager.addRowOfGrids(row1);
+ layoutManager.addRowOfGrids(row2);
+
+ //Populate the grid windows with proper content
+ List windows = pageResult.getWindows();
+ int counter = 0;
+ for(Iterator itr=windows.iterator();itr.hasNext();)
+ {
+ Window result = (Window)itr.next();
+
+ switch(counter)
+ {
+ case 0:
+ leftPanelWindow1.setContent(result.getContent());
+ break;
+
+ case 1:
+ leftPanelWindow2.setContent(result.getContent());
+ break;
+
+ case 2:
+ mainPanelWindow.setContent(result.getContent());
+ break;
+
+ case 3:
+ menuWindow.setContent(result.getContent());
+ break;
+
+ case 4:
+ headerTabsWindow.setContent(result.getContent());
+ break;
+ }
+
+ counter++;
+ }
+
+ return new Object[]{page, layoutManager};
+ }
+
+
+ /**
+ *
+ * @param containerId
+ * @param rows
+ * @param columns
+ * @return
+ */
+ private FlexibleGrid getGrid(String containerId,int rows, int columns)
+ {
+ FlexibleGrid grid = new FlexibleGrid(containerId);
+ grid.setRows(rows);
+ grid.setColumns(columns);
+ return grid;
+ }
+
+ /**
+ *
+ * @param componentId
+ * @param widthPercentage
+ * @param top
+ * @param bottom
+ * @param left
+ * @param right
+ */
+ private FlexibleGridConstraints getConstraints(String componentId, String widthPercentage, int top, int bottom, int left, int right, int row, int column)
+ {
+ FlexibleGridConstraints constraints = new FlexibleGridConstraints();
+ constraints.setComponentId(componentId);
+ constraints.setWidthPercentage(widthPercentage);
+ constraints.setRow(row);
+ constraints.setColumn(column);
+ constraints.setTop(top);
+ constraints.setBottom(bottom);
+ constraints.setLeft(left);
+ constraints.setRight(right);
+ return constraints;
+ }
+
+ /**
+ *
+ * @param pageResult
+ * @return
+ */
+ private Object[] getRegionBasedLayoutManager(Page pageResult)
+ {
+ Page page = new Page();
+ Container left = new Container("left");
+ Container center = new Container("center");
+ page.addContainer(left);
+ page.addContainer(center);
+
+ //Populate the grid windows with proper content
+ List windows = pageResult.getWindows();
+ int counter = 0;
+ for(Iterator itr=windows.iterator();itr.hasNext();)
+ {
+ Window result = (Window)itr.next();
+ Window uiWindow = new Window(result.getId());
+ uiWindow.setContent(result.getContent());
+ switch(counter)
+ {
+ case 0:
+ left.addComponent(uiWindow);
+ break;
+
+ case 1:
+ left.addComponent(uiWindow);
+ break;
+
+ case 2:
+ center.addComponent(uiWindow);
+ break;
+
+ case 3:
+ center.addComponent(uiWindow);
+ break;
+
+ case 4:
+ left.addComponent(uiWindow);
+ break;
+ }
+
+ counter++;
+ }
+
+ RegionLayoutManager layoutManager = new RegionLayoutManager();
+ RegionConstraints leftConstraints = new RegionConstraints("left", RegionConstraints.LEFT);
+ RegionConstraints centerConstraints = new RegionConstraints("center", RegionConstraints.CENTER);
+ layoutManager.addRegionConstraints(leftConstraints);
+ layoutManager.addRegionConstraints(centerConstraints);
+
+ return new Object[]{page, layoutManager};
+ }
}
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortletServiceImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortletServiceImpl.java 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/PortletServiceImpl.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -1,224 +0,0 @@
-package org.jboss.portal.uiserver.service;
-
-import java.io.InputStream;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.jboss.portal.uiserver.ajax.client.PortletService;
-import org.jboss.portal.uiserver.ajax.client.Page;
-import org.jboss.portal.uiserver.ajax.client.Window;
-
-import com.google.gwt.user.server.rpc.RemoteServiceServlet;
-
-/**
- * This is just a STUB server side component to test the client side components of the GWT-based AJAX UI
- *
- * In real implementation this functionality will be provided by the UIServer interfacing with the Portal Core
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class PortletServiceImpl extends RemoteServiceServlet implements PortletService
-{
-
- /**
- *
- */
- public String getPortlet(String portletId)
- {
- String portletContent = null;
-
- String contentPath = portletId;
- InputStream is = null;
- try
- {
- is = Thread.currentThread().getContextClassLoader().getResourceAsStream(contentPath);
- StringBuffer contentBuffer = new StringBuffer();
- int bytesRead = 0;
- byte[] data = new byte[1024];
- while((bytesRead=is.read(data)) != -1)
- {
- byte[] cour = new byte[bytesRead];
- System.arraycopy(data, 0, cour, 0, bytesRead);
- contentBuffer.append(new String(cour));
- }
- portletContent = contentBuffer.toString();
- }
- catch(Exception e)
- {
- throw new RuntimeException(e);
- }
- finally
- {
- if(is != null)
- {
- try{is.close();}catch(Exception e){}
- }
- }
-
- return portletContent;
- }
-
- /**
- *
- * @param pageId
- * @return
- */
- public Page getPage(String pageId)
- {
- Page page = new Page();
- page.name = pageId;
-
- if(pageId.equals("index") || pageId.equals("Page 1"))
- {
- String weatherContent = this.getPortlet("weatherPortlet.html");
- String cmsContent = this.getPortlet("cmsPortlet.html");
- Window[] windows = new Window[2];
- page.windows = windows;
-
-
- Window weatherWindow = new Window();
- weatherWindow.name = "weatherPortlet";
- weatherWindow.content = weatherContent;
-
- Window cmsWindow = new Window();
- cmsWindow.name = "cmsPortlet";
- cmsWindow.content = cmsContent;
-
- windows[0] = weatherWindow;
- windows[1] = cmsWindow;
- }
- else if(pageId.equals("Page 2"))
- {
- String weatherContent = this.getPortlet("weatherPortlet.html");
- Window[] windows = new Window[1];
- page.windows = windows;
-
-
- Window weatherWindow = new Window();
- weatherWindow.name = "weatherPortlet";
- weatherWindow.content = weatherContent;
-
- windows[0] = weatherWindow;
- }
- else if(pageId.equals("Page 3"))
- {
- String cmsContent = this.getPortlet("cmsPortlet.html");
- Window[] windows = new Window[1];
- page.windows = windows;
-
- Window cmsWindow = new Window();
- cmsWindow.name = "cmsPortlet";
- cmsWindow.content = cmsContent;
-
- windows[0] = cmsWindow;
- }
-
- HttpServletRequest request = this.getThreadLocalRequest();
- request.getSession().setAttribute("currentPage", page);
-
- return page;
- }
-
- /**
- *
- * @param window
- * @param state
- */
- public Page setState(String window, String newState)
- {
- HttpServletRequest request = this.getThreadLocalRequest();
- Page page = (Page)request.getSession().getAttribute("currentPage");
-
- Window selectedWindow = this.findWindow(page, window);
- selectedWindow.state = newState;
- if(selectedWindow.state.equals(Window.NORMAL))
- {
- if(selectedWindow.name.equals("cmsPortlet"))
- {
- selectedWindow.content = this.getPortlet("cmsPortlet.html");
- }
- else
- {
- selectedWindow.content = this.getPortlet("weatherPortlet.html");
- }
- this.hideWindows(page.windows, null, false);
- }
- else if(selectedWindow.state.equals(Window.MINIMIZED))
- {
- selectedWindow.content = "";
- this.hideWindows(page.windows, null, false);
- }
- if(selectedWindow.state.equals(Window.MAXIMIZED))
- {
- if(selectedWindow.name.equals("cmsPortlet"))
- {
- selectedWindow.content = this.getPortlet("cmsPortlet.html");
- }
- else
- {
- selectedWindow.content = this.getPortlet("weatherPortlet.html");
- }
- this.hideWindows(page.windows, selectedWindow, true);
- }
-
- return page;
- }
-
- /**
- *
- * @param window
- * @param state
- */
- public Page setMode(String window, String newMode)
- {
- HttpServletRequest request = this.getThreadLocalRequest();
- Page page = (Page)request.getSession().getAttribute("currentPage");
-
- Window selectedWindow = this.findWindow(page, window);
- selectedWindow.mode = newMode;
-
- return page;
- }
-
- /**
- *
- * @param page
- * @param windowName
- * @return
- */
- private Window findWindow(Page page, String windowName)
- {
- Window window = null;
-
- Window[] windows = page.windows;
- for(int i=0; i<windows.length; i++)
- {
- if(windows[i].name.equals(windowName))
- {
- window = windows[i];
- break;
- }
- }
-
- return window;
- }
-
- /**
- *
- * @param excludedWindow
- * @param hide
- */
- private void hideWindows(Window[] windows, Window excludedWindow, boolean hide)
- {
- for(int i=0; i<windows.length; i++)
- {
- if(excludedWindow != null && windows[i].name.equals(excludedWindow.name))
- {
- continue;
- }
-
- windows[i].isVisible = !hide;
- }
- }
-}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -22,24 +22,11 @@
******************************************************************************/
package org.jboss.portal.uiserver.service;
-import java.io.PrintWriter;
-import java.util.Iterator;
-import java.util.List;
import java.util.StringTokenizer;
-import org.jboss.portal.uiserver.protocol.Container;
-import org.jboss.portal.uiserver.protocol.Page;
-import org.jboss.portal.uiserver.protocol.Window;
import org.jboss.portal.uiserver.protocol.PortalObject;
import org.jboss.portal.uiserver.protocol.Portal;
-import org.jboss.portal.uiserver.layout.LayoutManager;
-import org.jboss.portal.uiserver.layout.classic.FlexibleGrid;
-import org.jboss.portal.uiserver.layout.classic.FlexibleGridConstraints;
-import org.jboss.portal.uiserver.layout.classic.FlexibleGridLayoutManager;
-import org.jboss.portal.uiserver.layout.classic.RegionLayoutManager;
-import org.jboss.portal.uiserver.layout.classic.RegionConstraints;
-
import org.jboss.portal.uiserver.processor.Processor;
import org.jboss.portal.uiserver.processor.ProcessorRequest;
import org.jboss.portal.uiserver.processor.ProcessorResponse;
@@ -159,12 +146,7 @@
//Go ahead and render to the client based on ProcessorResponse received from the core Portal
if(processorResponse != null)
{
- Page displayedPage = processorResponse.findDisplayedPage();
- if(displayedPage != null)
- {
- this.render(invocation.getServerContext().getClientResponse().getWriter(),
- displayedPage);
- }
+ invocation.getServerContext().getClientRequest().setAttribute("processorResponse", processorResponse);
}
}
catch(Exception e)
@@ -206,234 +188,5 @@
public void setProcessor(Processor processor)
{
this.processor = processor;
- }
- //---------All these are just helper methods for the prototype-----------------------------------------------------------------------------------------------
- //----It containts mostly hard coded logic for the prototype-------------------------------------------------------------------------------------------------
- /**
- * Based on the latest design discussion, this method is not needed.
- *
- * This will be an implementation detail of the UIServer processing the Response that is sent back to it
- * from the Core Portal Processor
- *
- * @param clientConnection
- * @param page
- */
- private void render(PrintWriter clientConnection, Page pageResult)
- {
- /**
- * Special Note: Currently this prototype code and layout configuration including page result creation is hard coded for the purpose
- * of getting the architecture right
- *
- * In the real implementation, LayoutState would be fetched dynamically based on the Page State/Configuration being rendered
- * Even type of Client considerations would be handled here
- *
- * Basically the UIServer would delegate functions to its various components and then send back the result to the client
- *
- */
- //Some flexible grid layout testing code
- Object[] gridData = this.getFlexibleGridLayoutManager(pageResult);
- Page page = (Page)gridData[0];
- LayoutManager layoutManager = (LayoutManager)gridData[1];
-
- //Some region layout testing code
- //Object[] regionData = this.getRegionBasedLayoutManager(pageResult);
- //Page page = (Page)regionData[0];
- //LayoutManager layoutManager = (LayoutManager)regionData[1];
-
- //Peform Page Layout
- String output = layoutManager.doLayout(page);
-
-
- //Create the final output...Also hardcoded without any preprocessing/postprocessing etc
- StringBuffer buffer = new StringBuffer();
- buffer.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>JBoss Portal UIServer</title><link rel=\"stylesheet\" id=\"dyna_css\" href=\"/portal-ajax/dyna/style.css\" type=\"text/css\"/><link rel=\"stylesheet\" type=\"text/css\" id=\"main_css\" href=\"/portal-core/themes/renaissance/portal_style.css\"/><link rel=\"shortcut icon\" href=\"/portal-core/themes/renaissance/images/favicon.ico\" /><link rel=\"icon\" type=\"image/gif\" href=\"/portal-core/themes/renaissance/images/animated_favicon1.gif\" /></head><body id=\"body\">\n");
- buffer.append(output);
- buffer.append("</body></html>\n");
-
-
- //Sending the results back to the Client
- clientConnection.write(buffer.toString());
- clientConnection.flush();
- }
-
- /**
- *
- */
- private Object[] getFlexibleGridLayoutManager(Page pageResult)
- {
- /**
- * Hard coding the FlexibleGridLayout Management here
- */
- Page page = new Page();
- Container header = new Container("header");
- Container leftPanel = new Container("leftPanel");
- Container mainPanel = new Container("mainPanel");
- Window headerTabsWindow = new Window("header-tabs-window");
- Window menuWindow = new Window("menu-window");
- Window leftPanelWindow1 = new Window("left-panel-window1");
- Window leftPanelWindow2 = new Window("left-panel-window2");
- Window mainPanelWindow = new Window("main-panel-window");
- header.addComponent(headerTabsWindow);
- header.addComponent(menuWindow);
- leftPanel.addComponent(leftPanelWindow1);
- leftPanel.addComponent(leftPanelWindow2);
- mainPanel.addComponent(mainPanelWindow);
-
- //Setup the Grid for headerTabs container
- page.addContainer(header);
- FlexibleGrid headerGrid = this.getGrid("header", 1, 2);
- FlexibleGridConstraints[] headerTabConstraints = { this.getConstraints("header-tabs-window", "100", 0, 0, 10, 0, 0, 0),
- this.getConstraints("menu-window", "100", 0, 0, 0, 0, 0, 1) };
- headerGrid.setConstraints(headerTabConstraints);
-
- //Setup the Grid for left panel container
- page.addContainer(leftPanel);
- FlexibleGrid leftPanelGrid = this.getGrid("leftPanel", 2, 1);
- FlexibleGridConstraints[] leftPanelConstraints = { this.getConstraints("left-panel-window1", "75", 0, 0, 0, 0, 0, 0),
- this.getConstraints("left-panel-window2", "75", 0, 0, 0, 0, 1, 0) };
- leftPanelGrid.setConstraints(leftPanelConstraints);
-
- //Setup the Grid for main panel container
- page.addContainer(mainPanel);
- FlexibleGrid mainPanelGrid = this.getGrid("mainPanel", 1, 1);
- FlexibleGridConstraints[] mainPanelConstraints = { this.getConstraints("main-panel-window", "100", 0, 0, 0, 0, 0, 0) };
- mainPanelGrid.setConstraints(mainPanelConstraints);
-
- //Setup the FlexibleGrid Layout Manager with the different grids
- FlexibleGrid[] row1 = { headerGrid };
- FlexibleGrid[] row2 = { leftPanelGrid, mainPanelGrid };
- FlexibleGridLayoutManager layoutManager = new FlexibleGridLayoutManager();
- layoutManager.addRowOfGrids(row1);
- layoutManager.addRowOfGrids(row2);
-
- //Populate the grid windows with proper content
- List windows = pageResult.getWindows();
- int counter = 0;
- for(Iterator itr=windows.iterator();itr.hasNext();)
- {
- Window result = (Window)itr.next();
-
- switch(counter)
- {
- case 0:
- leftPanelWindow1.setContent(result.getContent());
- break;
-
- case 1:
- leftPanelWindow2.setContent(result.getContent());
- break;
-
- case 2:
- mainPanelWindow.setContent(result.getContent());
- break;
-
- case 3:
- menuWindow.setContent(result.getContent());
- break;
-
- case 4:
- headerTabsWindow.setContent(result.getContent());
- break;
- }
-
- counter++;
- }
-
- return new Object[]{page, layoutManager};
- }
-
-
- /**
- *
- * @param containerId
- * @param rows
- * @param columns
- * @return
- */
- private FlexibleGrid getGrid(String containerId,int rows, int columns)
- {
- FlexibleGrid grid = new FlexibleGrid(containerId);
- grid.setRows(rows);
- grid.setColumns(columns);
- return grid;
- }
-
- /**
- *
- * @param componentId
- * @param widthPercentage
- * @param top
- * @param bottom
- * @param left
- * @param right
- */
- private FlexibleGridConstraints getConstraints(String componentId, String widthPercentage, int top, int bottom, int left, int right, int row, int column)
- {
- FlexibleGridConstraints constraints = new FlexibleGridConstraints();
- constraints.setComponentId(componentId);
- constraints.setWidthPercentage(widthPercentage);
- constraints.setRow(row);
- constraints.setColumn(column);
- constraints.setTop(top);
- constraints.setBottom(bottom);
- constraints.setLeft(left);
- constraints.setRight(right);
- return constraints;
- }
-
- /**
- *
- * @param pageResult
- * @return
- */
- private Object[] getRegionBasedLayoutManager(Page pageResult)
- {
- Page page = new Page();
- Container left = new Container("left");
- Container center = new Container("center");
- page.addContainer(left);
- page.addContainer(center);
-
- //Populate the grid windows with proper content
- List windows = pageResult.getWindows();
- int counter = 0;
- for(Iterator itr=windows.iterator();itr.hasNext();)
- {
- Window result = (Window)itr.next();
- Window uiWindow = new Window(result.getId());
- uiWindow.setContent(result.getContent());
- switch(counter)
- {
- case 0:
- left.addComponent(uiWindow);
- break;
-
- case 1:
- left.addComponent(uiWindow);
- break;
-
- case 2:
- center.addComponent(uiWindow);
- break;
-
- case 3:
- center.addComponent(uiWindow);
- break;
-
- case 4:
- left.addComponent(uiWindow);
- break;
- }
-
- counter++;
- }
-
- RegionLayoutManager layoutManager = new RegionLayoutManager();
- RegionConstraints leftConstraints = new RegionConstraints("left", RegionConstraints.LEFT);
- RegionConstraints centerConstraints = new RegionConstraints("center", RegionConstraints.CENTER);
- layoutManager.addRegionConstraints(leftConstraints);
- layoutManager.addRegionConstraints(centerConstraints);
-
- return new Object[]{page, layoutManager};
- }
+ }
}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/HostedModeProxy.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/HostedModeProxy.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/HostedModeProxy.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -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.uiserver.service.ajax;
+
+import java.io.ByteArrayInputStream;
+
+import javax.servlet.http.HttpServletRequest;
+
+import com.google.gwt.user.client.rpc.SerializationException;
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+
+import com.meterware.httpunit.WebConversation;
+import com.meterware.httpunit.PostMethodWebRequest;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+
+/**
+ * This is a RPC Proxy Service that is used only during development. This lets the GWT client integrate with the Portal server while running in
+ * Hosted Mode. It is very efficient to debug/develop client side GWT code in Hosted Mode.
+ *
+ * This service is never deployed in a production setting and Portal components *do not* have any compile time or run time dependency on this Proxy.
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class HostedModeProxy extends RemoteServiceServlet
+{
+ /**
+ *
+ */
+ public String processCall(String input) throws SerializationException
+ {
+ try
+ {
+ String response = null;
+
+ HttpServletRequest request = this.getThreadLocalRequest();
+
+ //Setup the conversation with the portal server
+ WebConversation wc = null;
+ if(request.getSession().getAttribute("conversation") != null)
+ {
+ wc = (WebConversation)request.getSession().getAttribute("conversation");
+ }
+ else
+ {
+ wc = new WebConversation();
+ request.getSession().setAttribute("conversation", wc);
+ }
+
+ //Proxy this rpc request over to the Portal server
+ WebRequest post = new PostMethodWebRequest(
+ "http://localhost:8080/portal-uiserver/portalrpc",
+ new ByteArrayInputStream(input.getBytes()),
+ "text/plain; charset=utf-8"
+ );
+ WebResponse webResponse = wc.getResponse(post);
+ response = webResponse.getText();
+
+ return response;
+ }
+ catch(Exception e)
+ {
+ throw new SerializationException(e);
+ }
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalRPCImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalRPCImpl.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalRPCImpl.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -0,0 +1,224 @@
+package org.jboss.portal.uiserver.service.ajax;
+
+
+import java.util.Map;
+import java.util.List;
+import java.util.HashMap;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import javax.servlet.ServletException;
+import javax.servlet.UnavailableException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanServerLocator;
+
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.server.RequestControllerFactory;
+import org.jboss.portal.server.Server;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.impl.ServerInvocationContextImpl;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.server.ServerRequest;
+import org.jboss.portal.server.ServerResponse;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.RequestControllerDispatcher;
+
+import org.jboss.portal.uiserver.ajax.client.service.PortalRPC;
+import org.jboss.portal.uiserver.ajax.client.Page;
+import org.jboss.portal.uiserver.ajax.client.Window;
+import org.jboss.portal.uiserver.processor.ProcessorResponse;
+import org.jboss.portal.uiserver.service.EntryPoint;
+
+import com.google.gwt.user.client.rpc.SerializationException;
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+
+/**
+ * This serves as the Portal Entry Point for AJAX (Asynchronous) RPC calls being made by the
+ * Ajax client of the Portal
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PortalRPCImpl extends RemoteServiceServlet implements
+PortalRPC
+{
+ /** The logger. */
+ private Logger log = Logger.getLogger(getClass());
+
+ /**
+ *
+ */
+ private EntryPoint entryPoint = null;
+
+ /** Configure the as default servlet. */
+ public void init() throws ServletException
+ {
+ try
+ {
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+ this.entryPoint = (EntryPoint) MBeanProxy.get(EntryPoint.class, new ObjectName(
+ this.getInitParameter("entryPointServiceName")),
+ mbeanServer);
+ }
+ catch (Exception e)
+ {
+ this.entryPoint = null;
+ String msg = "Portal Entry Point could not be created";
+ log.error(msg, e);
+ throw new UnavailableException(msg);
+ }
+ }
+
+ /**
+ *
+ */
+ public String processCall(String payload) throws SerializationException
+ {
+ HttpServletRequest request = this.getThreadLocalRequest();
+
+ //Perform the remote procedure call
+ String returnVal = super.processCall(payload);
+
+ //Perform any post-processing after calling the actual remote method that will perform
+ //the functionality for this particular remote procedure call
+ if(request.getAttribute("processorResponse") != null)
+ {
+ ProcessorResponse processorResponse = (ProcessorResponse)request.getAttribute("processorResponse");
+ request.getSession().setAttribute("processorResponse", processorResponse);
+ }
+
+ return returnVal;
+ }
+ // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Loads the initial Portal Page at the start of a Portal session
+ *
+ * @return The Initial Portal Page
+ */
+ public Page loadPortal()
+ {
+ try
+ {
+ Page display = null;
+ HttpServletRequest request = this.getThreadLocalRequest();
+ this.callPortalServer();
+ display = this.getDisplay((ProcessorResponse)request.getAttribute("processorResponse"));
+ return display;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * @return The Page of the Portal that should be currently displayed
+ */
+ public Page getCurrentPage()
+ {
+ Page currentPage = null;
+
+ HttpServletRequest request = this.getThreadLocalRequest();
+
+ ProcessorResponse processorResponse = (ProcessorResponse) request.getSession().getAttribute("processorResponse");
+
+ currentPage = this.getDisplay(processorResponse);
+
+ return currentPage;
+ }
+
+ /**
+ *
+ * @param processorResponse
+ * @return
+ */
+ private Page getDisplay(ProcessorResponse processorResponse)
+ {
+ Page display = null;
+
+ org.jboss.portal.uiserver.protocol.Page portalPage = processorResponse
+ .findDisplayedPage();
+
+ // Construct the ajax currentPage object from the portalPage that has been
+ // chosen to be displayed
+ if (portalPage != null)
+ {
+ display = new Page();
+ display.setName(portalPage.getName());
+ List pageWindows = portalPage.getWindows();
+ if(pageWindows != null && pageWindows.size()>0)
+ {
+ Window[] windows = new Window[pageWindows.size()];
+ display.setWindows(windows);
+ for(int i=0; i<pageWindows.size(); i++)
+ {
+ org.jboss.portal.uiserver.protocol.Window pageWindow = (org.jboss.portal.uiserver.protocol.Window)pageWindows.get(i);
+ Window window = new Window();
+ window.setName(pageWindow.getName());
+ window.setContent(pageWindow.getContent());
+ windows[i] = window;
+ }
+ }
+ }
+
+ return display;
+ }
+
+ /**
+ *
+ *
+ */
+ private void callPortalServer() throws Exception
+ {
+ HttpServletRequest req = this.getThreadLocalRequest();
+ HttpServletResponse resp = this.getThreadLocalResponse();
+ String requestURI = req.getRequestURI();
+ String contextPath = req.getContextPath();
+ String portalHost = req.getServerName();
+ String portalRequestPath = requestURI.substring(contextPath.length());
+ String portalContextPath = requestURI.substring(0, contextPath.length());
+ Map queryParameterMap = new HashMap();
+ URLContext urlContext = URLContext.newInstance(req.isSecure(), req.getRemoteUser() != null);
+
+ Server server = this.entryPoint.getPortalServer();
+
+ //
+ ServerInvocationContext invocationCtx = new ServerInvocationContextImpl(
+ req,
+ resp,
+ portalHost,
+ portalRequestPath,
+ portalContextPath,
+ queryParameterMap,
+ null, //body parameter map is not applicable for asynchronous RPC calls
+ urlContext,
+ null //media type information is not applicable for asynchronous RPC calls
+ );
+
+ //
+ ServerRequest request = new ServerRequest(invocationCtx);
+ request.setServer(server);
+
+ //
+ ServerResponse response = new ServerResponse(request, invocationCtx);
+
+ //
+ ServerInvocation invocation = new ServerInvocation(invocationCtx);
+ invocation.setRequest(request);
+ invocation.setResponse(response);
+
+ //
+ RequestControllerFactory controllerFactory = this.entryPoint.getControllerFactory();
+ RequestController controller = controllerFactory.createRequestController(invocation);
+ invocation.setHandler(new RequestControllerDispatcher(controller));
+
+ InterceptorStackFactory stack = this.entryPoint.getInterceptorStackFactory();
+ invocation.invoke(stack.getInterceptorStack());
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortletServiceImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortletServiceImpl.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortletServiceImpl.java 2007-11-06 07:18:27 UTC (rev 8829)
@@ -0,0 +1,233 @@
+package org.jboss.portal.uiserver.service.ajax;
+
+import java.io.InputStream;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.jboss.portal.uiserver.ajax.client.PortletService;
+import org.jboss.portal.uiserver.ajax.client.Page;
+import org.jboss.portal.uiserver.ajax.client.Window;
+
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+
+/**
+ * This is just a STUB server side component to test the client side components
+ * of the GWT-based AJAX UI
+ *
+ * In real implementation this functionality will be provided by the UIServer
+ * interfacing with the Portal Core
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PortletServiceImpl extends RemoteServiceServlet implements
+ PortletService
+{
+ /**
+ *
+ */
+ public String getPortlet(String portletId)
+ {
+ String portletContent = null;
+
+ String contentPath = portletId;
+ InputStream is = null;
+ try
+ {
+ is = Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream(contentPath);
+ StringBuffer contentBuffer = new StringBuffer();
+ int bytesRead = 0;
+ byte[] data = new byte[1024];
+ while ((bytesRead = is.read(data)) != -1)
+ {
+ byte[] cour = new byte[bytesRead];
+ System.arraycopy(data, 0, cour, 0, bytesRead);
+ contentBuffer.append(new String(cour));
+ }
+ portletContent = contentBuffer.toString();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ if (is != null)
+ {
+ try
+ {
+ is.close();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ }
+
+ return portletContent;
+ }
+
+ /**
+ *
+ * @param pageId
+ * @return
+ */
+ public Page getPage(String pageId)
+ {
+ Page page = new Page();
+ page.setName(pageId);
+
+ if (pageId.equals("index") || pageId.equals("Page 1"))
+ {
+ String weatherContent = this.getPortlet("weatherPortlet.html");
+ String cmsContent = this.getPortlet("cmsPortlet.html");
+ Window[] windows = new Window[2];
+ page.setWindows(windows);
+
+ Window weatherWindow = new Window();
+ weatherWindow.setName("weatherPortlet");
+ weatherWindow.setContent(weatherContent);
+
+ Window cmsWindow = new Window();
+ cmsWindow.setName("cmsPortlet");
+ cmsWindow.setContent(cmsContent);
+
+ windows[0] = weatherWindow;
+ windows[1] = cmsWindow;
+ }
+ else if (pageId.equals("Page 2"))
+ {
+ String weatherContent = this.getPortlet("weatherPortlet.html");
+ Window[] windows = new Window[1];
+ page.setWindows(windows);
+
+ Window weatherWindow = new Window();
+ weatherWindow.setName("weatherPortlet");
+ weatherWindow.setContent(weatherContent);
+
+ windows[0] = weatherWindow;
+ }
+ else if (pageId.equals("Page 3"))
+ {
+ String cmsContent = this.getPortlet("cmsPortlet.html");
+ Window[] windows = new Window[1];
+ page.setWindows(windows);
+
+ Window cmsWindow = new Window();
+ cmsWindow.setName("cmsPortlet");
+ cmsWindow.setContent(cmsContent);
+
+ windows[0] = cmsWindow;
+ }
+
+ HttpServletRequest request = this.getThreadLocalRequest();
+ request.getSession().setAttribute("currentPage", page);
+
+ return page;
+ }
+
+ /**
+ *
+ * @param window
+ * @param state
+ */
+ public Page setState(String window, String newState)
+ {
+ HttpServletRequest request = this.getThreadLocalRequest();
+ Page page = (Page) request.getSession().getAttribute("currentPage");
+
+ Window selectedWindow = this.findWindow(page, window);
+ selectedWindow.setState(newState);
+ if (selectedWindow.getState().equals(Window.NORMAL))
+ {
+ if (selectedWindow.getName().equals("cmsPortlet"))
+ {
+ selectedWindow.setContent(this.getPortlet("cmsPortlet.html"));
+ }
+ else
+ {
+ selectedWindow.setContent(this.getPortlet("weatherPortlet.html"));
+ }
+ this.hideWindows(page.getWindows(), null, false);
+ }
+ else if (selectedWindow.getState().equals(Window.MINIMIZED))
+ {
+ selectedWindow.setContent("");
+ this.hideWindows(page.getWindows(), null, false);
+ }
+ if (selectedWindow.getState().equals(Window.MAXIMIZED))
+ {
+ if (selectedWindow.getName().equals("cmsPortlet"))
+ {
+ selectedWindow.setContent(this.getPortlet("cmsPortlet.html"));
+ }
+ else
+ {
+ selectedWindow.setContent(this.getPortlet("weatherPortlet.html"));
+ }
+ this.hideWindows(page.getWindows(), selectedWindow, true);
+ }
+
+ return page;
+ }
+
+ /**
+ *
+ * @param window
+ * @param state
+ */
+ public Page setMode(String window, String newMode)
+ {
+ HttpServletRequest request = this.getThreadLocalRequest();
+ Page page = (Page) request.getSession().getAttribute("currentPage");
+
+ Window selectedWindow = this.findWindow(page, window);
+ selectedWindow.setMode(newMode);
+
+ return page;
+ }
+
+ /**
+ *
+ * @param page
+ * @param windowName
+ * @return
+ */
+ private Window findWindow(Page page, String windowName)
+ {
+ Window window = null;
+
+ Window[] windows = page.getWindows();
+ for (int i = 0; i < windows.length; i++)
+ {
+ if (windows[i].getName().equals(windowName))
+ {
+ window = windows[i];
+ break;
+ }
+ }
+
+ return window;
+ }
+
+ /**
+ *
+ * @param excludedWindow
+ * @param hide
+ */
+ private void hideWindows(Window[] windows, Window excludedWindow,
+ boolean hide)
+ {
+ for (int i = 0; i < windows.length; i++)
+ {
+ if (excludedWindow != null
+ && windows[i].getName().equals(excludedWindow.getName()))
+ {
+ continue;
+ }
+
+ windows[i].setVisible(!hide);
+ }
+ }
+}
Modified: branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/AsyncPages.gwt.xml
===================================================================
--- branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/AsyncPages.gwt.xml 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/AsyncPages.gwt.xml 2007-11-06 07:18:27 UTC (rev 8829)
@@ -6,5 +6,5 @@
<entry-point class="org.jboss.portal.uiserver.ajax.client.AsyncPages"/>
<!-- RPC related configuration -->
- <servlet path="/portletService" class="org.jboss.portal.uiserver.service.PortletServiceImpl"/>
+ <servlet path="/portletService" class="org.jboss.portal.uiserver.service.ajax.PortletServiceImpl"/>
</module>
Modified: branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/PartialRefresh.gwt.xml
===================================================================
--- branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/PartialRefresh.gwt.xml 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/PartialRefresh.gwt.xml 2007-11-06 07:18:27 UTC (rev 8829)
@@ -6,5 +6,5 @@
<entry-point class="org.jboss.portal.uiserver.ajax.client.PartialRefresh"/>
<!-- RPC related configuration -->
- <servlet path="/portletService" class="org.jboss.portal.uiserver.service.PortletServiceImpl"/>
+ <servlet path="/portletService" class="org.jboss.portal.uiserver.service.ajax.PortletServiceImpl"/>
</module>
Modified: branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/Portal.gwt.xml
===================================================================
--- branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/Portal.gwt.xml 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/Portal.gwt.xml 2007-11-06 07:18:27 UTC (rev 8829)
@@ -5,6 +5,6 @@
<!-- Specify the app entry point class -->
<entry-point class="org.jboss.portal.uiserver.ajax.client.Portal"/>
- <!-- RPC related configuration -->
- <servlet path="/portletService" class="org.jboss.portal.uiserver.service.PortletServiceImpl"/>
+ <!-- RPC related configuration. This is used only in Hosted Mode -->
+ <servlet path="/portalrpc" class="org.jboss.portal.uiserver.service.ajax.HostedModeProxy"/>
</module>
Modified: branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/PortalLayout.gwt.xml
===================================================================
--- branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/PortalLayout.gwt.xml 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/PortalLayout.gwt.xml 2007-11-06 07:18:27 UTC (rev 8829)
@@ -6,5 +6,5 @@
<entry-point class="org.jboss.portal.uiserver.ajax.client.PortalLayout"/>
<!-- RPC related configuration -->
- <servlet path="/portletService" class="org.jboss.portal.uiserver.service.PortletServiceImpl"/>
+ <servlet path="/portletService" class="org.jboss.portal.uiserver.service.ajax.PortletServiceImpl"/>
</module>
Modified: branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/public/index.html
===================================================================
--- branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/public/index.html 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/resources/client/ajax/src/org/jboss/portal/uiserver/ajax/public/index.html 2007-11-06 07:18:27 UTC (rev 8829)
@@ -30,13 +30,10 @@
<!-- AJAX Client for Portal Proof of Concept -->
<p>
- Asynchronous Page Management
+ JBoss Portal
</p>
- <table align="center">
+ <table align="center">
<tr>
- <td id="pageNavigator"></td>
- </tr>
- <tr>
<td id="currentPage"></td>
</tr>
</table>
Modified: branches/UIServer/uiserver/src/resources/portal-uiserver.sar/META-INF/jboss-service.xml
===================================================================
--- branches/UIServer/uiserver/src/resources/portal-uiserver.sar/META-INF/jboss-service.xml 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/resources/portal-uiserver.sar/META-INF/jboss-service.xml 2007-11-06 07:18:27 UTC (rev 8829)
@@ -42,4 +42,14 @@
<depends>portal:service=ResponseHandler,type=Selector</depends>
<depends>portal:service=ControlPolicy,type=Page</depends>
</mbean>
+ <mbean
+ code="org.jboss.portal.uiserver.service.EntryPointImpl"
+ name="portal:service=EntryPoint"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends optional-attribute-name="InterceptorStackFactory" proxy-type="attribute">portal:service=InterceptorStackFactory,type=Server</depends>
+ <depends optional-attribute-name="ControllerFactory" proxy-type="attribute">portal:service=ControllerFactory</depends>
+ <depends optional-attribute-name="PortalServer" proxy-type="attribute">portal:service=Server</depends>
+ </mbean>
</server>
Modified: branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml
===================================================================
--- branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml 2007-11-05 18:18:18 UTC (rev 8828)
+++ branches/UIServer/uiserver/src/resources/portal-uiserver.war/WEB-INF/web.xml 2007-11-06 07:18:27 UTC (rev 8829)
@@ -35,8 +35,8 @@
<filter-name>GWTClientFilter</filter-name>
<servlet-name>PortalEntryPoint</servlet-name>
</filter-mapping>
-
+
<!-- The portal servlet is the main entrance point -->
<servlet>
<servlet-name>PortalEntryPoint</servlet-name>
@@ -47,64 +47,48 @@
<description>The servlet needs to know wether it is set as a default servlet or not</description>
</init-param>
<init-param>
- <param-name>controllerFactoryName</param-name>
- <param-value>portal:service=ControllerFactory</param-value>
- <description>The request controller factory for the portal servlet</description>
+ <param-name>entryPointServiceName</param-name>
+ <param-value>portal:service=EntryPoint</param-value>
+ <description>Entry Point Service</description>
</init-param>
- <load-on-startup>0</load-on-startup>
- <security-role-ref>
- <role-name>Authenticated</role-name>
- <role-link>Authenticated</role-link>
- </security-role-ref>
- </servlet>
-
+ <load-on-startup>0</load-on-startup>
+ </servlet>
<servlet-mapping>
<servlet-name>PortalEntryPoint</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
-
<servlet-mapping>
<servlet-name>PortalEntryPoint</servlet-name>
<url-pattern>/sec/*</url-pattern>
</servlet-mapping>
-
<servlet-mapping>
<servlet-name>PortalEntryPoint</servlet-name>
<url-pattern>/auth/*</url-pattern>
</servlet-mapping>
-
<servlet-mapping>
<servlet-name>PortalEntryPoint</servlet-name>
<url-pattern>/authsec/*</url-pattern>
</servlet-mapping>
-
- <!-- GWT Prototyping only -->
+
+
+ <!-- Asynchronous service request processor -->
<servlet>
- <servlet-name>PortletService</servlet-name>
- <servlet-class>org.jboss.portal.uiserver.service.PortletServiceImpl</servlet-class>
+ <servlet-name>PortalRPC</servlet-name>
+ <servlet-class>org.jboss.portal.uiserver.service.ajax.PortalRPCImpl</servlet-class>
+ <init-param>
+ <param-name>asDefaultServlet</param-name>
+ <param-value>false</param-value>
+ <description>The servlet needs to know wether it is set as a default servlet or not</description>
+ </init-param>
+ <init-param>
+ <param-name>entryPointServiceName</param-name>
+ <param-value>portal:service=EntryPoint</param-value>
+ <description>Entry Point Service</description>
+ </init-param>
<load-on-startup>0</load-on-startup>
- </servlet>
-
+ </servlet>
<servlet-mapping>
- <servlet-name>PortletService</servlet-name>
- <url-pattern>/portletService/*</url-pattern>
- </servlet-mapping>
-
- <!-- these are only for standalone prototype testing...this is not integrated with portal -->
- <!--
- <servlet-mapping>
- <servlet-name>PortletService</servlet-name>
- <url-pattern>/org.jboss.portal.uiserver.ajax.PortalLayout/portletService/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>PortletService</servlet-name>
- <url-pattern>/org.jboss.portal.uiserver.ajax.PartialRefresh/portletService/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>PortletService</servlet-name>
- <url-pattern>/org.jboss.portal.uiserver.ajax.AsyncPages/portletService/*</url-pattern>
- </servlet-mapping>
- -->
+ <servlet-name>PortalRPC</servlet-name>
+ <url-pattern>/portalrpc/*</url-pattern>
+ </servlet-mapping>
</web-app>
16 years, 11 months
JBoss Portal SVN: r8828 - in branches/JBoss_Portal_2_6_2_SecurityPatch: jems/src/main/org/jboss/portal/jems/hibernate and 1 other directory.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-11-05 13:18:18 -0500 (Mon, 05 Nov 2007)
New Revision: 8828
Modified:
branches/JBoss_Portal_2_6_2_SecurityPatch/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
branches/JBoss_Portal_2_6_2_SecurityPatch/jems/src/main/org/jboss/portal/jems/hibernate/JMXTreeCacheProvider.java
Log:
added support for optmistic hibernate cache
Modified: branches/JBoss_Portal_2_6_2_SecurityPatch/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_2_6_2_SecurityPatch/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-11-05 11:26:07 UTC (rev 8827)
+++ branches/JBoss_Portal_2_6_2_SecurityPatch/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-11-05 18:18:18 UTC (rev 8828)
@@ -450,6 +450,10 @@
<depends>jboss:service=Naming</depends>
<depends>jboss:service=TransactionManager</depends>
<attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
+ <!-- Uncomment for using an Optimistic Hibernate Cache with Portal running on AS 4.2.1 -->
+ <!--
+ <attribute name="NodeLockingScheme">OPTIMISTIC</attribute>
+ -->
<attribute name="IsolationLevel">REPEATABLE_READ</attribute>
<attribute name="CacheMode">REPL_SYNC</attribute>
<attribute name="ClusterName">portal.hibernate</attribute>
Modified: branches/JBoss_Portal_2_6_2_SecurityPatch/jems/src/main/org/jboss/portal/jems/hibernate/JMXTreeCacheProvider.java
===================================================================
--- branches/JBoss_Portal_2_6_2_SecurityPatch/jems/src/main/org/jboss/portal/jems/hibernate/JMXTreeCacheProvider.java 2007-11-05 11:26:07 UTC (rev 8827)
+++ branches/JBoss_Portal_2_6_2_SecurityPatch/jems/src/main/org/jboss/portal/jems/hibernate/JMXTreeCacheProvider.java 2007-11-05 18:18:18 UTC (rev 8828)
@@ -27,6 +27,7 @@
import org.hibernate.cache.CacheException;
import org.hibernate.cache.CacheProvider;
import org.hibernate.cache.TreeCache;
+import org.hibernate.cache.OptimisticTreeCache;
import org.jboss.mx.util.MBeanProxy;
import org.jboss.mx.util.MBeanServerLocator;
@@ -63,7 +64,21 @@
MBeanServer server = MBeanServerLocator.locateJBoss();
TreeCacheProvider provider = (TreeCacheProvider)MBeanProxy.get(TreeCacheProvider.class, providerName, server);
org.jboss.cache.TreeCache cache = provider.getTreeCache();
- return new TreeCache(cache, regionName, cache.getTransactionManager());
+
+ //Select the proper type of hibernate cache to be used
+ Cache hibernateCache = null;
+ if(cache.getNodeLockingScheme().equalsIgnoreCase("OPTIMISTIC"))
+ {
+ log.debug("Selecting Optimistic Cache");
+ hibernateCache = new OptimisticTreeCache(cache, regionName);
+ }
+ else
+ {
+ log.debug("Selecting regular Tree Cache");
+ hibernateCache = new TreeCache(cache, regionName, cache.getTransactionManager());
+ }
+
+ return hibernateCache;
}
catch (Exception e)
{
16 years, 11 months
JBoss Portal SVN: r8827 - modules/identity/branches.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-11-05 06:26:07 -0500 (Mon, 05 Nov 2007)
New Revision: 8827
Added:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0/
Log:
make JBP_IDENTITY_BRANCH_1_0_0 for based on 1.0 tag for identity module
Copied: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0_0 (from rev 8826, modules/identity/tags/JBP_IDENTITY_1_0_0)
16 years, 11 months