[jboss-svn-commits] JBoss Portal SVN: r5502 - in trunk/wsrp: . src/main/org/jboss/portal/test/wsrp src/main/org/jboss/portal/test/wsrp/deployment src/main/org/jboss/portal/test/wsrp/framework src/main/org/jboss/portal/test/wsrp/framework/support src/main/org/jboss/portal/test/wsrp/portlet src/main/org/jboss/portal/test/wsrp/v1/consumer src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors src/main/org/jboss/portal/test/wsrp/v1/producer
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Oct 25 19:22:13 EDT 2006
Author: chris.laprun at jboss.com
Date: 2006-10-25 19:22:04 -0400 (Wed, 25 Oct 2006)
New Revision: 5502
Added:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ListBehaviorSequence.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/PortletManagementBehavior.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/RegistrationBehavior.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ServiceDescriptionBehavior.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/SingleBehaviorSequence.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestBehaviorSequence.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicServiceDescriptionBehavior.java
Modified:
trunk/wsrp/build.xml
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPBaseTest.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPConsumerBaseTest.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPProducerBaseTest.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPTestRunner.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPTestRunnerServlet.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/MarkupBehavior.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/ServiceObjectFactory.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/DispatcherPortlet.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/GetLocalesPortlet.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/ConsumerTestRunner.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/NeedPortletHandleTest.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ProducerTestRunner.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
Log:
Improvements to the WSRP test framework:
- Added support for service description, registration and portlet management.
- Added Behavior sequence concept to allow for the producer to use a sequence of behaviors.
- Several other fixes.
Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/build.xml 2006-10-25 23:22:04 UTC (rev 5502)
@@ -358,7 +358,8 @@
</target>
- <target name="package-consumer-test" description="Generates the consumer test artifacts" depends="package-test-runner,compile">
+ <target name="package-consumer-test" description="Generates the consumer test artifacts"
+ depends="package-test-runner,compile">
<jar jarfile="${build.lib.test}/test-wsrp-consumer-client.jar">
<fileset dir="${build.resources.test}/test-wsrp-consumer-client"/>
</jar>
@@ -530,17 +531,12 @@
<execute-tests>
<x-test>
<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.v1.producer.ProducerTestRunner"/>
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.v1.producer.PortletManagementTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.v1.producer.MarkupTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.v1.producer.ServiceDescriptionTestCase"/>-->
-
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.v1.producer.RegistrationTestCase"/>-->
</x-test>
<x-sysproperty>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=NONE"/>
- <!--<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"/>-->
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"/>
<sysproperty key="test.root" value="${build.lib}/tests"/>
</x-sysproperty>
<x-classpath>
@@ -560,14 +556,12 @@
<execute-tests>
<x-test>
<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.v1.consumer.ConsumerTestRunner"/>
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.v1.consumer.MarkupTestCase"/>-->
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.v1.consumer.ServiceDescriptionTestCase"/>-->
</x-test>
<x-sysproperty>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=NONE"/>
- <!--<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"/>-->
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"/>
<sysproperty key="test.root" value="${build.lib}/tests"/>
</x-sysproperty>
<x-classpath>
@@ -592,7 +586,7 @@
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=NONE"/>
- <!--<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"/>-->
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"/>
<sysproperty key="test.root" value="${build.lib}/tests"/>
</x-sysproperty>
<x-classpath>
@@ -615,6 +609,10 @@
<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.handler.RequestHeaderClientHandlerTestCase"/>
</x-test>
<x-sysproperty>
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xnoagent"/>
+ <jvmarg value="-Djava.compiler=NONE"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"/>
<sysproperty key="test.root" value="${build.lib}/tests"/>
</x-sysproperty>
<x-classpath>
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPBaseTest.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPBaseTest.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPBaseTest.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -49,14 +49,18 @@
Logger log = Logger.getLogger(WSRPBaseTest.class);
- /**
- * Make it accessible from outter packages.
- */
+ /** Make it accessible from outter packages. */
public void setUp() throws Exception
{
super.setUp();
}
+ /** Make it accessible from outter packages. */
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
protected WSRPBaseTest(String name) throws Exception
{
super(name);
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPConsumerBaseTest.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPConsumerBaseTest.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPConsumerBaseTest.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -20,6 +20,7 @@
* 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.wsrp;
import org.jboss.portal.test.wsrp.framework.TestWSRPProducer;
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPProducerBaseTest.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPProducerBaseTest.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPProducerBaseTest.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -20,11 +20,10 @@
* 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.wsrp;
-import org.jboss.portal.test.framework.ServiceLookup;
import org.jboss.portal.wsrp.WSRPProducer;
-import org.jboss.portal.wsrp.WSRPConsumer;
import org.jboss.portal.wsrp.services.ServiceFactory;
/**
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPTestRunner.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPTestRunner.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPTestRunner.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -1,31 +1,31 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.
-*/
+/******************************************************************************
+ * 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.wsrp;
import org.jboss.portal.test.framework.container.client.TestRunner;
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- */
+/** @author <a href="mailto:julien at jboss.org">Julien Viet</a> */
public class WSRPTestRunner extends TestRunner
{
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPTestRunnerServlet.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPTestRunnerServlet.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPTestRunnerServlet.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -20,6 +20,7 @@
* 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.wsrp;
import org.jboss.mx.util.MBeanProxy;
@@ -38,8 +39,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -49,6 +50,7 @@
{
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
+ WSRPBaseTest test = null;
try
{
TestCaseContext tcc = TestCaseContext.getCurrentContext();
@@ -56,12 +58,12 @@
String testCaseClassName = tcc.getTestCaseId().substring(0, pos);
String methodName = tcc.getTestCaseId().substring(pos + 1);
Class testCaseClass = Thread.currentThread().getContextClassLoader().loadClass(testCaseClassName);
- WSRPBaseTest o = (WSRPBaseTest)testCaseClass.newInstance();
+ test = (WSRPBaseTest)testCaseClass.newInstance();
//
- if (o instanceof WSRPConsumerBaseTest)
+ if (test instanceof WSRPConsumerBaseTest)
{
- WSRPConsumerBaseTest p = (WSRPConsumerBaseTest)o;
+ WSRPConsumerBaseTest p = (WSRPConsumerBaseTest)test;
TestWSRPProducer producer = (TestWSRPProducer)MBeanProxy.get(TestWSRPProducer.class, new ObjectName("portal.wsrp:service=WSRPProducer"), MBeanServerLocator.locateJBoss());
WSRPConsumer consumer = (WSRPConsumer)MBeanProxy.get(WSRPConsumer.class, new ObjectName("portal.wsrp:service=WSRPConsumer"), MBeanServerLocator.locateJBoss());
p.setConsumer(consumer);
@@ -69,7 +71,7 @@
}
else
{
- WSRPProducerBaseTest p = (WSRPProducerBaseTest)o;
+ WSRPProducerBaseTest p = (WSRPProducerBaseTest)test;
WSRPProducer producer = (WSRPProducer)MBeanProxy.get(WSRPProducer.class, new ObjectName("portal.wsrp:service=WSRPProducer"), MBeanServerLocator.locateJBoss());
ServiceFactory serviceFactory = (ServiceFactory)MBeanProxy.get(ServiceFactory.class, new ObjectName("portal.wsrp:service=CachingServiceFactory"), MBeanServerLocator.locateJBoss());
p.setProducer(producer);
@@ -77,11 +79,11 @@
}
//
- o.setUp();
+ test.setUp();
//
Method m = testCaseClass.getMethod(methodName, new Class[0]);
- m.invoke(o, new Object[0]);
+ m.invoke(test, new Object[0]);
TestCaseContext.setCurrentResult(new EndTestResult());
}
catch (InvocationTargetException e)
@@ -92,5 +94,19 @@
{
TestCaseContext.setCurrentResult(new AssertResult(e));
}
+ finally
+ {
+ if (test != null)
+ {
+ try
+ {
+ test.tearDown();
+ }
+ catch (Exception e)
+ {
+ TestCaseContext.setCurrentResult(new AssertResult(e));
+ }
+ }
+ }
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -20,6 +20,7 @@
* 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.wsrp.deployment;
import junit.framework.TestCase;
Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ListBehaviorSequence.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ListBehaviorSequence.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ListBehaviorSequence.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.wsrp.framework;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.framework.ListBehaviorSequence">Chris
+ * Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class ListBehaviorSequence extends TestBehaviorSequence
+{
+ private List sequence;
+
+ public ListBehaviorSequence(TestBehaviorSet behaviorSet)
+ {
+ super(behaviorSet);
+ sequence = new ArrayList(3);
+ sequence.add(behaviorSet);
+ }
+
+ public void setBehaviorSetAt(TestBehaviorSet behaviorSet, int sequenceOrder)
+ {
+ sequence.set(sequenceOrder, behaviorSet);
+ }
+
+ protected TestBehaviorSet getBehaviorSetFor(int sequenceOrder)
+ {
+ return (TestBehaviorSet)sequence.get(sequenceOrder);
+ }
+}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/MarkupBehavior.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/MarkupBehavior.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/MarkupBehavior.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -25,11 +25,35 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.wsrp.WSRPTypeFactory;
+import org.jboss.portal.wsrp.WSRPUtils;
+import org.jboss.portal.wsrp.core.AccessDeniedFault;
import org.jboss.portal.wsrp.core.BlockingInteractionResponse;
import org.jboss.portal.wsrp.core.GetMarkup;
+import org.jboss.portal.wsrp.core.InconsistentParametersFault;
+import org.jboss.portal.wsrp.core.InitCookie;
+import org.jboss.portal.wsrp.core.InvalidCookieFault;
+import org.jboss.portal.wsrp.core.InvalidHandleFault;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.InvalidSessionFault;
+import org.jboss.portal.wsrp.core.InvalidUserCategoryFault;
+import org.jboss.portal.wsrp.core.MarkupContext;
+import org.jboss.portal.wsrp.core.MarkupParams;
import org.jboss.portal.wsrp.core.MarkupResponse;
+import org.jboss.portal.wsrp.core.MissingParametersFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PerformBlockingInteraction;
+import org.jboss.portal.wsrp.core.PortletStateChangeRequiredFault;
+import org.jboss.portal.wsrp.core.ReleaseSessions;
+import org.jboss.portal.wsrp.core.ReturnAny;
+import org.jboss.portal.wsrp.core.UnsupportedLocaleFault;
+import org.jboss.portal.wsrp.core.UnsupportedMimeTypeFault;
+import org.jboss.portal.wsrp.core.UnsupportedModeFault;
+import org.jboss.portal.wsrp.core.UnsupportedWindowStateFault;
+import org.jboss.portal.wsrp.core.WSRP_v1_Markup_PortType;
+import java.rmi.RemoteException;
+
/**
* Behavior delivering Markup services.
*
@@ -38,7 +62,7 @@
* @version $Revision$
* @since 2.6
*/
-public abstract class MarkupBehavior extends TestProducerBehavior
+public abstract class MarkupBehavior extends TestProducerBehavior implements WSRP_v1_Markup_PortType
{
protected String portletHandle;
@@ -53,17 +77,29 @@
return portletHandle;
}
- /**
- * Returns a markup String based on the passed information.
- *
- * @param mode the requested mode
- * @param windowState the requested window state
- * @param navigationalState the current navigational state
- * @param getMarkup the original GetMarkup request (in case more information is required by this behavior)
- * @return a possibly <code>null</code> markup String
- */
- public abstract String getMarkupString(Mode mode, WindowState windowState, String navigationalState, GetMarkup getMarkup);
+ public MarkupResponse getMarkup(GetMarkup getMarkup) throws UnsupportedWindowStateFault, InvalidCookieFault,
+ InvalidSessionFault, AccessDeniedFault, InconsistentParametersFault, InvalidHandleFault, UnsupportedLocaleFault,
+ UnsupportedModeFault, OperationFailedFault, MissingParametersFault, InvalidUserCategoryFault,
+ InvalidRegistrationFault, UnsupportedMimeTypeFault, RemoteException
+ {
+ MarkupParams markupParams = getMarkup.getMarkupParams();
+
+ String markupString = getMarkupString(WSRPUtils.getJSR168PortletModeFromWSRPName(markupParams.getMode()),
+ WSRPUtils.getJSR168WindowStateFromWSRPName(markupParams.getWindowState()), markupParams.getNavigationalState(),
+ getMarkup);
+
+ MarkupContext markupContext = WSRPTypeFactory.createMarkupContext("text/html", markupString);
+ markupContext.setRequiresUrlRewriting(Boolean.TRUE);
+
+ MarkupResponse markupResponse = WSRPTypeFactory.createMarkupResponse(markupContext);
+
+ modifyResponseIfNeeded(markupResponse);
+
+ return markupResponse;
+ }
+
+
/**
* Performs a blocking interaction and returns the appropriate response. Default implementation returns
* <code>null</code>.
@@ -72,11 +108,42 @@
* @return a BlockingInteractionResponse
*/
public BlockingInteractionResponse performBlockingInteraction(PerformBlockingInteraction performBlockingInteraction)
+ throws InvalidSessionFault, UnsupportedModeFault, UnsupportedMimeTypeFault, OperationFailedFault,
+ UnsupportedWindowStateFault, UnsupportedLocaleFault, AccessDeniedFault, PortletStateChangeRequiredFault,
+ InvalidRegistrationFault, MissingParametersFault, InvalidUserCategoryFault, InconsistentParametersFault,
+ InvalidHandleFault, InvalidCookieFault, RemoteException
{
return null;
}
+ public ReturnAny releaseSessions(ReleaseSessions releaseSessions) throws InvalidRegistrationFault,
+ OperationFailedFault, MissingParametersFault, AccessDeniedFault, RemoteException
+ {
+ return null;
+ }
+
+ public ReturnAny initCookie(InitCookie initCookie) throws AccessDeniedFault, OperationFailedFault,
+ InvalidRegistrationFault, RemoteException
+ {
+ return null;
+ }
+
/**
+ * Returns a markup String based on the passed information.
+ *
+ * @param mode the requested mode
+ * @param windowState the requested window state
+ * @param navigationalState the current navigational state
+ * @param getMarkup the original GetMarkup request (in case more information is required by this behavior)
+ * @return a possibly <code>null</code> markup String
+ */
+ protected abstract String getMarkupString(Mode mode, WindowState windowState, String navigationalState, GetMarkup getMarkup)
+ throws UnsupportedWindowStateFault, InvalidCookieFault, InvalidSessionFault, AccessDeniedFault,
+ InconsistentParametersFault, InvalidHandleFault, UnsupportedLocaleFault, UnsupportedModeFault,
+ OperationFailedFault, MissingParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault,
+ UnsupportedMimeTypeFault, RemoteException;
+
+ /**
* Allows this behavior to modify the response after the markup has been generated. The default implementation does
* nothing.
*
Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/PortletManagementBehavior.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/PortletManagementBehavior.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/PortletManagementBehavior.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -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.wsrp.framework;
+
+import org.jboss.portal.wsrp.core.AccessDeniedFault;
+import org.jboss.portal.wsrp.core.ClonePortlet;
+import org.jboss.portal.wsrp.core.DestroyPortlets;
+import org.jboss.portal.wsrp.core.DestroyPortletsResponse;
+import org.jboss.portal.wsrp.core.GetPortletDescription;
+import org.jboss.portal.wsrp.core.GetPortletProperties;
+import org.jboss.portal.wsrp.core.GetPortletPropertyDescription;
+import org.jboss.portal.wsrp.core.InconsistentParametersFault;
+import org.jboss.portal.wsrp.core.InvalidHandleFault;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.InvalidUserCategoryFault;
+import org.jboss.portal.wsrp.core.MissingParametersFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.PortletContext;
+import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
+import org.jboss.portal.wsrp.core.PortletPropertyDescriptionResponse;
+import org.jboss.portal.wsrp.core.PropertyList;
+import org.jboss.portal.wsrp.core.SetPortletProperties;
+import org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.framework.PortletManagementBehavior">Chris
+ * Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class PortletManagementBehavior extends TestProducerBehavior implements WSRP_v1_PortletManagement_PortType
+{
+ public PortletDescriptionResponse getPortletDescription(GetPortletDescription getPortletDescription)
+ throws AccessDeniedFault, InvalidHandleFault, InvalidUserCategoryFault, InconsistentParametersFault,
+ MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
+ {
+ return null;
+ }
+
+ public PortletContext clonePortlet(ClonePortlet clonePortlet)
+ throws InvalidUserCategoryFault, AccessDeniedFault, OperationFailedFault, InvalidHandleFault,
+ InvalidRegistrationFault, InconsistentParametersFault, MissingParametersFault, RemoteException
+ {
+ return null;
+ }
+
+ public DestroyPortletsResponse destroyPortlets(DestroyPortlets destroyPortlets)
+ throws InconsistentParametersFault, MissingParametersFault, InvalidRegistrationFault, OperationFailedFault,
+ RemoteException
+ {
+ return null;
+ }
+
+ public PortletContext setPortletProperties(SetPortletProperties setPortletProperties)
+ throws OperationFailedFault, InvalidHandleFault, MissingParametersFault, InconsistentParametersFault,
+ InvalidUserCategoryFault, AccessDeniedFault, InvalidRegistrationFault, RemoteException
+ {
+ return null;
+ }
+
+ public PropertyList getPortletProperties(GetPortletProperties getPortletProperties)
+ throws InvalidHandleFault, MissingParametersFault, InvalidRegistrationFault, AccessDeniedFault,
+ OperationFailedFault, InconsistentParametersFault, InvalidUserCategoryFault, RemoteException
+ {
+ return null;
+ }
+
+ public PortletPropertyDescriptionResponse getPortletPropertyDescription(GetPortletPropertyDescription getPortletPropertyDescription)
+ throws MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault,
+ AccessDeniedFault, InvalidHandleFault, OperationFailedFault, RemoteException
+ {
+ return null;
+ }
+}
Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/RegistrationBehavior.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/RegistrationBehavior.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/RegistrationBehavior.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.wsrp.framework;
+
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.MissingParametersFault;
+import org.jboss.portal.wsrp.core.ModifyRegistration;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.RegistrationContext;
+import org.jboss.portal.wsrp.core.RegistrationData;
+import org.jboss.portal.wsrp.core.RegistrationState;
+import org.jboss.portal.wsrp.core.ReturnAny;
+import org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.framework.RegistrationBehavior">Chris
+ * Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationBehavior extends TestProducerBehavior implements WSRP_v1_Registration_PortType
+{
+ public RegistrationContext register(RegistrationData register)
+ throws MissingParametersFault, OperationFailedFault, RemoteException
+ {
+ return null;
+ }
+
+ public ReturnAny deregister(RegistrationContext deregister)
+ throws OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ return null;
+ }
+
+ public RegistrationState modifyRegistration(ModifyRegistration modifyRegistration)
+ throws MissingParametersFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ return null;
+ }
+}
Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ServiceDescriptionBehavior.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ServiceDescriptionBehavior.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ServiceDescriptionBehavior.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -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.wsrp.framework;
+
+import org.jboss.portal.test.wsrp.framework.support.ServiceObjectFactory;
+import org.jboss.portal.wsrp.WSRPConstants;
+import org.jboss.portal.wsrp.WSRPTypeFactory;
+import org.jboss.portal.wsrp.core.CookieProtocol;
+import org.jboss.portal.wsrp.core.GetServiceDescription;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.LocalizedString;
+import org.jboss.portal.wsrp.core.MarkupType;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.PortletDescription;
+import org.jboss.portal.wsrp.core.ServiceDescription;
+import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.framework.ServiceDescriptionBehavior">Chris
+ * Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public abstract class ServiceDescriptionBehavior extends TestProducerBehavior implements WSRP_v1_ServiceDescription_PortType
+{
+ protected ServiceDescription serviceDescription;
+
+ protected ServiceDescriptionBehavior()
+ {
+ //Prepare sample ServiceDescription
+ serviceDescription = WSRPTypeFactory.createServiceDescription(false);
+ }
+
+ public ServiceDescription getServiceDescription(GetServiceDescription getServiceDescription) throws
+ OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ return null;
+ }
+
+ protected PortletDescription createPortletDescription(String portletHandle, String suffix)
+ {
+ PortletDescription portletDesc = new PortletDescription();
+ portletDesc.setPortletHandle(portletHandle);
+ portletDesc.setMarkupTypes(new MarkupType[]{new MarkupType("text/html", new String[]{WSRPConstants.NORMAL_WINDOW_STATE},
+ new String[]{WSRPConstants.VIEW_MODE}, WSRPConstants.DEFAULT_LOCALES, null)});
+ portletDesc.setDescription(ServiceObjectFactory.createLocalizedString(ServiceObjectFactory.SAMPLE_DESCRIPTION + suffix));
+ portletDesc.setTitle(ServiceObjectFactory.createLocalizedString(ServiceObjectFactory.SAMPLE_TITLE + suffix));
+ portletDesc.setShortTitle(ServiceObjectFactory.createLocalizedString(ServiceObjectFactory.SAMPLE_SHORTTITLE + suffix));
+ portletDesc.setDisplayName(ServiceObjectFactory.createLocalizedString(ServiceObjectFactory.SAMPLE_DISPLAYNAME + suffix));
+ portletDesc.setKeywords(new LocalizedString[]{ServiceObjectFactory.createLocalizedString(ServiceObjectFactory.SAMPLE_KEYWORD + suffix)});
+ return portletDesc;
+ }
+
+ public void setRequiresRegistration(boolean requiresRegistration)
+ {
+ serviceDescription.setRequiresRegistration(requiresRegistration);
+ }
+
+ public void setRequiresInitCookie(CookieProtocol requiresInitCookie)
+ {
+ serviceDescription.setRequiresInitCookie(requiresInitCookie);
+ }
+}
Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/SingleBehaviorSequence.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/SingleBehaviorSequence.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/SingleBehaviorSequence.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * 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.wsrp.framework;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.framework.SingleBehaviorSequence">Chris
+ * Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class SingleBehaviorSequence extends TestBehaviorSequence
+{
+ private TestBehaviorSet behaviorSet;
+
+ public SingleBehaviorSequence(TestBehaviorSet behaviorSet)
+ {
+ super(behaviorSet);
+ System.out.println("Using SingleBehaviorSet, behaviorSet: " + behaviorSet);
+ setBehaviorSetAt(behaviorSet, 0);
+ }
+
+ public void setBehaviorSetAt(TestBehaviorSet behaviorSet, int sequenceOrder)
+ {
+ if (sequenceOrder != 0)
+ {
+ throw new IllegalArgumentException("SingleBehaviorSequence only accepts a single BehaviorSet.");
+ }
+ this.behaviorSet = behaviorSet;
+ }
+
+ protected TestBehaviorSet getBehaviorSetFor(int sequenceOrder)
+ {
+ return behaviorSet;
+ }
+
+
+ public String toString()
+ {
+ return "SingleBehaviorSequence{" +
+ "behaviorSet=" + behaviorSet +
+ '}';
+ }
+}
Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestBehaviorSequence.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestBehaviorSequence.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestBehaviorSequence.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -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.wsrp.framework;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.framework.TestBehaviorSequence">Chris
+ * Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public abstract class TestBehaviorSequence
+{
+
+ public TestBehaviorSequence(TestBehaviorSet behaviorSet)
+ {
+ }
+
+ public abstract void setBehaviorSetAt(TestBehaviorSet behaviorSet, int sequenceOrder);
+
+ protected abstract TestBehaviorSet getBehaviorSetFor(int sequenceOrder);
+
+ public void setBehaviorAt(TestProducerBehavior behavior, int sequenceOrder)
+ {
+ getBehaviorSetFor(sequenceOrder).setBehavior(behavior);
+ }
+
+ public ServiceDescriptionBehavior getServiceDescriptionBehaviorFor(int sequenceOrder)
+ {
+ return getBehaviorSetFor(sequenceOrder).descriptionBehavior;
+ }
+
+ public MarkupBehavior getMarkupBehaviorFor(int sequenceOrder)
+ {
+ return getBehaviorSetFor(sequenceOrder).markupBehavior;
+ }
+
+ public PortletManagementBehavior getPortletManagementBehaviorFor(int sequenceOrder)
+ {
+ return getBehaviorSetFor(sequenceOrder).managementBehavior;
+ }
+
+ public RegistrationBehavior getRegistrationBehaviorFor(int sequenceOrder)
+ {
+ return getBehaviorSetFor(sequenceOrder).registrationBehavior;
+ }
+
+ public static class TestBehaviorSet
+ {
+
+ public TestBehaviorSet(ServiceDescriptionBehavior descriptionBehavior, MarkupBehavior markupBehavior,
+ PortletManagementBehavior managementBehavior, RegistrationBehavior registrationBehavior)
+ {
+ this.descriptionBehavior = descriptionBehavior;
+ this.markupBehavior = markupBehavior;
+ this.managementBehavior = managementBehavior;
+ this.registrationBehavior = registrationBehavior;
+ }
+
+ /**
+ * Constructs a set containing only one behavior. Used for simple tests.
+ *
+ * @param behavior
+ */
+ public TestBehaviorSet(TestProducerBehavior behavior)
+ {
+ setBehavior(behavior);
+ }
+
+
+ public String toString()
+ {
+ return "TestBehaviorSet{" +
+ "descriptionBehavior=" + descriptionBehavior +
+ ", markupBehavior=" + markupBehavior +
+ ", managementBehavior=" + managementBehavior +
+ ", registrationBehavior=" + registrationBehavior +
+ '}';
+ }
+
+ private ServiceDescriptionBehavior descriptionBehavior;
+ private MarkupBehavior markupBehavior;
+ private PortletManagementBehavior managementBehavior;
+ private RegistrationBehavior registrationBehavior;
+
+ public void setBehavior(TestProducerBehavior behavior)
+ {
+ if (behavior instanceof ServiceDescriptionBehavior)
+ {
+ descriptionBehavior = (ServiceDescriptionBehavior)behavior;
+ }
+ else if (behavior instanceof MarkupBehavior)
+ {
+ markupBehavior = (MarkupBehavior)behavior;
+ }
+ else if (behavior instanceof PortletManagementBehavior)
+ {
+ managementBehavior = (PortletManagementBehavior)behavior;
+ }
+ else if (behavior instanceof RegistrationBehavior)
+ {
+ registrationBehavior = (RegistrationBehavior)behavior;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Invalid behavior: " + behavior);
+ }
+ }
+ }
+}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -20,6 +20,7 @@
* 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.wsrp.framework;
import org.jboss.portal.wsrp.WSRPProducer;
@@ -39,11 +40,4 @@
void setResponse(HttpServletResponse response);
- /**
- * Forces this producer to use the specified behavior.
- *
- * @param behavior the behavior to use
- * @since 2.6
- */
- void useBehavior(TestProducerBehavior behavior);
}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -20,25 +20,22 @@
* 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.wsrp.framework;
-import org.jboss.invocation.Invocation;
import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.test.wsrp.framework.support.ServiceObjectFactory;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicMarkupBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicServiceDescriptionBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.EmptyMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.NullMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.SessionMarkupBehavior;
import org.jboss.portal.wsrp.WSRPConstants;
-import org.jboss.portal.wsrp.WSRPTypeFactory;
-import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.AccessDeniedFault;
import org.jboss.portal.wsrp.core.BlockingInteractionResponse;
import org.jboss.portal.wsrp.core.ClonePortlet;
import org.jboss.portal.wsrp.core.CookieProtocol;
import org.jboss.portal.wsrp.core.DestroyPortlets;
import org.jboss.portal.wsrp.core.DestroyPortletsResponse;
-import org.jboss.portal.wsrp.core.Fault;
import org.jboss.portal.wsrp.core.GetMarkup;
import org.jboss.portal.wsrp.core.GetPortletDescription;
import org.jboss.portal.wsrp.core.GetPortletProperties;
@@ -51,18 +48,13 @@
import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
import org.jboss.portal.wsrp.core.InvalidSessionFault;
import org.jboss.portal.wsrp.core.InvalidUserCategoryFault;
-import org.jboss.portal.wsrp.core.LocalizedString;
-import org.jboss.portal.wsrp.core.MarkupContext;
-import org.jboss.portal.wsrp.core.MarkupParams;
import org.jboss.portal.wsrp.core.MarkupResponse;
-import org.jboss.portal.wsrp.core.MarkupType;
import org.jboss.portal.wsrp.core.MissingParametersFault;
import org.jboss.portal.wsrp.core.ModelDescription;
import org.jboss.portal.wsrp.core.ModifyRegistration;
import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PerformBlockingInteraction;
import org.jboss.portal.wsrp.core.PortletContext;
-import org.jboss.portal.wsrp.core.PortletDescription;
import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
import org.jboss.portal.wsrp.core.PortletPropertyDescriptionResponse;
import org.jboss.portal.wsrp.core.PortletStateChangeRequiredFault;
@@ -82,7 +74,6 @@
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
-import java.lang.reflect.Method;
import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.Map;
@@ -99,8 +90,6 @@
{
//injected objects to return by WS methods (for tests)
- ServiceDescription serviceDescription;
-
/**
* The ServiceDescription that is returned to an unregistred Consumer when registration is required: no information
* is provided apart from the fact that registration is required and what information is required to sucessfully
@@ -126,9 +115,12 @@
/** Used to set the cookie in initCookie */
private HttpServletResponse response;
- /** The behavior that is currently active. */
- private TestProducerBehavior currentBehavior;
+ /** The behavior sequence that will be used for the current test. */
+ private TestBehaviorSequence sequence;
+ /** The current order in the sequence (number of times the methods have been called) */
+ private int sequenceOrder;
+
public static final String USER_COOKIE = "cookie";
public TestWSRPProducerImpl()
@@ -143,14 +135,6 @@
requiredRegistrationNotProvidedSD = new ServiceDescription(true, null, null, null, null, null, requiresInitCookie,
requiredRegistrationInfo, WSRPConstants.DEFAULT_LOCALES, null, null);
- //Prepare sample ServiceDescription
- serviceDescription = WSRPTypeFactory.createServiceDescription(requiresRegistration);
-
- //Prepare description of two portlets
- PortletDescription pd1 = createPortletDescription(BasicMarkupBehavior.PORTLET_HANDLE, "");
- PortletDescription pd2 = createPortletDescription(SessionMarkupBehavior.PORTLET_HANDLE, "2");
- serviceDescription.setOfferedPortlets(new PortletDescription[]{pd1, pd2});
-
if (response != null)
{
response.reset();
@@ -164,52 +148,70 @@
registerMarkupBehavior(new NullMarkupBehavior());
registerMarkupBehavior(new EmptyMarkupBehavior());
- currentBehavior = null;
+ sequence = new SingleBehaviorSequence(new TestBehaviorSequence.TestBehaviorSet(new BasicServiceDescriptionBehavior()));
+ sequenceOrder = 0;
}
// Behavior management **********************************************************************************************
- Map behaviors = new HashMap();
+ Map registeredBehaviors = new HashMap();
- public void useBehavior(TestProducerBehavior behavior)
+ private void useBehavior(TestProducerBehavior behavior)
{
- currentBehavior = behavior;
+ sequence = new SingleBehaviorSequence(new TestBehaviorSequence.TestBehaviorSet(behavior));
}
private void registerMarkupBehavior(MarkupBehavior behavior)
{
- behaviors.put(behavior.getPortletHandle(), behavior);
+ registeredBehaviors.put(behavior.getPortletHandle(), behavior);
}
private MarkupBehavior getMarkupBehaviorFor(String portletHandle)
{
- return (MarkupBehavior)behaviors.get(portletHandle);
+ return (MarkupBehavior)registeredBehaviors.get(portletHandle);
}
- private void updateCurrentBehaviorIfNeeded(String handle)
+ private void updateCurrentMarkupBehaviorIfNeeded(String handle)
{
- if (currentBehavior == null || handle != null)
+ if (sequence == null)
{
- currentBehavior = getMarkupBehaviorFor(handle);
+ if (handle != null)
+ {
+ useBehavior(getMarkupBehaviorFor(handle));
+ }
}
+ else
+ {
+ MarkupBehavior markupBehavior = sequence.getMarkupBehaviorFor(sequenceOrder);
+ if (markupBehavior == null || handle != null)
+ {
+ MarkupBehavior behavior = getMarkupBehaviorFor(handle);
+ sequence.setBehaviorAt(behavior, sequenceOrder);
+ }
+ }
}
private void incrementBehaviorCallCount()
{
- if (currentBehavior != null)
- {
- currentBehavior.incrementCallCount();
- }
+ sequenceOrder++;
}
private MarkupBehavior getMarkupBehavior()
{
- if (currentBehavior instanceof MarkupBehavior)
+ if (sequence != null)
{
- return (MarkupBehavior)currentBehavior;
+ return sequence.getMarkupBehaviorFor(sequenceOrder);
}
+ throw new IllegalStateException("Don't have a MarkupBehavior to return!");
+ }
- throw new IllegalArgumentException("Current behavior cannot be used for a Markup interaction. Was: "
- + currentBehavior);
+ private ServiceDescriptionBehavior getServiceDescriptionBehavior()
+ {
+ if (sequence != null)
+ {
+ ServiceDescriptionBehavior behavior = sequence.getServiceDescriptionBehaviorFor(sequenceOrder);
+ return behavior;
+ }
+ throw new IllegalStateException("Don't have a ServiceDescriptionBehavior to return!");
}
public void setResponse(HttpServletResponse response)
@@ -217,27 +219,14 @@
this.response = response;
}
- private PortletDescription createPortletDescription(String portletHandle, String suffix)
- {
- PortletDescription portletDesc = new PortletDescription();
- portletDesc.setPortletHandle(portletHandle);
- portletDesc.setMarkupTypes(new MarkupType[]{new MarkupType("text/html", new String[]{WSRPConstants.NORMAL_WINDOW_STATE},
- new String[]{WSRPConstants.VIEW_MODE}, WSRPConstants.DEFAULT_LOCALES, null)});
- portletDesc.setDescription(ServiceObjectFactory.createLocalizedString(ServiceObjectFactory.SAMPLE_DESCRIPTION + suffix));
- portletDesc.setTitle(ServiceObjectFactory.createLocalizedString(ServiceObjectFactory.SAMPLE_TITLE + suffix));
- portletDesc.setShortTitle(ServiceObjectFactory.createLocalizedString(ServiceObjectFactory.SAMPLE_SHORTTITLE + suffix));
- portletDesc.setDisplayName(ServiceObjectFactory.createLocalizedString(ServiceObjectFactory.SAMPLE_DISPLAYNAME + suffix));
- portletDesc.setKeywords(new LocalizedString[]{ServiceObjectFactory.createLocalizedString(ServiceObjectFactory.SAMPLE_KEYWORD + suffix)});
- return portletDesc;
- }
-
// ServiceDescription implementation ********************************************************************************
public ServiceDescription getServiceDescription(GetServiceDescription gs)
throws InvalidRegistrationFault, OperationFailedFault, RemoteException
{
+ ServiceDescription response = getServiceDescriptionBehavior().getServiceDescription(gs);
incrementBehaviorCallCount();
- return serviceDescription;
+ return response;
}
// MarkupService implementation *************************************************************************************
@@ -248,24 +237,10 @@
OperationFailedFault, MissingParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault,
UnsupportedMimeTypeFault, RemoteException
{
- String handle = getMarkup.getPortletContext().getPortletHandle();
- String markupString;
+ updateCurrentMarkupBehaviorIfNeeded(getMarkup.getPortletContext().getPortletHandle());
- MarkupParams markupParams = getMarkup.getMarkupParams();
+ MarkupResponse markupResponse = getMarkupBehavior().getMarkup(getMarkup);
- updateCurrentBehaviorIfNeeded(handle);
-
- markupString = getMarkupBehavior().getMarkupString(WSRPUtils.getJSR168PortletModeFromWSRPName(markupParams.getMode()),
- WSRPUtils.getJSR168WindowStateFromWSRPName(markupParams.getWindowState()), markupParams.getNavigationalState(),
- getMarkup);
-
- MarkupContext markupContext = WSRPTypeFactory.createMarkupContext("text/html", markupString);
- markupContext.setRequiresUrlRewriting(Boolean.TRUE);
-
- MarkupResponse markupResponse = WSRPTypeFactory.createMarkupResponse(markupContext);
-
- getMarkupBehavior().modifyResponseIfNeeded(markupResponse);
-
incrementBehaviorCallCount();
return markupResponse;
}
@@ -276,7 +251,7 @@
InvalidRegistrationFault, MissingParametersFault, InvalidUserCategoryFault, InconsistentParametersFault,
InvalidHandleFault, InvalidCookieFault, RemoteException
{
- updateCurrentBehaviorIfNeeded(performBlockingInteraction.getPortletContext().getPortletHandle());
+ updateCurrentMarkupBehaviorIfNeeded(performBlockingInteraction.getPortletContext().getPortletHandle());
BlockingInteractionResponse res = getMarkupBehavior().performBlockingInteraction(performBlockingInteraction);
@@ -365,6 +340,7 @@
public void setRequiresRegistration(boolean requiresRegistration)
{
this.requiresRegistration = requiresRegistration;
+ getServiceDescriptionBehavior().setRequiresRegistration(requiresRegistration);
}
public boolean isRequiresRegistration()
@@ -380,7 +356,7 @@
public void setRequiresInitCookie(CookieProtocol requiresInitCookie)
{
this.requiresInitCookie = requiresInitCookie;
- serviceDescription.setRequiresInitCookie(requiresInitCookie);
+ getServiceDescriptionBehavior().setRequiresInitCookie(requiresInitCookie);
}
public int getSessionExpirationTime()
@@ -393,25 +369,6 @@
this.sessionExpirationTime = sessionExpirationTime;
}
- public PortletDescription getPortletDescription(String handle, String[] locales)
- {
- if (handle == null)
- {
- throw new IllegalArgumentException("Invalid handle");
- }
-
- PortletDescription[] offeredPortlets = serviceDescription.getOfferedPortlets();
- if (BasicMarkupBehavior.PORTLET_HANDLE.equals(handle))
- {
- return offeredPortlets[0];
- }
- if (SessionMarkupBehavior.PORTLET_HANDLE.equals(handle))
- {
- return offeredPortlets[1];
- }
- return null;
- }
-
public void addRegistrationProperty(PropertyDescription propertyDescription)
{
PropertyDescription[] descriptions = requiredRegistrationInfo.getPropertyDescriptions();
@@ -434,88 +391,9 @@
requiredRegistrationInfo.setPropertyDescriptions(null);
}
- // Contract with Invoker implementation *****************************************************************************
-
- /** Dispatch the invocation to the target by reflection */
- public Object invoke(Invocation invocation) throws Exception
- {
- Method method = invocation.getMethod();
- Object[] args = invocation.getArguments();
- return method.invoke(this, args);
- }
-
- // Protected methods ************************************************************************************************
-
- /**
- * Checks that the specified registration information is valid if this Producer requires registration.
- *
- * @param registrationContext
- * @return
- */
- protected boolean isRegistrationValid(RegistrationContext registrationContext)
- {
- if (isRequiresRegistration())
- {
- // todo: implement more completely
- if (registrationContext == null)
- {
- return false;
- }
- }
- return true;
- }
-
public boolean isSessionValid(String sessionId)
{
// todo: implement
return true;
}
-
- /**
- * Create a new OperationFailedFault based on the specified cause.
- *
- * @param cause the cause why the operation failed
- * @return a new OperationFailedFault based on the specified cause.
- */
- protected OperationFailedFault createOperationFailedFault(Throwable cause)
- {
- return (OperationFailedFault)createFaultFrom(OperationFailedFault.class, cause);
- }
-
- protected Fault createFaultFrom(Class faultClass, Throwable cause)
- {
- Fault fault = null;
- try
- {
- fault = (Fault)faultClass.newInstance();
- fault.initCause(cause);
- }
- catch (Exception e)
- {
- // shouldn't happen
- e.printStackTrace();
- }
- return fault;
- }
-
- protected void checkMissingValue(Object valueToCheck, String valueName, String context) throws MissingParametersFault
- {
- if (valueToCheck == null)
- {
- throw(MissingParametersFault)
- createFaultFrom(MissingParametersFault.class, new NullPointerException("Missing required " + valueName
- + (context != null ? " in " + context : "")));
- }
- }
-
- /**
- * Retrieves the service description offered to unregistered consumers when registration is required.
- *
- * @return the service description offered to unregistered consumers when registration is required
- */
- protected ServiceDescription getRegistrationNotProvidedServiceDescription()
- {
- return requiredRegistrationNotProvidedSD;
- }
-
}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/ServiceObjectFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/ServiceObjectFactory.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/ServiceObjectFactory.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -20,6 +20,7 @@
* 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.wsrp.framework.support;
import org.jboss.portal.wsrp.core.LocalizedString;
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/DispatcherPortlet.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/DispatcherPortlet.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/DispatcherPortlet.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -20,6 +20,7 @@
* 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.wsrp.portlet;
import javax.portlet.GenericPortlet;
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/GetLocalesPortlet.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/GetLocalesPortlet.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/GetLocalesPortlet.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -20,6 +20,7 @@
* 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.wsrp.portlet;
import javax.portlet.GenericPortlet;
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/ConsumerTestRunner.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/ConsumerTestRunner.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/ConsumerTestRunner.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -1,30 +1,31 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.
-*/
+/******************************************************************************
+ * 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.wsrp.v1.consumer;
+import junit.framework.TestSuite;
+import org.jboss.portal.common.junit.TestBuilder;
+import org.jboss.portal.test.framework.container.client.TestCase;
import org.jboss.portal.test.wsrp.WSRPTestRunner;
-import org.jboss.portal.test.framework.container.client.TestCase;
-import org.jboss.portal.common.junit.TestBuilder;
-import junit.framework.TestSuite;
import java.util.Map;
@@ -51,8 +52,8 @@
try
{
WSRPTestRunner runner = new WSRPTestRunner();
- TestBuilder.introspect(runner, ServiceDescriptionTestCase.class, new Blah(ServiceDescriptionTestCase.class));
- TestBuilder.introspect(runner, MarkupTestCase.class, new Blah(MarkupTestCase.class));
+ TestBuilder.introspect(runner, ServiceDescriptionTestCase.class, new ClassNameTestCaseFactory(ServiceDescriptionTestCase.class));
+ TestBuilder.introspect(runner, MarkupTestCase.class, new ClassNameTestCaseFactory(MarkupTestCase.class));
return runner;
}
catch (NoSuchMethodException e)
@@ -62,13 +63,15 @@
}
}
- private static class Blah implements TestBuilder.TestCaseFactory
+ private static class ClassNameTestCaseFactory implements TestBuilder.TestCaseFactory
{
private Class clazz;
- public Blah(Class clazz)
+
+ public ClassNameTestCaseFactory(Class clazz)
{
this.clazz = clazz;
}
+
public junit.framework.TestCase createTestCase(Map parametrization, String name) throws Exception
{
return new TestCase(clazz.getName() + "#" + name, "/testrunner");
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -146,6 +146,11 @@
private FragmentResponse checkRenderResult(PortletInvocationResponse response, String markup)
{
assertNotNull(response);
+ if (response instanceof ErrorResponse)
+ {
+ ErrorResponse errorResponse = (ErrorResponse)response;
+ fail("Got an ErrorResponse instead of a FragmentResponse. Message: " + errorResponse.getMessage());
+ }
assertTrue("Was expecting a FragmentResponse. Got: " + response, response instanceof FragmentResponse);
FragmentResponse fragment = (FragmentResponse)response;
assertEquals(markup, fragment.getChars().toString());
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -48,8 +48,9 @@
assertEquals(ServiceObjectFactory.SAMPLE_KEYWORD + suffix, ServiceObjectFactory.extractString(meta.getMetaValue(MetaInfo.KEYWORDS)));
}
- protected void tearDown() throws Exception
+ public void tearDown() throws Exception
{
+ System.out.println("V1ConsumerBaseTest.tearDown");
producer.reset();
super.tearDown();
}
Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicServiceDescriptionBehavior.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicServiceDescriptionBehavior.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicServiceDescriptionBehavior.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -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.wsrp.v1.consumer.behaviors;
+
+import org.jboss.portal.test.wsrp.framework.ServiceDescriptionBehavior;
+import org.jboss.portal.wsrp.core.GetServiceDescription;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.PortletDescription;
+import org.jboss.portal.wsrp.core.ServiceDescription;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicServiceDescriptionBehavior">Chris
+ * Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class BasicServiceDescriptionBehavior extends ServiceDescriptionBehavior
+{
+
+ public BasicServiceDescriptionBehavior()
+ {
+ //Prepare description of two portlets
+ PortletDescription pd1 = createPortletDescription(BasicMarkupBehavior.PORTLET_HANDLE, "");
+ PortletDescription pd2 = createPortletDescription(SessionMarkupBehavior.PORTLET_HANDLE, "2");
+ serviceDescription.setOfferedPortlets(new PortletDescription[]{pd1, pd2});
+ }
+
+ public ServiceDescription getServiceDescription(GetServiceDescription getServiceDescription)
+ throws OperationFailedFault, InvalidRegistrationFault, RemoteException
+ {
+ return serviceDescription;
+ }
+}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/NeedPortletHandleTest.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/NeedPortletHandleTest.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/NeedPortletHandleTest.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -29,7 +29,6 @@
import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PortletDescription;
import org.jboss.portal.wsrp.core.ServiceDescription;
-import org.jboss.portal.common.NotYetImplemented;
import java.rmi.RemoteException;
import java.util.HashMap;
@@ -147,7 +146,7 @@
deploy(portletWARFileName);
}
- protected void tearDown() throws Exception
+ public void tearDown() throws Exception
{
undeploy(portletWARFileName);
super.tearDown();
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ProducerTestRunner.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ProducerTestRunner.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ProducerTestRunner.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -1,30 +1,31 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., 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.
-*/
+/******************************************************************************
+ * 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.wsrp.v1.producer;
import junit.framework.TestSuite;
+import org.jboss.portal.common.junit.TestBuilder;
+import org.jboss.portal.test.framework.container.client.TestCase;
import org.jboss.portal.test.wsrp.WSRPTestRunner;
-import org.jboss.portal.test.framework.container.client.TestCase;
-import org.jboss.portal.common.junit.TestBuilder;
import java.util.Map;
@@ -51,10 +52,10 @@
try
{
WSRPTestRunner runner = new WSRPTestRunner();
- TestBuilder.introspect(runner, ServiceDescriptionTestCase.class, new ProducerTestRunner.Blah(ServiceDescriptionTestCase.class));
- TestBuilder.introspect(runner, MarkupTestCase.class, new ProducerTestRunner.Blah(MarkupTestCase.class));
+ TestBuilder.introspect(runner, ServiceDescriptionTestCase.class, new ProducerTestRunner.ClassNameTestCaseFactory(ServiceDescriptionTestCase.class));
+ TestBuilder.introspect(runner, MarkupTestCase.class, new ProducerTestRunner.ClassNameTestCaseFactory(MarkupTestCase.class));
// TestBuilder.introspect(runner, RegistrationTestCase.class, new ProducerTestRunner.Blah(RegistrationTestCase.class));
- TestBuilder.introspect(runner, PortletManagementTestCase.class, new ProducerTestRunner.Blah(PortletManagementTestCase.class));
+ TestBuilder.introspect(runner, PortletManagementTestCase.class, new ProducerTestRunner.ClassNameTestCaseFactory(PortletManagementTestCase.class));
return runner;
}
catch (NoSuchMethodException e)
@@ -64,13 +65,15 @@
}
}
- private static class Blah implements TestBuilder.TestCaseFactory
+ private static class ClassNameTestCaseFactory implements TestBuilder.TestCaseFactory
{
private Class clazz;
- public Blah(Class clazz)
+
+ public ClassNameTestCaseFactory(Class clazz)
{
this.clazz = clazz;
}
+
public junit.framework.TestCase createTestCase(Map parametrization, String name) throws Exception
{
return new TestCase(clazz.getName() + "#" + name, "/testrunner");
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -153,7 +153,7 @@
checkServiceDescriptionWithOnlyBasicPortlet(gs);
}
- protected void tearDown() throws Exception
+ public void tearDown() throws Exception
{
producer.clearRegistrationProperties();
super.tearDown();
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2006-10-25 15:59:50 UTC (rev 5501)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2006-10-25 23:22:04 UTC (rev 5502)
@@ -78,7 +78,7 @@
portletManagementService = (WSRP_v1_PortletManagement_PortType)serviceFactory.getService(WSRP_v1_PortletManagement_PortType.class);
}
- protected void tearDown() throws Exception
+ public void tearDown() throws Exception
{
super.tearDown();
resetRegistrationInfo();
More information about the jboss-svn-commits
mailing list