Author: chris.laprun(a)jboss.com
Date: 2007-06-12 00:52:45 -0400 (Tue, 12 Jun 2007)
New Revision: 7405
Modified:
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/v1/consumer/MarkupTestCase.java
Log:
- Started fixing failing WSRP tests:
+ Started cleaning up TestWSRPProducerImpl to have a correct implementation of
initCookie (still need to properly hook to JBoss WS).
+ Fixed incorrect assumption in testSessionHandling: a Cookie is not necessarily set by
all producers when a session is created on the producer.
+ Cleaned up testInitCookie (still failing).
+ Removed TestWSRPProducer.setResponse as it's not used anymore.
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 2007-06-11
23:13:08 UTC (rev 7404)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java 2007-06-12
04:52:45 UTC (rev 7405)
@@ -25,8 +25,6 @@
import org.jboss.portal.wsrp.WSRPProducer;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Exposes WSPRProducer test implementation methods - we inject what it returns
*
@@ -38,7 +36,5 @@
/** Resets any currently held state. */
void reset();
- void setResponse(HttpServletResponse response);
-
BehaviorRegistry getBehaviorRegistry();
}
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 2007-06-11
23:13:08 UTC (rev 7404)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java 2007-06-12
04:52:45 UTC (rev 7405)
@@ -70,6 +70,10 @@
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.server.ServiceLifecycle;
+import javax.xml.rpc.server.ServletEndpointContext;
import java.rmi.RemoteException;
/**
@@ -81,24 +85,28 @@
* @version $Revision$
* @since 2.4
*/
-public class TestWSRPProducerImpl extends AbstractJBossService implements
TestWSRPProducer
+public class TestWSRPProducerImpl extends AbstractJBossService implements
TestWSRPProducer, ServiceLifecycle
{
private int sessionExpirationTime = DEFAULT_SESSION_EXPIRATION_TIME;
private CookieProtocol requiresInitCookie = CookieProtocol.none;
- /** Used to set the cookie in initCookie */
- private HttpServletResponse response;
-
private BehaviorRegistry behaviorRegistry = new BehaviorRegistry();
public static final String USER_COOKIE = "cookie";
+ private ServletEndpointContext context;
+
public TestWSRPProducerImpl()
{
reset();
}
+ public void init(Object context) throws ServiceException
+ {
+ this.context = (ServletEndpointContext)context;
+ }
+
public BehaviorRegistry getBehaviorRegistry()
{
return behaviorRegistry;
@@ -106,12 +114,6 @@
public void reset()
{
- if (response != null)
- {
- response.reset();
- }
- response = null;
-
requiresInitCookie = null;
behaviorRegistry.clear();
}
@@ -131,18 +133,12 @@
return behaviorRegistry.getPortletManagementBehavior();
}
- public void setResponse(HttpServletResponse response)
- {
- this.response = response;
- }
-
// ServiceDescription implementation
********************************************************************************
public ServiceDescription getServiceDescription(GetServiceDescription gs)
throws InvalidRegistrationFault, OperationFailedFault, RemoteException
{
- ServiceDescription response =
getServiceDescriptionBehavior().getServiceDescription(gs);
- return response;
+ return getServiceDescriptionBehavior().getServiceDescription(gs);
}
// MarkupService implementation
*************************************************************************************
@@ -153,10 +149,9 @@
OperationFailedFault, MissingParametersFault, InvalidUserCategoryFault,
InvalidRegistrationFault,
UnsupportedMimeTypeFault, RemoteException
{
- MarkupResponse markupResponse =
getMarkupBehaviorFor(getMarkup.getPortletContext().getPortletHandle())
- .getMarkup(getMarkup);
- return markupResponse;
+ return getMarkupBehaviorFor(getMarkup.getPortletContext().getPortletHandle())
+ .getMarkup(getMarkup);
}
public BlockingInteractionResponse
performBlockingInteraction(PerformBlockingInteraction performBlockingInteraction)
@@ -165,10 +160,9 @@
InvalidRegistrationFault, MissingParametersFault, InvalidUserCategoryFault,
InconsistentParametersFault,
InvalidHandleFault, InvalidCookieFault, RemoteException
{
- BlockingInteractionResponse res =
getMarkupBehaviorFor(performBlockingInteraction.getPortletContext().getPortletHandle())
- .performBlockingInteraction(performBlockingInteraction);
- return res;
+ return
getMarkupBehaviorFor(performBlockingInteraction.getPortletContext().getPortletHandle())
+ .performBlockingInteraction(performBlockingInteraction);
}
public ReturnAny releaseSessions(ReleaseSessions releaseSessions)
@@ -186,7 +180,9 @@
throw new OperationFailedFault();
}
- response.addCookie(new Cookie("cookieName", USER_COOKIE));
+ MessageContext msgContext = context.getMessageContext();
+ HttpServletResponse res =
(HttpServletResponse)msgContext.getProperty("javax.xml.ws.servlet.response");
+ res.addCookie(new Cookie("name", "value"));
return null;
}
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 2007-06-11
23:13:08 UTC (rev 7404)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java 2007-06-12
04:52:45 UTC (rev 7405)
@@ -120,7 +120,6 @@
String sessionId =
sessionInfo.getSessionIdForPortlet(SessionMarkupBehavior.PORTLET_HANDLE);
ExtendedAssert.assertNotNull(sessionId);
ExtendedAssert.assertEquals(SessionMarkupBehavior.SESSION_ID, sessionId);
- ExtendedAssert.assertNotNull(sessionInfo.getUserCookie());
ExtendedAssert.assertFalse(sessionInfo.isPerGroupCookies());
ExtendedAssert.assertFalse(sessionInfo.isInitCookieDone());
@@ -134,7 +133,6 @@
RenderInvocation render =
createRenderInvocation(InitCookieMarkupBehavior.PORTLET_HANDLE);
TestPortletInvocationContext invocationContext =
(TestPortletInvocationContext)render.getContext();
HttpSession session = invocationContext.getClientRequest().getSession();
- producer.setResponse(invocationContext.getClientResponse());
ProducerSessionInformation sessionInfo =
consumer.getProducerSessionInformationFrom(session);
ExtendedAssert.assertNull(sessionInfo);
@@ -149,9 +147,6 @@
// now require cookie initialization and check that everything went well
producer.setRequiresInitCookie(CookieProtocol.perUser);
render = createRenderInvocation(InitCookieMarkupBehavior.PORTLET_HANDLE);
- invocationContext = (TestPortletInvocationContext)render.getContext();
- session = invocationContext.getClientRequest().getSession();
- producer.setResponse(invocationContext.getClientResponse());
consumer.invoke(render);
Show replies by date