[gatein-commits] gatein SVN: r3473 - components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jun 24 12:09:13 EDT 2010


Author: mwringe
Date: 2010-06-24 12:09:13 -0400 (Thu, 24 Jun 2010)
New Revision: 3473

Modified:
   components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/PerUserInitCookieMarkupBehavior.java
Log:
GTNWSRP-46: Update the PerUnitCookiesMarkupBehaviour so that a cookie gets set and the v1 MarkupTestCases will finally pass.

Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/PerUserInitCookieMarkupBehavior.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/PerUserInitCookieMarkupBehavior.java	2010-06-24 14:02:46 UTC (rev 3472)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/PerUserInitCookieMarkupBehavior.java	2010-06-24 16:09:13 UTC (rev 3473)
@@ -23,7 +23,20 @@
 
 package org.gatein.wsrp.test.protocol.v1.behaviors;
 
+import java.util.List;
+
+import javax.xml.soap.MimeHeaders;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.gatein.wsrp.handler.RequestHeaderClientHandler;
+import org.gatein.wsrp.test.handler.MockSOAPMessage;
+import org.gatein.wsrp.test.handler.MockSOAPMessageContext;
 import org.gatein.wsrp.test.protocol.v1.BehaviorRegistry;
+import org.oasis.wsrp.v1.V1AccessDenied;
+import org.oasis.wsrp.v1.V1Extension;
+import org.oasis.wsrp.v1.V1InvalidRegistration;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1RegistrationContext;
 
 /**
  * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
@@ -42,4 +55,24 @@
    {
       portletHandle = PER_USER_INIT_COOKIE_HANDLE;
    }
+   
+   @Override
+   public List<V1Extension> initCookie(V1RegistrationContext registrationContext) throws V1InvalidRegistration,
+         V1AccessDenied, V1OperationFailed
+   {
+      //Set the Cookie through the RequestHeaderClientHandler manually here since we use a test BehaviourBackedServiceFactory instead
+      //of the real SOAPServiceFactory.
+      MockSOAPMessage message = new MockSOAPMessage();
+      SOAPMessageContext msgContext = MockSOAPMessageContext.createMessageContext(message, getClass().getClassLoader());
+      MimeHeaders headers = new MimeHeaders();
+      headers.setHeader("Set-Cookie", "name=value");
+      message.setMimeHeaders(headers);
+      
+      RequestHeaderClientHandler rhch = new RequestHeaderClientHandler();
+      rhch.handleResponse(msgContext);
+      
+      return super.initCookie(registrationContext);
+   }
+   
+   
 }



More information about the gatein-commits mailing list