[portal-commits] JBoss Portal SVN: r12986 - in branches/JBoss_Portal_AS5_Deployer/wsrp: src/main/org/jboss/portal/test/wsrp/consumer and 12 other directories.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Fri Mar 6 18:22:50 EST 2009


Author: mwringe
Date: 2009-03-06 18:22:50 -0500 (Fri, 06 Mar 2009)
New Revision: 12986

Added:
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/handler/MockSOAPBody.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/handler/WSRPExtensionHandlerTestCase.java
Modified:
   branches/JBoss_Portal_AS5_Deployer/wsrp/.classpath
   branches/JBoss_Portal_AS5_Deployer/wsrp/build.xml
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ConsumerRegistryTestCase.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/handler/MockSOAPMessage.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/handler/WSRPExtensionHandler.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/resources/portal-wsrp-client-jar/META-INF/wsdl/wsrp_v1_types.xsd
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/resources/portal-wsrp-war/WEB-INF/wsdl/wsrp_v1_types.xsd
   branches/JBoss_Portal_AS5_Deployer/wsrp/src/resources/webservice/wsrp_v1_types.xsd
Log:
Merge JBoss_Portal_Branch_2_7 changes (rev range 12254:12964) into JBoss_Portal_AS5_Deployer branch

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/.classpath
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/.classpath	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/.classpath	2009-03-06 23:22:50 UTC (rev 12986)
@@ -30,10 +30,10 @@
 	<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/common/lib/portal-common-portal-lib.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-federation-lib.jar"/>
-	<classpathentry kind="lib" path="/thirdparty/sun-javamail/lib/mail.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/apache-fileupload/lib/commons-fileupload.jar"/>
 	<classpathentry kind="lib" path="/tools/lib/xercesImpl.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/portlet/lib/portlet-api.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/core"/>
+	<classpathentry kind="lib" path="/thirdparty/glassfish/javamail/lib/mail.jar"/>
 	<classpathentry kind="output" path="output/classes"/>
 </classpath>

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/build.xml
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/build.xml	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/build.xml	2009-03-06 23:22:50 UTC (rev 12986)
@@ -107,13 +107,7 @@
          <path refid="oswego.concurrent.classpath"/>
          <path refid="junit.junit.classpath"/>
          <path refid="sun.servlet.classpath"/>
-         <path refid="sun.jaf.classpath"/>
-         <!--<pathelement path="${jboss.home}/lib/jboss-common.jar"/>
-         <pathelement path="${jboss.home}/lib/jboss-jmx.jar"/>
-         <pathelement path="${jboss.home}/lib/jboss-system.jar"/>
-         <pathelement path="${jboss.deploy.lib.dir}/jboss-j2ee.jar"/>
-         <pathelement path="${jboss.deploy.lib.dir}/jboss-jaxrpc.jar"/>
-         <pathelement path="${jboss.deploy.lib.dir}/jboss-saaj.jar"/>-->
+         <path refid="glassfish.jaf.classpath"/>
          <pathelement path="${jbossas/core.libs.lib}/jboss-common.jar"/>
          <pathelement path="${jbossas/core.libs.lib}/jboss-jmx.jar"/>
          <pathelement path="${jbossas/core.libs.lib}/jboss-system.jar"/>
@@ -121,6 +115,7 @@
          <pathelement path="${jbossas/core.libs.lib}/jboss-jaxrpc.jar"/>
          <pathelement path="${jbossas/core.libs.lib}/jboss-saaj.jar"/>
 
+
          <!-- needed to compile on JDK 1.4 -->
          <pathelement path="${jbossas/core.libs.lib}/namespace.jar"/>
 
@@ -130,7 +125,7 @@
          <path refid="apache.httpclient.classpath"/>
          <path refid="hibernate.hibernate.classpath"/>
          <path refid="apache.fileupload.classpath"/>
-         <path refid="sun.javamail.classpath"/>
+         <path refid="glassfish.javamail.classpath"/>
       </path>
 
       <!-- Libraries required for tests -->
@@ -180,6 +175,7 @@
 
          <pathelement path="${jboss.aop.lib}/jboss-aop.jar"/>
          <path refid="javassist.javassist.classpath"/>
+         <path refid="jboss/jboss.mdr.classpath"/>
          <path refid="oswego.concurrent.classpath"/>
          <path refid="trove.trove.classpath"/>
          <path refid="qdox.qdox.classpath"/>
@@ -872,6 +868,7 @@
             <test todir="${test.reports}"
                   name="org.jboss.portal.test.wsrp.other.RegistrationPropertyDescriptionTestCase"/>
             <test todir="${test.reports}" name="org.jboss.portal.test.wsrp.handler.RequestHeaderClientHandlerTestCase"/>
+            <test todir="${test.reports}" name="org.jboss.portal.test.wsrp.handler.WSRPExtensionHandlerTestCase"/>
          </x-test>
          <x-sysproperty>
             <!--<jvmarg value="-Xdebug"/>

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ConsumerRegistryTestCase.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ConsumerRegistryTestCase.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ConsumerRegistryTestCase.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * JBoss, a division of Red Hat                                               *
- * Copyright 2007, Red Hat Middleware, LLC, and individual                    *
+ * Copyright 2009, 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.                                                   *
@@ -31,6 +31,7 @@
 import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
 import org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo;
 import org.jboss.portal.wsrp.consumer.ProducerInfo;
+import org.jboss.portal.wsrp.consumer.RegistrationInfo;
 
 import java.util.Collection;
 
@@ -77,7 +78,8 @@
       assertNotNull(endpoint);
       assertEquals(EndpointConfigurationInfo.UNSET, endpoint.getServiceDescriptionURL());
       assertEquals(EndpointConfigurationInfo.UNSET, endpoint.getMarkupURL());
-      assertNull(info.getRegistrationInfo());
+      RegistrationInfo regInfo = info.getRegistrationInfo();
+      assertTrue(regInfo.isUndetermined());
       TransactionAssert.commitTransaction();
 
       TransactionAssert.beginTransaction();
@@ -103,7 +105,7 @@
       assertNotNull(endpoint);
       assertEquals(EndpointConfigurationInfo.UNSET, endpoint.getServiceDescriptionURL());
       assertEquals(EndpointConfigurationInfo.UNSET, endpoint.getMarkupURL());
-      assertNull(info.getRegistrationInfo());
+      assertTrue(info.getRegistrationInfo().isUndetermined());
 
       assertNull(registry.getConsumer("inexistent"));
       Collection consumers = registry.getConfiguredConsumers();

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * JBoss, a division of Red Hat                                               *
- * Copyright 2007, Red Hat Middleware, LLC, and individual                    *
+ * Copyright 2009, 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.                                                   *
@@ -152,7 +152,8 @@
    public void testRefreshAndRegistration() throws Exception
    {
       assertFalse(info.isRegistered());
-      assertNull(info.getRegistrationInfo());
+      RegistrationInfo regInfo = info.getRegistrationInfo();
+      assertTrue(regInfo.isUndetermined());
 
       ServiceDescriptionBehavior sd = new ServiceDescriptionBehavior();
       sd.setRequiresRegistration(true);
@@ -173,7 +174,8 @@
    public void testGetRegistrationContext() throws Exception
    {
       assertFalse(info.isRegistered());
-      assertNull(info.getRegistrationInfo());
+      RegistrationInfo regInfo = info.getRegistrationInfo();
+      assertTrue(regInfo.isUndetermined());
 
       ServiceDescriptionBehavior sd = new ServiceDescriptionBehavior();
       sd.setRequiresRegistration(true);

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * JBoss, a division of Red Hat                                               *
- * Copyright 2007, Red Hat Middleware, LLC, and individual                    *
+ * Copyright 2009, 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.                                                   *
@@ -56,13 +56,7 @@
     */
    public MockConsumerRegistry()
    {
-      consumers.put(CONSUMER1, new MockWSRPConsumer(CONSUMER1));
-      MockWSRPConsumer consumer = new MockWSRPConsumer(CONSUMER2);
-      consumer.getProducerInfo().setActive(true);
-      EndpointConfigurationInfo info = consumer.getProducerInfo().getEndpointConfigurationInfo();
-      info.setServiceDescriptionURL(MOCK_SERVICE_DESCRIPTION);
-      info.setMarkupURL(MOCK_MARKUP);
-      consumers.put(CONSUMER2, consumer);
+      reloadConsumers();
    }
 
    public List<WSRPConsumer> getConfiguredConsumers()
@@ -118,4 +112,16 @@
    {
       // do nothing
    }
+
+   public void reloadConsumers()
+   {
+      consumers.clear();
+      consumers.put(CONSUMER1, new MockWSRPConsumer(CONSUMER1));
+      MockWSRPConsumer consumer = new MockWSRPConsumer(CONSUMER2);
+      consumer.getProducerInfo().setActive(true);
+      EndpointConfigurationInfo info = consumer.getProducerInfo().getEndpointConfigurationInfo();
+      info.setServiceDescriptionURL(MOCK_SERVICE_DESCRIPTION);
+      info.setMarkupURL(MOCK_MARKUP);
+      consumers.put(CONSUMER2, consumer);
+   }
 }

Copied: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/handler/MockSOAPBody.java (from rev 12964, branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/handler/MockSOAPBody.java)
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/handler/MockSOAPBody.java	                        (rev 0)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/handler/MockSOAPBody.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -0,0 +1,57 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, 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.handler;
+
+import org.jboss.util.xml.DOMUtils;
+import org.w3c.dom.Element;
+
+import javax.xml.soap.SOAPBody;
+import java.io.IOException;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class MockSOAPBody implements InvocationHandler
+{
+   Element body;
+
+   public MockSOAPBody(Element body)
+   {
+      this.body = body;
+   }
+
+   public static SOAPBody newInstance(String body) throws IOException
+   {
+      return (SOAPBody)Proxy.newProxyInstance(MockSOAPBody.class.getClassLoader(), new Class[]{SOAPBody.class},
+         new MockSOAPBody(DOMUtils.parse(body)));
+   }
+
+   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+   {
+      return method.invoke(body, args);
+   }
+}

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/handler/MockSOAPMessage.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/handler/MockSOAPMessage.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/handler/MockSOAPMessage.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -25,6 +25,7 @@
 
 import javax.xml.soap.AttachmentPart;
 import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPElement;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPMessage;
@@ -42,8 +43,8 @@
 public class MockSOAPMessage extends SOAPMessage
 {
    MimeHeaders headers;
+   String messageBody;
 
-
    public MockSOAPMessage()
    {
       headers = new MimeHeaders();
@@ -54,6 +55,24 @@
       this.headers = headers;
    }
 
+   public void setMessageBody(String messageBody)
+   {
+      this.messageBody = messageBody;
+   }
+
+   @Override
+   public SOAPBody getSOAPBody() throws SOAPException
+   {
+      try
+      {
+         return MockSOAPBody.newInstance(messageBody);
+      }
+      catch (IOException e)
+      {
+         throw new SOAPException(e);
+      }
+   }
+
    public MimeHeaders getMimeHeaders()
    {
       return headers;

Copied: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/handler/WSRPExtensionHandlerTestCase.java (from rev 12964, branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/handler/WSRPExtensionHandlerTestCase.java)
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/handler/WSRPExtensionHandlerTestCase.java	                        (rev 0)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/handler/WSRPExtensionHandlerTestCase.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -0,0 +1,239 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, 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.handler;
+
+import junit.framework.TestCase;
+import org.jboss.portal.wsrp.handler.WSRPExtensionHandler;
+
+import javax.xml.rpc.handler.HandlerInfo;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class WSRPExtensionHandlerTestCase extends TestCase
+{
+   private WSRPExtensionHandler handler;
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      handler = new WSRPExtensionHandler();
+
+      HandlerInfo info = new HandlerInfo();
+      Map<String, String> config = new HashMap<String, String>();
+      config.put("debug", "false");
+      config.put("removeExtensions", "true");
+      info.setHandlerConfig(config);
+      handler.init(info);
+   }
+
+   public void testRemoveExtensions() throws SOAPException
+   {
+      MockSOAPMessage message = new MockSOAPMessage();
+      message.setMessageBody("<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'\n" +
+         "\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'\n" +
+         "\txmlns:xsd='http://www.w3.org/2001/XMLSchema'\n" +
+         "\txmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>\n" +
+         "\t<env:Body>\n" +
+         "\t\t<ns0:getMarkup xmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t<ns0:registrationContext\n" +
+         "\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t<ns0:registrationHandle\n" +
+         "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t17\n" +
+         "\t\t\t\t</ns0:registrationHandle>\n" +
+         "\t\t\t\t<ns0:registrationState\n" +
+         "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types' />\n" +
+         "\t\t\t</ns0:registrationContext>\n" +
+         "\t\t\t<ns0:portletContext\n" +
+         "\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t<ns0:portletHandle\n" +
+         "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t_18\n" +
+         "\t\t\t\t</ns0:portletHandle>\n" +
+         "\t\t\t\t<ns0:portletState\n" +
+         "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types' />\n" +
+         "\t\t\t</ns0:portletContext>\n" +
+         "\t\t\t<ns0:runtimeContext\n" +
+         "\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t<ns0:userAuthentication xmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\twsrp:none\n" +
+         "\t\t\t\t</ns0:userAuthentication>\n" +
+         "\t\t\t\t<ns0:portletInstanceKey\n" +
+         "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t949994222\n" +
+         "\t\t\t\t</ns0:portletInstanceKey>\n" +
+         "\t\t\t\t<ns0:namespacePrefix\n" +
+         "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t__ns949994222_\n" +
+         "\t\t\t\t</ns0:namespacePrefix>\n" +
+         "\t\t\t</ns0:runtimeContext>\n" +
+         "\t\t\t<ns0:userContext\n" +
+         "\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t<ns0:userContextKey\n" +
+         "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\twsrp:minimal\n" +
+         "\t\t\t\t</ns0:userContextKey>\n" +
+         "\t\t\t\t<ns0:profile\n" +
+         "\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types' />\n" +
+         "\t\t\t</ns0:userContext>\n" +
+         "\t\t\t<ns0:markupParams\n" +
+         "\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t<ns0:secureClientCommunication xmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\tfalse\n" +
+         "\t\t\t\t\t</ns0:secureClientCommunication>\n" +
+         "\t\t\t\t\t<ns0:locales\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\ten-US\n" +
+         "\t\t\t\t\t</ns0:locales>\n" +
+         "\t\t\t\t\t<ns0:mimeTypes\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\ttext/html\n" +
+         "\t\t\t\t\t</ns0:mimeTypes>\n" +
+         "\t\t\t\t\t<ns0:mimeTypes\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\ttext/xml\n" +
+         "\t\t\t\t\t</ns0:mimeTypes>\n" +
+         "\t\t\t\t\t<ns0:mimeTypes\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\ttext/vnd.oracle.mobilexml\n" +
+         "\t\t\t\t\t</ns0:mimeTypes>\n" +
+         "\t\t\t\t\t<ns0:mimeTypes\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\t*\n" +
+         "\t\t\t\t\t</ns0:mimeTypes>\n" +
+         "\t\t\t\t\t<ns0:mode\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\twsrp:view\n" +
+         "\t\t\t\t\t</ns0:mode>\n" +
+         "\t\t\t\t\t<ns0:windowState\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\twsrp:normal\n" +
+         "\t\t\t\t\t</ns0:windowState>\n" +
+         "\t\t\t\t\t<ns0:clientData\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\t<ns0:userAgent\n" +
+         "\t\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\t\tMozilla/5.0 (Windows; U; Windows NT 5.1;\n" +
+         "\t\t\t\t\t\t\ten-US; rv:1.9.0.3) Gecko/2008092417\n" +
+         "\t\t\t\t\t\t\tFirefox/3.0.3\n" +
+         "\t\t\t\t\t\t</ns0:userAgent>\n" +
+         "\t\t\t\t\t\t<ns0:extensions\n" +
+         "\t\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\t\t<ns1:GenericExtension\n" +
+         "\t\t\t\t\t\t\t\txmlns:ns1='http://xmlns.oracle.com/portal/wsrp/v1'>\n" +
+         "\t\t\t\t\t\t\t\t<ns0:NamedString name='CONNECTION'\n" +
+         "\t\t\t\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\t\t\t\t<ns0:value\n" +
+         "\t\t\t\t\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\t\t\t\t\tkeep-alive\n" +
+         "\t\t\t\t\t\t\t\t\t</ns0:value>\n" +
+         "\t\t\t\t\t\t\t\t</ns0:NamedString>\n" +
+         "\t\t\t\t\t\t\t\t<ns0:NamedString name='ACCEPT-ENCODING'\n" +
+         "\t\t\t\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\t\t\t\t<ns0:value xmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\t\t\t\t\tgzip,deflate\n" +
+         "\t\t\t\t\t\t\t\t\t\t</ns0:value>\n" +
+         "\t\t\t\t\t\t\t\t</ns0:NamedString>\n" +
+         "\t\t\t\t\t\t\t\t<ns0:NamedString name='KEEP-ALIVE'\n" +
+         "\t\t\t\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\t\t\t\t<ns0:value xmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\t\t\t\t\t300\n" +
+         "\t\t\t\t\t\t\t\t\t</ns0:value>\n" +
+         "\t\t\t\t\t\t\t\t</ns0:NamedString>\n" +
+         "\t\t\t\t\t\t\t\t<ns0:NamedString name='HOST'\n" +
+         "\t\t\t\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\t\t\t\t<ns0:value xmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\t\t\t\t\t127.0.0.1:8988\n" +
+         "\t\t\t\t\t\t\t\t\t</ns0:value>\n" +
+         "\t\t\t\t\t\t\t\t</ns0:NamedString>\n" +
+         "\t\t\t\t\t\t\t</ns1:GenericExtension>\n" +
+         "\t\t\t\t\t\t</ns0:extensions>\n" +
+         "\t\t\t\t\t</ns0:clientData>\n" +
+         "\t\t\t\t\t<ns0:markupCharacterSets\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\tUTF-8\n" +
+         "\t\t\t\t\t</ns0:markupCharacterSets>\n" +
+         "\t\t\t\t\t<ns0:validNewModes\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\twsrp:view\n" +
+         "\t\t\t\t\t</ns0:validNewModes>\n" +
+         "\t\t\t\t\t<ns0:validNewModes\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\turn:javax:portlet:mode:custo m:edit_defaults\n" +
+         "\t\t\t\t\t</ns0:validNewModes>\n" +
+         "\t\t\t\t\t<ns0:validNewModes\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\twsrp:edit\n" +
+         "\t\t\t\t\t</ns0:validNewModes>\n" +
+         "\t\t\t\t\t<ns0:validNewModes\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\twsrp:help\n" +
+         "\t\t\t\t\t</ns0:validNewModes>\n" +
+         "\t\t\t\t\t<ns0:validNewModes\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\turn:javax:portlet:mode:custo m:about\n" +
+         "\t\t\t\t\t</ns0:validNewModes>\n" +
+         "\t\t\t\t\t<ns0:validNewModes\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\turn:javax:portlet:mode:custo m:print\n" +
+         "\t\t\t\t\t</ns0:validNewModes>\n" +
+         "\t\t\t\t\t<ns0:validNewModes\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\turn:javax:portlet:mode:custo m:config\n" +
+         "\t\t\t\t\t</ns0:validNewModes>\n" +
+         "\t\t\t\t\t<ns0:validNewWindowStates\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\twsrp:normal\n" +
+         "\t\t\t\t\t</ns0:validNewWindowStates>\n" +
+         "\t\t\t\t\t<ns0:validNewWindowStates\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\twsrp:maximized\n" +
+         "\t\t\t\t\t</ns0:validNewWindowStates>\n" +
+         "\t\t\t\t\t<ns0:validNewWindowStates\n" +
+         "\t\t\t\t\t\txmlns:ns0='urn:oasis:names:tc:wsrp:v1:types'>\n" +
+         "\t\t\t\t\t\twsrp:minimized\n" +
+         "\t\t\t\t\t</ns0:validNewWindowStates>\n" +
+         "\t\t\t</ns0:markupParams>\n" +
+         "\t\t</ns0:getMarkup>\n" +
+         "\t</env:Body>\n" +
+         "</env:Envelope>");
+
+
+      SOAPMessageContext msgContext = MockSOAPMessageContext.createMessageContext(message, getClass().getClassLoader());
+
+      handler.handleRequest(msgContext);
+
+      SOAPBody body = msgContext.getMessage().getSOAPBody();
+      String asString = body.toString();
+      assertFalse(asString.contains("ns0:extensions"));
+      assertFalse(asString.contains("ns1:GenericExtensions"));
+      assertFalse(asString.contains("ACCEPT-ENCODING"));
+   }
+}

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * Copyright 2009, 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.                                                   *
@@ -51,7 +51,7 @@
    public void testResource()
    {
       String expected = "wsrp_rewrite?wsrp-urlType=resource&amp;wsrp-url=http%3A%2F%2Ftest.com%2Fimages%2Ftest.gif" +
-              "&amp;wsrp-requiresRewrite=true/wsrp_rewrite";
+         "&amp;wsrp-requiresRewrite=true/wsrp_rewrite";
       WSRPPortletURL url = WSRPPortletURL.create(expected);
 
       assertEquals("http://test.com/images/test.gif", url.toString());
@@ -61,7 +61,7 @@
    public void testSecureInteraction()
    {
       String expected = "wsrp_rewrite?wsrp-urlType=blockingAction&amp;wsrp-secureURL=true" +
-              "&amp;wsrp-navigationalState=a8h4K5JD9&amp;wsrp-interactionState=fg4h923mdk/wsrp_rewrite";
+         "&amp;wsrp-navigationalState=a8h4K5JD9&amp;wsrp-interactionState=fg4h923mdk/wsrp_rewrite";
       WSRPPortletURL url = WSRPPortletURL.create(expected);
 
       assertTrue(url instanceof WSRPActionURL);
@@ -195,25 +195,27 @@
       checkInvalidURL(invalid, "Should have detected invalid URL: ", "invalidURL");
    }
 
-   private void checkInvalidURL(String invalid, String message, String mustBeInException)
+   public void testNullURL()
    {
       try
       {
-         WSRPPortletURL.create(invalid);
-         fail(message + mustBeInException);
+         WSRPPortletURL.create(null);
+         fail("Should have detected null URL");
       }
       catch (IllegalArgumentException e)
       {
-         assertTrue(e.getLocalizedMessage().contains(mustBeInException));
+         // expected
       }
    }
 
-   public void testNullURL()
+   public void testInvalidURLType()
    {
+      String wrongURLType = "wsrp_rewrite?wsrp-urlType=pipo&amp;wsrp-mode=help/wsrp_rewrite";
+
       try
       {
-         WSRPPortletURL.create(null);
-         fail("Should have detected null URL");
+         WSRPPortletURL.create(wrongURLType);
+         fail("Should have detected wrong URL type");
       }
       catch (IllegalArgumentException e)
       {
@@ -221,18 +223,36 @@
       }
    }
 
-   public void testInvalidURLType()
+   public void testProperEndTokenInRelaxedMode()
    {
-      String wrongURLType = "wsrp_rewrite?wsrp-urlType=pipo&amp;wsrp-mode=help/wsrp_rewrite";
+      WSRPPortletURL.setStrict(false);
 
+      WSRPPortletURL url = new WSRPPortletURL()
+      {
+         @Override
+         protected String getURLType()
+         {
+            return WSRPRewritingConstants.URL_TYPE_BLOCKING_ACTION;
+         }
+
+         @Override
+         protected void appendEnd(StringBuffer sb)
+         {
+         }
+      };
+      assertTrue(url.toString().contains(WSRPRewritingConstants.END_WSRP_REWRITE));
+   }
+
+   private void checkInvalidURL(String invalid, String message, String mustBeInException)
+   {
       try
       {
-         WSRPPortletURL.create(wrongURLType);
-         fail("Should have detected wrong URL type");
+         WSRPPortletURL.create(invalid);
+         fail(message + mustBeInException);
       }
       catch (IllegalArgumentException e)
       {
-         // expected
+         assertTrue(e.getLocalizedMessage().contains(mustBeInException));
       }
    }
 }
\ No newline at end of file

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -144,7 +144,7 @@
       // now modify Producer's set of required registration info
       String newPropName = "New Prop";
       RegistrationPropertyDescription regProp = new RegistrationPropertyDescription(newPropName,
-              new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
+         new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
       regProp.setDefaultLabel("New Registration Property");
       producer.getProducerRegistrationRequirements().addRegistrationProperty(regProp);
 
@@ -184,10 +184,20 @@
       // remove registration context, try again and check that we get new registration info
       gs.setRegistrationContext(null);
       PropertyDescription[] pds = serviceDescriptionService.getServiceDescription(gs)
-              .getRegistrationPropertyDescription().getPropertyDescriptions();
+         .getRegistrationPropertyDescription().getPropertyDescriptions();
       ExtendedAssert.assertEquals(2, pds.length);
-      assertEquals(WSRPUtils.convertToPropertyDescription(regProp), pds[1]);
 
+      // Check that one of the returned property description is equal to the one we just added
+      PropertyDescription description = pds[1];
+      if (description.getName().startsWith("New"))
+      {
+         assertEquals(WSRPUtils.convertToPropertyDescription(regProp), description);
+      }
+      else
+      {
+         assertEquals(WSRPUtils.convertToPropertyDescription(regProp), pds[0]);
+      }
+
       // Update registration data
       RegistrationData regData = createBaseRegData();
       org.jboss.portal.wsrp.core.Property[] props = regData.getRegistrationProperties();
@@ -211,7 +221,7 @@
       // now modify Producer's set of required registration info
       String newPropName = "New Prop";
       RegistrationPropertyDescription regProp = new RegistrationPropertyDescription(newPropName,
-              new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
+         new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
       regProp.setDefaultLabel("New Registration Property");
       producer.getProducerRegistrationRequirements().addRegistrationProperty(regProp);
 

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -117,16 +117,16 @@
       ExtendedAssert.assertEquals(1, markupTypes.length);
       MarkupType markupType = markupTypes[0];
       assertEquals(new MarkupType("text/html", new String[]{WSRPConstants.VIEW_MODE},
-              new String[]{WSRPConstants.NORMAL_WINDOW_STATE, WSRPConstants.MAXIMIZED_WINDOW_STATE, WSRPConstants.MINIMIZED_WINDOW_STATE},
-              new String[]{"en"}, null), markupType);
+         new String[]{WSRPConstants.NORMAL_WINDOW_STATE, WSRPConstants.MAXIMIZED_WINDOW_STATE, WSRPConstants.MINIMIZED_WINDOW_STATE},
+         new String[]{"en"}, null), markupType);
    }
 
    protected ServiceDescription checkServiceDescriptionWithOnlyBasicPortlet(GetServiceDescription gs)
-           throws Exception
+      throws Exception
    {
       deploy("test-basic-portlet.war");
       //Invoke the Web Service
-      ServiceDescription sd = serviceDescriptionService.getServiceDescription(gs);                    
+      ServiceDescription sd = serviceDescriptionService.getServiceDescription(gs);
 
       ExtendedAssert.assertNotNull("sd != null", sd);
 
@@ -149,7 +149,7 @@
    }
 
    protected RegistrationContext registerConsumer()
-           throws org.jboss.portal.wsrp.core.MissingParametersFault, org.jboss.portal.wsrp.core.OperationFailedFault, java.rmi.RemoteException
+      throws org.jboss.portal.wsrp.core.MissingParametersFault, org.jboss.portal.wsrp.core.OperationFailedFault, java.rmi.RemoteException
    {
       RegistrationData registrationData = createBaseRegData();
       return registrationService.register(registrationData);
@@ -173,7 +173,7 @@
       {
          // fix-me: http://jira.jboss.com/jira/browse/JBPORTAL-821
          RegistrationPropertyDescription regProp = new RegistrationPropertyDescription("regProp",
-                 new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
+            new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
          regProp.setDefaultLabel("Registration Property");
          producer.getProducerRegistrationRequirements().addRegistrationProperty(regProp);
 
@@ -246,7 +246,7 @@
 
    protected static void assertEquals(PropertyDescription expected, PropertyDescription tested)
    {
-      String message = "Expected: <" + expected + ">, got: <" + tested + ">. Failed on: ";
+      String message = "Expected: <" + expected + ">, got: <" + tested + ">. Failed on ";
 
       if (expected != tested)
       {
@@ -255,16 +255,18 @@
             ExtendedAssert.fail(message + "Different classes or not both null.");
          }
 
-         ExtendedAssert.assertEquals(expected.getExtensions(), tested.getExtensions(), false, message + "Extensions");
-         assertEquals(message + "Hint", expected.getHint(), tested.getHint());
-         assertEquals(message + "Label", expected.getLabel(), tested.getLabel());
-         ExtendedAssert.assertEquals(message + "Name", expected.getName(), tested.getName());
-         ExtendedAssert.assertEquals(message + "Type", expected.getType(), tested.getType());
+         ExtendedAssert.assertEquals(expected.getExtensions(), tested.getExtensions(), false, message + "extensions.");
+         assertEquals(message + "hint.", expected.getHint(), tested.getHint());
+         assertEquals(message + "label.", expected.getLabel(), tested.getLabel());
+         ExtendedAssert.assertEquals(message + "name.", expected.getName(), tested.getName());
+         ExtendedAssert.assertEquals(message + "type.", expected.getType(), tested.getType());
       }
    }
 
    protected static void assertEquals(String message, LocalizedString expected, LocalizedString tested)
    {
+      String precise = "Expected: <" + expected + ">, got: <" + tested + ">. Failed on ";
+
       if (expected != tested)
       {
          if (expected == null || tested == null)
@@ -272,9 +274,9 @@
             ExtendedAssert.fail(message + ": Different classes or not both null.");
          }
 
-         ExtendedAssert.assertEquals(expected.getLang(), tested.getLang());
-         ExtendedAssert.assertEquals(expected.getResourceName(), tested.getResourceName());
-         ExtendedAssert.assertEquals(expected.getValue(), tested.getValue());
+         ExtendedAssert.assertEquals(precise + "lang.", expected.getLang(), tested.getLang());
+         ExtendedAssert.assertEquals(precise + "resource name.", expected.getResourceName(), tested.getResourceName());
+         ExtendedAssert.assertEquals(precise + "value.", expected.getValue(), tested.getValue());
       }
    }
 

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * Copyright 2009, 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.                                                   *
@@ -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.wsrp;
 
 import org.jboss.portal.Mode;

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * Copyright 2009, 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.                                                   *
@@ -347,13 +347,13 @@
       //
       if (mode != null)
       {
-         createURLParameter(sb, WSRPRewritingConstants.MODE, mode.toString());
+         createURLParameter(sb, WSRPRewritingConstants.MODE, WSRPUtils.getWSRPNameFromJSR168PortletMode(mode));
       }
 
       //
       if (windowState != null)
       {
-         createURLParameter(sb, WSRPRewritingConstants.WINDOW_STATE, windowState.toString());
+         createURLParameter(sb, WSRPRewritingConstants.WINDOW_STATE, WSRPUtils.getWSRPNameFromJSR168WindowState(windowState));
       }
 
       // todo: not sure how to deal with authenticated
@@ -369,19 +369,15 @@
       else
       {
          // we're in relaxed mode so we need to deal with extra params if they exist
-         StringBuffer extras = null;
          if (extraParams != null && !extraParams.isEmpty())
          {
-            extras = new StringBuffer();
+            StringBuffer extras = new StringBuffer();
             for (Map.Entry<String, String> entry : extraParams.entrySet())
             {
                createURLParameter(extras, entry.getKey(), entry.getValue());
             }
-         }
 
-         // if we had extra params, we need to figure out where thwy should be positioned wrt end token
-         if (extras != null)
-         {
+            // if we had extra params, we need to figure out where thwy should be positioned wrt end token
             if (extraParamsAfterEndToken)
             {
                sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
@@ -393,6 +389,10 @@
                sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
             }
          }
+         else
+         {
+            sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
+         }
       }
       return sb.toString();
    }

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -1,24 +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.
-*/
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2009, 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.wsrp.consumer;
 
@@ -60,4 +61,6 @@
    void registerOrDeregisterConsumerWith(String id, boolean register) throws ConsumerException;
 
    void destroyConsumer(String id) throws ConsumerException;
+
+   void reloadConsumers();
 }
\ No newline at end of file

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * Copyright 2009, 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.                                                   *
@@ -262,7 +262,11 @@
    {
       InitialContext initialContext = new InitialContext();
       sessionFactory = (SessionFactory)initialContext.lookup(sessionFactoryJNDIName);
+      reloadConsumers();
+   }
 
+   public void reloadConsumers()
+   {
       // load the configured consumers
       consumers = new TreeMap<String, WSRPConsumer>();
 

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * JBoss, a division of Red Hat                                               *
- * Copyright 2007, Red Hat Middleware, LLC, and individual                    *
+ * Copyright 2009, 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.                                                   *
@@ -123,6 +123,7 @@
    public ProducerInfo()
    {
       persistentEndpointInfo = new EndpointConfigurationInfo(this);
+      persistentRegistrationInfo = RegistrationInfo.createUndeterminedRegistration(this);
    }
 
    public ConsumerRegistry getRegistry()
@@ -176,10 +177,7 @@
    public RegistrationInfo getRegistrationInfo()
    {
       // update parent since it might not be set when unfrozen from Hibernate
-      if (persistentRegistrationInfo != null)
-      {
-         persistentRegistrationInfo.setParent(this);
-      }
+      persistentRegistrationInfo.setParent(this);
       return persistentRegistrationInfo;
    }
 
@@ -190,35 +188,30 @@
 
    public boolean isRegistered()
    {
-      if (persistentRegistrationInfo != null)
+      Boolean valid = persistentRegistrationInfo.isRegistrationValid();
+      if (valid == null)
       {
-         Boolean valid = persistentRegistrationInfo.isRegistrationValid();
-         if (valid == null)
-         {
-            return persistentRegistrationInfo.getRegistrationHandle() != null;
-         }
-         else
-         {
-            return valid;
-         }
+         return persistentRegistrationInfo.getRegistrationHandle() != null;
       }
-
-      return false;
+      else
+      {
+         return valid;
+      }
    }
 
    public boolean isRegistrationRequired()
    {
-      return persistentRegistrationInfo != null && persistentRegistrationInfo.isRegistrationDeterminedRequired();
+      return persistentRegistrationInfo.isRegistrationDeterminedRequired();
    }
 
    public boolean isRegistrationChecked()
    {
-      return persistentRegistrationInfo != null && persistentRegistrationInfo.isRegistrationRequired() != null;
+      return persistentRegistrationInfo.isRegistrationRequired() != null;
    }
 
    public boolean hasLocalRegistrationInfo()
    {
-      return persistentRegistrationInfo != null && persistentRegistrationInfo.hasLocalInfo();
+      return persistentRegistrationInfo.hasLocalInfo();
    }
 
    /**
@@ -250,7 +243,7 @@
 
    public boolean isModifyRegistrationRequired()
    {
-      return isModifyRegistrationRequired || (persistentRegistrationInfo != null && persistentRegistrationInfo.isModifyRegistrationNeeded());
+      return isModifyRegistrationRequired || persistentRegistrationInfo.isModifyRegistrationNeeded();
    }
 
    // FIX-ME: remove when a better dirty management is in place at property level
@@ -345,7 +338,7 @@
          try
          {
             // if we don't yet have registration information, get an unregistered service description
-            serviceDescription = getUnmanagedServiceDescription(persistentRegistrationInfo == null);
+            serviceDescription = getUnmanagedServiceDescription(persistentRegistrationInfo.isUndetermined());
             result.setServiceDescription(serviceDescription);
          }
          catch (OperationFailedFault operationFailedFault)
@@ -409,7 +402,7 @@
    }
 
    private RefreshResult refreshInfo(boolean forceRefresh, ServiceDescription serviceDescription, RefreshResult result)
-           throws PortletInvokerException
+      throws PortletInvokerException
    {
       // do we need to call initCookie or not?
       requiresInitCookie = serviceDescription.getRequiresInitCookie();
@@ -542,8 +535,8 @@
       if (info.isUsesMethodGet())
       {
          log.warn("Portlet '" + portletHandle
-                 + "' uses the GET method in forms. Since we don't handle this, this portlet will be excluded from " +
-                 "the list of offered portlets for producer " + persistentId);
+            + "' uses the GET method in forms. Since we don't handle this, this portlet will be excluded from " +
+            "the list of offered portlets for producer " + persistentId);
       }
       else
       {
@@ -616,7 +609,7 @@
          catch (Exception e)
          {
             log.debug("Couldn't get portlet via getPortletDescription for producer '" + persistentId
-                    + "'. Attempting to retrieve it from the service description as this producer might not support the PortletManagement interface.", e);
+               + "'. Attempting to retrieve it from the service description as this producer might not support the PortletManagement interface.", e);
 
             justRefreshed = refresh(true);
             portlet = getPortletFromCaches(portletHandle, justRefreshed);
@@ -686,7 +679,7 @@
    private boolean isCacheExpired()
    {
       boolean result = !useCache() || System.currentTimeMillis() > expirationTimeMillis || popsMap == null
-              || portletGroups == null;
+         || portletGroups == null;
       if (result)
       {
          log.debug("Cache expired or not used");
@@ -765,7 +758,7 @@
    {
       Throwable cause = e.getCause();
       throw new InvokerUnavailableException("Problem getting service description for producer "
-              + persistentId + ", please see the logs for more information. ", cause == null ? e : cause);
+         + persistentId + ", please see the logs for more information. ", cause == null ? e : cause);
    }
 
    private GetServiceDescription getServiceDescriptionRequest(boolean asUnregistred) throws PortletInvokerException
@@ -787,7 +780,7 @@
 
    public RegistrationContext getRegistrationContext() throws PortletInvokerException
    {
-      if (persistentRegistrationInfo == null)
+      if (persistentRegistrationInfo.isUndetermined())
       {
          refresh(false);
       }
@@ -797,10 +790,7 @@
 
    public void resetRegistration() throws PortletInvokerException
    {
-      if (persistentRegistrationInfo != null)
-      {
-         persistentRegistrationInfo.resetRegistration();
-      }
+      persistentRegistrationInfo.resetRegistration();
 
       invalidateCache();
       registry.updateProducerInfo(this);
@@ -835,7 +825,7 @@
             throw new RuntimeException("Couldn't reset registration", e);
          }
          throw new IllegalArgumentException("Couldn't get property descriptions for portlet '" + portletHandle
-                 + "' because the provided registration is invalid!");
+            + "' because the provided registration is invalid!");
       }
       catch (Exception e)
       {
@@ -863,11 +853,6 @@
     */
    private RefreshResult register(ServiceDescription serviceDescription, boolean forceRefresh) throws PortletInvokerException
    {
-      if (persistentRegistrationInfo == null)
-      {
-         persistentRegistrationInfo = new RegistrationInfo(this);
-      }
-
       if (!isRegistered())
       {
          persistentEndpointInfo.refresh();
@@ -887,7 +872,7 @@
                {
                   log.debug("Attempting registration");
                   RegistrationContext registrationContext = persistentEndpointInfo.getRegistrationService()
-                          .register(persistentRegistrationInfo.getRegistrationData());
+                     .register(persistentRegistrationInfo.getRegistrationData());
 
                   if (registrationContext == null)
                   {
@@ -897,7 +882,7 @@
 
                   persistentRegistrationInfo.setRegistrationContext(registrationContext);
                   String msg = "Consumer with id '" + persistentId + "' successfully registered with handle: '"
-                          + registrationContext.getRegistrationHandle() + "'";
+                     + registrationContext.getRegistrationHandle() + "'";
                   log.debug(msg);
                   RefreshResult res = new RefreshResult();
                   res.setRegistrationResult(result);
@@ -955,7 +940,7 @@
 
    public void modifyRegistration() throws PortletInvokerException
    {
-      if (persistentRegistrationInfo != null && persistentRegistrationInfo.getRegistrationHandle() != null)
+      if (persistentRegistrationInfo.getRegistrationHandle() != null)
       {
          persistentEndpointInfo.refresh();
 
@@ -963,7 +948,7 @@
          {
             RegistrationContext registrationContext = getRegistrationContext();
             ModifyRegistration modifyRegistration = WSRPTypeFactory.createModifyRegistration(registrationContext,
-                    persistentRegistrationInfo.getRegistrationData());
+               persistentRegistrationInfo.getRegistrationData());
             RegistrationState state = persistentEndpointInfo.getRegistrationService().modifyRegistration(modifyRegistration);
 
             // force refresh of internal RegistrationInfo state
@@ -993,7 +978,7 @@
       else
       {
          throw new IllegalStateException("Cannot modify registration for producer '" + persistentId
-                 + "' as it's not registered");
+            + "' as it's not registered");
       }
    }
 
@@ -1007,13 +992,8 @@
 
    private RefreshResult internalRefreshRegistration(ServiceDescription serviceDescription, boolean mergeWithLocalInfo, boolean forceRefresh, boolean forceCheckOfExtraProps) throws PortletInvokerException
    {
-      if (persistentRegistrationInfo == null)
-      {
-         persistentRegistrationInfo = new RegistrationInfo(this);
-      }
-
       RefreshResult result =
-              persistentRegistrationInfo.refresh(serviceDescription, persistentId, mergeWithLocalInfo, forceRefresh, forceCheckOfExtraProps);
+         persistentRegistrationInfo.refresh(serviceDescription, persistentId, mergeWithLocalInfo, forceRefresh, forceCheckOfExtraProps);
 
       log.debug("Refreshed registration information for consumer with id '" + persistentId + "'");
 
@@ -1023,9 +1003,8 @@
    public boolean isRefreshNeeded(boolean considerCache)
    {
       boolean result = (considerCache && isCacheExpired())
-              || persistentRegistrationInfo == null
-              || persistentRegistrationInfo.isRefreshNeeded()
-              || persistentEndpointInfo.isRefreshNeeded();
+         || persistentRegistrationInfo.isRefreshNeeded()
+         || persistentEndpointInfo.isRefreshNeeded();
       if (result)
       {
          log.debug("Refresh needed for producer '" + persistentId + "'");
@@ -1042,7 +1021,7 @@
 
    public void eraseRegistrationInfo()
    {
-      persistentRegistrationInfo = null;
+      persistentRegistrationInfo = RegistrationInfo.createUndeterminedRegistration(this);
 
       registry.updateProducerInfo(this);
 

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -30,6 +30,7 @@
 import org.jboss.portal.wsrp.WSRPConstants;
 import org.jboss.portal.wsrp.core.SessionContext;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -43,7 +44,7 @@
  * @version $Revision$
  * @since 2.4 (May 30, 2006)
  */
-public class ProducerSessionInformation
+public class ProducerSessionInformation implements Serializable
 {
    private static Logger log = Logger.getLogger(ProducerSessionInformation.class);
 
@@ -63,7 +64,7 @@
    private Cookie[] userCookie;
 
    /** Parent SessionHandler so that session mappings can be updated */
-   private SessionHandler parent;
+   private transient SessionHandler parent;
 
    /** The identifier of the Session containing this ProducerSessionInformation */
    private String parentSessionId;
@@ -464,7 +465,7 @@
       }
    }
 
-   private class SessionInfo
+   private class SessionInfo implements Serializable
    {
       private SessionContext sessionContext;
       private long lastInvocationTime;

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * JBoss, a division of Red Hat                                               *
- * Copyright 2007, Red Hat Middleware, LLC, and individual                    *
+ * Copyright 2009, 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.                                                   *
@@ -68,6 +68,12 @@
    private transient boolean modifyRegistrationNeeded;
    private transient ProducerInfo parent;
 
+   /**
+    * Marker string to identify a RegistrationInfo created for a producer that might not require registration as a work
+    * around https://jira.jboss.org/jira/browse/JBPORTAL-2284
+    */
+   private static final String UNDETERMINED_REGISTRATION = "__JBP__UNDETERMINED__REGISTRATION__";
+
    public RegistrationInfo(ProducerInfo producerInfo)
    {
       this();
@@ -76,6 +82,18 @@
       parent = producerInfo;
    }
 
+   static RegistrationInfo createUndeterminedRegistration(ProducerInfo producerInfo)
+   {
+      RegistrationInfo info = new RegistrationInfo(producerInfo);
+      info.setConsumerName(UNDETERMINED_REGISTRATION);
+      return info;
+   }
+
+   public boolean isUndetermined()
+   {
+      return UNDETERMINED_REGISTRATION.equals(persistentConsumerName);
+   }
+
    public RegistrationInfo(ProducerInfo producerInfo, boolean requiresRegistration)
    {
       this(producerInfo);
@@ -379,6 +397,12 @@
 
       if (forceRefresh || isRefreshNeeded())
       {
+         // if we were previously undetermined, become determined! :)
+         if (isUndetermined())
+         {
+            setConsumerName(WSRPConstants.DEFAULT_CONSUMER_NAME);
+         }
+
          // get a service description if we don't already have one
          if (serviceDescription == null && parent != null)
          {

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/handler/WSRPExtensionHandler.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/handler/WSRPExtensionHandler.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/handler/WSRPExtensionHandler.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -23,23 +23,18 @@
 package org.jboss.portal.wsrp.handler;
 
 import org.jboss.logging.Logger;
-import org.jboss.util.xml.DOMUtils;
-import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
 
 import javax.xml.namespace.QName;
 import javax.xml.rpc.handler.GenericHandler;
 import javax.xml.rpc.handler.HandlerInfo;
 import javax.xml.rpc.handler.MessageContext;
 import javax.xml.rpc.handler.soap.SOAPMessageContext;
-import javax.xml.soap.Node;
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPMessage;
-import java.util.Iterator;
 
-//$Id$
-
 /**
- * JAX-RPC Handler that strips the SOAP Message of any WSRP extensions. Right now, only operates on response messages.
+ * JAX-RPC Handler that strips the SOAP Message of any WSRP extensions.
  *
  * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
  * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
@@ -93,31 +88,7 @@
          if (removeExtensions)
          {
             SOAPBody soapBody = soapMessage.getSOAPBody();
-            Element firstEl = DOMUtils.getFirstChildElement(soapBody);
-            Iterator iter = DOMUtils.getChildElements(firstEl);
-            while (iter.hasNext())
-            {
-               Element elt = (Element)iter.next();
-               String nodeName = elt.getNodeName();
-               if (EXTENSIONS.equals(nodeName))
-               {
-                  removeChildrenOf(elt);
-               }
-               else
-               {
-                  Iterator extensions = DOMUtils.getChildElements(elt, EXTENSIONS);
-                  if (extensions.hasNext())
-                  {
-                     log.debug("extensions exist on " + nodeName);
-                     Element exts = (Element)extensions.next();
-                     removeChildrenOf(exts);
-                     if (debug)
-                     {
-                        soapMessage.writeTo(System.out);
-                     }
-                  }
-               }
-            }
+            traverseAndRemoveExtensions(soapBody);
          }
       }
       catch (Exception e)
@@ -126,27 +97,39 @@
       }
    }
 
-   private void removeChildrenOf(Element element)
+   /**
+    * Remove extensions nodes recursively, depth-first.
+    *
+    * @param node
+    */
+   private void traverseAndRemoveExtensions(org.w3c.dom.Node node)
    {
-      Iterator children = DOMUtils.getChildElements(element);
-      while (children.hasNext())
+      NodeList children = node.getChildNodes();
+      int childrenNb = children.getLength();
+      for (int i = 0; i < childrenNb; i++)
       {
-         Node node = (Node)children.next();
-         element.removeChild(node);
-      }
-   }
+         org.w3c.dom.Node child = children.item(i);
 
-   /*private boolean shouldRemoveWSRPExtensions(SOAPHeader soapHeader)
-   {
-      boolean result = false;
-      if (soapHeader != null)
-      {
-         Iterator iter = DOMUtils.getChildElements(soapHeader, "jboss_wsrp_remove_extension");
-         if (iter.hasNext())
+         // only process elements
+         if (org.w3c.dom.Node.ELEMENT_NODE == child.getNodeType())
          {
-            result = true;
+            String name = child.getLocalName();
+
+            // if we found an extension, remove it or continue
+            if (EXTENSIONS.equals(name))
+            {
+               if (debug)
+               {
+                  log.debug("Extensions removed on " + name);
+               }
+               node.removeChild(child);
+               break;
+            }
+            else
+            {
+               traverseAndRemoveExtensions(child);
+            }
          }
       }
-      return result;
-   }*/
+   }
 }

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -456,33 +456,12 @@
     */
    Registration getRegistrationOrFailIfInvalid(RegistrationContext registrationContext) throws InvalidRegistrationFault, OperationFailedFault
    {
-      Registration registration = getRegistrationFrom(registrationContext);
-      isRegistrationValid(registration, true);
+      Registration registration = registrationHandler.getRegistrationFrom(registrationContext);
+      registrationHandler.isRegistrationValid(registration, true);
 
       return registration;
    }
 
-   /**
-    * @param registration
-    * @param throwExceptionIfInvalid
-    * @return
-    * @since 2.6.2
-    */
-   boolean isRegistrationValid(Registration registration, boolean throwExceptionIfInvalid) throws InvalidRegistrationFault
-   {
-      return registrationHandler.isRegistrationValid(registration, throwExceptionIfInvalid);
-   }
-
-   /**
-    * @param registrationContext
-    * @return
-    * @since 2.6.2
-    */
-   Registration getRegistrationFrom(RegistrationContext registrationContext)
-   {
-      return registrationHandler.getRegistrationFrom(registrationContext);
-   }
-
    private Boolean remotableByDefault;
 
    public Boolean isRemotableByDefault()

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java	2009-03-06 23:22:50 UTC (rev 12986)
@@ -73,13 +73,16 @@
 
    private static DefaultSchemaResolver RESOLVER;
 
+   private static final String PRODUCER_NAMESPACE = "urn:jboss:portal:wsrp:producer:v2_7";
+   private static final String PRODUCER_XSD = "jboss-wsrp-producer_2_7.xsd";
+
    static
    {
       RESOLVER = new DefaultSchemaResolver();
       RESOLVER.setCacheResolvedSchemas(true);
       RESOLVER.addSchemaLocation("http://www.w3.org/XML/1998/namespace", "xsd/xml.xsd");
       RESOLVER.addSchemaLocation("urn:jboss:portal:wsrp:producer:v2_6", "xsd/jboss-wsrp-producer_2_6.xsd");
-      RESOLVER.addSchemaLocation("urn:jboss:portal:wsrp:producer:v2_7", "xsd/jboss-wsrp-producer_2_7.xsd");
+      RESOLVER.addSchemaLocation(PRODUCER_NAMESPACE, "xsd/" + PRODUCER_XSD);
    }
 
    public String getConfigLocation()
@@ -111,8 +114,27 @@
       {
          throw new RuntimeException("Couldn't locate server data dir!", e);
       }
-      config = new File(dataDir, "portal/wsrp-producer-config.xml");
 
+      // if "portal" directory doesn't exist already in data, create it (JBPORTAL-2229)
+      File portalDir = new File(dataDir, "portal");
+      if (!portalDir.exists())
+      {
+         if (!portalDir.mkdir())
+         {
+            throw new RuntimeException("Couldn't create 'portal' directory in " + dataDir.getAbsolutePath());
+         }
+      }
+      else
+      {
+         if (!portalDir.isDirectory())
+         {
+            throw new RuntimeException("Was expecting a directory named 'portal' in " + dataDir.getAbsolutePath()
+               + ", not a simple file! Cannot continue.");
+         }
+      }
+
+      config = new File(portalDir, "wsrp-producer-config.xml");
+
       reloadConfiguration();
    }
 
@@ -129,7 +151,7 @@
          if (config.exists())
          {
             log.debug("Configuration saved at " + config.getCanonicalPath()
-                    + " is not loading properly. Falling back to default configuration.");
+               + " is not loading properly. Falling back to default configuration.");
             config.delete(); // delete improper config so that we retrieve the default configuration
             loadConfigurationAt(getConfigLocationURL());
          }
@@ -229,7 +251,7 @@
       StringWriter xmlOutput = new StringWriter();
 
       // get the XML Schema source
-      InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("xsd/jboss-wsrp-producer_2_6.xsd");
+      InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("xsd/" + PRODUCER_XSD);
 
       Reader xsReader = new InputStreamReader(is);
 
@@ -239,15 +261,15 @@
       marshaller.setSchemaResolver(RESOLVER);
 
       // we need to specify what elements are top most (roots) providing namespace URI, prefix and local name
-      marshaller.addRootElement("urn:jboss:portal:wsrp:producer:v2_6", "", "producer-configuration");
+      marshaller.addRootElement(PRODUCER_NAMESPACE, "", "producer-configuration");
 
       // declare default namespace
-      marshaller.declareNamespace("wpc", "urn:jboss:portal:wsrp:producer:v2_6");
+      marshaller.declareNamespace("wpc", PRODUCER_NAMESPACE);
 
       // add schema location by declaring xsi namespace and adding xsi:schemaLocation attribute
       marshaller.declareNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
       marshaller.addAttribute("xsi", "schemaLocation", "string",
-              "urn:jboss:portal:wsrp:producer:v2_6 http://www.jboss.org/portal/xsd/jboss-wsrp-producer_2_6.xsd");
+         PRODUCER_NAMESPACE + " http://www.jboss.org/portal/xsd/" + PRODUCER_XSD);
 
       // create an instance of Object Model Provider
       ObjectModelProvider provider = new ProducerConfigurationProvider();

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/resources/portal-wsrp-client-jar/META-INF/wsdl/wsrp_v1_types.xsd
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/resources/portal-wsrp-client-jar/META-INF/wsdl/wsrp_v1_types.xsd	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/resources/portal-wsrp-client-jar/META-INF/wsdl/wsrp_v1_types.xsd	2009-03-06 23:22:50 UTC (rev 12986)
@@ -50,8 +50,8 @@
 
   <complexType name="Extension">
     <sequence>
-      <!-- JBoss modification: added processContents="lax" to better process extensions. -->
-       <any namespace="##other" processContents="lax"/>
+      <!-- JBoss modification: added processContents="skip" to better process extensions. -->
+       <any namespace="##other" processContents="skip"/>
     </sequence>
   </complexType>
 
@@ -502,8 +502,8 @@
     <sequence>
       <!-- Would prefer this to be a choice ... Axis and JAX-RPC failed to handle that -->
        <element name="stringValue" type="xsd:string" minOccurs="0"/>
-       <!-- JBoss modification: added processContents="lax" to better process extensions. -->
-       <any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
+       <!-- JBoss modification: added processContents="skip" to better process extensions. -->
+       <any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
        <!-- end prefer this to be a choice -->
     </sequence>
     <attribute name="name" type="xsd:string" use="required"/>
@@ -536,8 +536,8 @@
 
   <complexType name="ModelTypes">
     <sequence>
-      <!-- JBoss modification: added processContents="lax" to better process extensions. -->
-       <any namespace="##other" processContents="lax"/>
+      <!-- JBoss modification: added processContents="skip" to better process extensions. -->
+       <any namespace="##other" processContents="skip"/>
     </sequence>
   </complexType>
 

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/resources/portal-wsrp-war/WEB-INF/wsdl/wsrp_v1_types.xsd
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/resources/portal-wsrp-war/WEB-INF/wsdl/wsrp_v1_types.xsd	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/resources/portal-wsrp-war/WEB-INF/wsdl/wsrp_v1_types.xsd	2009-03-06 23:22:50 UTC (rev 12986)
@@ -50,8 +50,8 @@
 
   <complexType name="Extension">
     <sequence>
-      <!-- JBoss modification: added processContents="lax" to better process extensions. -->
-       <any namespace="##other" processContents="lax"/>
+      <!-- JBoss modification: added processContents="skip" to better process extensions. -->
+       <any namespace="##other" processContents="skip"/>
     </sequence>
   </complexType>
 
@@ -502,8 +502,8 @@
     <sequence>
       <!-- Would prefer this to be a choice ... Axis and JAX-RPC failed to handle that -->
        <element name="stringValue" type="xsd:string" minOccurs="0"/>
-       <!-- JBoss modification: added processContents="lax" to better process extensions. -->
-       <any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
+       <!-- JBoss modification: added processContents="skip" to better process extensions. -->
+       <any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
        <!-- end prefer this to be a choice -->
     </sequence>
     <attribute name="name" type="xsd:string" use="required"/>
@@ -536,8 +536,8 @@
 
   <complexType name="ModelTypes">
     <sequence>
-      <!-- JBoss modification: added processContents="lax" to better process extensions. -->
-       <any namespace="##other" processContents="lax"/>
+      <!-- JBoss modification: added processContents="skip" to better process extensions. -->
+       <any namespace="##other" processContents="skip"/>
     </sequence>
   </complexType>
 

Modified: branches/JBoss_Portal_AS5_Deployer/wsrp/src/resources/webservice/wsrp_v1_types.xsd
===================================================================
--- branches/JBoss_Portal_AS5_Deployer/wsrp/src/resources/webservice/wsrp_v1_types.xsd	2009-03-06 23:22:39 UTC (rev 12985)
+++ branches/JBoss_Portal_AS5_Deployer/wsrp/src/resources/webservice/wsrp_v1_types.xsd	2009-03-06 23:22:50 UTC (rev 12986)
@@ -50,8 +50,8 @@
 
   <complexType name="Extension">
     <sequence>
-      <!-- JBoss modification: added processContents="lax" to better process extensions. -->
-       <any namespace="##other" processContents="lax"/>
+      <!-- JBoss modification: added processContents="skip" to better process extensions. -->
+       <any namespace="##other" processContents="skip"/>
     </sequence>
   </complexType>
 
@@ -502,8 +502,8 @@
     <sequence>
       <!-- Would prefer this to be a choice ... Axis and JAX-RPC failed to handle that -->
        <element name="stringValue" type="xsd:string" minOccurs="0"/>
-       <!-- JBoss modification: added processContents="lax" to better process extensions. -->
-       <any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
+       <!-- JBoss modification: added processContents="skip" to better process extensions. -->
+       <any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
        <!-- end prefer this to be a choice -->
     </sequence>
     <attribute name="name" type="xsd:string" use="required"/>
@@ -536,8 +536,8 @@
 
   <complexType name="ModelTypes">
     <sequence>
-      <!-- JBoss modification: added processContents="lax" to better process extensions. -->
-       <any namespace="##other" processContents="lax"/>
+      <!-- JBoss modification: added processContents="skip" to better process extensions. -->
+       <any namespace="##other" processContents="skip"/>
     </sequence>
   </complexType>
 




More information about the portal-commits mailing list