Author: chris.laprun(a)jboss.com
Date: 2010-05-27 12:51:39 -0400 (Thu, 27 May 2010)
New Revision: 3209
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorBackedServiceFactory.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorRegistry.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducer.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducerImpl.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorRegistry.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/MarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/PortletManagementBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/RegistrationBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/ServiceDescriptionBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestProducerBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducer.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducerImpl.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicPortletManagementBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicServiceDescriptionBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/DestroyClonesPortletManagementBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/EmptyMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/GroupedPortletsServiceDescriptionBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieNotRequiredMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/NullMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerGroupInitCookieMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerUserInitCookieMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/ResourceMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/SessionMarkupBehavior.java
Removed:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/BehaviorRegistry.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/TestWSRPProducer.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/TestWSRPProducerImpl.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/BehaviorBackedServiceFactory.java
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/EndpointConfigurationInfoTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationInfoTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationPropertyTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/WSRPConsumerBaseTest.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/InteropServiceDescriptionTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/MarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicPortletManagementBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/DestroyClonesPortletManagementBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/EmptyMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieNotRequiredMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/NullMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/PerGroupInitCookieMarkupBehavior.java
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/ResourceMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/SessionMarkupBehavior.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockEndpointConfigurationInfo.java
Log:
- Duplicated TestWSRPProducer and behavior structure for WSRP 2 so that both versions of
the protocol can be tested.
- Moved classes so that we can isolate classes that can only work with one version of the
protocol in a specific package (not completely done).
- Activated tests should now all pass.
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/EndpointConfigurationInfoTestCase.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/EndpointConfigurationInfoTestCase.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/EndpointConfigurationInfoTestCase.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -26,7 +26,7 @@
import junit.framework.TestCase;
import org.gatein.pc.api.InvokerUnavailableException;
import org.gatein.wsrp.services.ServiceFactory;
-import org.gatein.wsrp.test.support.BehaviorBackedServiceFactory;
+import org.gatein.wsrp.test.protocol.v2.BehaviorBackedServiceFactory;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -25,34 +25,36 @@
import junit.framework.TestCase;
import org.gatein.pc.api.Portlet;
-import org.gatein.pc.api.PortletContext;
import org.gatein.pc.api.PortletInvokerException;
-import org.gatein.wsrp.spec.v1.WSRP1ExceptionFactory;
-import org.gatein.wsrp.test.protocol.v1.PortletManagementBehavior;
-import org.gatein.wsrp.test.protocol.v1.RegistrationBehavior;
-import org.gatein.wsrp.test.protocol.v1.ServiceDescriptionBehavior;
-import org.gatein.wsrp.test.support.BehaviorBackedServiceFactory;
+import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.test.protocol.v2.BehaviorBackedServiceFactory;
+import org.gatein.wsrp.test.protocol.v2.PortletManagementBehavior;
+import org.gatein.wsrp.test.protocol.v2.RegistrationBehavior;
+import org.gatein.wsrp.test.protocol.v2.ServiceDescriptionBehavior;
import org.gatein.wsrp.test.support.MockConsumerRegistry;
-import org.oasis.wsrp.v1.V1AccessDenied;
-import org.oasis.wsrp.v1.V1Extension;
-import org.oasis.wsrp.v1.V1InconsistentParameters;
-import org.oasis.wsrp.v1.V1InvalidHandle;
-import org.oasis.wsrp.v1.V1InvalidRegistration;
-import org.oasis.wsrp.v1.V1InvalidRegistrationFault;
-import org.oasis.wsrp.v1.V1InvalidUserCategory;
-import org.oasis.wsrp.v1.V1MissingParameters;
-import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1OperationFailedFault;
-import org.oasis.wsrp.v1.V1PortletContext;
-import org.oasis.wsrp.v1.V1PortletDescription;
-import org.oasis.wsrp.v1.V1Property;
-import org.oasis.wsrp.v1.V1RegistrationContext;
-import org.oasis.wsrp.v1.V1RegistrationData;
-import org.oasis.wsrp.v1.V1ResourceList;
-import org.oasis.wsrp.v1.V1UserContext;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.InconsistentParameters;
+import org.oasis.wsrp.v2.InvalidHandle;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.InvalidRegistrationFault;
+import org.oasis.wsrp.v2.InvalidUserCategory;
+import org.oasis.wsrp.v2.Lifetime;
+import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.OperationFailedFault;
+import org.oasis.wsrp.v2.OperationNotSupported;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.Property;
import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.RegistrationData;
+import org.oasis.wsrp.v2.ResourceList;
+import org.oasis.wsrp.v2.ResourceSuspended;
+import org.oasis.wsrp.v2.UserContext;
import javax.jws.WebParam;
+import javax.xml.namespace.QName;
import javax.xml.ws.Holder;
import java.util.List;
@@ -173,14 +175,14 @@
// activate caching for this test so that we can simulate portlet deployment on the
producer with a cached SD
info.setExpirationCacheSeconds(1000);
- PortletContext portletContext =
PortletContext.createPortletContext("test");
+ org.gatein.pc.api.PortletContext portletContext =
org.gatein.pc.api.PortletContext.createPortletContext("test");
Portlet portlet = info.getPortlet(portletContext);
assertNotNull(portlet);
assertEquals(portletContext, portlet.getContext());
assertEquals(1, behavior.getCallCount());
// test2 is not in the service description, so it should be looked up via Portlet
Management...
- portletContext = PortletContext.createPortletContext("test2");
+ portletContext =
org.gatein.pc.api.PortletContext.createPortletContext("test2");
// add portlet management behavior
TestPortletManagementBehavior pmBehavior = new TestPortletManagementBehavior();
serviceFactory.getRegistry().setPortletManagementBehavior(pmBehavior);
@@ -193,7 +195,7 @@
serviceFactory.getRegistry().setPortletManagementBehavior(null);
// simulate a new portlet deployment since last time the SD was refreshed
behavior.addPortletDescription(behavior.createPortletDescription("test3",
null));
- portletContext = PortletContext.createPortletContext("test3");
+ portletContext =
org.gatein.pc.api.PortletContext.createPortletContext("test3");
portlet = info.getPortlet(portletContext);
assertEquals(2, behavior.getCallCount());
assertNotNull(portlet);
@@ -355,8 +357,9 @@
private static class TestPortletManagementBehavior extends PortletManagementBehavior
{
+
@Override
- public void getPortletDescription(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1UserContext userContext, @WebParam(name =
"desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> desiredLocales,
@WebParam(name = "portletDescription", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types", mode = WebParam.Mode.OUT)
Holder<V1PortletDescription> portletDescription, @WebParam(name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types",
mode = WebParam.Mode.OUT) Holder<V1ResourceList> resourceList, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types",
mode = WebParam.Mode.OUT) Holder<List<V1Extension>> ext!
ensions) throws V1AccessDenied, V1InconsistentParameters, V1InvalidHandle,
V1InvalidRegistration, V1InvalidUserCategory, V1MissingParameters, V1OperationFailed
+ public void getPortletDescription(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") UserContext userContext, @WebParam(name =
"desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> desiredLocales,
@WebParam(mode = WebParam.Mode.OUT, name = "portletDescription", targetNamespace
= "urn:oasis:names:tc:wsrp:v1:types") Holder<PortletDescription>
portletDescription, @WebParam(mode = WebParam.Mode.OUT, name = "resourceList",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<ResourceList>
resourceList, @WebParam(mode = WebParam.Mode.OUT, name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<Extension>> extensions) thr!
ows MissingParameters, InconsistentParameters, InvalidHandle, InvalidRegistration,
InvalidUserCategory, AccessDenied, OperationFailed
{
super.getPortletDescription(registrationContext, portletContext, userContext,
desiredLocales, portletDescription, resourceList, extensions);
portletDescription.value = createPortletDescription("test2", null);
@@ -365,41 +368,41 @@
private static class TestRegistrationBehavior extends RegistrationBehavior
{
- private static final String PROP_NAME = "prop0";
+ private static final QName PROP_NAME = QName.valueOf("prop0");
private static final String MODIFIED_VALUE = "value2";
private static final String ORIGINAL_VALUE = "value";
@Override
- public void register(@WebParam(name = "consumerName", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") String consumerName, @WebParam(name =
"consumerAgent", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
String consumerAgent, @WebParam(name = "methodGetSupported", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") boolean methodGetSupported, @WebParam(name =
"consumerModes", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
List<String> consumerModes, @WebParam(name = "consumerWindowStates",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") List<String>
consumerWindowStates, @WebParam(name = "consumerUserScopes", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> consumerUserScopes,
@WebParam(name = "customUserProfileData", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> customUserProfileData,
@WebParam(name = "registrationProperties", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<V1Property> regi!
strationProperties, @WebParam(name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types", mode = WebParam.Mode.INOUT)
Holder<List<V1Extension>> extensions, @WebParam(name =
"registrationHandle", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types", mode = WebParam.Mode.OUT)
Holder<String> registrationHandle, @WebParam(name = "registrationState",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types", mode = WebParam.Mode.OUT)
Holder<byte[]> registrationState) throws V1MissingParameters, V1OperationFailed
+ public void register(@WebParam(name = "registrationData", targetNamespace
= "urn:oasis:names:tc:wsrp:v2:types") RegistrationData registrationData,
@WebParam(name = "lifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") Lifetime lifetime, @WebParam(name =
"userContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
UserContext userContext, @WebParam(name = "registrationState", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<byte[]> registrationState, @WebParam(name = "scheduledDestruction",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Lifetime> scheduledDestruction, @WebParam(name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions, @WebParam(name =
"registrationHandle", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<String> registrationHandle) throws Mi!
ssingParameters, OperationFailed, OperationNotSupported
{
- V1Property prop = checkRegistrationData(registrationProperties);
+ Property prop =
checkRegistrationData(registrationData.getRegistrationProperties());
String value = prop.getStringValue();
if (ORIGINAL_VALUE.equals(value) && PROP_NAME.equals(prop.getName()))
{
- super.register(consumerName, consumerAgent, methodGetSupported,
consumerModes, consumerWindowStates, consumerUserScopes, customUserProfileData,
registrationProperties, extensions, registrationHandle, registrationState);
+ super.register(registrationData, lifetime, userContext, registrationState,
scheduledDestruction, extensions, registrationHandle);
return;
}
- throw WSRP1ExceptionFactory.<V1OperationFailed,
V1OperationFailedFault>throwWSException(WSRP1ExceptionFactory.OPERATION_FAILED,
+ throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
value + " is not a valid value for " + PROP_NAME, null);
}
@Override
- public void modifyRegistration(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "registrationData", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RegistrationData registrationData,
@WebParam(name = "registrationState", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types", mode = WebParam.Mode.OUT)
Holder<byte[]> registrationState, @WebParam(name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types", mode = WebParam.Mode.OUT)
Holder<List<V1Extension>> extensions) throws V1InvalidRegistration,
V1MissingParameters, V1OperationFailed
+ public void modifyRegistration(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "registrationData", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationData registrationData,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"registrationState", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<byte[]> registrationState, @WebParam(name = "scheduledDestruction",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Lifetime> scheduledDestruction, @WebParam(name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws InvalidRegistration,
MissingParameters, OperationFailed, OperationNotSupported, ResourceSuspended
{
incrementCallCount();
-
WSRP1ExceptionFactory.throwMissingParametersIfValueIsMissing(registrationContext,
"RegistrationContext", null);
+ WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(registrationContext,
"RegistrationContext", null);
if
(!RegistrationBehavior.REGISTRATION_HANDLE.equals(registrationContext.getRegistrationHandle()))
{
- WSRP1ExceptionFactory.<V1InvalidRegistration,
V1InvalidRegistrationFault>throwWSException(WSRP1ExceptionFactory.INVALID_REGISTRATION,
"Invalid registration", null);
+ WSRPExceptionFactory.<InvalidRegistration,
InvalidRegistrationFault>throwWSException(WSRPExceptionFactory.INVALID_REGISTRATION,
"Invalid registration", null);
}
- WSRP1ExceptionFactory.throwMissingParametersIfValueIsMissing(registrationData,
"RegistrationData", null);
+ WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(registrationData,
"RegistrationData", null);
- V1Property prop =
checkRegistrationData(registrationData.getRegistrationProperties());
+ Property prop =
checkRegistrationData(registrationData.getRegistrationProperties());
String value = prop.getStringValue();
if (MODIFIED_VALUE.equals(value) && PROP_NAME.equals(prop.getName()))
@@ -407,16 +410,17 @@
return;
}
- throw WSRP1ExceptionFactory.<V1OperationFailed,
V1OperationFailedFault>throwWSException(WSRP1ExceptionFactory.OPERATION_FAILED, value
+ throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED, value
+ " is not a valid value for " + PROP_NAME, null);
+
}
- private V1Property checkRegistrationData(List<V1Property>
registrationProperties) throws V1OperationFailed
+ private Property checkRegistrationData(List<Property> registrationProperties)
throws OperationFailed
{
-
WSRP1ExceptionFactory.throwOperationFailedIfValueIsMissing(registrationProperties,
"RegistrationData");
+
WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(registrationProperties,
"RegistrationData");
- V1Property prop = registrationProperties.get(0);
- WSRP1ExceptionFactory.throwOperationFailedIfValueIsMissing(prop,
"Registration property");
+ Property prop = registrationProperties.get(0);
+ WSRPExceptionFactory.throwOperationFailedIfValueIsMissing(prop,
"Registration property");
return prop;
}
}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationInfoTestCase.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationInfoTestCase.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationInfoTestCase.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -26,8 +26,7 @@
import junit.framework.TestCase;
import org.gatein.wsrp.WSRPConstants;
import org.gatein.wsrp.WSRPTypeFactory;
-import org.gatein.wsrp.spec.v1.V2V1Converter;
-import org.gatein.wsrp.test.protocol.v1.ServiceDescriptionBehavior;
+import org.gatein.wsrp.test.protocol.v2.ServiceDescriptionBehavior;
import org.oasis.wsrp.v2.Property;
import org.oasis.wsrp.v2.RegistrationContext;
import org.oasis.wsrp.v2.RegistrationData;
@@ -249,10 +248,15 @@
assertEquals(1, result.getRegistrationProperties().size());
assertFalse(info.isModifyRegistrationNeeded());
- Map regProps = result.getRegistrationProperties();
+ checkProperties(result);
+ }
+
+ private void checkProperties(RegistrationInfo.RegistrationRefreshResult result)
+ {
+ Map<QName, RegistrationProperty> regProps =
result.getRegistrationProperties();
assertNotNull(regProps);
- RegistrationProperty prop = (RegistrationProperty)regProps.get("foo");
+ RegistrationProperty prop = regProps.get(QName.valueOf("foo"));
assertNotNull(prop);
assertEquals("bar", prop.getValue());
assertTrue(prop.isInvalid());
@@ -276,14 +280,7 @@
assertEquals(1, result.getRegistrationProperties().size());
assertTrue(info.isModifyRegistrationNeeded());
- Map regProps = result.getRegistrationProperties();
- assertNotNull(regProps);
-
- RegistrationProperty prop = (RegistrationProperty)regProps.get("foo");
- assertNotNull(prop);
- assertEquals("bar", prop.getValue());
- assertTrue(prop.isInvalid());
- assertEquals(RegistrationProperty.Status.INEXISTENT, prop.getStatus());
+ checkProperties(result);
}
public void testRefreshRegistrationRegistrationNoLocalInfo()
@@ -299,14 +296,14 @@
assertEquals(2, result.getRegistrationProperties().size());
assertFalse(info.isModifyRegistrationNeeded()); // we weren't registered
- Map regProps = result.getRegistrationProperties();
+ Map<QName, RegistrationProperty> regProps =
result.getRegistrationProperties();
assertNotNull(regProps);
- RegistrationProperty prop = (RegistrationProperty)regProps.get("prop0");
+ RegistrationProperty prop = regProps.get(QName.valueOf("prop0"));
assertNotNull(prop);
assertTrue(prop.isInvalid());
assertEquals(RegistrationProperty.Status.MISSING, prop.getStatus());
- prop = (RegistrationProperty)regProps.get("prop1");
+ prop = regProps.get(QName.valueOf("prop1"));
assertNotNull(prop);
assertTrue(prop.isInvalid());
assertEquals(RegistrationProperty.Status.MISSING, prop.getStatus());
@@ -327,14 +324,14 @@
assertEquals(2, result.getRegistrationProperties().size());
assertTrue(info.isModifyRegistrationNeeded());
- Map regProps = result.getRegistrationProperties();
+ Map<QName, RegistrationProperty> regProps =
result.getRegistrationProperties();
assertNotNull(regProps);
- RegistrationProperty prop = (RegistrationProperty)regProps.get("prop0");
+ RegistrationProperty prop = regProps.get(QName.valueOf("prop0"));
assertNotNull(prop);
assertTrue(prop.isInvalid());
assertEquals(RegistrationProperty.Status.MISSING, prop.getStatus());
- prop = (RegistrationProperty)regProps.get("prop1");
+ prop = regProps.get(QName.valueOf("prop1"));
assertNotNull(prop);
assertTrue(prop.isInvalid());
assertEquals(RegistrationProperty.Status.MISSING, prop.getStatus());
@@ -501,12 +498,12 @@
assertNotNull(properties);
assertEquals(1, properties.size());
Property property = properties.get(0);
- assertEquals("prop0", property.getName());
+ assertEquals("prop0", property.getName().toString());
assertEquals(prop0Value, property.getStringValue());
}
private ServiceDescription createServiceDescription(boolean requiresRegistration, int
numberOfProperties)
{
- return
V2V1Converter.toV2ServiceDescription(ServiceDescriptionBehavior.createServiceDescription(requiresRegistration,
numberOfProperties));
+ return ServiceDescriptionBehavior.createServiceDescription(requiresRegistration,
numberOfProperties);
}
}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationPropertyTestCase.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationPropertyTestCase.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationPropertyTestCase.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -25,6 +25,8 @@
import junit.framework.TestCase;
+import javax.xml.namespace.QName;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision: 11941 $
@@ -106,7 +108,7 @@
public void testGetters()
{
- assertEquals("name", prop.getName());
+ assertEquals(QName.valueOf("name"), prop.getName());
assertEquals("value", prop.getValue());
assertEquals("en", prop.getLang());
assertNull(prop.isInvalid());
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/WSRPConsumerBaseTest.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/WSRPConsumerBaseTest.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/WSRPConsumerBaseTest.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -1,39 +1,39 @@
-/******************************************************************************
- * 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 2010, 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.gatein.wsrp.consumer;
import junit.framework.TestCase;
import org.gatein.wsrp.WSRPConsumer;
-import org.gatein.wsrp.test.BehaviorRegistry;
import org.gatein.wsrp.test.ExtendedAssert;
-import org.gatein.wsrp.test.TestWSRPProducer;
-import org.gatein.wsrp.test.TestWSRPProducerImpl;
+import org.gatein.wsrp.test.protocol.v1.BehaviorRegistry;
import org.gatein.wsrp.test.protocol.v1.MarkupBehavior;
import org.gatein.wsrp.test.protocol.v1.PortletManagementBehavior;
import org.gatein.wsrp.test.protocol.v1.RegistrationBehavior;
import org.gatein.wsrp.test.protocol.v1.ServiceDescriptionBehavior;
import org.gatein.wsrp.test.protocol.v1.TestProducerBehavior;
+import org.gatein.wsrp.test.protocol.v1.TestWSRPProducer;
+import org.gatein.wsrp.test.protocol.v1.TestWSRPProducerImpl;
import org.gatein.wsrp.test.protocol.v1.behaviors.BasicMarkupBehavior;
import org.gatein.wsrp.test.protocol.v1.behaviors.BasicPortletManagementBehavior;
import org.gatein.wsrp.test.protocol.v1.behaviors.BasicServiceDescriptionBehavior;
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/InteropServiceDescriptionTestCase.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/InteropServiceDescriptionTestCase.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/InteropServiceDescriptionTestCase.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -1,31 +1,32 @@
/*
-* 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.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.protocol.v1;
import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletInvokerException;
-import org.gatein.wsrp.test.BehaviorRegistry;
import org.gatein.wsrp.test.ExtendedAssert;
+import org.gatein.wsrp.test.protocol.v1.BehaviorRegistry;
import java.util.HashSet;
import java.util.Set;
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -40,8 +40,8 @@
import org.gatein.pc.portlet.impl.spi.AbstractUserContext;
import org.gatein.pc.portlet.impl.spi.AbstractWindowContext;
import org.gatein.wsrp.consumer.ProducerSessionInformation;
-import org.gatein.wsrp.test.BehaviorRegistry;
import org.gatein.wsrp.test.ExtendedAssert;
+import org.gatein.wsrp.test.protocol.v1.BehaviorRegistry;
import org.gatein.wsrp.test.protocol.v1.behaviors.BasicMarkupBehavior;
import org.gatein.wsrp.test.protocol.v1.behaviors.EmptyMarkupBehavior;
import
org.gatein.wsrp.test.protocol.v1.behaviors.GroupedPortletsServiceDescriptionBehavior;
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -1,25 +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 2010, 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.gatein.wsrp.protocol.v1;
@@ -28,8 +28,8 @@
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.PortletStateType;
import org.gatein.pc.api.state.DestroyCloneFailure;
-import org.gatein.wsrp.test.BehaviorRegistry;
import org.gatein.wsrp.test.ExtendedAssert;
+import org.gatein.wsrp.test.protocol.v1.BehaviorRegistry;
import org.gatein.wsrp.test.protocol.v1.behaviors.BasicMarkupBehavior;
import org.gatein.wsrp.test.protocol.v1.behaviors.BasicPortletManagementBehavior;
import
org.gatein.wsrp.test.protocol.v1.behaviors.DestroyClonesPortletManagementBehavior;
Deleted:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/BehaviorRegistry.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/BehaviorRegistry.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/BehaviorRegistry.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -1,115 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.test;
-
-import org.gatein.wsrp.WSRPExceptionFactory;
-import org.gatein.wsrp.test.protocol.v1.MarkupBehavior;
-import org.gatein.wsrp.test.protocol.v1.PortletManagementBehavior;
-import org.gatein.wsrp.test.protocol.v1.RegistrationBehavior;
-import org.gatein.wsrp.test.protocol.v1.ServiceDescriptionBehavior;
-import org.oasis.wsrp.v2.InvalidHandle;
-import org.oasis.wsrp.v2.InvalidHandleFault;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision: 9360 $
- * @since 2.6
- */
-public class BehaviorRegistry
-{
- private final Map<String, MarkupBehavior> behaviors = new HashMap<String,
MarkupBehavior>();
- private PortletManagementBehavior portletManagementBehavior;
- private ServiceDescriptionBehavior serviceDescriptionBehavior;
- private RegistrationBehavior registrationBehavior;
-
- public ServiceDescriptionBehavior getServiceDescriptionBehavior()
- {
- // this is required since the consumer will try to access the producer as soon as
it's started and the test
- // producer will not be properly setup at that time since it's set up in the
test's setUp method...
- if (serviceDescriptionBehavior == null)
- {
- return ServiceDescriptionBehavior.DEFAULT;
- }
-
- return serviceDescriptionBehavior;
- }
-
- public void clear()
- {
- behaviors.clear();
- }
-
- public MarkupBehavior getMarkupBehaviorFor(String handle) throws InvalidHandle
- {
- if (behaviors.containsKey(handle))
- {
- return behaviors.get(handle);
- }
- throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
- "There is no registered MarkupBehavior for handle '" + handle +
"'", null);
- }
-
- public void registerMarkupBehavior(MarkupBehavior behavior)
- {
- for (String handle : behavior.getSupportedHandles())
- {
- MarkupBehavior existing = behaviors.get(handle);
- if (existing != null)
- {
- throw new IllegalArgumentException("Cannot register behavior " +
behavior.getClass().getName()
- + " because it uses a handle '" + handle + "'
that's already associated with behavior "
- + existing.getClass().getName());
- }
- behaviors.put(handle, behavior);
- }
- }
-
- public PortletManagementBehavior getPortletManagementBehavior()
- {
- return portletManagementBehavior;
- }
-
- public void setPortletManagementBehavior(PortletManagementBehavior
portletManagementBehavior)
- {
- this.portletManagementBehavior = portletManagementBehavior;
- }
-
- public void setServiceDescriptionBehavior(ServiceDescriptionBehavior
serviceDescriptionBehavior)
- {
- this.serviceDescriptionBehavior = serviceDescriptionBehavior;
- }
-
- public RegistrationBehavior getRegistrationBehavior()
- {
- return registrationBehavior;
- }
-
- public void setRegistrationBehavior(RegistrationBehavior registrationBehavior)
- {
- this.registrationBehavior = registrationBehavior;
- }
-}
Deleted:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/TestWSRPProducer.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/TestWSRPProducer.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/TestWSRPProducer.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -1,50 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.test;
-
-/**
- * Exposes WSPRProducer test implementation methods - we inject what it returns
- *
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
- * @version $Revision: 10610 $
- */
-public interface TestWSRPProducer
-{
- /** Resets any currently held state. */
- void reset();
-
- BehaviorRegistry getBehaviorRegistry();
-
- /**
- * Sets the currently used portlet handle identifying the MarkupBehavior we're
using. This is needed to be able to
- * dispatch calls to initCookie to the proper behavior.
- *
- * @param handle
- */
- void setCurrentMarkupBehaviorHandle(String handle);
-
- void setRequiresInitCookie(String cookieProtocolAsString);
-
- void usingStrictModeChangedTo(boolean strictMode);
-}
Deleted:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/TestWSRPProducerImpl.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/TestWSRPProducerImpl.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/TestWSRPProducerImpl.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -1,268 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.test;
-
-import org.gatein.wsrp.spec.v1.WSRP1ExceptionFactory;
-import org.gatein.wsrp.test.protocol.v1.MarkupBehavior;
-import org.gatein.wsrp.test.protocol.v1.PortletManagementBehavior;
-import org.gatein.wsrp.test.protocol.v1.ServiceDescriptionBehavior;
-import org.oasis.wsrp.v1.V1AccessDenied;
-import org.oasis.wsrp.v1.V1CookieProtocol;
-import org.oasis.wsrp.v1.V1DestroyFailed;
-import org.oasis.wsrp.v1.V1Extension;
-import org.oasis.wsrp.v1.V1InconsistentParameters;
-import org.oasis.wsrp.v1.V1InteractionParams;
-import org.oasis.wsrp.v1.V1InvalidCookie;
-import org.oasis.wsrp.v1.V1InvalidHandle;
-import org.oasis.wsrp.v1.V1InvalidHandleFault;
-import org.oasis.wsrp.v1.V1InvalidRegistration;
-import org.oasis.wsrp.v1.V1InvalidSession;
-import org.oasis.wsrp.v1.V1InvalidUserCategory;
-import org.oasis.wsrp.v1.V1ItemDescription;
-import org.oasis.wsrp.v1.V1MarkupContext;
-import org.oasis.wsrp.v1.V1MarkupParams;
-import org.oasis.wsrp.v1.V1MissingParameters;
-import org.oasis.wsrp.v1.V1ModelDescription;
-import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1OperationFailedFault;
-import org.oasis.wsrp.v1.V1PortletContext;
-import org.oasis.wsrp.v1.V1PortletDescription;
-import org.oasis.wsrp.v1.V1PortletStateChangeRequired;
-import org.oasis.wsrp.v1.V1Property;
-import org.oasis.wsrp.v1.V1PropertyList;
-import org.oasis.wsrp.v1.V1RegistrationContext;
-import org.oasis.wsrp.v1.V1RegistrationData;
-import org.oasis.wsrp.v1.V1ResetProperty;
-import org.oasis.wsrp.v1.V1ResourceList;
-import org.oasis.wsrp.v1.V1RuntimeContext;
-import org.oasis.wsrp.v1.V1SessionContext;
-import org.oasis.wsrp.v1.V1UnsupportedLocale;
-import org.oasis.wsrp.v1.V1UnsupportedMimeType;
-import org.oasis.wsrp.v1.V1UnsupportedMode;
-import org.oasis.wsrp.v1.V1UnsupportedWindowState;
-import org.oasis.wsrp.v1.V1UpdateResponse;
-import org.oasis.wsrp.v1.V1UserContext;
-import org.oasis.wsrp.v1.WSRPV1MarkupPortType;
-import org.oasis.wsrp.v1.WSRPV1PortletManagementPortType;
-import org.oasis.wsrp.v1.WSRPV1RegistrationPortType;
-import org.oasis.wsrp.v1.WSRPV1ServiceDescriptionPortType;
-import org.oasis.wsrp.v2.InvalidHandle;
-
-import javax.jws.WebParam;
-import javax.xml.ws.Holder;
-import java.util.List;
-
-/**
- * This is dummy clone of org.jboss.portal.wsrp.producer.WSRPProducerImpl customizable
from client side. Just for
- * consumer implementation testing purposes.
- *
- * @author <a href="mailto:Boleslaw.Dawidowicz@jboss.com">Boleslaw
Dawidowicz</a>
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision: 12020 $
- * @since 2.4
- */
-public class TestWSRPProducerImpl implements TestWSRPProducer, WSRPV1MarkupPortType,
WSRPV1PortletManagementPortType, WSRPV1RegistrationPortType,
WSRPV1ServiceDescriptionPortType
-{
- private int sessionExpirationTime = 600;
-
- private V1CookieProtocol requiresInitCookie = V1CookieProtocol.NONE;
-
- private BehaviorRegistry behaviorRegistry = new BehaviorRegistry();
-
- public static final String USER_COOKIE = "cookie";
-
- private String currentMarkupBehaviorHandle;
-
- private boolean strict = true;
-
- public TestWSRPProducerImpl()
- {
- reset();
- }
-
- public BehaviorRegistry getBehaviorRegistry()
- {
- return behaviorRegistry;
- }
-
- public void setCurrentMarkupBehaviorHandle(String handle)
- {
- currentMarkupBehaviorHandle = handle;
- }
-
- public void reset()
- {
- requiresInitCookie = null;
- currentMarkupBehaviorHandle = null;
- behaviorRegistry.clear();
- }
-
- private MarkupBehavior getMarkupBehaviorFor(String portletHandle) throws
V1InvalidHandle
- {
- try
- {
- return behaviorRegistry.getMarkupBehaviorFor(portletHandle);
- }
- catch (InvalidHandle invalidHandle)
- {
- throw WSRP1ExceptionFactory.<V1InvalidHandle,
V1InvalidHandleFault>throwWSException(WSRP1ExceptionFactory.INVALID_HANDLE,
"Invalid handle", null);
- }
- }
-
- private ServiceDescriptionBehavior getServiceDescriptionBehavior()
- {
- return behaviorRegistry.getServiceDescriptionBehavior();
- }
-
- public PortletManagementBehavior getPortletManagementBehavior()
- {
- return behaviorRegistry.getPortletManagementBehavior();
- }
-
- // ServiceDescription implementation
********************************************************************************
-
-
- public void getServiceDescription(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> desiredLocales,
@WebParam(mode = WebParam.Mode.OUT, name = "requiresRegistration",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<Boolean>
requiresRegistration, @WebParam(mode = WebParam.Mode.OUT, name =
"offeredPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1PortletDescription>> offeredPortlets, @WebParam(mode =
WebParam.Mode.OUT, name = "userCategoryDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1ItemDescription>>
userCategoryDescriptions, @WebParam(mode = WebParam.Mode.OUT, name =
"customUserProfileItemDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1ItemDescription>>
customUserProfileIte!
mDescriptions, @WebParam(mode = WebParam.Mode.OUT, name =
"customWindowStateDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1ItemDescription>>
customWindowStateDescriptions, @WebParam(mode = WebParam.Mode.OUT, name =
"customModeDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1ItemDescription>>
customModeDescriptions, @WebParam(mode = WebParam.Mode.OUT, name =
"requiresInitCookie", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<V1CookieProtocol>
requiresInitCookie, @WebParam(mode = WebParam.Mode.OUT, name =
"registrationPropertyDescription", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<V1ModelDescription>
registrationPropertyDescription, @WebParam(mode = WebParam.Mode.OUT, name =
"locales", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<String>> locales, @WebParam(mode = WebParam.Mode.OUT, name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v1:ty!
pes") Holder<V1ResourceList> resourceList, @WebParam(mode = We!
bParam.M
ode.OUT, name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1Extension>>
extensions) throws V1InvalidRegistration, V1OperationFailed
- {
- getServiceDescriptionBehavior().getServiceDescription(registrationContext,
desiredLocales, requiresRegistration,
- offeredPortlets, userCategoryDescriptions, customUserProfileItemDescriptions,
customWindowStateDescriptions,
- customModeDescriptions, requiresInitCookie, registrationPropertyDescription,
locales, resourceList, extensions);
- }
-
- // MarkupService implementation
*************************************************************************************
-
-
- public void performBlockingInteraction(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext registrationContext,
@WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1PortletContext portletContext,
@WebParam(name = "runtimeContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RuntimeContext runtimeContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1UserContext userContext, @WebParam(name =
"markupParams", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
V1MarkupParams markupParams, @WebParam(name = "interactionParams",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1InteractionParams
interactionParams, @WebParam(mode = WebParam.Mode.OUT, name = "updateResponse",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<V1UpdateResponse> updateResponse, @WebParam(mode = WebParam.Mode.OUT, name =
"redir!
ectURL", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<String> redirectURL, @WebParam(mode = WebParam.Mode.OUT, name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> extensions) throws V1UnsupportedMimeType,
V1UnsupportedMode, V1UnsupportedWindowState, V1InvalidCookie, V1InvalidSession,
V1MissingParameters, V1UnsupportedLocale, V1InconsistentParameters,
V1PortletStateChangeRequired, V1InvalidHandle, V1InvalidRegistration,
V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
- {
-
getMarkupBehaviorFor(portletContext.getPortletHandle()).performBlockingInteraction(registrationContext,
portletContext, runtimeContext, userContext, markupParams, interactionParams,
updateResponse, redirectURL, extensions);
- }
-
- public List<V1Extension> releaseSessions(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext registrationContext,
@WebParam(name = "sessionIDs", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> sessionIDs) throws
V1MissingParameters, V1InvalidRegistration, V1AccessDenied, V1OperationFailed
- {
- return null;
- }
-
- public void getMarkup(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1PortletContext portletContext,
@WebParam(name = "runtimeContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RuntimeContext runtimeContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1UserContext userContext, @WebParam(name =
"markupParams", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
V1MarkupParams markupParams, @WebParam(mode = WebParam.Mode.OUT, name =
"markupContext", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<V1MarkupContext> markupContext, @WebParam(mode = WebParam.Mode.OUT, name =
"sessionContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<V1SessionContext>
sessionContext, @WebParam(mode = WebParam.Mode.OUT, name = "!
extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> extensions) throws V1UnsupportedMimeType,
V1UnsupportedMode, V1UnsupportedWindowState, V1InvalidCookie, V1InvalidSession,
V1MissingParameters, V1UnsupportedLocale, V1InconsistentParameters, V1InvalidHandle,
V1InvalidRegistration, V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
- {
-
getMarkupBehaviorFor(portletContext.getPortletHandle()).getMarkup(registrationContext,
portletContext, runtimeContext, userContext, markupParams, markupContext, sessionContext,
extensions);
- }
-
- public List<V1Extension> initCookie(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext registrationContext)
throws V1InvalidRegistration, V1AccessDenied, V1OperationFailed
- {
- // should only be called if we required cookies to be initialized
- if (requiresInitCookie == null ||
V1CookieProtocol.NONE.equals(requiresInitCookie))
- {
- throw WSRP1ExceptionFactory.<V1OperationFailed,
V1OperationFailedFault>throwWSException(WSRP1ExceptionFactory.OPERATION_FAILED,
"Shouldn't have called initCookie", null);
- }
-
- try
- {
- return
getMarkupBehaviorFor(currentMarkupBehaviorHandle).initCookie(registrationContext);
- }
- catch (V1InvalidHandle invalidHandle)
- {
- throw WSRP1ExceptionFactory.<V1OperationFailed,
V1OperationFailedFault>throwWSException(WSRP1ExceptionFactory.OPERATION_FAILED,
"Invalid handle", invalidHandle);
- }
- }
-
- // Registration implementation
**************************************************************************************
-
-
- public void register(@WebParam(name = "consumerName", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") String consumerName, @WebParam(name =
"consumerAgent", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
String consumerAgent, @WebParam(name = "methodGetSupported", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") boolean methodGetSupported, @WebParam(name =
"consumerModes", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
List<String> consumerModes, @WebParam(name = "consumerWindowStates",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") List<String>
consumerWindowStates, @WebParam(name = "consumerUserScopes", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> consumerUserScopes,
@WebParam(name = "customUserProfileData", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> customUserProfileData,
@WebParam(name = "registrationProperties", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<V1Property> registr!
ationProperties, @WebParam(mode = WebParam.Mode.INOUT, name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> extensions, @WebParam(mode = WebParam.Mode.OUT, name
= "registrationHandle", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<String> registrationHandle,
@WebParam(mode = WebParam.Mode.OUT, name = "registrationState", targetNamespace
= "urn:oasis:names:tc:wsrp:v1:types") Holder<byte[]> registrationState)
throws V1MissingParameters, V1OperationFailed
- {
- registrationHandle.value = "registration";
- }
-
- public void modifyRegistration(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "registrationData", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RegistrationData registrationData,
@WebParam(mode = WebParam.Mode.OUT, name = "registrationState", targetNamespace
= "urn:oasis:names:tc:wsrp:v1:types") Holder<byte[]> registrationState,
@WebParam(mode = WebParam.Mode.OUT, name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1Extension>>
extensions) throws V1MissingParameters, V1InvalidRegistration, V1OperationFailed
- {
- // do nothing
- }
-
- public void deregister(@WebParam(name = "registrationHandle",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") String registrationHandle,
@WebParam(name = "registrationState", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") byte[] registrationState, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types",
mode = WebParam.Mode.INOUT) Holder<List<V1Extension>> extensions) throws
V1InvalidRegistration, V1OperationFailed
- {
- // do nothing
- }
-
- // PortletManagement implementation
*********************************************************************************
-
- public void getPortletPropertyDescription(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext registrationContext,
@WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1UserContext userContext, @WebParam(name =
"desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> desiredLocales,
@WebParam(mode = WebParam.Mode.OUT, name = "modelDescription", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<V1ModelDescription>
modelDescription, @WebParam(mode = WebParam.Mode.OUT, name = "resourceList",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<V1ResourceList> resourceList, @WebParam(mode = WebParam.Mode.OUT, name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> exte!
nsions) throws V1MissingParameters, V1InconsistentParameters, V1InvalidHandle,
V1InvalidRegistration, V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
- {
- getPortletManagementBehavior().getPortletPropertyDescription(registrationContext,
portletContext, userContext, desiredLocales, modelDescription, resourceList, extensions);
- }
-
- public void setPortletProperties(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1UserContext userContext, @WebParam(name =
"propertyList", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
V1PropertyList propertyList, @WebParam(mode = WebParam.Mode.OUT, name =
"portletHandle", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<String> portletHandle, @WebParam(mode = WebParam.Mode.OUT, name =
"portletState", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<byte[]> portletState, @WebParam(mode = WebParam.Mode.OUT, name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> extensions) throws V1MissingParameters, V!
1InconsistentParameters, V1InvalidHandle, V1InvalidRegistration, V1InvalidUserCategory,
V1AccessDenied, V1OperationFailed
- {
- getPortletManagementBehavior().setPortletProperties(registrationContext,
portletContext, userContext, propertyList, portletHandle, portletState, extensions);
- }
-
- public void clonePortlet(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1UserContext userContext, @WebParam(mode =
WebParam.Mode.OUT, name = "portletHandle", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<String> portletHandle,
@WebParam(mode = WebParam.Mode.OUT, name = "portletState", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<byte[]> portletState,
@WebParam(mode = WebParam.Mode.OUT, name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1Extension>>
extensions) throws V1MissingParameters, V1InconsistentParameters, V1InvalidHandle,
V1InvalidRegistration, V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
- {
- getPortletManagementBehavior().clonePortlet(registrationContext, portletContext,
userContext, portletHandle, portletState, extensions);
- }
-
- public void getPortletDescription(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1UserContext userContext, @WebParam(name =
"desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> desiredLocales,
@WebParam(mode = WebParam.Mode.OUT, name = "portletDescription", targetNamespace
= "urn:oasis:names:tc:wsrp:v1:types") Holder<V1PortletDescription>
portletDescription, @WebParam(mode = WebParam.Mode.OUT, name = "resourceList",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<V1ResourceList> resourceList, @WebParam(mode = WebParam.Mode.OUT, name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> extens!
ions) throws V1MissingParameters, V1InconsistentParameters, V1InvalidHandle,
V1InvalidRegistration, V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
- {
- getPortletManagementBehavior().getPortletDescription(registrationContext,
portletContext, userContext, desiredLocales, portletDescription, resourceList,
extensions);
- }
-
- public void getPortletProperties(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1UserContext userContext, @WebParam(name =
"names", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
List<String> names, @WebParam(mode = WebParam.Mode.OUT, name =
"properties", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Property>> properties, @WebParam(mode = WebParam.Mode.OUT, name
= "resetProperties", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1ResetProperty>>
resetProperties, @WebParam(mode = WebParam.Mode.OUT, name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> extensions) throws V1MissingPara!
meters, V1InconsistentParameters, V1InvalidHandle, V1InvalidRegistration,
V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
- {
- getPortletManagementBehavior().getPortletProperties(registrationContext,
portletContext, userContext, names, properties, resetProperties, extensions);
- }
-
- public void destroyPortlets(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "portletHandles", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> portletHandles,
@WebParam(mode = WebParam.Mode.OUT, name = "destroyFailed", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1DestroyFailed>>
destroyFailed, @WebParam(mode = WebParam.Mode.OUT, name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> extensions) throws V1MissingParameters,
V1InconsistentParameters, V1InvalidRegistration, V1OperationFailed
- {
- getPortletManagementBehavior().destroyPortlets(registrationContext, portletHandles,
destroyFailed, extensions);
- }
-
- // Producer implementation
******************************************************************************************
-
- public V1CookieProtocol getRequiresInitCookie()
- {
- return requiresInitCookie;
- }
-
- public void setRequiresInitCookie(String cookieProtocolAsString)
- {
- V1CookieProtocol protocol = V1CookieProtocol.fromValue(cookieProtocolAsString);
- this.requiresInitCookie = protocol;
- getServiceDescriptionBehavior().setRequiresInitCookie(requiresInitCookie);
- }
-
- public int getSessionExpirationTime()
- {
- return sessionExpirationTime;
- }
-
- public void setSessionExpirationTime(int sessionExpirationTime)
- {
- this.sessionExpirationTime = sessionExpirationTime;
- }
-
- public void usingStrictModeChangedTo(boolean strictMode)
- {
-// WSRPValidator.setStrict(strictMode);
- strict = strictMode;
- }
-}
Copied:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorBackedServiceFactory.java
(from rev 3203,
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/BehaviorBackedServiceFactory.java)
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorBackedServiceFactory.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorBackedServiceFactory.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,227 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v1;
+
+import org.gatein.common.NotYetImplemented;
+import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.WindowState;
+import org.gatein.wsrp.services.ServiceFactory;
+import org.oasis.wsrp.v1.V1AccessDenied;
+import org.oasis.wsrp.v1.V1GetMarkup;
+import org.oasis.wsrp.v1.V1InconsistentParameters;
+import org.oasis.wsrp.v1.V1InvalidCookie;
+import org.oasis.wsrp.v1.V1InvalidHandle;
+import org.oasis.wsrp.v1.V1InvalidRegistration;
+import org.oasis.wsrp.v1.V1InvalidSession;
+import org.oasis.wsrp.v1.V1InvalidUserCategory;
+import org.oasis.wsrp.v1.V1MissingParameters;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1UnsupportedLocale;
+import org.oasis.wsrp.v1.V1UnsupportedMimeType;
+import org.oasis.wsrp.v1.V1UnsupportedMode;
+import org.oasis.wsrp.v1.V1UnsupportedWindowState;
+import org.oasis.wsrp.v1.WSRPV1MarkupPortType;
+import org.oasis.wsrp.v1.WSRPV1PortletManagementPortType;
+import org.oasis.wsrp.v1.WSRPV1RegistrationPortType;
+import org.oasis.wsrp.v1.WSRPV1ServiceDescriptionPortType;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 11461 $
+ * @since 2.6
+ */
+public class BehaviorBackedServiceFactory implements ServiceFactory
+{
+ private BehaviorRegistry registry;
+ private final static String MARKUP = "markup";
+ private final static String SD_URL = "sd";
+ private final static String M_URL = "m";
+ private final static String PM_URL = "pm";
+ private final static String R_URL = "r";
+ private boolean initialized = false;
+ private String wsdl = DEFAULT_WSDL_URL;
+ public static final String DEFAULT_WSDL_URL =
"http://example.com/producer?wsdl";
+ private int timeout;
+
+
+ public BehaviorBackedServiceFactory()
+ {
+ registry = new BehaviorRegistry();
+ registry.registerMarkupBehavior(new SimpleMarkupBehavior());
+ }
+
+ public <T> T getService(Class<T> serviceClass) throws Exception
+ {
+ if (!isAvailable() && !isFailed())
+ {
+ start();
+ }
+
+ if (WSRPV1ServiceDescriptionPortType.class.isAssignableFrom(serviceClass))
+ {
+ return (T)registry.getServiceDescriptionBehavior();
+ }
+ if (WSRPV1MarkupPortType.class.isAssignableFrom(serviceClass))
+ {
+ return (T)registry.getMarkupBehaviorFor(MARKUP);
+ }
+ if (WSRPV1PortletManagementPortType.class.isAssignableFrom(serviceClass))
+ {
+ return (T)registry.getPortletManagementBehavior();
+ }
+ if (WSRPV1RegistrationPortType.class.isAssignableFrom(serviceClass))
+ {
+ return (T)registry.getRegistrationBehavior();
+ }
+ return null;
+ }
+
+ public BehaviorRegistry getRegistry()
+ {
+ return registry;
+ }
+
+ public void setRegistry(BehaviorRegistry registry)
+ {
+ this.registry = registry;
+ }
+
+ public boolean isAvailable()
+ {
+ return initialized;
+ }
+
+ public boolean isFailed()
+ {
+ return false;
+ }
+
+ public void setFailed(boolean failed)
+ {
+ // do nothing
+ }
+
+ public void setWSOperationTimeOut(int msBeforeTimeOut)
+ {
+ if (msBeforeTimeOut < 0)
+ {
+ msBeforeTimeOut = DEFAULT_TIMEOUT_MS;
+ }
+
+ timeout = msBeforeTimeOut;
+ }
+
+ public int getWSOperationTimeOut()
+ {
+ return timeout;
+ }
+
+ public String getServiceDescriptionURL()
+ {
+ return SD_URL;
+ }
+
+ public String getMarkupURL()
+ {
+ return M_URL;
+ }
+
+ public String getRegistrationURL()
+ {
+ return R_URL;
+ }
+
+ public String getPortletManagementURL()
+ {
+ return PM_URL;
+ }
+
+ public void setServiceDescriptionURL(String serviceDescriptionURL)
+ {
+ // do nothing
+ }
+
+ public void setMarkupURL(String markupURL)
+ {
+ // do nothing
+ }
+
+ public void setRegistrationURL(String registrationURL)
+ {
+ // do nothing
+ }
+
+ public void setPortletManagementURL(String portletManagementURL)
+ {
+ // do nothing
+ }
+
+ public void create() throws Exception
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void start() throws Exception
+ {
+ initialized = true;
+ }
+
+ public void stop()
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void setWsdlDefinitionURL(String wsdlDefinitionURL)
+ {
+ wsdl = wsdlDefinitionURL;
+ }
+
+ public String getWsdlDefinitionURL()
+ {
+ return wsdl;
+ }
+
+ public void destroy()
+ {
+ throw new NotYetImplemented();
+ }
+
+ private class SimpleMarkupBehavior extends MarkupBehavior
+ {
+ public SimpleMarkupBehavior()
+ {
+ super(BehaviorBackedServiceFactory.this.registry);
+ registerHandle(MARKUP);
+ }
+
+ @Override
+ protected String getMarkupString(Mode mode, WindowState windowState, String
navigationalState, V1GetMarkup getMarkup)
+ throws V1UnsupportedWindowState, V1InvalidCookie, V1InvalidSession,
V1AccessDenied, V1InconsistentParameters,
+ V1InvalidHandle, V1UnsupportedLocale, V1UnsupportedMode, V1OperationFailed,
V1MissingParameters, V1InvalidUserCategory,
+ V1InvalidRegistration, V1UnsupportedMimeType
+ {
+ return MARKUP;
+ }
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorBackedServiceFactory.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorRegistry.java
(from rev 3203,
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/BehaviorRegistry.java)
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorRegistry.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorRegistry.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v1;
+
+import org.gatein.wsrp.WSRPExceptionFactory;
+import org.oasis.wsrp.v2.InvalidHandle;
+import org.oasis.wsrp.v2.InvalidHandleFault;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9360 $
+ * @since 2.6
+ */
+public class BehaviorRegistry
+{
+ private final Map<String, MarkupBehavior> behaviors = new HashMap<String,
MarkupBehavior>();
+ private PortletManagementBehavior portletManagementBehavior;
+ private ServiceDescriptionBehavior serviceDescriptionBehavior;
+ private RegistrationBehavior registrationBehavior;
+
+ public ServiceDescriptionBehavior getServiceDescriptionBehavior()
+ {
+ // this is required since the consumer will try to access the producer as soon as
it's started and the test
+ // producer will not be properly setup at that time since it's set up in the
test's setUp method...
+ if (serviceDescriptionBehavior == null)
+ {
+ return ServiceDescriptionBehavior.DEFAULT;
+ }
+
+ return serviceDescriptionBehavior;
+ }
+
+ public void clear()
+ {
+ behaviors.clear();
+ }
+
+ public MarkupBehavior getMarkupBehaviorFor(String handle) throws InvalidHandle
+ {
+ if (behaviors.containsKey(handle))
+ {
+ return behaviors.get(handle);
+ }
+ throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
+ "There is no registered MarkupBehavior for handle '" + handle +
"'", null);
+ }
+
+ public void registerMarkupBehavior(MarkupBehavior behavior)
+ {
+ for (String handle : behavior.getSupportedHandles())
+ {
+ MarkupBehavior existing = behaviors.get(handle);
+ if (existing != null)
+ {
+ throw new IllegalArgumentException("Cannot register behavior " +
behavior.getClass().getName()
+ + " because it uses a handle '" + handle + "'
that's already associated with behavior "
+ + existing.getClass().getName());
+ }
+ behaviors.put(handle, behavior);
+ }
+ }
+
+ public PortletManagementBehavior getPortletManagementBehavior()
+ {
+ return portletManagementBehavior;
+ }
+
+ public void setPortletManagementBehavior(PortletManagementBehavior
portletManagementBehavior)
+ {
+ this.portletManagementBehavior = portletManagementBehavior;
+ }
+
+ public void setServiceDescriptionBehavior(ServiceDescriptionBehavior
serviceDescriptionBehavior)
+ {
+ this.serviceDescriptionBehavior = serviceDescriptionBehavior;
+ }
+
+ public RegistrationBehavior getRegistrationBehavior()
+ {
+ return registrationBehavior;
+ }
+
+ public void setRegistrationBehavior(RegistrationBehavior registrationBehavior)
+ {
+ this.registrationBehavior = registrationBehavior;
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorRegistry.java
___________________________________________________________________
Name: svn:executable
+ *
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/MarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/MarkupBehavior.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/MarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -28,7 +28,6 @@
import org.gatein.pc.api.WindowState;
import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
-import org.gatein.wsrp.test.BehaviorRegistry;
import org.oasis.wsrp.v1.V1AccessDenied;
import org.oasis.wsrp.v1.V1Extension;
import org.oasis.wsrp.v1.V1GetMarkup;
@@ -166,11 +165,10 @@
String markupString =
getMarkupString(WSRPUtils.getJSR168PortletModeFromWSRPName(markupParams.getMode()),
WSRPUtils.getJSR168WindowStateFromWSRPName(markupParams.getWindowState()),
markupParams.getNavigationalState(), gm);
- V1MarkupContext v2MarkupContext =
WSRP1TypeFactory.createMarkupContext(MediaType.TEXT_HTML.getValue(), markupString);
- markupContext.value = v2MarkupContext;
+ markupContext.value =
WSRP1TypeFactory.createMarkupContext(MediaType.TEXT_HTML.getValue(), markupString);
markupContext.value.setRequiresUrlRewriting(Boolean.TRUE);
- V1MarkupResponse markupResponse =
WSRP1TypeFactory.createMarkupResponse(v2MarkupContext);
+ V1MarkupResponse markupResponse =
WSRP1TypeFactory.createMarkupResponse(markupContext.value);
modifyResponseIfNeeded(markupResponse);
}
Copied:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducer.java
(from rev 3203,
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/TestWSRPProducer.java)
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducer.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducer.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v1;
+
+/**
+ * Exposes WSPRProducer test implementation methods - we inject what it returns
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 10610 $
+ */
+public interface TestWSRPProducer
+{
+ /** Resets any currently held state. */
+ void reset();
+
+ BehaviorRegistry getBehaviorRegistry();
+
+ /**
+ * Sets the currently used portlet handle identifying the MarkupBehavior we're
using. This is needed to be able to
+ * dispatch calls to initCookie to the proper behavior.
+ *
+ * @param handle
+ */
+ void setCurrentMarkupBehaviorHandle(String handle);
+
+ void setRequiresInitCookie(String cookieProtocolAsString);
+
+ void usingStrictModeChangedTo(boolean strictMode);
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducer.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducerImpl.java
(from rev 3203,
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/TestWSRPProducerImpl.java)
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducerImpl.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducerImpl.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,265 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v1;
+
+import org.gatein.wsrp.spec.v1.WSRP1ExceptionFactory;
+import org.oasis.wsrp.v1.V1AccessDenied;
+import org.oasis.wsrp.v1.V1CookieProtocol;
+import org.oasis.wsrp.v1.V1DestroyFailed;
+import org.oasis.wsrp.v1.V1Extension;
+import org.oasis.wsrp.v1.V1InconsistentParameters;
+import org.oasis.wsrp.v1.V1InteractionParams;
+import org.oasis.wsrp.v1.V1InvalidCookie;
+import org.oasis.wsrp.v1.V1InvalidHandle;
+import org.oasis.wsrp.v1.V1InvalidHandleFault;
+import org.oasis.wsrp.v1.V1InvalidRegistration;
+import org.oasis.wsrp.v1.V1InvalidSession;
+import org.oasis.wsrp.v1.V1InvalidUserCategory;
+import org.oasis.wsrp.v1.V1ItemDescription;
+import org.oasis.wsrp.v1.V1MarkupContext;
+import org.oasis.wsrp.v1.V1MarkupParams;
+import org.oasis.wsrp.v1.V1MissingParameters;
+import org.oasis.wsrp.v1.V1ModelDescription;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1OperationFailedFault;
+import org.oasis.wsrp.v1.V1PortletContext;
+import org.oasis.wsrp.v1.V1PortletDescription;
+import org.oasis.wsrp.v1.V1PortletStateChangeRequired;
+import org.oasis.wsrp.v1.V1Property;
+import org.oasis.wsrp.v1.V1PropertyList;
+import org.oasis.wsrp.v1.V1RegistrationContext;
+import org.oasis.wsrp.v1.V1RegistrationData;
+import org.oasis.wsrp.v1.V1ResetProperty;
+import org.oasis.wsrp.v1.V1ResourceList;
+import org.oasis.wsrp.v1.V1RuntimeContext;
+import org.oasis.wsrp.v1.V1SessionContext;
+import org.oasis.wsrp.v1.V1UnsupportedLocale;
+import org.oasis.wsrp.v1.V1UnsupportedMimeType;
+import org.oasis.wsrp.v1.V1UnsupportedMode;
+import org.oasis.wsrp.v1.V1UnsupportedWindowState;
+import org.oasis.wsrp.v1.V1UpdateResponse;
+import org.oasis.wsrp.v1.V1UserContext;
+import org.oasis.wsrp.v1.WSRPV1MarkupPortType;
+import org.oasis.wsrp.v1.WSRPV1PortletManagementPortType;
+import org.oasis.wsrp.v1.WSRPV1RegistrationPortType;
+import org.oasis.wsrp.v1.WSRPV1ServiceDescriptionPortType;
+import org.oasis.wsrp.v2.InvalidHandle;
+
+import javax.jws.WebParam;
+import javax.xml.ws.Holder;
+import java.util.List;
+
+/**
+ * This is dummy clone of org.jboss.portal.wsrp.producer.WSRPProducerImpl customizable
from client side. Just for
+ * consumer implementation testing purposes.
+ *
+ * @author <a href="mailto:Boleslaw.Dawidowicz@jboss.com">Boleslaw
Dawidowicz</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 12020 $
+ * @since 2.4
+ */
+public class TestWSRPProducerImpl implements TestWSRPProducer, WSRPV1MarkupPortType,
WSRPV1PortletManagementPortType, WSRPV1RegistrationPortType,
WSRPV1ServiceDescriptionPortType
+{
+ private int sessionExpirationTime = 600;
+
+ private V1CookieProtocol requiresInitCookie = V1CookieProtocol.NONE;
+
+ private BehaviorRegistry behaviorRegistry = new BehaviorRegistry();
+
+ public static final String USER_COOKIE = "cookie";
+
+ private String currentMarkupBehaviorHandle;
+
+ private boolean strict = true;
+
+ public TestWSRPProducerImpl()
+ {
+ reset();
+ }
+
+ public BehaviorRegistry getBehaviorRegistry()
+ {
+ return behaviorRegistry;
+ }
+
+ public void setCurrentMarkupBehaviorHandle(String handle)
+ {
+ currentMarkupBehaviorHandle = handle;
+ }
+
+ public void reset()
+ {
+ requiresInitCookie = null;
+ currentMarkupBehaviorHandle = null;
+ behaviorRegistry.clear();
+ }
+
+ private MarkupBehavior getMarkupBehaviorFor(String portletHandle) throws
V1InvalidHandle
+ {
+ try
+ {
+ return behaviorRegistry.getMarkupBehaviorFor(portletHandle);
+ }
+ catch (InvalidHandle invalidHandle)
+ {
+ throw WSRP1ExceptionFactory.<V1InvalidHandle,
V1InvalidHandleFault>throwWSException(WSRP1ExceptionFactory.INVALID_HANDLE,
"Invalid handle", null);
+ }
+ }
+
+ private ServiceDescriptionBehavior getServiceDescriptionBehavior()
+ {
+ return behaviorRegistry.getServiceDescriptionBehavior();
+ }
+
+ public PortletManagementBehavior getPortletManagementBehavior()
+ {
+ return behaviorRegistry.getPortletManagementBehavior();
+ }
+
+ // ServiceDescription implementation
********************************************************************************
+
+
+ public void getServiceDescription(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> desiredLocales,
@WebParam(mode = WebParam.Mode.OUT, name = "requiresRegistration",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<Boolean>
requiresRegistration, @WebParam(mode = WebParam.Mode.OUT, name =
"offeredPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1PortletDescription>> offeredPortlets, @WebParam(mode =
WebParam.Mode.OUT, name = "userCategoryDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1ItemDescription>>
userCategoryDescriptions, @WebParam(mode = WebParam.Mode.OUT, name =
"customUserProfileItemDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1ItemDescription>>
customUserProfileIte!
mDescriptions, @WebParam(mode = WebParam.Mode.OUT, name =
"customWindowStateDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1ItemDescription>>
customWindowStateDescriptions, @WebParam(mode = WebParam.Mode.OUT, name =
"customModeDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1ItemDescription>>
customModeDescriptions, @WebParam(mode = WebParam.Mode.OUT, name =
"requiresInitCookie", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<V1CookieProtocol>
requiresInitCookie, @WebParam(mode = WebParam.Mode.OUT, name =
"registrationPropertyDescription", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<V1ModelDescription>
registrationPropertyDescription, @WebParam(mode = WebParam.Mode.OUT, name =
"locales", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<String>> locales, @WebParam(mode = WebParam.Mode.OUT, name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v1:ty!
pes") Holder<V1ResourceList> resourceList, @WebParam(mode = We!
bParam.M
ode.OUT, name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1Extension>>
extensions) throws V1InvalidRegistration, V1OperationFailed
+ {
+ getServiceDescriptionBehavior().getServiceDescription(registrationContext,
desiredLocales, requiresRegistration,
+ offeredPortlets, userCategoryDescriptions, customUserProfileItemDescriptions,
customWindowStateDescriptions,
+ customModeDescriptions, requiresInitCookie, registrationPropertyDescription,
locales, resourceList, extensions);
+ }
+
+ // MarkupService implementation
*************************************************************************************
+
+
+ public void performBlockingInteraction(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext registrationContext,
@WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1PortletContext portletContext,
@WebParam(name = "runtimeContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RuntimeContext runtimeContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1UserContext userContext, @WebParam(name =
"markupParams", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
V1MarkupParams markupParams, @WebParam(name = "interactionParams",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1InteractionParams
interactionParams, @WebParam(mode = WebParam.Mode.OUT, name = "updateResponse",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<V1UpdateResponse> updateResponse, @WebParam(mode = WebParam.Mode.OUT, name =
"redir!
ectURL", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<String> redirectURL, @WebParam(mode = WebParam.Mode.OUT, name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> extensions) throws V1UnsupportedMimeType,
V1UnsupportedMode, V1UnsupportedWindowState, V1InvalidCookie, V1InvalidSession,
V1MissingParameters, V1UnsupportedLocale, V1InconsistentParameters,
V1PortletStateChangeRequired, V1InvalidHandle, V1InvalidRegistration,
V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
+ {
+
getMarkupBehaviorFor(portletContext.getPortletHandle()).performBlockingInteraction(registrationContext,
portletContext, runtimeContext, userContext, markupParams, interactionParams,
updateResponse, redirectURL, extensions);
+ }
+
+ public List<V1Extension> releaseSessions(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext registrationContext,
@WebParam(name = "sessionIDs", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> sessionIDs) throws
V1MissingParameters, V1InvalidRegistration, V1AccessDenied, V1OperationFailed
+ {
+ return null;
+ }
+
+ public void getMarkup(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1PortletContext portletContext,
@WebParam(name = "runtimeContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RuntimeContext runtimeContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1UserContext userContext, @WebParam(name =
"markupParams", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
V1MarkupParams markupParams, @WebParam(mode = WebParam.Mode.OUT, name =
"markupContext", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<V1MarkupContext> markupContext, @WebParam(mode = WebParam.Mode.OUT, name =
"sessionContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<V1SessionContext>
sessionContext, @WebParam(mode = WebParam.Mode.OUT, name = "!
extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> extensions) throws V1UnsupportedMimeType,
V1UnsupportedMode, V1UnsupportedWindowState, V1InvalidCookie, V1InvalidSession,
V1MissingParameters, V1UnsupportedLocale, V1InconsistentParameters, V1InvalidHandle,
V1InvalidRegistration, V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
+ {
+
getMarkupBehaviorFor(portletContext.getPortletHandle()).getMarkup(registrationContext,
portletContext, runtimeContext, userContext, markupParams, markupContext, sessionContext,
extensions);
+ }
+
+ public List<V1Extension> initCookie(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext registrationContext)
throws V1InvalidRegistration, V1AccessDenied, V1OperationFailed
+ {
+ // should only be called if we required cookies to be initialized
+ if (requiresInitCookie == null ||
V1CookieProtocol.NONE.equals(requiresInitCookie))
+ {
+ throw WSRP1ExceptionFactory.<V1OperationFailed,
V1OperationFailedFault>throwWSException(WSRP1ExceptionFactory.OPERATION_FAILED,
"Shouldn't have called initCookie", null);
+ }
+
+ try
+ {
+ return
getMarkupBehaviorFor(currentMarkupBehaviorHandle).initCookie(registrationContext);
+ }
+ catch (V1InvalidHandle invalidHandle)
+ {
+ throw WSRP1ExceptionFactory.<V1OperationFailed,
V1OperationFailedFault>throwWSException(WSRP1ExceptionFactory.OPERATION_FAILED,
"Invalid handle", invalidHandle);
+ }
+ }
+
+ // Registration implementation
**************************************************************************************
+
+
+ public void register(@WebParam(name = "consumerName", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") String consumerName, @WebParam(name =
"consumerAgent", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
String consumerAgent, @WebParam(name = "methodGetSupported", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") boolean methodGetSupported, @WebParam(name =
"consumerModes", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
List<String> consumerModes, @WebParam(name = "consumerWindowStates",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") List<String>
consumerWindowStates, @WebParam(name = "consumerUserScopes", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> consumerUserScopes,
@WebParam(name = "customUserProfileData", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> customUserProfileData,
@WebParam(name = "registrationProperties", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<V1Property> registr!
ationProperties, @WebParam(mode = WebParam.Mode.INOUT, name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> extensions, @WebParam(mode = WebParam.Mode.OUT, name
= "registrationHandle", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<String> registrationHandle,
@WebParam(mode = WebParam.Mode.OUT, name = "registrationState", targetNamespace
= "urn:oasis:names:tc:wsrp:v1:types") Holder<byte[]> registrationState)
throws V1MissingParameters, V1OperationFailed
+ {
+ registrationHandle.value = "registration";
+ }
+
+ public void modifyRegistration(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "registrationData", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RegistrationData registrationData,
@WebParam(mode = WebParam.Mode.OUT, name = "registrationState", targetNamespace
= "urn:oasis:names:tc:wsrp:v1:types") Holder<byte[]> registrationState,
@WebParam(mode = WebParam.Mode.OUT, name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1Extension>>
extensions) throws V1MissingParameters, V1InvalidRegistration, V1OperationFailed
+ {
+ // do nothing
+ }
+
+ public void deregister(@WebParam(name = "registrationHandle",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") String registrationHandle,
@WebParam(name = "registrationState", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") byte[] registrationState, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types",
mode = WebParam.Mode.INOUT) Holder<List<V1Extension>> extensions) throws
V1InvalidRegistration, V1OperationFailed
+ {
+ // do nothing
+ }
+
+ // PortletManagement implementation
*********************************************************************************
+
+ public void getPortletPropertyDescription(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext registrationContext,
@WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1UserContext userContext, @WebParam(name =
"desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> desiredLocales,
@WebParam(mode = WebParam.Mode.OUT, name = "modelDescription", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<V1ModelDescription>
modelDescription, @WebParam(mode = WebParam.Mode.OUT, name = "resourceList",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<V1ResourceList> resourceList, @WebParam(mode = WebParam.Mode.OUT, name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> exte!
nsions) throws V1MissingParameters, V1InconsistentParameters, V1InvalidHandle,
V1InvalidRegistration, V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
+ {
+ getPortletManagementBehavior().getPortletPropertyDescription(registrationContext,
portletContext, userContext, desiredLocales, modelDescription, resourceList, extensions);
+ }
+
+ public void setPortletProperties(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1UserContext userContext, @WebParam(name =
"propertyList", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
V1PropertyList propertyList, @WebParam(mode = WebParam.Mode.OUT, name =
"portletHandle", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<String> portletHandle, @WebParam(mode = WebParam.Mode.OUT, name =
"portletState", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<byte[]> portletState, @WebParam(mode = WebParam.Mode.OUT, name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> extensions) throws V1MissingParameters, V!
1InconsistentParameters, V1InvalidHandle, V1InvalidRegistration, V1InvalidUserCategory,
V1AccessDenied, V1OperationFailed
+ {
+ getPortletManagementBehavior().setPortletProperties(registrationContext,
portletContext, userContext, propertyList, portletHandle, portletState, extensions);
+ }
+
+ public void clonePortlet(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1UserContext userContext, @WebParam(mode =
WebParam.Mode.OUT, name = "portletHandle", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<String> portletHandle,
@WebParam(mode = WebParam.Mode.OUT, name = "portletState", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<byte[]> portletState,
@WebParam(mode = WebParam.Mode.OUT, name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1Extension>>
extensions) throws V1MissingParameters, V1InconsistentParameters, V1InvalidHandle,
V1InvalidRegistration, V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
+ {
+ getPortletManagementBehavior().clonePortlet(registrationContext, portletContext,
userContext, portletHandle, portletState, extensions);
+ }
+
+ public void getPortletDescription(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1UserContext userContext, @WebParam(name =
"desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> desiredLocales,
@WebParam(mode = WebParam.Mode.OUT, name = "portletDescription", targetNamespace
= "urn:oasis:names:tc:wsrp:v1:types") Holder<V1PortletDescription>
portletDescription, @WebParam(mode = WebParam.Mode.OUT, name = "resourceList",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<V1ResourceList> resourceList, @WebParam(mode = WebParam.Mode.OUT, name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> extens!
ions) throws V1MissingParameters, V1InconsistentParameters, V1InvalidHandle,
V1InvalidRegistration, V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
+ {
+ getPortletManagementBehavior().getPortletDescription(registrationContext,
portletContext, userContext, desiredLocales, portletDescription, resourceList,
extensions);
+ }
+
+ public void getPortletProperties(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") V1UserContext userContext, @WebParam(name =
"names", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
List<String> names, @WebParam(mode = WebParam.Mode.OUT, name =
"properties", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Property>> properties, @WebParam(mode = WebParam.Mode.OUT, name
= "resetProperties", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1ResetProperty>>
resetProperties, @WebParam(mode = WebParam.Mode.OUT, name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> extensions) throws V1MissingPara!
meters, V1InconsistentParameters, V1InvalidHandle, V1InvalidRegistration,
V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
+ {
+ getPortletManagementBehavior().getPortletProperties(registrationContext,
portletContext, userContext, names, properties, resetProperties, extensions);
+ }
+
+ public void destroyPortlets(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext
registrationContext, @WebParam(name = "portletHandles", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> portletHandles,
@WebParam(mode = WebParam.Mode.OUT, name = "destroyFailed", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1DestroyFailed>>
destroyFailed, @WebParam(mode = WebParam.Mode.OUT, name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<V1Extension>> extensions) throws V1MissingParameters,
V1InconsistentParameters, V1InvalidRegistration, V1OperationFailed
+ {
+ getPortletManagementBehavior().destroyPortlets(registrationContext, portletHandles,
destroyFailed, extensions);
+ }
+
+ // Producer implementation
******************************************************************************************
+
+ public V1CookieProtocol getRequiresInitCookie()
+ {
+ return requiresInitCookie;
+ }
+
+ public void setRequiresInitCookie(String cookieProtocolAsString)
+ {
+ V1CookieProtocol protocol = V1CookieProtocol.fromValue(cookieProtocolAsString);
+ this.requiresInitCookie = protocol;
+ getServiceDescriptionBehavior().setRequiresInitCookie(requiresInitCookie);
+ }
+
+ public int getSessionExpirationTime()
+ {
+ return sessionExpirationTime;
+ }
+
+ public void setSessionExpirationTime(int sessionExpirationTime)
+ {
+ this.sessionExpirationTime = sessionExpirationTime;
+ }
+
+ public void usingStrictModeChangedTo(boolean strictMode)
+ {
+// WSRPValidator.setStrict(strictMode);
+ strict = strictMode;
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/TestWSRPProducerImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicMarkupBehavior.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -28,7 +28,7 @@
import org.gatein.wsrp.WSRPConstants;
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
-import org.gatein.wsrp.test.BehaviorRegistry;
+import org.gatein.wsrp.test.protocol.v1.BehaviorRegistry;
import org.gatein.wsrp.test.protocol.v1.MarkupBehavior;
import org.oasis.wsrp.v1.V1AccessDenied;
import org.oasis.wsrp.v1.V1Extension;
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicPortletManagementBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicPortletManagementBehavior.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/BasicPortletManagementBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -25,7 +25,7 @@
import org.gatein.wsrp.spec.v1.WSRP1ExceptionFactory;
import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
-import org.gatein.wsrp.test.BehaviorRegistry;
+import org.gatein.wsrp.test.protocol.v1.BehaviorRegistry;
import org.gatein.wsrp.test.protocol.v1.MarkupBehavior;
import org.gatein.wsrp.test.protocol.v1.PortletManagementBehavior;
import org.oasis.wsrp.v1.V1AccessDenied;
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/DestroyClonesPortletManagementBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/DestroyClonesPortletManagementBehavior.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/DestroyClonesPortletManagementBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -24,7 +24,7 @@
package org.gatein.wsrp.test.protocol.v1.behaviors;
import org.gatein.wsrp.spec.v1.WSRP1ExceptionFactory;
-import org.gatein.wsrp.test.BehaviorRegistry;
+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.V1InconsistentParameters;
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/EmptyMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/EmptyMarkupBehavior.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/EmptyMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -25,7 +25,7 @@
import org.gatein.pc.api.Mode;
import org.gatein.pc.api.WindowState;
-import org.gatein.wsrp.test.BehaviorRegistry;
+import org.gatein.wsrp.test.protocol.v1.BehaviorRegistry;
import org.gatein.wsrp.test.protocol.v1.MarkupBehavior;
import org.oasis.wsrp.v1.V1AccessDenied;
import org.oasis.wsrp.v1.V1GetMarkup;
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieMarkupBehavior.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -26,7 +26,7 @@
import org.gatein.pc.api.Mode;
import org.gatein.pc.api.WindowState;
import org.gatein.wsrp.spec.v1.WSRP1ExceptionFactory;
-import org.gatein.wsrp.test.BehaviorRegistry;
+import org.gatein.wsrp.test.protocol.v1.BehaviorRegistry;
import org.gatein.wsrp.test.protocol.v1.MarkupBehavior;
import org.oasis.wsrp.v1.V1AccessDenied;
import org.oasis.wsrp.v1.V1Extension;
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieNotRequiredMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieNotRequiredMarkupBehavior.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/InitCookieNotRequiredMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -24,7 +24,7 @@
package org.gatein.wsrp.test.protocol.v1.behaviors;
import org.gatein.wsrp.spec.v1.WSRP1ExceptionFactory;
-import org.gatein.wsrp.test.BehaviorRegistry;
+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;
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/NullMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/NullMarkupBehavior.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/NullMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -25,7 +25,7 @@
import org.gatein.pc.api.Mode;
import org.gatein.pc.api.WindowState;
-import org.gatein.wsrp.test.BehaviorRegistry;
+import org.gatein.wsrp.test.protocol.v1.BehaviorRegistry;
import org.gatein.wsrp.test.protocol.v1.MarkupBehavior;
import org.oasis.wsrp.v1.V1AccessDenied;
import org.oasis.wsrp.v1.V1GetMarkup;
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/PerGroupInitCookieMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/PerGroupInitCookieMarkupBehavior.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/PerGroupInitCookieMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -24,7 +24,7 @@
package org.gatein.wsrp.test.protocol.v1.behaviors;
import org.gatein.wsrp.spec.v1.WSRP1ExceptionFactory;
-import org.gatein.wsrp.test.BehaviorRegistry;
+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;
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-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/PerUserInitCookieMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -1,28 +1,29 @@
/*
-* 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.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v1.behaviors;
-import org.gatein.wsrp.test.BehaviorRegistry;
+import org.gatein.wsrp.test.protocol.v1.BehaviorRegistry;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/ResourceMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/ResourceMarkupBehavior.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/ResourceMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -25,7 +25,7 @@
import org.gatein.pc.api.Mode;
import org.gatein.pc.api.WindowState;
-import org.gatein.wsrp.test.BehaviorRegistry;
+import org.gatein.wsrp.test.protocol.v1.BehaviorRegistry;
import org.gatein.wsrp.test.protocol.v1.MarkupBehavior;
import org.oasis.wsrp.v1.V1AccessDenied;
import org.oasis.wsrp.v1.V1GetMarkup;
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/SessionMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/SessionMarkupBehavior.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/behaviors/SessionMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -26,7 +26,7 @@
import org.gatein.pc.api.Mode;
import org.gatein.pc.api.WindowState;
import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
-import org.gatein.wsrp.test.BehaviorRegistry;
+import org.gatein.wsrp.test.protocol.v1.BehaviorRegistry;
import org.gatein.wsrp.test.protocol.v1.MarkupBehavior;
import org.oasis.wsrp.v1.V1AccessDenied;
import org.oasis.wsrp.v1.V1Extension;
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,224 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2;
+
+import org.gatein.common.NotYetImplemented;
+import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.WindowState;
+import org.gatein.wsrp.services.ServiceFactory;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.GetMarkup;
+import org.oasis.wsrp.v2.InconsistentParameters;
+import org.oasis.wsrp.v2.InvalidCookie;
+import org.oasis.wsrp.v2.InvalidHandle;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.InvalidSession;
+import org.oasis.wsrp.v2.InvalidUserCategory;
+import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.UnsupportedLocale;
+import org.oasis.wsrp.v2.UnsupportedMimeType;
+import org.oasis.wsrp.v2.UnsupportedMode;
+import org.oasis.wsrp.v2.UnsupportedWindowState;
+import org.oasis.wsrp.v2.WSRPV2MarkupPortType;
+import org.oasis.wsrp.v2.WSRPV2PortletManagementPortType;
+import org.oasis.wsrp.v2.WSRPV2RegistrationPortType;
+import org.oasis.wsrp.v2.WSRPV2ServiceDescriptionPortType;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 11461 $
+ * @since 2.6
+ */
+public class BehaviorBackedServiceFactory implements ServiceFactory
+{
+ private BehaviorRegistry registry;
+ private final static String MARKUP = "markup";
+ private final static String SD_URL = "sd";
+ private final static String M_URL = "m";
+ private final static String PM_URL = "pm";
+ private final static String R_URL = "r";
+ private boolean initialized = false;
+ private String wsdl = DEFAULT_WSDL_URL;
+ public static final String DEFAULT_WSDL_URL =
"http://example.com/producer?wsdl";
+ private int timeout;
+
+
+ public BehaviorBackedServiceFactory()
+ {
+ registry = new BehaviorRegistry();
+ registry.registerMarkupBehavior(new SimpleMarkupBehavior());
+ }
+
+ public <T> T getService(Class<T> serviceClass) throws Exception
+ {
+ if (!isAvailable() && !isFailed())
+ {
+ start();
+ }
+
+ if (WSRPV2ServiceDescriptionPortType.class.isAssignableFrom(serviceClass))
+ {
+ return (T)registry.getServiceDescriptionBehavior();
+ }
+ if (WSRPV2MarkupPortType.class.isAssignableFrom(serviceClass))
+ {
+ return (T)registry.getMarkupBehaviorFor(MARKUP);
+ }
+ if (WSRPV2PortletManagementPortType.class.isAssignableFrom(serviceClass))
+ {
+ return (T)registry.getPortletManagementBehavior();
+ }
+ if (WSRPV2RegistrationPortType.class.isAssignableFrom(serviceClass))
+ {
+ return (T)registry.getRegistrationBehavior();
+ }
+ return null;
+ }
+
+ public BehaviorRegistry getRegistry()
+ {
+ return registry;
+ }
+
+ public void setRegistry(BehaviorRegistry registry)
+ {
+ this.registry = registry;
+ }
+
+ public boolean isAvailable()
+ {
+ return initialized;
+ }
+
+ public boolean isFailed()
+ {
+ return false;
+ }
+
+ public void setFailed(boolean failed)
+ {
+ // do nothing
+ }
+
+ public void setWSOperationTimeOut(int msBeforeTimeOut)
+ {
+ if (msBeforeTimeOut < 0)
+ {
+ msBeforeTimeOut = DEFAULT_TIMEOUT_MS;
+ }
+
+ timeout = msBeforeTimeOut;
+ }
+
+ public int getWSOperationTimeOut()
+ {
+ return timeout;
+ }
+
+ public String getServiceDescriptionURL()
+ {
+ return SD_URL;
+ }
+
+ public String getMarkupURL()
+ {
+ return M_URL;
+ }
+
+ public String getRegistrationURL()
+ {
+ return R_URL;
+ }
+
+ public String getPortletManagementURL()
+ {
+ return PM_URL;
+ }
+
+ public void setServiceDescriptionURL(String serviceDescriptionURL)
+ {
+ // do nothing
+ }
+
+ public void setMarkupURL(String markupURL)
+ {
+ // do nothing
+ }
+
+ public void setRegistrationURL(String registrationURL)
+ {
+ // do nothing
+ }
+
+ public void setPortletManagementURL(String portletManagementURL)
+ {
+ // do nothing
+ }
+
+ public void create() throws Exception
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void start() throws Exception
+ {
+ initialized = true;
+ }
+
+ public void stop()
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void setWsdlDefinitionURL(String wsdlDefinitionURL)
+ {
+ wsdl = wsdlDefinitionURL;
+ }
+
+ public String getWsdlDefinitionURL()
+ {
+ return wsdl;
+ }
+
+ public void destroy()
+ {
+ throw new NotYetImplemented();
+ }
+
+ private class SimpleMarkupBehavior extends MarkupBehavior
+ {
+ public SimpleMarkupBehavior()
+ {
+ super(BehaviorBackedServiceFactory.this.registry);
+ registerHandle(MARKUP);
+ }
+
+ @Override
+ protected String getMarkupString(Mode mode, WindowState windowState, String
navigationalState, GetMarkup getMarkup) throws UnsupportedWindowState, InvalidCookie,
InvalidSession, AccessDenied, InconsistentParameters, InvalidHandle, UnsupportedLocale,
UnsupportedMode, OperationFailed, MissingParameters, InvalidUserCategory,
InvalidRegistration, UnsupportedMimeType
+ {
+ return MARKUP;
+ }
+ }
+}
\ No newline at end of file
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorRegistry.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorRegistry.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorRegistry.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2;
+
+import org.gatein.wsrp.WSRPExceptionFactory;
+import org.oasis.wsrp.v2.InvalidHandle;
+import org.oasis.wsrp.v2.InvalidHandleFault;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9360 $
+ * @since 2.6
+ */
+public class BehaviorRegistry
+{
+ private final Map<String, MarkupBehavior> behaviors = new HashMap<String,
MarkupBehavior>();
+ private PortletManagementBehavior portletManagementBehavior;
+ private ServiceDescriptionBehavior serviceDescriptionBehavior;
+ private RegistrationBehavior registrationBehavior;
+
+ public ServiceDescriptionBehavior getServiceDescriptionBehavior()
+ {
+ // this is required since the consumer will try to access the producer as soon as
it's started and the test
+ // producer will not be properly setup at that time since it's set up in the
test's setUp method...
+ if (serviceDescriptionBehavior == null)
+ {
+ return ServiceDescriptionBehavior.DEFAULT;
+ }
+
+ return serviceDescriptionBehavior;
+ }
+
+ public void clear()
+ {
+ behaviors.clear();
+ }
+
+ public MarkupBehavior getMarkupBehaviorFor(String handle) throws InvalidHandle
+ {
+ if (behaviors.containsKey(handle))
+ {
+ return behaviors.get(handle);
+ }
+ throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
+ "There is no registered MarkupBehavior for handle '" + handle +
"'", null);
+ }
+
+ public void registerMarkupBehavior(MarkupBehavior behavior)
+ {
+ for (String handle : behavior.getSupportedHandles())
+ {
+ MarkupBehavior existing = behaviors.get(handle);
+ if (existing != null)
+ {
+ throw new IllegalArgumentException("Cannot register behavior " +
behavior.getClass().getName()
+ + " because it uses a handle '" + handle + "'
that's already associated with behavior "
+ + existing.getClass().getName());
+ }
+ behaviors.put(handle, behavior);
+ }
+ }
+
+ public PortletManagementBehavior getPortletManagementBehavior()
+ {
+ return portletManagementBehavior;
+ }
+
+ public void setPortletManagementBehavior(PortletManagementBehavior
portletManagementBehavior)
+ {
+ this.portletManagementBehavior = portletManagementBehavior;
+ }
+
+ public void setServiceDescriptionBehavior(ServiceDescriptionBehavior
serviceDescriptionBehavior)
+ {
+ this.serviceDescriptionBehavior = serviceDescriptionBehavior;
+ }
+
+ public RegistrationBehavior getRegistrationBehavior()
+ {
+ return registrationBehavior;
+ }
+
+ public void setRegistrationBehavior(RegistrationBehavior registrationBehavior)
+ {
+ this.registrationBehavior = registrationBehavior;
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorRegistry.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/MarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/MarkupBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/MarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,187 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2;
+
+import org.gatein.common.NotYetImplemented;
+import org.gatein.common.net.media.MediaType;
+import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.WindowState;
+import org.gatein.wsrp.WSRPTypeFactory;
+import org.gatein.wsrp.WSRPUtils;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.EventParams;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.GetMarkup;
+import org.oasis.wsrp.v2.HandleEventsFailed;
+import org.oasis.wsrp.v2.InconsistentParameters;
+import org.oasis.wsrp.v2.InteractionParams;
+import org.oasis.wsrp.v2.InvalidCookie;
+import org.oasis.wsrp.v2.InvalidHandle;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.InvalidSession;
+import org.oasis.wsrp.v2.InvalidUserCategory;
+import org.oasis.wsrp.v2.MarkupContext;
+import org.oasis.wsrp.v2.MarkupParams;
+import org.oasis.wsrp.v2.MarkupResponse;
+import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.OperationNotSupported;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.PortletStateChangeRequired;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.ResourceContext;
+import org.oasis.wsrp.v2.ResourceParams;
+import org.oasis.wsrp.v2.ResourceSuspended;
+import org.oasis.wsrp.v2.RuntimeContext;
+import org.oasis.wsrp.v2.SessionContext;
+import org.oasis.wsrp.v2.UnsupportedLocale;
+import org.oasis.wsrp.v2.UnsupportedMimeType;
+import org.oasis.wsrp.v2.UnsupportedMode;
+import org.oasis.wsrp.v2.UnsupportedWindowState;
+import org.oasis.wsrp.v2.UpdateResponse;
+import org.oasis.wsrp.v2.UserContext;
+import org.oasis.wsrp.v2.WSRPV2MarkupPortType;
+
+import javax.jws.WebParam;
+import javax.xml.ws.Holder;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Behavior delivering Markup services.
+ *
+ * @author <a
href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.test.AbstractMarkupBehavior">Chris
Laprun</a>
+ * @version $Revision: 10337 $
+ * @since 2.6
+ */
+public abstract class MarkupBehavior extends TestProducerBehavior implements
WSRPV2MarkupPortType
+{
+ private List<String> handles = new ArrayList<String>(3);
+ private BehaviorRegistry registry;
+
+
+ protected MarkupBehavior(BehaviorRegistry registry)
+ {
+ this.registry = registry;
+ }
+
+ /**
+ * Returns a markup String based on the passed information.
+ *
+ * @param mode the requested mode
+ * @param windowState the requested window state
+ * @param navigationalState the current navigational state
+ * @param getMarkup the original GetMarkup request (in case more information
is required by this behavior)
+ * @return a possibly <code>null</code> markup String
+ */
+ protected abstract String getMarkupString(Mode mode, WindowState windowState, String
navigationalState, GetMarkup getMarkup)
+ throws UnsupportedWindowState, InvalidCookie, InvalidSession, AccessDenied,
InconsistentParameters, InvalidHandle,
+ UnsupportedLocale, UnsupportedMode, OperationFailed, MissingParameters,
InvalidUserCategory, InvalidRegistration,
+ UnsupportedMimeType;
+
+ /**
+ * Allows this behavior to modify the response after the markup has been generated.
The default implementation does
+ * nothing.
+ *
+ * @param markupResponse the response that will be passed on to the consumer
+ */
+ public void modifyResponseIfNeeded(MarkupResponse markupResponse)
+ {
+ // default implementation does not nothing
+ }
+
+ public List<String> getSupportedHandles()
+ {
+ return handles;
+ }
+
+ public PortletDescription getPortletDescriptionFor(String handle)
+ {
+ if (handles.contains(handle))
+ {
+ return createPortletDescription(handle, getSuffixFor(handle));
+ }
+ throw new IllegalArgumentException("MarkupBehavior " +
getClass().getName() + " is not associated with handle '"
+ + handle + "'");
+ }
+
+ protected String getSuffixFor(String handle)
+ {
+ return "";
+ }
+
+ protected void registerHandle(String handle)
+ {
+ handles.add(handle);
+
registry.getServiceDescriptionBehavior().addPortletDescription(createPortletDescription(handle,
getSuffixFor(handle)));
+ }
+
+ public void getResource(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.INOUT)
Holder<PortletContext> portletContext, @WebParam(name = "runtimeContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RuntimeContext
runtimeContext, @WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"resourceParams", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") ResourceParams resourceParams,
@WebParam(name = "resourceContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<ResourceContext> resourceContext, @WebParam(name =
"sessionContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<SessionContext> sessionContext, @WebPara!
m(name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession,
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended, UnsupportedLocale, UnsupportedMimeType,
UnsupportedMode, UnsupportedWindowState
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void performBlockingInteraction(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "runtimeContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RuntimeContext runtimeContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"markupParams", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
MarkupParams markupParams, @WebParam(name = "interactionParams", targetNamespace
= "urn:oasis:names:tc:wsrp:v2:types") InteractionParams interactionParams,
@WebParam(name = "updateResponse", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<UpdateResponse> updateResponse, @WebParam(name = "redirectURL",
targetNamespace = "urn:oasis:na!
mes:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<String> redirectURL,
@WebParam(name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession,
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed,
PortletStateChangeRequired, ResourceSuspended, UnsupportedLocale, UnsupportedMimeType,
UnsupportedMode, UnsupportedWindowState
+ {
+ // do nothing
+ }
+
+ public void handleEvents(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "runtimeContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RuntimeContext runtimeContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"markupParams", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
MarkupParams markupParams, @WebParam(name = "eventParams", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") EventParams eventParams, @WebParam(name =
"updateResponse", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<UpdateResponse> updateResponse, @WebParam(name = "failedEvents",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = W!
ebParam.Mode.OUT) Holder<List<HandleEventsFailed>> failedEvents,
@WebParam(name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession,
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, PortletStateChangeRequired, ResourceSuspended, UnsupportedLocale,
UnsupportedMimeType, UnsupportedMode, UnsupportedWindowState
+ {
+ throw new NotYetImplemented();
+ }
+
+ public List<Extension> releaseSessions(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "sessionIDs", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<String> sessionIDs,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext) throws
AccessDenied, InvalidRegistration, MissingParameters, ModifyRegistrationRequired,
OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void getMarkup(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "runtimeContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RuntimeContext runtimeContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"markupParams", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
MarkupParams markupParams, @WebParam(name = "markupContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<MarkupContext> markupContext, @WebParam(name = "sessionContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<SessionContext> sessionContext, @WebParam(name = "extensions",
targetNamespace = "urn:oasi!
s:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession,
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed,
ResourceSuspended, UnsupportedLocale, UnsupportedMimeType, UnsupportedMode,
UnsupportedWindowState
+ {
+ GetMarkup gm = new GetMarkup();
+ gm.setMarkupParams(markupParams);
+ gm.setPortletContext(portletContext);
+ gm.setRegistrationContext(registrationContext);
+ gm.setRuntimeContext(runtimeContext);
+ gm.setUserContext(userContext);
+
+ String markupString =
getMarkupString(WSRPUtils.getJSR168PortletModeFromWSRPName(markupParams.getMode()),
+ WSRPUtils.getJSR168WindowStateFromWSRPName(markupParams.getWindowState()),
+ markupParams.getNavigationalContext().getOpaqueValue(), gm);
+
+ markupContext.value =
WSRPTypeFactory.createMarkupContext(MediaType.TEXT_HTML.getValue(), markupString);
+ markupContext.value.setRequiresRewriting(Boolean.TRUE);
+
+ MarkupResponse markupResponse =
WSRPTypeFactory.createMarkupResponse(markupContext.value);
+
+ modifyResponseIfNeeded(markupResponse);
+ }
+
+ public List<Extension> initCookie(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext) throws
AccessDenied, InvalidRegistration, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended
+ {
+ return null;
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/MarkupBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/PortletManagementBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/PortletManagementBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/PortletManagementBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2;
+
+import org.gatein.common.NotYetImplemented;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.CopiedPortlet;
+import org.oasis.wsrp.v2.ExportByValueNotSupported;
+import org.oasis.wsrp.v2.ExportNoLongerValid;
+import org.oasis.wsrp.v2.ExportedPortlet;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.FailedPortlets;
+import org.oasis.wsrp.v2.ImportPortlet;
+import org.oasis.wsrp.v2.ImportPortletsFailed;
+import org.oasis.wsrp.v2.ImportedPortlet;
+import org.oasis.wsrp.v2.InconsistentParameters;
+import org.oasis.wsrp.v2.InvalidHandle;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.InvalidUserCategory;
+import org.oasis.wsrp.v2.Lifetime;
+import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.ModelDescription;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.OperationNotSupported;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.PortletLifetime;
+import org.oasis.wsrp.v2.Property;
+import org.oasis.wsrp.v2.PropertyList;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.ResetProperty;
+import org.oasis.wsrp.v2.ResourceList;
+import org.oasis.wsrp.v2.ResourceSuspended;
+import org.oasis.wsrp.v2.SetExportLifetime;
+import org.oasis.wsrp.v2.UserContext;
+import org.oasis.wsrp.v2.WSRPV2PortletManagementPortType;
+
+import javax.jws.WebParam;
+import javax.xml.ws.Holder;
+import java.util.List;
+
+/**
+ * @author <a
href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.test.PortletManagementBehavior">Chris
+ * Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class PortletManagementBehavior extends TestProducerBehavior implements
WSRPV2PortletManagementPortType
+{
+ public void getPortletPropertyDescription(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") RegistrationContext registrationContext,
@WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") UserContext userContext, @WebParam(name =
"desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> desiredLocales,
@WebParam(mode = WebParam.Mode.OUT, name = "modelDescription", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<ModelDescription>
modelDescription, @WebParam(mode = WebParam.Mode.OUT, name = "resourceList",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<ResourceList>
resourceList, @WebParam(mode = WebParam.Mode.OUT, name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<Extension>> extensions) thro!
ws MissingParameters, InconsistentParameters, InvalidHandle, InvalidRegistration,
InvalidUserCategory, AccessDenied, OperationFailed
+ {
+ incrementCallCount();
+ }
+
+ public void getPortletDescription(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") UserContext userContext, @WebParam(name =
"desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> desiredLocales,
@WebParam(mode = WebParam.Mode.OUT, name = "portletDescription", targetNamespace
= "urn:oasis:names:tc:wsrp:v1:types") Holder<PortletDescription>
portletDescription, @WebParam(mode = WebParam.Mode.OUT, name = "resourceList",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<ResourceList>
resourceList, @WebParam(mode = WebParam.Mode.OUT, name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<Extension>> extensions) throws!
MissingParameters, InconsistentParameters, InvalidHandle, InvalidRegistration,
InvalidUserCategory, AccessDenied, OperationFailed
+ {
+ incrementCallCount();
+ }
+
+ public void clonePortlet(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"lifetime", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
Lifetime lifetime, @WebParam(name = "portletHandle", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<String> portletHandle, @WebParam(name = "portletState",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<byte[]> portletState, @WebParam(name = "scheduledDestruction",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Lifetime> scheduledDestruction, @WebParam(name = "extensions",
targetNamespace!
= "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory,
MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported,
ResourceSuspended
+ {
+ incrementCallCount();
+ }
+
+ public void destroyPortlets(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletHandles", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<String> portletHandles,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"failedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws
InconsistentParameters, InvalidRegistration, MissingParameters,
ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ incrementCallCount();
+ }
+
+ public void getPortletsLifetime(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<PortletContext> portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"portletLifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<PortletLifetime>> portletLifetime, @WebParam(name =
"failedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ResourceList> resourceList, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT)!
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidHandle, InvalidRegistration, ModifyRegistrationRequired,
OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void setPortletsLifetime(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<PortletContext> portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"lifetime", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
Lifetime lifetime, @WebParam(name = "updatedPortlet", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<PortletLifetime>> updatedPortlet, @WebParam(name =
"failedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ResourceList> resourceList, @WebParam(!
name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidHandle, InvalidRegistration, ModifyRegistrationRequired,
OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void copyPortlets(@WebParam(name = "toRegistrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
toRegistrationContext, @WebParam(name = "toUserContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext toUserContext, @WebParam(name =
"fromRegistrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext fromRegistrationContext,
@WebParam(name = "fromUserContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext fromUserContext, @WebParam(name
= "fromPortletContexts", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<PortletContext>
fromPortletContexts, @WebParam(name = "lifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") Lifetime lifetime, @WebParam(name =
"copiedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<CopiedPortlet>> copiedPortlets, @WebParam(name =
"failedPortlets", targetNamesp!
ace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ResourceList> resourceList, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws
AccessDenied, InconsistentParameters, InvalidHandle, InvalidRegistration,
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void exportPortlets(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<PortletContext> portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"lifetime", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode
= WebParam.Mode.INOUT) Holder<Lifetime> lifetime, @WebParam(name =
"exportByValueRequired", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") Boolean exportByValueRequired,
@WebParam(name = "exportContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<byte[]> exportContext, @WebParam(name = "exportedPortlet",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ExportedPortlet>> exportedPortlet, @WebParam(name!
= "failedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ResourceList> resourceList, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws
AccessDenied, ExportByValueNotSupported, InconsistentParameters, InvalidHandle,
InvalidRegistration, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired,
OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void importPortlets(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "importContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") byte[] importContext, @WebParam(name =
"importPortlet", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
List<ImportPortlet> importPortlet, @WebParam(name = "userContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") UserContext userContext,
@WebParam(name = "lifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") Lifetime lifetime, @WebParam(name =
"importedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ImportedPortlet>> importedPortlets, @WebParam(name =
"importFailed", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<ImportPortletsFailed>> importFailed,
@WebParam(name = "resourceList", targetNamespace =!
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<ResourceList> resourceList, @WebParam(name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied, ExportNoLongerValid,
InconsistentParameters, InvalidRegistration, InvalidUserCategory, MissingParameters,
ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ public List<Extension> releaseExport(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "exportContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") byte[] exportContext, @WebParam(name =
"userContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
UserContext userContext)
+ {
+ throw new NotYetImplemented();
+ }
+
+ public Lifetime setExportLifetime(@WebParam(name = "setExportLifetime",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", partName =
"setExportLifetime") SetExportLifetime setExportLifetime) throws AccessDenied,
InvalidHandle, InvalidRegistration, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void setPortletProperties(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"propertyList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
PropertyList propertyList, @WebParam(name = "portletHandle", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<String> portletHandle, @WebParam(name = "portletState",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<byte[]> portletState, @WebParam(name = "scheduledDestruction",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Lifetime> scheduledDestruction, @WebParam(name = "extensio!
ns", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode =
WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory,
MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported,
ResourceSuspended
+ {
+ incrementCallCount();
+ }
+
+ public void getPortletProperties(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") UserContext userContext, @WebParam(name =
"names", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
List<String> names, @WebParam(mode = WebParam.Mode.OUT, name =
"properties", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<Property>> properties, @WebParam(mode = WebParam.Mode.OUT, name =
"resetProperties", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<ResetProperty>>
resetProperties, @WebParam(mode = WebParam.Mode.OUT, name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<Extension>> extensions) throws MissingParameters, Incons!
istentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory, AccessDenied,
OperationFailed
+ {
+ incrementCallCount();
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/PortletManagementBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/RegistrationBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/RegistrationBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/RegistrationBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2;
+
+import org.gatein.common.NotYetImplemented;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.GetRegistrationLifetime;
+import org.oasis.wsrp.v2.InvalidHandle;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.Lifetime;
+import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.OperationNotSupported;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.RegistrationData;
+import org.oasis.wsrp.v2.ResourceSuspended;
+import org.oasis.wsrp.v2.SetRegistrationLifetime;
+import org.oasis.wsrp.v2.UserContext;
+import org.oasis.wsrp.v2.WSRPV2RegistrationPortType;
+
+import javax.jws.WebParam;
+import javax.xml.ws.Holder;
+import java.util.List;
+
+/**
+ * @author <a
href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.test.RegistrationBehavior">Chris
Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class RegistrationBehavior extends TestProducerBehavior implements
WSRPV2RegistrationPortType
+{
+ public static final String REGISTRATION_HANDLE = "registration";
+
+ public void register(@WebParam(name = "registrationData", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationData registrationData,
@WebParam(name = "lifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") Lifetime lifetime, @WebParam(name =
"userContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
UserContext userContext, @WebParam(name = "registrationState", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<byte[]> registrationState, @WebParam(name = "scheduledDestruction",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Lifetime> scheduledDestruction, @WebParam(name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions, @WebParam(name =
"registrationHandle", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<String> registrationHandle) throws Missi!
ngParameters, OperationFailed, OperationNotSupported
+ {
+ incrementCallCount();
+ registrationHandle.value = REGISTRATION_HANDLE;
+ }
+
+ public List<Extension> deregister(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext) throws
InvalidRegistration, OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ incrementCallCount();
+ return null;
+ }
+
+ public void modifyRegistration(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "registrationData", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationData registrationData,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"registrationState", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<byte[]> registrationState, @WebParam(name = "scheduledDestruction",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Lifetime> scheduledDestruction, @WebParam(name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws InvalidRegistration,
MissingParameters, OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ incrementCallCount();
+ }
+
+ public Lifetime getRegistrationLifetime(@WebParam(name =
"getRegistrationLifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", partName =
"getRegistrationLifetime") GetRegistrationLifetime getRegistrationLifetime)
throws AccessDenied, InvalidHandle, InvalidRegistration, ModifyRegistrationRequired,
OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ public Lifetime setRegistrationLifetime(@WebParam(name =
"setRegistrationLifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", partName =
"setRegistrationLifetime") SetRegistrationLifetime setRegistrationLifetime)
throws AccessDenied, InvalidHandle, InvalidRegistration, ModifyRegistrationRequired,
OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/RegistrationBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/ServiceDescriptionBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/ServiceDescriptionBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/ServiceDescriptionBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,148 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2;
+
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.WSRPTypeFactory;
+import org.oasis.wsrp.v2.CookieProtocol;
+import org.oasis.wsrp.v2.EventDescription;
+import org.oasis.wsrp.v2.ExportDescription;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.ExtensionDescription;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.ItemDescription;
+import org.oasis.wsrp.v2.ModelDescription;
+import org.oasis.wsrp.v2.ModelTypes;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.PropertyDescription;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.ResourceList;
+import org.oasis.wsrp.v2.ResourceSuspended;
+import org.oasis.wsrp.v2.ServiceDescription;
+import org.oasis.wsrp.v2.UserContext;
+import org.oasis.wsrp.v2.WSRPV2ServiceDescriptionPortType;
+
+import javax.jws.WebParam;
+import javax.xml.ws.Holder;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author <a
href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.test.ServiceDescriptionBehavior">Chris
+ * Laprun</a>
+ * @version $Revision: 11320 $
+ * @since 2.6
+ */
+public class ServiceDescriptionBehavior extends TestProducerBehavior implements
WSRPV2ServiceDescriptionPortType
+{
+ protected ServiceDescription serviceDescription;
+ private static final ServiceDescription DEFAULT_SERVICE_DESCRIPTION =
WSRPTypeFactory.createServiceDescription(false);
+ public static final ServiceDescriptionBehavior DEFAULT = new
ServiceDescriptionBehavior();
+
+ protected List<PortletDescription> offeredPortlets;
+ private boolean requiresRegistration;
+ private CookieProtocol cookieProtocol;
+ private ModelDescription registrationProperties;
+
+ public ServiceDescriptionBehavior()
+ {
+ offeredPortlets = new LinkedList<PortletDescription>();
+ }
+
+ public void setRequiresRegistration(boolean requiresRegistration)
+ {
+ this.requiresRegistration = requiresRegistration;
+ }
+
+ public void setRequiresInitCookie(CookieProtocol requiresInitCookie)
+ {
+ this.cookieProtocol = requiresInitCookie;
+ }
+
+ public void setServiceDescription(boolean requiresRegistration, int numberOfProps)
+ {
+ ServiceDescription sd = createServiceDescription(requiresRegistration,
numberOfProps);
+ offeredPortlets = sd.getOfferedPortlets();
+ this.requiresRegistration = sd.isRequiresRegistration();
+ registrationProperties = sd.getRegistrationPropertyDescription();
+ }
+
+ public static ServiceDescription getDefaultServiceDescription()
+ {
+ return DEFAULT_SERVICE_DESCRIPTION;
+ }
+
+ public void addPortletDescription(PortletDescription portletDescription)
+ {
+ offeredPortlets.add(portletDescription);
+ }
+
+ public Set<String> getPortletHandles()
+ {
+ Set<String> handles = new HashSet<String>(offeredPortlets.size());
+
+ for (PortletDescription description : offeredPortlets)
+ {
+ handles.add(description.getPortletHandle());
+ }
+
+ return handles;
+ }
+
+ public int getPortletNumber()
+ {
+ return offeredPortlets.size();
+ }
+
+ public static ServiceDescription createServiceDescription(boolean
requiresRegistration, int numberOfProperties)
+ {
+ ServiceDescription sd =
WSRPTypeFactory.createServiceDescription(requiresRegistration);
+
+ if (requiresRegistration)
+ {
+ List<PropertyDescription> descriptions = new
ArrayList<PropertyDescription>(numberOfProperties);
+ for (int i = 0; i < numberOfProperties; i++)
+ {
+ descriptions.add(WSRPTypeFactory.createPropertyDescription("prop" +
i, WSRPConstants.XSD_STRING));
+ }
+
sd.setRegistrationPropertyDescription(WSRPTypeFactory.createModelDescription(descriptions));
+ }
+
+ return sd;
+ }
+
+ public void getServiceDescription(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<String> desiredLocales,
@WebParam(name = "portletHandles", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<String> portletHandles,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"requiresRegistration", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Boolean> requiresRegistration, @WebParam(name = "offeredPortlets",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<PortletDescription>> offeredPortlets, @WebParam(name =
"userCategoryDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ItemDes!
cription>> userCategoryDescriptions, @WebParam(name =
"extensionDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ExtensionDescription>> extensionDescriptions, @WebParam(name =
"customWindowStateDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ItemDescription>> customWindowStateDescriptions, @WebParam(name =
"customModeDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ItemDescription>> customModeDescriptions, @WebParam(name =
"requiresInitCookie", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<CookieProtocol> requiresInitCookie, @WebParam(name =
"registrationPropertyDescription", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<ModelDescription> registrationPropertyDescription, @WebParam(name =
"locales", targetNamespace = "urn:!
oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holde!
r<List<S
tring>> locales, @WebParam(name = "resourceList", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<ResourceList> resourceList, @WebParam(name = "eventDescriptions",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<EventDescription>> eventDescriptions, @WebParam(name =
"schemaType", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ModelTypes> schemaType, @WebParam(name =
"supportedOptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<String>> supportedOptions, @WebParam(name =
"exportDescription", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<ExportDescription> exportDescription, @WebParam(name =
"mayReturnRegistrationState", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Boolean> mayReturnRegistrationState, @WebParam(name = "extens!
ions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode =
WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws
InvalidRegistration, ModifyRegistrationRequired, OperationFailed, ResourceSuspended
+ {
+ incrementCallCount();
+ offeredPortlets.value = this.offeredPortlets;
+ requiresRegistration.value = this.requiresRegistration;
+ requiresInitCookie.value = this.cookieProtocol;
+ registrationPropertyDescription.value = registrationProperties;
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/ServiceDescriptionBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestProducerBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestProducerBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestProducerBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2;
+
+import org.gatein.common.net.media.MediaType;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.WSRPTypeFactory;
+import org.oasis.wsrp.v2.LocalizedString;
+import org.oasis.wsrp.v2.MarkupType;
+import org.oasis.wsrp.v2.PortletDescription;
+
+/**
+ * Provides a base class for Producer behavior used in Consumer testing.
+ *
+ * @author <a
href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.test.TestProducerBehavior">Chris
Laprun</a>
+ * @version $Revision: 11317 $
+ * @since 2.6
+ */
+public abstract class TestProducerBehavior
+{
+ protected int callCount;
+ public static final String SAMPLE_DESCRIPTION = "SampleDescription";
+ public static final String SAMPLE_SHORTTITLE = "SampleShortTitle";
+ public static final String SAMPLE_TITLE = "SampleTitle";
+ public static final String SAMPLE_DISPLAYNAME = "SampleDisplayName";
+ public static final String SAMPLE_KEYWORD = "keyword";
+
+ /**
+ * Increment the number of times methods of this behavior have been called. Used when
the behavior changes depending
+ * on how many times methods have been called.
+ */
+ public void incrementCallCount()
+ {
+ callCount++;
+ }
+
+ public int getCallCount()
+ {
+ return callCount;
+ }
+
+ public PortletDescription createPortletDescription(String portletHandle, String
suffix)
+ {
+ PortletDescription portletDesc = new PortletDescription();
+ portletDesc.setPortletHandle(portletHandle);
+ MarkupType markupType = new MarkupType();
+ markupType.setMimeType(MediaType.TEXT_HTML.getValue());
+ markupType.getModes().add(WSRPConstants.VIEW_MODE);
+ markupType.getWindowStates().add(WSRPConstants.NORMAL_WINDOW_STATE);
+ markupType.getLocales().addAll(WSRPConstants.getDefaultLocales());
+ portletDesc.getMarkupTypes().add(markupType);
+
+ String suffixString = suffix == null ? "" : suffix;
+ portletDesc.setDescription(createLocalizedString(SAMPLE_DESCRIPTION +
suffixString));
+ portletDesc.setTitle(createLocalizedString(SAMPLE_TITLE + suffixString));
+ portletDesc.setShortTitle(createLocalizedString(SAMPLE_SHORTTITLE +
suffixString));
+ portletDesc.setDisplayName(createLocalizedString(SAMPLE_DISPLAYNAME +
suffixString));
+ portletDesc.getKeywords().add(createLocalizedString(SAMPLE_KEYWORD +
suffixString));
+ return portletDesc;
+ }
+
+ /**
+ * Create the dummiest form of LocalizedString
+ *
+ * @param value
+ * @return
+ */
+ public static LocalizedString createLocalizedString(String value)
+ {
+ return WSRPTypeFactory.createLocalizedString(value);
+ }
+
+ /** Produces String from LocalizedString */
+ public static String extractString(org.gatein.common.i18n.LocalizedString ls)
+ {
+ return ls.getPreferredOrBestLocalizedMappingFor(new
String[]{"en"}).getString();
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestProducerBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducer.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducer.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducer.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2;
+
+import org.oasis.wsrp.v2.CookieProtocol;
+
+/**
+ * Exposes WSPRProducer test implementation methods - we inject what it returns
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 10610 $
+ */
+public interface TestWSRPProducer
+{
+ /** Resets any currently held state. */
+ void reset();
+
+ BehaviorRegistry getBehaviorRegistry();
+
+ /**
+ * Sets the currently used portlet handle identifying the MarkupBehavior we're
using. This is needed to be able to
+ * dispatch calls to initCookie to the proper behavior.
+ *
+ * @param handle
+ */
+ void setCurrentMarkupBehaviorHandle(String handle);
+
+ void setRequiresInitCookie(CookieProtocol requiresInitCookie);
+
+ void usingStrictModeChangedTo(boolean strictMode);
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducer.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducerImpl.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducerImpl.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducerImpl.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,330 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2;
+
+import org.gatein.common.NotYetImplemented;
+import org.gatein.wsrp.WSRPExceptionFactory;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.CookieProtocol;
+import org.oasis.wsrp.v2.CopiedPortlet;
+import org.oasis.wsrp.v2.EventDescription;
+import org.oasis.wsrp.v2.EventParams;
+import org.oasis.wsrp.v2.ExportByValueNotSupported;
+import org.oasis.wsrp.v2.ExportDescription;
+import org.oasis.wsrp.v2.ExportNoLongerValid;
+import org.oasis.wsrp.v2.ExportedPortlet;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.ExtensionDescription;
+import org.oasis.wsrp.v2.FailedPortlets;
+import org.oasis.wsrp.v2.GetRegistrationLifetime;
+import org.oasis.wsrp.v2.HandleEventsFailed;
+import org.oasis.wsrp.v2.ImportPortlet;
+import org.oasis.wsrp.v2.ImportPortletsFailed;
+import org.oasis.wsrp.v2.ImportedPortlet;
+import org.oasis.wsrp.v2.InconsistentParameters;
+import org.oasis.wsrp.v2.InteractionParams;
+import org.oasis.wsrp.v2.InvalidCookie;
+import org.oasis.wsrp.v2.InvalidHandle;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.InvalidSession;
+import org.oasis.wsrp.v2.InvalidUserCategory;
+import org.oasis.wsrp.v2.ItemDescription;
+import org.oasis.wsrp.v2.Lifetime;
+import org.oasis.wsrp.v2.MarkupContext;
+import org.oasis.wsrp.v2.MarkupParams;
+import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.ModelDescription;
+import org.oasis.wsrp.v2.ModelTypes;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.OperationFailedFault;
+import org.oasis.wsrp.v2.OperationNotSupported;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.PortletLifetime;
+import org.oasis.wsrp.v2.PortletStateChangeRequired;
+import org.oasis.wsrp.v2.Property;
+import org.oasis.wsrp.v2.PropertyList;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.RegistrationData;
+import org.oasis.wsrp.v2.ResetProperty;
+import org.oasis.wsrp.v2.ResourceContext;
+import org.oasis.wsrp.v2.ResourceList;
+import org.oasis.wsrp.v2.ResourceParams;
+import org.oasis.wsrp.v2.ResourceSuspended;
+import org.oasis.wsrp.v2.RuntimeContext;
+import org.oasis.wsrp.v2.SessionContext;
+import org.oasis.wsrp.v2.SetExportLifetime;
+import org.oasis.wsrp.v2.SetRegistrationLifetime;
+import org.oasis.wsrp.v2.UnsupportedLocale;
+import org.oasis.wsrp.v2.UnsupportedMimeType;
+import org.oasis.wsrp.v2.UnsupportedMode;
+import org.oasis.wsrp.v2.UnsupportedWindowState;
+import org.oasis.wsrp.v2.UpdateResponse;
+import org.oasis.wsrp.v2.UserContext;
+import org.oasis.wsrp.v2.WSRPV2MarkupPortType;
+import org.oasis.wsrp.v2.WSRPV2PortletManagementPortType;
+import org.oasis.wsrp.v2.WSRPV2RegistrationPortType;
+import org.oasis.wsrp.v2.WSRPV2ServiceDescriptionPortType;
+
+import javax.jws.WebParam;
+import javax.xml.ws.Holder;
+import java.util.List;
+
+/**
+ * This is dummy clone of org.jboss.portal.wsrp.producer.WSRPProducerImpl customizable
from client side. Just for
+ * consumer implementation testing purposes.
+ *
+ * @author <a href="mailto:Boleslaw.Dawidowicz@jboss.com">Boleslaw
Dawidowicz</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 12020 $
+ * @since 2.4
+ */
+public class TestWSRPProducerImpl implements TestWSRPProducer, WSRPV2MarkupPortType,
WSRPV2PortletManagementPortType, WSRPV2RegistrationPortType,
WSRPV2ServiceDescriptionPortType
+{
+ private int sessionExpirationTime = 600;
+
+ private CookieProtocol requiresInitCookie = CookieProtocol.NONE;
+
+ private BehaviorRegistry behaviorRegistry = new BehaviorRegistry();
+
+ public static final String USER_COOKIE = "cookie";
+
+ private String currentMarkupBehaviorHandle;
+
+ private boolean strict = true;
+
+ public TestWSRPProducerImpl()
+ {
+ reset();
+ }
+
+ public BehaviorRegistry getBehaviorRegistry()
+ {
+ return behaviorRegistry;
+ }
+
+ public void setCurrentMarkupBehaviorHandle(String handle)
+ {
+ currentMarkupBehaviorHandle = handle;
+ }
+
+ public void reset()
+ {
+ requiresInitCookie = null;
+ currentMarkupBehaviorHandle = null;
+ behaviorRegistry.clear();
+ }
+
+ private MarkupBehavior getMarkupBehaviorFor(String portletHandle) throws
InvalidHandle
+ {
+ return behaviorRegistry.getMarkupBehaviorFor(portletHandle);
+ }
+
+ private ServiceDescriptionBehavior getServiceDescriptionBehavior()
+ {
+ return behaviorRegistry.getServiceDescriptionBehavior();
+ }
+
+ public PortletManagementBehavior getPortletManagementBehavior()
+ {
+ return behaviorRegistry.getPortletManagementBehavior();
+ }
+
+ // ServiceDescription implementation
********************************************************************************
+
+
+ public void getServiceDescription(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<String> desiredLocales,
@WebParam(name = "portletHandles", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<String> portletHandles,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"requiresRegistration", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Boolean> requiresRegistration, @WebParam(name = "offeredPortlets",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<PortletDescription>> offeredPortlets, @WebParam(name =
"userCategoryDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ItemDes!
cription>> userCategoryDescriptions, @WebParam(name =
"extensionDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ExtensionDescription>> extensionDescriptions, @WebParam(name =
"customWindowStateDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ItemDescription>> customWindowStateDescriptions, @WebParam(name =
"customModeDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ItemDescription>> customModeDescriptions, @WebParam(name =
"requiresInitCookie", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<CookieProtocol> requiresInitCookie, @WebParam(name =
"registrationPropertyDescription", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<ModelDescription> registrationPropertyDescription, @WebParam(name =
"locales", targetNamespace = "urn:!
oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holde!
r<List<S
tring>> locales, @WebParam(name = "resourceList", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<ResourceList> resourceList, @WebParam(name = "eventDescriptions",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<EventDescription>> eventDescriptions, @WebParam(name =
"schemaType", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ModelTypes> schemaType, @WebParam(name =
"supportedOptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<String>> supportedOptions, @WebParam(name =
"exportDescription", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<ExportDescription> exportDescription, @WebParam(name =
"mayReturnRegistrationState", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Boolean> mayReturnRegistrationState, @WebParam(name = "extens!
ions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode =
WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws
InvalidRegistration, ModifyRegistrationRequired, OperationFailed, ResourceSuspended
+ {
+ getServiceDescriptionBehavior().getServiceDescription(registrationContext,
desiredLocales, portletHandles, userContext, requiresRegistration, offeredPortlets,
userCategoryDescriptions, extensionDescriptions, customWindowStateDescriptions,
customModeDescriptions, requiresInitCookie, registrationPropertyDescription, locales,
resourceList, eventDescriptions, schemaType, supportedOptions, exportDescription,
mayReturnRegistrationState, extensions);
+ }
+
+ // MarkupService implementation
*************************************************************************************
+
+ public void getMarkup(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "runtimeContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RuntimeContext runtimeContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"markupParams", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
MarkupParams markupParams, @WebParam(name = "markupContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<MarkupContext> markupContext, @WebParam(name = "sessionContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<SessionContext> sessionContext, @WebParam(name = "extensions",
targetNamespace = "urn:oasi!
s:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession,
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed,
ResourceSuspended, UnsupportedLocale, UnsupportedMimeType, UnsupportedMode,
UnsupportedWindowState
+ {
+
getMarkupBehaviorFor(portletContext.getPortletHandle()).getMarkup(registrationContext,
portletContext, runtimeContext, userContext, markupParams, markupContext, sessionContext,
extensions);
+ }
+
+ public void getResource(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.INOUT)
Holder<PortletContext> portletContext, @WebParam(name = "runtimeContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RuntimeContext
runtimeContext, @WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"resourceParams", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") ResourceParams resourceParams,
@WebParam(name = "resourceContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<ResourceContext> resourceContext, @WebParam(name =
"sessionContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<SessionContext> sessionContext, @WebPara!
m(name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession,
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended, UnsupportedLocale, UnsupportedMimeType,
UnsupportedMode, UnsupportedWindowState
+ {
+
getMarkupBehaviorFor(portletContext.value.getPortletHandle()).getResource(registrationContext,
portletContext, runtimeContext, userContext, resourceParams, resourceContext,
sessionContext, extensions);
+ }
+
+ public void performBlockingInteraction(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "runtimeContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RuntimeContext runtimeContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"markupParams", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
MarkupParams markupParams, @WebParam(name = "interactionParams", targetNamespace
= "urn:oasis:names:tc:wsrp:v2:types") InteractionParams interactionParams,
@WebParam(name = "updateResponse", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<UpdateResponse> updateResponse, @WebParam(name = "redirectURL",
targetNamespace = "urn:oasis:na!
mes:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<String> redirectURL,
@WebParam(name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession,
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed,
PortletStateChangeRequired, ResourceSuspended, UnsupportedLocale, UnsupportedMimeType,
UnsupportedMode, UnsupportedWindowState
+ {
+
getMarkupBehaviorFor(portletContext.getPortletHandle()).performBlockingInteraction(registrationContext,
portletContext, runtimeContext, userContext, markupParams, interactionParams,
updateResponse, redirectURL, extensions);
+ }
+
+ public void handleEvents(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "runtimeContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RuntimeContext runtimeContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"markupParams", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
MarkupParams markupParams, @WebParam(name = "eventParams", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") EventParams eventParams, @WebParam(name =
"updateResponse", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<UpdateResponse> updateResponse, @WebParam(name = "failedEvents",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = W!
ebParam.Mode.OUT) Holder<List<HandleEventsFailed>> failedEvents,
@WebParam(name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession,
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, PortletStateChangeRequired, ResourceSuspended, UnsupportedLocale,
UnsupportedMimeType, UnsupportedMode, UnsupportedWindowState
+ {
+
getMarkupBehaviorFor(portletContext.getPortletHandle()).handleEvents(registrationContext,
portletContext, runtimeContext, userContext, markupParams, eventParams, updateResponse,
failedEvents, extensions);
+ }
+
+ public List<Extension> releaseSessions(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "sessionIDs", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<String> sessionIDs,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext) throws
AccessDenied, InvalidRegistration, MissingParameters, ModifyRegistrationRequired,
OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ public List<Extension> initCookie(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext) throws
AccessDenied, InvalidRegistration, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended
+ {
+ // should only be called if we required cookies to be initialized
+ if (requiresInitCookie == null || CookieProtocol.NONE.equals(requiresInitCookie))
+ {
+ throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
"Shouldn't have called initCookie", null);
+ }
+
+ try
+ {
+ return
getMarkupBehaviorFor(currentMarkupBehaviorHandle).initCookie(registrationContext,
userContext);
+ }
+ catch (InvalidHandle invalidHandle)
+ {
+ throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
"Invalid handle", invalidHandle);
+ }
+ }
+
+ // Registration implementation
**************************************************************************************
+
+ public void register(@WebParam(name = "registrationData", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationData registrationData,
@WebParam(name = "lifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") Lifetime lifetime, @WebParam(name =
"userContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
UserContext userContext, @WebParam(name = "registrationState", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<byte[]> registrationState, @WebParam(name = "scheduledDestruction",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Lifetime> scheduledDestruction, @WebParam(name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions, @WebParam(name =
"registrationHandle", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<String> registrationHandle) throws Missi!
ngParameters, OperationFailed, OperationNotSupported
+ {
+ registrationHandle.value = "registration";
+ }
+
+ public List<Extension> deregister(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext) throws
InvalidRegistration, OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ return null;
+ }
+
+ public void modifyRegistration(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "registrationData", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationData registrationData,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"registrationState", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<byte[]> registrationState, @WebParam(name = "scheduledDestruction",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Lifetime> scheduledDestruction, @WebParam(name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws InvalidRegistration,
MissingParameters, OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ // do nothing
+ }
+
+ public Lifetime getRegistrationLifetime(@WebParam(name =
"getRegistrationLifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", partName =
"getRegistrationLifetime") GetRegistrationLifetime getRegistrationLifetime)
throws AccessDenied, InvalidHandle, InvalidRegistration, ModifyRegistrationRequired,
OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ public Lifetime setRegistrationLifetime(@WebParam(name =
"setRegistrationLifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", partName =
"setRegistrationLifetime") SetRegistrationLifetime setRegistrationLifetime)
throws AccessDenied, InvalidHandle, InvalidRegistration, ModifyRegistrationRequired,
OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ // PortletManagement implementation
*********************************************************************************
+
+ public void getPortletDescription(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<String> desiredLocales,
@WebParam(name = "portletDescription", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<PortletDescription> portletDescription, @WebParam(name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ResourceList> resourceList, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws!
AccessDenied, InconsistentParameters, InvalidHandle, InvalidRegistration,
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended
+ {
+ getPortletManagementBehavior().getPortletDescription(registrationContext,
portletContext, userContext, desiredLocales, portletDescription, resourceList,
extensions);
+ }
+
+ public void clonePortlet(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"lifetime", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
Lifetime lifetime, @WebParam(name = "portletHandle", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<String> portletHandle, @WebParam(name = "portletState",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<byte[]> portletState, @WebParam(name = "scheduledDestruction",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Lifetime> scheduledDestruction, @WebParam(name = "extensions",
targetNamespace!
= "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory,
MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported,
ResourceSuspended
+ {
+ getPortletManagementBehavior().clonePortlet(registrationContext, portletContext,
userContext, lifetime, portletHandle, portletState, scheduledDestruction, extensions);
+ }
+
+ public void destroyPortlets(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletHandles", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<String> portletHandles,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"failedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws
InconsistentParameters, InvalidRegistration, MissingParameters,
ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ getPortletManagementBehavior().destroyPortlets(registrationContext, portletHandles,
userContext, failedPortlets, extensions);
+ }
+
+ public void getPortletsLifetime(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<PortletContext> portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"portletLifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<PortletLifetime>> portletLifetime, @WebParam(name =
"failedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ResourceList> resourceList, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT)!
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidHandle, InvalidRegistration, ModifyRegistrationRequired,
OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ getPortletManagementBehavior().getPortletsLifetime(registrationContext,
portletContext, userContext, portletLifetime, failedPortlets, resourceList, extensions);
+ }
+
+ public void setPortletsLifetime(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<PortletContext> portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"lifetime", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
Lifetime lifetime, @WebParam(name = "updatedPortlet", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<PortletLifetime>> updatedPortlet, @WebParam(name =
"failedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ResourceList> resourceList, @WebParam(!
name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidHandle, InvalidRegistration, ModifyRegistrationRequired,
OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ getPortletManagementBehavior().setPortletsLifetime(registrationContext,
portletContext, userContext, lifetime, updatedPortlet, failedPortlets, resourceList,
extensions);
+ }
+
+ public void copyPortlets(@WebParam(name = "toRegistrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
toRegistrationContext, @WebParam(name = "toUserContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext toUserContext, @WebParam(name =
"fromRegistrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext fromRegistrationContext,
@WebParam(name = "fromUserContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext fromUserContext, @WebParam(name
= "fromPortletContexts", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<PortletContext>
fromPortletContexts, @WebParam(name = "lifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") Lifetime lifetime, @WebParam(name =
"copiedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<CopiedPortlet>> copiedPortlets, @WebParam(name =
"failedPortlets", targetNamesp!
ace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ResourceList> resourceList, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws
AccessDenied, InconsistentParameters, InvalidHandle, InvalidRegistration,
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended
+ {
+ getPortletManagementBehavior().copyPortlets(toRegistrationContext, toUserContext,
fromRegistrationContext, fromUserContext, fromPortletContexts, lifetime, copiedPortlets,
failedPortlets, resourceList, extensions);
+ }
+
+ public void exportPortlets(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<PortletContext> portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"lifetime", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode
= WebParam.Mode.INOUT) Holder<Lifetime> lifetime, @WebParam(name =
"exportByValueRequired", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") Boolean exportByValueRequired,
@WebParam(name = "exportContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<byte[]> exportContext, @WebParam(name = "exportedPortlet",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ExportedPortlet>> exportedPortlet, @WebParam(name!
= "failedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ResourceList> resourceList, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws
AccessDenied, ExportByValueNotSupported, InconsistentParameters, InvalidHandle,
InvalidRegistration, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired,
OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ getPortletManagementBehavior().exportPortlets(registrationContext, portletContext,
userContext, lifetime, exportByValueRequired, exportContext, exportedPortlet,
failedPortlets, resourceList, extensions);
+ }
+
+ public void importPortlets(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "importContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") byte[] importContext, @WebParam(name =
"importPortlet", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
List<ImportPortlet> importPortlet, @WebParam(name = "userContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") UserContext userContext,
@WebParam(name = "lifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") Lifetime lifetime, @WebParam(name =
"importedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ImportedPortlet>> importedPortlets, @WebParam(name =
"importFailed", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<ImportPortletsFailed>> importFailed,
@WebParam(name = "resourceList", targetNamespace =!
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<ResourceList> resourceList, @WebParam(name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied, ExportNoLongerValid,
InconsistentParameters, InvalidRegistration, InvalidUserCategory, MissingParameters,
ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ getPortletManagementBehavior().importPortlets(registrationContext, importContext,
importPortlet, userContext, lifetime, importedPortlets, importFailed, resourceList,
extensions);
+ }
+
+ public List<Extension> releaseExport(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "exportContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") byte[] exportContext, @WebParam(name =
"userContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
UserContext userContext)
+ {
+ return getPortletManagementBehavior().releaseExport(registrationContext,
exportContext, userContext);
+ }
+
+ public Lifetime setExportLifetime(@WebParam(name = "setExportLifetime",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", partName =
"setExportLifetime") SetExportLifetime setExportLifetime) throws AccessDenied,
InvalidHandle, InvalidRegistration, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended
+ {
+ return getPortletManagementBehavior().setExportLifetime(setExportLifetime);
+ }
+
+ public void setPortletProperties(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"propertyList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
PropertyList propertyList, @WebParam(name = "portletHandle", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<String> portletHandle, @WebParam(name = "portletState",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<byte[]> portletState, @WebParam(name = "scheduledDestruction",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Lifetime> scheduledDestruction, @WebParam(name = "extensio!
ns", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode =
WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory,
MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported,
ResourceSuspended
+ {
+ getPortletManagementBehavior().setPortletProperties(registrationContext,
portletContext, userContext, propertyList, portletHandle, portletState,
scheduledDestruction, extensions);
+ }
+
+ public void getPortletProperties(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"names", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
List<String> names, @WebParam(name = "properties", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Property>> properties, @WebParam(name =
"resetProperties", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ResetProperty>> resetProperties, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws
AccessDenied, Inconsisten!
tParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory, MissingParameters,
ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ getPortletManagementBehavior().getPortletProperties(registrationContext,
portletContext, userContext, names, properties, resetProperties, extensions);
+ }
+
+ public void getPortletPropertyDescription(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<String> desiredLocales,
@WebParam(name = "modelDescription", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<ModelDescription> modelDescription, @WebParam(name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ResourceList> resourceList, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) thro!
ws AccessDenied, InconsistentParameters, InvalidHandle, InvalidRegistration,
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended
+ {
+ getPortletManagementBehavior().getPortletPropertyDescription(registrationContext,
portletContext, userContext, desiredLocales, modelDescription, resourceList, extensions);
+ }
+
+ // Producer implementation
******************************************************************************************
+
+ public CookieProtocol getRequiresInitCookie()
+ {
+ return requiresInitCookie;
+ }
+
+ public void setRequiresInitCookie(CookieProtocol requiresInitCookie)
+ {
+ this.requiresInitCookie = requiresInitCookie;
+ getServiceDescriptionBehavior().setRequiresInitCookie(requiresInitCookie);
+ }
+
+ public int getSessionExpirationTime()
+ {
+ return sessionExpirationTime;
+ }
+
+ public void setSessionExpirationTime(int sessionExpirationTime)
+ {
+ this.sessionExpirationTime = sessionExpirationTime;
+ }
+
+ public void usingStrictModeChangedTo(boolean strictMode)
+ {
+// WSRPValidator.setStrict(strictMode);
+ strict = strictMode;
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/TestWSRPProducerImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicMarkupBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2.behaviors;
+
+import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.OpaqueStateString;
+import org.gatein.pc.api.WindowState;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.WSRPTypeFactory;
+import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
+import org.gatein.wsrp.test.protocol.v2.MarkupBehavior;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.GetMarkup;
+import org.oasis.wsrp.v2.InconsistentParameters;
+import org.oasis.wsrp.v2.InteractionParams;
+import org.oasis.wsrp.v2.InvalidCookie;
+import org.oasis.wsrp.v2.InvalidHandle;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.InvalidSession;
+import org.oasis.wsrp.v2.InvalidUserCategory;
+import org.oasis.wsrp.v2.MarkupParams;
+import org.oasis.wsrp.v2.MarkupResponse;
+import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.PortletStateChangeRequired;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.ResourceSuspended;
+import org.oasis.wsrp.v2.RuntimeContext;
+import org.oasis.wsrp.v2.UnsupportedLocale;
+import org.oasis.wsrp.v2.UnsupportedMimeType;
+import org.oasis.wsrp.v2.UnsupportedMode;
+import org.oasis.wsrp.v2.UnsupportedWindowState;
+import org.oasis.wsrp.v2.UpdateResponse;
+import org.oasis.wsrp.v2.UserContext;
+
+import javax.jws.WebParam;
+import javax.xml.ws.Holder;
+import java.util.List;
+
+/**
+ * @author <a
href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.v1.consumer.producer.BasicProducer">Chris
+ * Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class BasicMarkupBehavior extends MarkupBehavior
+{
+ public static final String PORTLET_HANDLE = "SamplePortletHandle";
+ public static final String NS = "ns1";
+
+
+ public BasicMarkupBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ registerHandle(PORTLET_HANDLE);
+ }
+
+ public String getMarkupString(Mode mode, WindowState windowState, String
navigationalState, GetMarkup getMarkup)
+ {
+ StringBuffer markupString = new StringBuffer("portlet1:");
+
+ markupString.append(mode).append(":").append(windowState);
+ if (navigationalState != null)
+ {
+ markupString.append(":").append(navigationalState);
+ }
+
+ return markupString.toString();
+ }
+
+ @Override
+ public void performBlockingInteraction(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "runtimeContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RuntimeContext runtimeContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"markupParams", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
MarkupParams markupParams, @WebParam(name = "interactionParams", targetNamespace
= "urn:oasis:names:tc:wsrp:v2:types") InteractionParams interactionParams,
@WebParam(name = "updateResponse", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<UpdateResponse> updateResponse, @WebParam(name = "redirectURL",
targetNamespace = "urn:oasis:na!
mes:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<String> redirectURL,
@WebParam(name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession,
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed,
PortletStateChangeRequired, ResourceSuspended, UnsupportedLocale, UnsupportedMimeType,
UnsupportedMode, UnsupportedWindowState
+ {
+ UpdateResponse ur = WSRPTypeFactory.createUpdateResponse();
+ ur.setNavigationalContext(WSRPTypeFactory.createNavigationalContextOrNull(new
OpaqueStateString(NS), null));
+ updateResponse.value = ur;
+ }
+
+ public void modifyResponseIfNeeded(MarkupResponse markupResponse)
+ {
+ // fake markup caching
+
markupResponse.getMarkupContext().setCacheControl(WSRPTypeFactory.createCacheControl(15,
WSRPConstants.CACHE_PER_USER));
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicMarkupBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicPortletManagementBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicPortletManagementBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicPortletManagementBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,260 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2.behaviors;
+
+import org.gatein.common.NotYetImplemented;
+import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.WSRPTypeFactory;
+import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
+import org.gatein.wsrp.test.protocol.v2.MarkupBehavior;
+import org.gatein.wsrp.test.protocol.v2.PortletManagementBehavior;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.CopiedPortlet;
+import org.oasis.wsrp.v2.ExportByValueNotSupported;
+import org.oasis.wsrp.v2.ExportNoLongerValid;
+import org.oasis.wsrp.v2.ExportedPortlet;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.FailedPortlets;
+import org.oasis.wsrp.v2.ImportPortlet;
+import org.oasis.wsrp.v2.ImportPortletsFailed;
+import org.oasis.wsrp.v2.ImportedPortlet;
+import org.oasis.wsrp.v2.InconsistentParameters;
+import org.oasis.wsrp.v2.InvalidHandle;
+import org.oasis.wsrp.v2.InvalidHandleFault;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.InvalidUserCategory;
+import org.oasis.wsrp.v2.Lifetime;
+import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.ModelDescription;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.OperationFailedFault;
+import org.oasis.wsrp.v2.OperationNotSupported;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.PortletLifetime;
+import org.oasis.wsrp.v2.Property;
+import org.oasis.wsrp.v2.PropertyList;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.ResetProperty;
+import org.oasis.wsrp.v2.ResourceList;
+import org.oasis.wsrp.v2.ResourceSuspended;
+import org.oasis.wsrp.v2.SetExportLifetime;
+import org.oasis.wsrp.v2.UserContext;
+
+import javax.jws.WebParam;
+import javax.xml.ws.Holder;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class BasicPortletManagementBehavior extends PortletManagementBehavior
+{
+ private static final String CLONE_SUFFIX = "_clone";
+ public static final String PROPERTY_NAME = "prop1";
+ public static final String PROPERTY_VALUE = "value1";
+ public static final String PROPERTY_NEW_VALUE = "value2";
+ public static final String CLONED_HANDLE = BasicMarkupBehavior.PORTLET_HANDLE +
CLONE_SUFFIX;
+ private BehaviorRegistry registry;
+
+ public BasicPortletManagementBehavior(BehaviorRegistry registry)
+ {
+ super();
+ this.registry = registry;
+ }
+
+ @Override
+ public void getPortletPropertyDescription(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") RegistrationContext registrationContext,
@WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") UserContext userContext, @WebParam(name =
"desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> desiredLocales,
@WebParam(mode = WebParam.Mode.OUT, name = "modelDescription", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<ModelDescription>
modelDescription, @WebParam(mode = WebParam.Mode.OUT, name = "resourceList",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<ResourceList>
resourceList, @WebParam(mode = WebParam.Mode.OUT, name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<Extension>> extensions) thro!
ws MissingParameters, InconsistentParameters, InvalidHandle, InvalidRegistration,
InvalidUserCategory, AccessDenied, OperationFailed
+ {
+ throw new NotYetImplemented();
+ }
+
+ @Override
+ public void getPortletDescription(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") UserContext userContext, @WebParam(name =
"desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> desiredLocales,
@WebParam(mode = WebParam.Mode.OUT, name = "portletDescription", targetNamespace
= "urn:oasis:names:tc:wsrp:v1:types") Holder<PortletDescription>
portletDescription, @WebParam(mode = WebParam.Mode.OUT, name = "resourceList",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<ResourceList>
resourceList, @WebParam(mode = WebParam.Mode.OUT, name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<Extension>> extensions) throws!
MissingParameters, InconsistentParameters, InvalidHandle, InvalidRegistration,
InvalidUserCategory, AccessDenied, OperationFailed
+ {
+ super.getPortletDescription(registrationContext, portletContext, userContext,
desiredLocales, portletDescription, resourceList, extensions);
+
+ String handle = getHandleFrom(portletContext, "portlet context");
+
+ // need to fake that the clone exists... so remove suffix to get the description of
the POP
+ int index = handle.indexOf(CLONE_SUFFIX);
+ if (index != -1)
+ {
+ handle = handle.substring(0, index);
+ }
+
+ // get the POP description...
+ MarkupBehavior markupBehaviorFor = registry.getMarkupBehaviorFor(handle);
+ PortletDescription description =
markupBehaviorFor.getPortletDescriptionFor(handle);
+
+ // if it was a clone, add the suffix back to the handle.
+ if (index != -1)
+ {
+ description.setPortletHandle(handle + CLONE_SUFFIX);
+ }
+
+ portletDescription.value = description;
+ }
+
+ @Override
+ public void clonePortlet(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"lifetime", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
Lifetime lifetime, @WebParam(name = "portletHandle", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<String> portletHandle, @WebParam(name = "portletState",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<byte[]> portletState, @WebParam(name = "scheduledDestruction",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Lifetime> scheduledDestruction, @WebParam(name = "extensions",
targetNamespace!
= "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory,
MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported,
ResourceSuspended
+ {
+ String handle = getHandleFrom(portletContext, "portlet context");
+
+ if (!BasicMarkupBehavior.PORTLET_HANDLE.equals(handle))
+ {
+ throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
+ "Can only clone portlet with handle '" +
BasicMarkupBehavior.PORTLET_HANDLE + "'", null);
+ }
+
+ portletHandle.value = CLONED_HANDLE;
+ }
+
+ @Override
+ public void destroyPortlets(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletHandles", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<String> portletHandles,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"failedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws
InconsistentParameters, InvalidRegistration, MissingParameters,
ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ super.destroyPortlets(registrationContext, portletHandles, userContext,
failedPortlets, extensions);
+ WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(portletHandles,
"portlet handles", "destroyPortlets");
+ if (portletHandles.isEmpty())
+ {
+ WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(portletHandles,
"portlet handles", "DestroyPortlets");
+ }
+
+ for (String handle : portletHandles)
+ {
+ if (!CLONED_HANDLE.equals(handle))
+ {
+ ArrayList<String> failed = new ArrayList<String>();
+ failed.add(handle);
+ failedPortlets.value.add(WSRPTypeFactory.createFailedPortlets(failed,
"Handle '" + handle + "' doesn't exist"));
+ }
+ }
+ }
+
+ @Override
+ public void getPortletsLifetime(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<PortletContext> portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"portletLifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<PortletLifetime>> portletLifetime, @WebParam(name =
"failedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ResourceList> resourceList, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT)!
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidHandle, InvalidRegistration, ModifyRegistrationRequired,
OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ @Override
+ public void setPortletsLifetime(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<PortletContext> portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"lifetime", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
Lifetime lifetime, @WebParam(name = "updatedPortlet", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<PortletLifetime>> updatedPortlet, @WebParam(name =
"failedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ResourceList> resourceList, @WebParam(!
name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidHandle, InvalidRegistration, ModifyRegistrationRequired,
OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ @Override
+ public void copyPortlets(@WebParam(name = "toRegistrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
toRegistrationContext, @WebParam(name = "toUserContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext toUserContext, @WebParam(name =
"fromRegistrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext fromRegistrationContext,
@WebParam(name = "fromUserContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext fromUserContext, @WebParam(name
= "fromPortletContexts", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<PortletContext>
fromPortletContexts, @WebParam(name = "lifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") Lifetime lifetime, @WebParam(name =
"copiedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<CopiedPortlet>> copiedPortlets, @WebParam(name =
"failedPortlets", targetNamesp!
ace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ResourceList> resourceList, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws
AccessDenied, InconsistentParameters, InvalidHandle, InvalidRegistration,
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ @Override
+ public void exportPortlets(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<PortletContext> portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"lifetime", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode
= WebParam.Mode.INOUT) Holder<Lifetime> lifetime, @WebParam(name =
"exportByValueRequired", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") Boolean exportByValueRequired,
@WebParam(name = "exportContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<byte[]> exportContext, @WebParam(name = "exportedPortlet",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ExportedPortlet>> exportedPortlet, @WebParam(name!
= "failedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<FailedPortlets>> failedPortlets, @WebParam(name =
"resourceList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ResourceList> resourceList, @WebParam(name =
"extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws
AccessDenied, ExportByValueNotSupported, InconsistentParameters, InvalidHandle,
InvalidRegistration, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired,
OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ @Override
+ public void importPortlets(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "importContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") byte[] importContext, @WebParam(name =
"importPortlet", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
List<ImportPortlet> importPortlet, @WebParam(name = "userContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") UserContext userContext,
@WebParam(name = "lifetime", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") Lifetime lifetime, @WebParam(name =
"importedPortlets", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ImportedPortlet>> importedPortlets, @WebParam(name =
"importFailed", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<List<ImportPortletsFailed>> importFailed,
@WebParam(name = "resourceList", targetNamespace =!
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<ResourceList> resourceList, @WebParam(name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied, ExportNoLongerValid,
InconsistentParameters, InvalidRegistration, InvalidUserCategory, MissingParameters,
ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ @Override
+ public List<Extension> releaseExport(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "exportContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") byte[] exportContext, @WebParam(name =
"userContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
UserContext userContext)
+ {
+ throw new NotYetImplemented();
+ }
+
+ @Override
+ public Lifetime setExportLifetime(@WebParam(name = "setExportLifetime",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", partName =
"setExportLifetime") SetExportLifetime setExportLifetime) throws AccessDenied,
InvalidHandle, InvalidRegistration, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended
+ {
+ throw new NotYetImplemented();
+ }
+
+ @Override
+ public void setPortletProperties(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"propertyList", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
PropertyList propertyList, @WebParam(name = "portletHandle", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<String> portletHandle, @WebParam(name = "portletState",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<byte[]> portletState, @WebParam(name = "scheduledDestruction",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Lifetime> scheduledDestruction, @WebParam(name = "extensio!
ns", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode =
WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory,
MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported,
ResourceSuspended
+ {
+ String handle = getHandleFrom(portletContext, "portlet context");
+
+ if (!(CLONED_HANDLE).equals(handle))
+ {
+ throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
+ "Cannot modify portlet '" + handle + "'", null);
+ }
+
+ portletHandle.value = handle;
+ }
+
+ @Override
+ public void getPortletProperties(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") UserContext userContext, @WebParam(name =
"names", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
List<String> names, @WebParam(mode = WebParam.Mode.OUT, name =
"properties", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<Property>> properties, @WebParam(mode = WebParam.Mode.OUT, name =
"resetProperties", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") Holder<List<ResetProperty>>
resetProperties, @WebParam(mode = WebParam.Mode.OUT, name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<Extension>> extensions) throws MissingParameters, Incons!
istentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory, AccessDenied,
OperationFailed
+ {
+ String handle = getHandleFrom(portletContext, "portlet context");
+
+ List<Property> propertyList = new ArrayList<Property>(1);
+
+ if (BasicMarkupBehavior.PORTLET_HANDLE.equals(handle))
+ {
+ propertyList.add(WSRPTypeFactory.createProperty(PROPERTY_NAME, "en",
PROPERTY_VALUE));
+ }
+ else if (CLONED_HANDLE.equals(handle))
+ {
+ if (callCount != 2)
+ {
+ propertyList.add(WSRPTypeFactory.createProperty(PROPERTY_NAME,
"en", PROPERTY_VALUE));
+ }
+ else
+ {
+ propertyList.add(WSRPTypeFactory.createProperty(PROPERTY_NAME,
"en", PROPERTY_NEW_VALUE));
+ }
+ }
+ else
+ {
+ WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
+ "Unknown handle '" + handle + "'", null);
+ }
+
+ incrementCallCount();
+ properties.value = propertyList;
+ }
+
+ private String getHandleFrom(PortletContext portletContext, String context) throws
MissingParameters, InvalidHandle
+ {
+ WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(portletContext,
"portlet context", context);
+ String handle = portletContext.getPortletHandle();
+ WSRPExceptionFactory.throwMissingParametersIfValueIsMissing(handle, "portlet
handle", "PortletContext");
+ if (handle.length() == 0)
+ {
+ throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
+ "Portlet handle is empty", null);
+ }
+
+ return handle;
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicPortletManagementBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicServiceDescriptionBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicServiceDescriptionBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicServiceDescriptionBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2.behaviors;
+
+import org.gatein.wsrp.test.protocol.v2.ServiceDescriptionBehavior;
+import org.oasis.wsrp.v2.PortletDescription;
+
+/**
+ * @author <a
href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.protocol.v1.behaviors.BasicServiceDescriptionBehavior">Chris
+ * Laprun</a>
+ * @version $Revision: 10610 $
+ * @since 2.6
+ */
+public class BasicServiceDescriptionBehavior extends ServiceDescriptionBehavior
+{
+
+ public BasicServiceDescriptionBehavior()
+ {
+ //Prepare description of two portlets
+ PortletDescription pd1 =
createPortletDescription(BasicMarkupBehavior.PORTLET_HANDLE, "");
+ PortletDescription pd2 =
createPortletDescription(SessionMarkupBehavior.PORTLET_HANDLE, "2");
+ offeredPortlets.add(pd1);
+ offeredPortlets.add(pd2);
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/BasicServiceDescriptionBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/DestroyClonesPortletManagementBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/DestroyClonesPortletManagementBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/DestroyClonesPortletManagementBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2.behaviors;
+
+import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.InconsistentParameters;
+import org.oasis.wsrp.v2.InvalidHandle;
+import org.oasis.wsrp.v2.InvalidHandleFault;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.InvalidUserCategory;
+import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.ResourceList;
+import org.oasis.wsrp.v2.UserContext;
+
+import javax.jws.WebParam;
+import javax.xml.ws.Holder;
+import java.util.List;
+
+/**
+ * Specific behavior used in PortletManagementCase.testDestroyClones.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class DestroyClonesPortletManagementBehavior extends
BasicPortletManagementBehavior
+{
+ public DestroyClonesPortletManagementBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ }
+
+ @Override
+ public void getPortletDescription(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") RegistrationContext
registrationContext, @WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") PortletContext portletContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") UserContext userContext, @WebParam(name =
"desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v1:types") List<String> desiredLocales,
@WebParam(mode = WebParam.Mode.OUT, name = "portletDescription", targetNamespace
= "urn:oasis:names:tc:wsrp:v1:types") Holder<PortletDescription>
portletDescription, @WebParam(mode = WebParam.Mode.OUT, name = "resourceList",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<ResourceList>
resourceList, @WebParam(mode = WebParam.Mode.OUT, name = "extensions",
targetNamespace = "urn:oasis:names:tc:wsrp:v1:types")
Holder<List<Extension>> extensions) throws!
MissingParameters, InconsistentParameters, InvalidHandle, InvalidRegistration,
InvalidUserCategory, AccessDenied, OperationFailed
+ {
+ // only return the portlet description the first time the method is called since
all other calls happen after
+ // the clone has been destroyed...
+ if (getCallCount() == 0)
+ {
+ incrementCallCount();
+ super.getPortletDescription(registrationContext, portletContext, userContext,
desiredLocales, portletDescription, resourceList, extensions);
+ }
+ else
+ {
+ throw WSRPExceptionFactory.<InvalidHandle,
InvalidHandleFault>throwWSException(WSRPExceptionFactory.INVALID_HANDLE,
+ "Invalid portlet handle: " + portletContext.getPortletHandle(),
null);
+ }
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/DestroyClonesPortletManagementBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/EmptyMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/EmptyMarkupBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/EmptyMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2.behaviors;
+
+import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.WindowState;
+import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
+import org.gatein.wsrp.test.protocol.v2.MarkupBehavior;
+import org.oasis.wsrp.v2.GetMarkup;
+
+/**
+ * @author <a
href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.v1.consumer.producer.EmptyMarkupBehavior">Chris
+ * Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class EmptyMarkupBehavior extends MarkupBehavior
+{
+ public static final String PORTLET_HANDLE = "EmptyMarkup";
+
+
+ public EmptyMarkupBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ registerHandle(PORTLET_HANDLE);
+ }
+
+ public String getMarkupString(Mode mode, WindowState windowState, String
navigationalState, GetMarkup getMarkup)
+ {
+ return "";
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/EmptyMarkupBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/GroupedPortletsServiceDescriptionBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/GroupedPortletsServiceDescriptionBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/GroupedPortletsServiceDescriptionBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2.behaviors;
+
+import org.gatein.wsrp.test.protocol.v2.ServiceDescriptionBehavior;
+import org.oasis.wsrp.v2.CookieProtocol;
+import org.oasis.wsrp.v2.EventDescription;
+import org.oasis.wsrp.v2.ExportDescription;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.ExtensionDescription;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.ItemDescription;
+import org.oasis.wsrp.v2.ModelDescription;
+import org.oasis.wsrp.v2.ModelTypes;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.ResourceList;
+import org.oasis.wsrp.v2.ResourceSuspended;
+import org.oasis.wsrp.v2.UserContext;
+
+import javax.jws.WebParam;
+import javax.xml.ws.Holder;
+import java.util.List;
+
+/**
+ * Wraps a service description to add group information on portlet descriptions...
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class GroupedPortletsServiceDescriptionBehavior extends
ServiceDescriptionBehavior
+{
+ public GroupedPortletsServiceDescriptionBehavior(List<PortletDescription>
offeredPortlets)
+ {
+ this.offeredPortlets = offeredPortlets;
+ }
+
+ @Override
+ public void getServiceDescription(@WebParam(name = "registrationContext",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext
registrationContext, @WebParam(name = "desiredLocales", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<String> desiredLocales,
@WebParam(name = "portletHandles", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") List<String> portletHandles,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"requiresRegistration", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Boolean> requiresRegistration, @WebParam(name = "offeredPortlets",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<PortletDescription>> offeredPortlets, @WebParam(name =
"userCategoryDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ItemDes!
cription>> userCategoryDescriptions, @WebParam(name =
"extensionDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ExtensionDescription>> extensionDescriptions, @WebParam(name =
"customWindowStateDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ItemDescription>> customWindowStateDescriptions, @WebParam(name =
"customModeDescriptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<ItemDescription>> customModeDescriptions, @WebParam(name =
"requiresInitCookie", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<CookieProtocol> requiresInitCookie, @WebParam(name =
"registrationPropertyDescription", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<ModelDescription> registrationPropertyDescription, @WebParam(name =
"locales", targetNamespace = "urn:!
oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holde!
r<List<S
tring>> locales, @WebParam(name = "resourceList", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<ResourceList> resourceList, @WebParam(name = "eventDescriptions",
targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<EventDescription>> eventDescriptions, @WebParam(name =
"schemaType", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types",
mode = WebParam.Mode.OUT) Holder<ModelTypes> schemaType, @WebParam(name =
"supportedOptions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<String>> supportedOptions, @WebParam(name =
"exportDescription", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<ExportDescription> exportDescription, @WebParam(name =
"mayReturnRegistrationState", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<Boolean> mayReturnRegistrationState, @WebParam(name = "extens!
ions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode =
WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws
InvalidRegistration, ModifyRegistrationRequired, OperationFailed, ResourceSuspended
+ {
+ super.getServiceDescription(registrationContext, desiredLocales, portletHandles,
userContext, requiresRegistration, offeredPortlets, userCategoryDescriptions,
extensionDescriptions, customWindowStateDescriptions, customModeDescriptions,
requiresInitCookie, registrationPropertyDescription, locales, resourceList,
eventDescriptions, schemaType, supportedOptions, exportDescription,
mayReturnRegistrationState, extensions);
+ List<PortletDescription> portletDescriptions = offeredPortlets.value;
+ for (int i = 0; i < portletDescriptions.size(); i++)
+ {
+ portletDescriptions.get(i).setGroupID("group" + i % 3);
+ }
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/GroupedPortletsServiceDescriptionBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieMarkupBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2.behaviors;
+
+import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.WindowState;
+import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
+import org.gatein.wsrp.test.protocol.v2.MarkupBehavior;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.GetMarkup;
+import org.oasis.wsrp.v2.InvalidCookie;
+import org.oasis.wsrp.v2.InvalidCookieFault;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.OperationFailedFault;
+import org.oasis.wsrp.v2.OperationNotSupported;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.ResourceSuspended;
+import org.oasis.wsrp.v2.UserContext;
+
+import javax.jws.WebParam;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 10610 $
+ * @since 2.6
+ */
+public abstract class InitCookieMarkupBehavior extends MarkupBehavior
+{
+ protected String portletHandle;
+ protected int initCookieCallCount;
+
+ public InitCookieMarkupBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ initPortletHandle();
+ registerHandle(portletHandle);
+ }
+
+ protected abstract void initPortletHandle();
+
+
+ protected String getMarkupString(Mode mode, WindowState windowState, String
navigationalState, GetMarkup getMarkup) throws OperationFailed, InvalidCookie
+ {
+ String handle = getMarkup.getPortletContext().getPortletHandle();
+
+ if (portletHandle.equals(handle))
+ {
+ return getMarkupString(handle);
+ }
+
+ // shouldn't happen
+ throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
"Shouldn't be happen", null);
+ }
+
+ protected String getMarkupString(String handle) throws InvalidCookie, OperationFailed
+ {
+ switch (callCount++)
+ {
+ case 0:
+ // simulate change of configuration between calls: upon receiving this, the
consumer should invoke initCookie
+ throw WSRPExceptionFactory.<InvalidCookie,
InvalidCookieFault>throwWSException(WSRPExceptionFactory.INVALID_COOKIE, "Simulate
invalid cookie", null);
+
+ case 1:
+ return handle;
+
+ default:
+ // shouldn't be called more than twice
+ throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
"Shouldn't be called more than twice", null);
+ }
+ }
+
+ @Override
+ public List<Extension> initCookie(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext) throws
AccessDenied, InvalidRegistration, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended
+ {
+ initCookieCallCount++;
+ return null;
+ }
+
+ public int getInitCookieCallCount()
+ {
+ return initCookieCallCount;
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieMarkupBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieNotRequiredMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieNotRequiredMarkupBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieNotRequiredMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2.behaviors;
+
+import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.OperationFailedFault;
+import org.oasis.wsrp.v2.OperationNotSupported;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.ResourceSuspended;
+import org.oasis.wsrp.v2.UserContext;
+
+import javax.jws.WebParam;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class InitCookieNotRequiredMarkupBehavior extends InitCookieMarkupBehavior
+{
+ public static final String INIT_COOKIE_NOT_REQUIRED_HANDLE =
"InitCookieNotRequired";
+
+ public InitCookieNotRequiredMarkupBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ }
+
+ protected void initPortletHandle()
+ {
+ portletHandle = INIT_COOKIE_NOT_REQUIRED_HANDLE;
+ }
+
+ @Override
+ protected String getMarkupString(String handle)
+ {
+ return handle;
+ }
+
+ @Override
+ public List<Extension> initCookie(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext) throws
AccessDenied, InvalidRegistration, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended
+ {
+ super.initCookie(registrationContext, userContext);
+ throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
"Shouldn't be called", null);
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/InitCookieNotRequiredMarkupBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/NullMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/NullMarkupBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/NullMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2.behaviors;
+
+import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.WindowState;
+import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
+import org.gatein.wsrp.test.protocol.v2.MarkupBehavior;
+import org.oasis.wsrp.v2.GetMarkup;
+
+/**
+ * @author <a
href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.v1.consumer.producer.NullMarkupBehavior">Chris
+ * Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class NullMarkupBehavior extends MarkupBehavior
+{
+ public static final String PORTLET_HANDLE = "NullMarkup";
+
+
+ public NullMarkupBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ registerHandle(PORTLET_HANDLE);
+ }
+
+ public String getMarkupString(Mode mode, WindowState windowState, String
navigationalState, GetMarkup getMarkup)
+ {
+ return null;
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/NullMarkupBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerGroupInitCookieMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerGroupInitCookieMarkupBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerGroupInitCookieMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2.behaviors;
+
+import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.OperationFailedFault;
+import org.oasis.wsrp.v2.OperationNotSupported;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.ResourceSuspended;
+import org.oasis.wsrp.v2.UserContext;
+
+import javax.jws.WebParam;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class PerGroupInitCookieMarkupBehavior extends InitCookieMarkupBehavior
+{
+ public static final String PER_GROUP_INIT_COOKIE_HANDLE =
"PerGroupInitCookie";
+
+ public PerGroupInitCookieMarkupBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ }
+
+ protected void initPortletHandle()
+ {
+ portletHandle = PER_GROUP_INIT_COOKIE_HANDLE;
+ }
+
+ @Override
+ public List<Extension> initCookie(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext) throws
AccessDenied, InvalidRegistration, ModifyRegistrationRequired, OperationFailed,
OperationNotSupported, ResourceSuspended
+ {
+ List<Extension> extensions = super.initCookie(registrationContext,
userContext);
+
+ if (initCookieCallCount > 3)
+ {
+ throw WSRPExceptionFactory.<OperationFailed,
OperationFailedFault>throwWSException(WSRPExceptionFactory.OPERATION_FAILED,
+ "Service description only defines 3 groups so initCookie should only be
called 3 times!",
+ new IllegalStateException("Service description only defines 3 groups so
initCookie should only be called 3 times!"));
+ }
+ return extensions;
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerGroupInitCookieMarkupBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerUserInitCookieMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerUserInitCookieMarkupBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerUserInitCookieMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2.behaviors;
+
+import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class PerUserInitCookieMarkupBehavior extends InitCookieMarkupBehavior
+{
+ public static final String PER_USER_INIT_COOKIE_HANDLE =
"PerUserInitCookie";
+
+ public PerUserInitCookieMarkupBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ }
+
+ protected void initPortletHandle()
+ {
+ portletHandle = PER_USER_INIT_COOKIE_HANDLE;
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/PerUserInitCookieMarkupBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/ResourceMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/ResourceMarkupBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/ResourceMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2.behaviors;
+
+import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.WindowState;
+import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
+import org.gatein.wsrp.test.protocol.v2.MarkupBehavior;
+import org.oasis.wsrp.v2.GetMarkup;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class ResourceMarkupBehavior extends MarkupBehavior
+{
+ public static final String PORTLET_HANDLE = "resource";
+
+
+ public ResourceMarkupBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ registerHandle(PORTLET_HANDLE);
+ }
+
+ protected String getMarkupString(Mode mode, WindowState windowState, String
navigationalState, GetMarkup getMarkup)
+ {
+ return "<img
src='wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080"
+
+
"%2Ftest-resource-portlet%2Fgif%2Flogo.gif&wsrp-requiresRewrite=true/wsrp_rewrite'/>";
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/ResourceMarkupBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/SessionMarkupBehavior.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/SessionMarkupBehavior.java
(rev 0)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/SessionMarkupBehavior.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.test.protocol.v2.behaviors;
+
+import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.OpaqueStateString;
+import org.gatein.pc.api.WindowState;
+import org.gatein.wsrp.WSRPTypeFactory;
+import org.gatein.wsrp.test.protocol.v2.BehaviorRegistry;
+import org.gatein.wsrp.test.protocol.v2.MarkupBehavior;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.GetMarkup;
+import org.oasis.wsrp.v2.InconsistentParameters;
+import org.oasis.wsrp.v2.InteractionParams;
+import org.oasis.wsrp.v2.InvalidCookie;
+import org.oasis.wsrp.v2.InvalidHandle;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.InvalidSession;
+import org.oasis.wsrp.v2.InvalidUserCategory;
+import org.oasis.wsrp.v2.MarkupParams;
+import org.oasis.wsrp.v2.MarkupResponse;
+import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.ModifyRegistrationRequired;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.PortletStateChangeRequired;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.ResourceSuspended;
+import org.oasis.wsrp.v2.RuntimeContext;
+import org.oasis.wsrp.v2.SessionContext;
+import org.oasis.wsrp.v2.UnsupportedLocale;
+import org.oasis.wsrp.v2.UnsupportedMimeType;
+import org.oasis.wsrp.v2.UnsupportedMode;
+import org.oasis.wsrp.v2.UnsupportedWindowState;
+import org.oasis.wsrp.v2.UpdateResponse;
+import org.oasis.wsrp.v2.UserContext;
+
+import javax.jws.WebParam;
+import javax.xml.ws.Holder;
+import java.util.List;
+
+/**
+ * @author <a
href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.v1.consumer.producer.SessionBehavior">Chris
+ * Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class SessionMarkupBehavior extends MarkupBehavior
+{
+ public static final String PORTLET_HANDLE = "SecondPortletHandle";
+ public static final String SESSION_ID = "sessionID";
+ public static final String NS = "ns2";
+
+
+ private int count = 0;
+ private String sessionId;
+
+ public SessionMarkupBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ registerHandle(PORTLET_HANDLE);
+ }
+
+ public String getMarkupString(Mode mode, WindowState windowState, String
navigationalState, GetMarkup getMarkup)
+ {
+ StringBuffer markupString = new StringBuffer("portlet2:");
+ sessionId = getMarkup.getRuntimeContext().getSessionParams().getSessionID();
+
+ // if we have a session, increments count to simulate session usage
+ if (SESSION_ID.equals(sessionId))
+ {
+ count++;
+ }
+ markupString.append(count).append(":");
+
+ markupString.append(mode).append(":").append(windowState);
+ if (navigationalState != null)
+ {
+ markupString.append(":").append(navigationalState);
+ }
+
+ return markupString.toString();
+ }
+
+ @Override
+ public void performBlockingInteraction(@WebParam(name =
"registrationContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext,
@WebParam(name = "portletContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext,
@WebParam(name = "runtimeContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") RuntimeContext runtimeContext,
@WebParam(name = "userContext", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name =
"markupParams", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types")
MarkupParams markupParams, @WebParam(name = "interactionParams", targetNamespace
= "urn:oasis:names:tc:wsrp:v2:types") InteractionParams interactionParams,
@WebParam(name = "updateResponse", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<UpdateResponse> updateResponse, @WebParam(name = "redirectURL",
targetNamespace = "urn:oasis:na!
mes:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<String> redirectURL,
@WebParam(name = "extensions", targetNamespace =
"urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT)
Holder<List<Extension>> extensions) throws AccessDenied,
InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession,
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed,
PortletStateChangeRequired, ResourceSuspended, UnsupportedLocale, UnsupportedMimeType,
UnsupportedMode, UnsupportedWindowState
+ {
+ UpdateResponse ur = WSRPTypeFactory.createUpdateResponse();
+ ur.setNavigationalContext(WSRPTypeFactory.createNavigationalContextOrNull(new
OpaqueStateString(NS), null));
+ updateResponse.value = ur;
+ }
+
+ public void modifyResponseIfNeeded(MarkupResponse markupResponse)
+ {
+ // fakes creation of a portlet session if not already present
+ if (count == 0 || SESSION_ID.equals(sessionId))
+ {
+ SessionContext sessionContext = WSRPTypeFactory.createSessionContext(SESSION_ID,
30);
+ markupResponse.setSessionContext(sessionContext);
+ }
+ }
+
+
+ protected String getSuffixFor(String handle)
+ {
+ return "2";
+ }
+}
Property changes on:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/behaviors/SessionMarkupBehavior.java
___________________________________________________________________
Name: svn:executable
+ *
Deleted:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/BehaviorBackedServiceFactory.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/BehaviorBackedServiceFactory.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/BehaviorBackedServiceFactory.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -1,229 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.test.support;
-
-import org.gatein.common.NotYetImplemented;
-import org.gatein.pc.api.Mode;
-import org.gatein.pc.api.WindowState;
-import org.gatein.wsrp.services.ServiceFactory;
-import org.gatein.wsrp.test.BehaviorRegistry;
-import org.gatein.wsrp.test.protocol.v1.MarkupBehavior;
-import org.oasis.wsrp.v1.V1AccessDenied;
-import org.oasis.wsrp.v1.V1GetMarkup;
-import org.oasis.wsrp.v1.V1InconsistentParameters;
-import org.oasis.wsrp.v1.V1InvalidCookie;
-import org.oasis.wsrp.v1.V1InvalidHandle;
-import org.oasis.wsrp.v1.V1InvalidRegistration;
-import org.oasis.wsrp.v1.V1InvalidSession;
-import org.oasis.wsrp.v1.V1InvalidUserCategory;
-import org.oasis.wsrp.v1.V1MissingParameters;
-import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1UnsupportedLocale;
-import org.oasis.wsrp.v1.V1UnsupportedMimeType;
-import org.oasis.wsrp.v1.V1UnsupportedMode;
-import org.oasis.wsrp.v1.V1UnsupportedWindowState;
-import org.oasis.wsrp.v1.WSRPV1MarkupPortType;
-import org.oasis.wsrp.v1.WSRPV1PortletManagementPortType;
-import org.oasis.wsrp.v1.WSRPV1RegistrationPortType;
-import org.oasis.wsrp.v1.WSRPV1ServiceDescriptionPortType;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision: 11461 $
- * @since 2.6
- */
-public class BehaviorBackedServiceFactory implements ServiceFactory
-{
- private BehaviorRegistry registry;
- private final static String MARKUP = "markup";
- private final static String SD_URL = "sd";
- private final static String M_URL = "m";
- private final static String PM_URL = "pm";
- private final static String R_URL = "r";
- private boolean initialized = false;
- private String wsdl = DEFAULT_WSDL_URL;
- public static final String DEFAULT_WSDL_URL =
"http://example.com/producer?wsdl";
- private int timeout;
-
-
- public BehaviorBackedServiceFactory()
- {
- registry = new BehaviorRegistry();
- registry.registerMarkupBehavior(new SimpleMarkupBehavior());
- }
-
- public <T> T getService(Class<T> serviceClass) throws Exception
- {
- if (!isAvailable() && !isFailed())
- {
- start();
- }
-
- if (WSRPV1ServiceDescriptionPortType.class.isAssignableFrom(serviceClass))
- {
- return (T)registry.getServiceDescriptionBehavior();
- }
- if (WSRPV1MarkupPortType.class.isAssignableFrom(serviceClass))
- {
- return (T)registry.getMarkupBehaviorFor(MARKUP);
- }
- if (WSRPV1PortletManagementPortType.class.isAssignableFrom(serviceClass))
- {
- return (T)registry.getPortletManagementBehavior();
- }
- if (WSRPV1RegistrationPortType.class.isAssignableFrom(serviceClass))
- {
- return (T)registry.getRegistrationBehavior();
- }
- return null;
- }
-
- public BehaviorRegistry getRegistry()
- {
- return registry;
- }
-
- public void setRegistry(BehaviorRegistry registry)
- {
- this.registry = registry;
- }
-
- public boolean isAvailable()
- {
- return initialized;
- }
-
- public boolean isFailed()
- {
- return false;
- }
-
- public void setFailed(boolean failed)
- {
- // do nothing
- }
-
- public void setWSOperationTimeOut(int msBeforeTimeOut)
- {
- if (msBeforeTimeOut < 0)
- {
- msBeforeTimeOut = DEFAULT_TIMEOUT_MS;
- }
-
- timeout = msBeforeTimeOut;
- }
-
- public int getWSOperationTimeOut()
- {
- return timeout;
- }
-
- public String getServiceDescriptionURL()
- {
- return SD_URL;
- }
-
- public String getMarkupURL()
- {
- return M_URL;
- }
-
- public String getRegistrationURL()
- {
- return R_URL;
- }
-
- public String getPortletManagementURL()
- {
- return PM_URL;
- }
-
- public void setServiceDescriptionURL(String serviceDescriptionURL)
- {
- // do nothing
- }
-
- public void setMarkupURL(String markupURL)
- {
- // do nothing
- }
-
- public void setRegistrationURL(String registrationURL)
- {
- // do nothing
- }
-
- public void setPortletManagementURL(String portletManagementURL)
- {
- // do nothing
- }
-
- public void create() throws Exception
- {
- throw new NotYetImplemented();
- }
-
- public void start() throws Exception
- {
- initialized = true;
- }
-
- public void stop()
- {
- throw new NotYetImplemented();
- }
-
- public void setWsdlDefinitionURL(String wsdlDefinitionURL)
- {
- wsdl = wsdlDefinitionURL;
- }
-
- public String getWsdlDefinitionURL()
- {
- return wsdl;
- }
-
- public void destroy()
- {
- throw new NotYetImplemented();
- }
-
- private class SimpleMarkupBehavior extends MarkupBehavior
- {
- public SimpleMarkupBehavior()
- {
- super(BehaviorBackedServiceFactory.this.registry);
- registerHandle(MARKUP);
- }
-
- @Override
- protected String getMarkupString(Mode mode, WindowState windowState, String
navigationalState, V1GetMarkup getMarkup)
- throws V1UnsupportedWindowState, V1InvalidCookie, V1InvalidSession,
V1AccessDenied, V1InconsistentParameters,
- V1InvalidHandle, V1UnsupportedLocale, V1UnsupportedMode, V1OperationFailed,
V1MissingParameters, V1InvalidUserCategory,
- V1InvalidRegistration, V1UnsupportedMimeType
- {
- return MARKUP;
- }
- }
-}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockEndpointConfigurationInfo.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockEndpointConfigurationInfo.java 2010-05-27
07:15:18 UTC (rev 3208)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockEndpointConfigurationInfo.java 2010-05-27
16:51:39 UTC (rev 3209)
@@ -24,6 +24,7 @@
package org.gatein.wsrp.test.support;
import org.gatein.wsrp.consumer.EndpointConfigurationInfo;
+import org.gatein.wsrp.test.protocol.v2.BehaviorBackedServiceFactory;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>