Author: chris.laprun(a)jboss.com
Date: 2007-06-17 12:39:12 -0400 (Sun, 17 Jun 2007)
New Revision: 7451
Modified:
trunk/wsrp/build.xml
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
Log:
- ProducerInfo.getRegistrationContext was providing a code path where out of date
information could be sent to the Producer.
Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml 2007-06-17 09:14:54 UTC (rev 7450)
+++ trunk/wsrp/build.xml 2007-06-17 16:39:12 UTC (rev 7451)
@@ -342,7 +342,7 @@
<!-- ================================================================== -->
<target name="main" depends="most"/>
- <target name="all" depends="_default:all"/>
+ <target name="all" depends="_default:all, explode"/>
<target name="most" depends="_default:most"/>
<target name="help" depends="_default:help"/>
@@ -780,7 +780,7 @@
name="org.jboss.portal.test.wsrp.consumer.ProducerSessionInformationTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.consumer.EndpointConfigurationInfoTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.consumer.ProducerInfoTestCase"/>
- <test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.consumer.RegistrationInfoTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.consumer.RegistrationInfoTestCase"/>
<zest todir="${test.reports}"
name="org.jboss.portal.test.wsrp.consumer.ConsumerRegistryTestCase"
outfile="TEST-ConsumerRegistryTestCase">
<parameter name="Config"
value="persistent-jboss-beans.xml"/>
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java 2007-06-17
09:14:54 UTC (rev 7450)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java 2007-06-17
16:39:12 UTC (rev 7451)
@@ -43,6 +43,7 @@
import org.jboss.portal.wsrp.core.MissingParametersFault;
import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
+import org.jboss.portal.wsrp.core.RegistrationContext;
import java.rmi.RemoteException;
@@ -147,6 +148,24 @@
assertEquals(1, regBehavior.getCallCount());
}
+ public void testGetRegistrationContext() throws Exception
+ {
+ assertFalse(info.isRegistered());
+ assertNull(info.getRegistrationInfo());
+
+ ServiceDescriptionBehavior sd = new ServiceDescriptionBehavior();
+ sd.setRequiresRegistration(true);
+ serviceFactory.getRegistry().setServiceDescriptionBehavior(sd);
+ RegistrationBehavior regBehavior = new RegistrationBehavior();
+ serviceFactory.getRegistry().setRegistrationBehavior(regBehavior);
+
+ RegistrationContext registrationContext = info.getRegistrationContext();
+ assertNotNull(registrationContext);
+ assertEquals(RegistrationBehavior.REGISTRATION_HANDLE,
registrationContext.getRegistrationHandle());
+ assertEquals("Registration should have occured", 1,
regBehavior.getCallCount());
+ assertEquals("Service description should have been called once unregistered
and once registered", 2, sd.getCallCount());
+ }
+
private static class TestPortletManagementBehavior extends PortletManagementBehavior
{
public PortletDescriptionResponse getPortletDescription(GetPortletDescription
getPortletDescription)
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java 2007-06-17
09:14:54 UTC (rev 7450)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java 2007-06-17
16:39:12 UTC (rev 7451)
@@ -208,7 +208,7 @@
getActionRequest(request).setUserContext(userContext);
}
- protected void updateRegistrationContext(Object request)
+ protected void updateRegistrationContext(Object request) throws
PortletInvokerException
{
getActionRequest(request).setRegistrationContext(consumer.getRegistrationContext());
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java 2007-06-17
09:14:54 UTC (rev 7450)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java 2007-06-17
16:39:12 UTC (rev 7451)
@@ -252,7 +252,7 @@
protected abstract void updateUserContext(Object request, UserContext userContext);
- protected abstract void updateRegistrationContext(Object request);
+ protected abstract void updateRegistrationContext(Object request) throws
PortletInvokerException;
protected abstract RuntimeContext getRuntimeContextFrom(Object request);
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-06-17
09:14:54 UTC (rev 7450)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-06-17
16:39:12 UTC (rev 7451)
@@ -257,7 +257,7 @@
// POPs and rest of producer info separetely...
if (forceRefresh || isRefreshNeeded(true))
{
- log.debug("Refreshing...");
+ log.debug("Refreshing info for producer '" + getId() +
"'");
RefreshResult result = new RefreshResult(true, REFRESH_MEANING);
try
{
@@ -270,7 +270,8 @@
// save changes to endpoint
registry.updateProducerInfo(this);
- serviceDescription = getServiceDescription(false);
+ // if we don't yet have registration information, get an unregistered
service description
+ serviceDescription = getServiceDescription(persistentRegistrationInfo == null);
// do we need to call initCookie or not?
requiresInitCookie = serviceDescription.getRequiresInitCookie();
@@ -567,7 +568,7 @@
}
}
- private GetServiceDescription getServiceDescriptionRequest(boolean asUnregistred)
+ private GetServiceDescription getServiceDescriptionRequest(boolean asUnregistred)
throws PortletInvokerException
{
//todo: might need to implement customization of default service description
GetServiceDescription gsd = WSRPTypeFactory.createGetServiceDescription();
@@ -584,9 +585,14 @@
}
}
- public RegistrationContext getRegistrationContext()
+ public RegistrationContext getRegistrationContext() throws PortletInvokerException
{
- return persistentRegistrationInfo == null ? null :
persistentRegistrationInfo.getRegistrationContext();
+ if (persistentRegistrationInfo == null)
+ {
+ refresh(false);
+ }
+
+ return persistentRegistrationInfo.getRegistrationContext();
}
public void resetRegistration() throws PortletInvokerException
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2007-06-17
09:14:54 UTC (rev 7450)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2007-06-17
16:39:12 UTC (rev 7451)
@@ -23,8 +23,9 @@
package org.jboss.portal.wsrp.consumer;
+import org.jboss.portal.common.net.URLTools;
import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.common.net.URLTools;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
@@ -131,7 +132,7 @@
getRenderRequest(request).setUserContext(userContext);
}
- protected void updateRegistrationContext(Object request)
+ protected void updateRegistrationContext(Object request) throws
PortletInvokerException
{
getRenderRequest(request).setRegistrationContext(consumer.getRegistrationContext());
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-06-17
09:14:54 UTC (rev 7450)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-06-17
16:39:12 UTC (rev 7451)
@@ -443,7 +443,7 @@
producerInfo.resetRegistration();
}
- RegistrationContext getRegistrationContext()
+ RegistrationContext getRegistrationContext() throws PortletInvokerException
{
return producerInfo.getRegistrationContext();
}