gatein SVN: r3345 - epp/docs/branches/EPP_5_0_Branch.
by do-not-reply@jboss.org
Author: smumford
Date: 2010-06-15 23:19:41 -0400 (Tue, 15 Jun 2010)
New Revision: 3345
Added:
epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Technical_Preview_Release_Notes/
Removed:
epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/
Log:
Renaming as per packaging requirements
Copied: epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Technical_Preview_Release_Notes (from rev 3344, epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes)
14 years, 6 months
gatein SVN: r3344 - in components/wsrp/trunk: producer/src/main/java/org/gatein/wsrp/producer and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-06-15 18:34:17 -0400 (Tue, 15 Jun 2010)
New Revision: 3344
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ServiceDescriptionHandler.java
Log:
- GTNWSRP-45: Started re-implementing service description handling so that we can cache data. Right now, only registration properties are cached as caching portlet information will require PC-level support. NOT TESTED.
- GTNWSRP-38, GTNWSRP-39: Started adding PRP and event information in portlet and service descriptions. NOT TESTED.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-06-15 22:29:02 UTC (rev 3343)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-06-15 22:34:17 UTC (rev 3344)
@@ -45,6 +45,7 @@
import org.oasis.wsrp.v2.ClonePortlet;
import org.oasis.wsrp.v2.DestroyPortlets;
import org.oasis.wsrp.v2.DestroyPortletsResponse;
+import org.oasis.wsrp.v2.EventDescription;
import org.oasis.wsrp.v2.FailedPortlets;
import org.oasis.wsrp.v2.GetMarkup;
import org.oasis.wsrp.v2.GetPortletDescription;
@@ -62,6 +63,7 @@
import org.oasis.wsrp.v2.ModifyRegistration;
import org.oasis.wsrp.v2.NamedString;
import org.oasis.wsrp.v2.NavigationalContext;
+import org.oasis.wsrp.v2.ParameterDescription;
import org.oasis.wsrp.v2.PerformBlockingInteraction;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
@@ -264,7 +266,7 @@
/** ====== WSRP Response objects ====== * */
public static BlockingInteractionResponse createBlockingInteractionResponse(UpdateResponse updateResponse)
- {
+ {
if (updateResponse == null)
{
throw new IllegalArgumentException("BlockingInteractionResponse requires either an UpdateResponse or a redirect URL.");
@@ -290,23 +292,6 @@
return new UpdateResponse();
}
- public static PortletDescription createPortletDescription(org.gatein.pc.api.PortletContext portletContext, List<MarkupType> markupTypes)
- {
- PortletContext context = WSRPUtils.convertToWSRPPortletContext(portletContext);
-
- ParameterValidation.throwIllegalArgExceptionIfNull(markupTypes, "MarkupType");
- if (markupTypes.isEmpty())
- {
- throw new IllegalArgumentException("Cannot create a PortletDescription with an empty list of MarkupTypes!");
- }
-
- PortletDescription portletDescription = new PortletDescription();
- portletDescription.setPortletHandle(context.getPortletHandle());
- portletDescription.getMarkupTypes().addAll(markupTypes);
-
- return portletDescription;
- }
-
public static PortletDescription createPortletDescription(String portletHandle, List<MarkupType> markupTypes)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", null);
@@ -1155,4 +1140,20 @@
return null;
}
+
+ public static ParameterDescription createParameterDescription(String identifier)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(identifier, "Parameter identifier", null);
+ ParameterDescription desc = new ParameterDescription();
+ desc.setIdentifier(identifier);
+ return desc;
+ }
+
+ public static EventDescription createEventDescription(QName name)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(name, "name");
+ EventDescription desc = new EventDescription();
+ desc.setName(name);
+ return desc;
+ }
}
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ServiceDescriptionHandler.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ServiceDescriptionHandler.java 2010-06-15 22:29:02 UTC (rev 3343)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ServiceDescriptionHandler.java 2010-06-15 22:34:17 UTC (rev 3344)
@@ -27,24 +27,33 @@
import org.gatein.common.util.ParameterValidation;
import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletInvokerException;
+import org.gatein.pc.api.TransportGuarantee;
import org.gatein.pc.api.info.CapabilitiesInfo;
+import org.gatein.pc.api.info.EventInfo;
+import org.gatein.pc.api.info.EventingInfo;
import org.gatein.pc.api.info.MetaInfo;
import org.gatein.pc.api.info.ModeInfo;
+import org.gatein.pc.api.info.NavigationInfo;
+import org.gatein.pc.api.info.ParameterInfo;
import org.gatein.pc.api.info.PortletInfo;
+import org.gatein.pc.api.info.SecurityInfo;
import org.gatein.pc.api.info.WindowStateInfo;
import org.gatein.registration.Registration;
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+import org.gatein.wsrp.spec.v2.WSRP2Constants;
import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.oasis.wsrp.v2.CookieProtocol;
+import org.oasis.wsrp.v2.EventDescription;
import org.oasis.wsrp.v2.GetServiceDescription;
import org.oasis.wsrp.v2.InvalidHandle;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.MarkupType;
import org.oasis.wsrp.v2.ModelDescription;
import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.ParameterDescription;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.RegistrationContext;
@@ -54,7 +63,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -65,29 +73,24 @@
* @version $Revision: 12017 $
* @since 2.4
*/
-class
- ServiceDescriptionHandler extends ServiceHandler implements ServiceDescriptionInterface
+class ServiceDescriptionHandler extends ServiceHandler implements ServiceDescriptionInterface
{
// JBPORTAL-1220: force call to initCookie... Required so that BEA version < 9.2 will behave properly as a Consumer
- private final CookieProtocol BEA_8_CONSUMER_FIX = CookieProtocol.PER_USER;
+ private static final CookieProtocol BEA_8_CONSUMER_FIX = CookieProtocol.PER_USER;
+ private ServiceDescriptionInfo serviceDescription;
ServiceDescriptionHandler(WSRPProducerImpl producer)
{
super(producer);
+ serviceDescription = new ServiceDescriptionInfo(producer);
}
- public ServiceDescription getServiceDescription(GetServiceDescription gs)
- throws InvalidRegistration, OperationFailed
+ public ServiceDescription getServiceDescription(GetServiceDescription gs) throws InvalidRegistration, OperationFailed
{
WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(gs, "GetServiceDescription");
RegistrationContext registrationContext = gs.getRegistrationContext();
- ProducerRegistrationRequirements requirements = producer.getProducerRegistrationRequirements();
- ServiceDescription serviceDescription = WSRPTypeFactory.createServiceDescription(requirements.isRegistrationRequired());
- serviceDescription.setRequiresInitCookie(BEA_8_CONSUMER_FIX);
- serviceDescription.getLocales().addAll(producer.getSupportedLocales());
-
// if a RegistrationContext is provided, we need to validate the registration information
Registration registration = null;
if (registrationContext != null)
@@ -95,57 +98,35 @@
registration = producer.getRegistrationOrFailIfInvalid(registrationContext);
}
- // get the portlet descriptions based on registration information
- List<PortletDescription> offeredPortlets = getPortletDescriptions(gs.getDesiredLocales(), registration);
- if (offeredPortlets != null)
+ ProducerRegistrationRequirements requirements = producer.getProducerRegistrationRequirements();
+
+ // if we don't have registration information but a registration is required, send registration props information
+ boolean needsRegistrationProperties = registration == null && requirements.isRegistrationRequired();
+ if (needsRegistrationProperties)
{
- serviceDescription.getOfferedPortlets().addAll(offeredPortlets);
+ serviceDescription.updateRegistrationProperties(requirements);
}
- // if we don't have registration information but a registration is required, send registration props information
- if (registration == null && requirements.isRegistrationRequired())
+ boolean needsPortletDescriptions = registration == null && requirements.isRegistrationRequired()
+ && requirements.isRegistrationRequiredForFullDescription();
+ if (needsPortletDescriptions)
{
- log.debug("Unregistered consumer while registration is required. Sending registration information.");
-
- // do not create a ModelDescription if there is no registration properties
- Map<QName, RegistrationPropertyDescription> info = requirements.getRegistrationProperties();
- ModelDescription description = null;
- if (info != null && !info.isEmpty())
+ Set<Portlet> portlets;
+ try
{
- description = Utils.convertRegistrationPropertiesToModelDescription(info);
+ portlets = producer.getRemotablePortlets();
}
-
- serviceDescription.setRegistrationPropertyDescription(description);
+ catch (PortletInvokerException e)
+ {
+ log.warn("Could not retrieve portlets. Reason:\n\t" + e.getLocalizedMessage());
+ portlets = Collections.emptySet();
+ }
+ serviceDescription.updatePortletDescriptions(portlets, gs.getDesiredLocales(), registration);
}
- return serviceDescription;
+ return serviceDescription.getServiceDescription(needsRegistrationProperties, needsPortletDescriptions);
}
-
- private Set<PortletDescription> getOfferedPortletDescriptions(List<String> desiredLocales)
- {
- Set<Portlet> portlets;
- try
- {
- portlets = producer.getRemotablePortlets();
- }
- catch (PortletInvokerException e)
- {
- log.warn("Could not retrieve portlets. Reason:\n\t" + e.getLocalizedMessage());
- return Collections.emptySet();
- }
-
- Set<PortletDescription> offeredPortletDescriptions = new HashSet<PortletDescription>(portlets.size());
-
- for (Portlet portlet : portlets)
- {
- PortletDescription desc = getPortletDescription(portlet, desiredLocales);
- offeredPortletDescriptions.add(desc);
- }
-
- return offeredPortletDescriptions;
- }
-
public PortletDescription getPortletDescription(PortletContext portletContext, List<String> desiredLocales, Registration registration) throws InvalidHandle, OperationFailed
{
ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "portlet context");
@@ -162,22 +143,16 @@
}
/**
- * @param desiredLocales the locales in which the portlet descriptions must be provided (best effort)
- * @param registration used to filter offered portlet lists
- * @return an array of portlet descriptions offered by this producer (which could be filtered based on the
- * registration information) or <code>null</code> if no registration is provided and the producer requires
- * registration to access the full service description.
+ * Creates a PortletDescription based on the user desired locales (ordered according to user preferences) for the
+ * specified component.
+ *
+ * @param portlet
+ * @param desiredLocales the user desired locales (ordered according to user preferences) to use for the description
+ * @return a PortletDescription describing the specified portlet
*/
- private List<PortletDescription> getPortletDescriptions(List<String> desiredLocales, Registration registration)
+ static PortletDescription getPortletDescription(Portlet portlet, List<String> desiredLocales)
{
- ProducerRegistrationRequirements registrationReq = producer.getProducerRegistrationRequirements();
- if (registration == null && registrationReq.isRegistrationRequired() && registrationReq.isRegistrationRequiredForFullDescription())
- {
- return null;
- }
-
- Set<PortletDescription> descriptions = getOfferedPortletDescriptions(desiredLocales);
- return new ArrayList<PortletDescription>(descriptions);
+ return getPortletDescription(portlet, desiredLocales, null);
}
/**
@@ -188,11 +163,15 @@
* @param desiredLocales the user desired locales (ordered according to user preferences) to use for the description
* @return a PortletDescription describing the specified portlet
*/
- PortletDescription getPortletDescription(Portlet portlet, List<String> desiredLocales)
+ static PortletDescription getPortletDescription(Portlet portlet, List<String> desiredLocales, ServiceDescriptionInfo sdi)
{
org.gatein.pc.api.PortletContext context = portlet.getContext();
PortletInfo info = portlet.getInfo();
- log.debug("Constructing portlet description for: " + context.getId());
+ String handle = context.getId();
+ if (log.isDebugEnabled())
+ {
+ log.debug("Constructing portlet description for: " + handle);
+ }
CapabilitiesInfo capInfo = info.getCapabilities();
Collection<MediaType> allMediaTypes = capInfo.getMediaTypes();
@@ -205,7 +184,7 @@
markupTypes.add(markupType);
}
- PortletDescription desc = WSRPTypeFactory.createPortletDescription(context, markupTypes);
+ PortletDescription desc = WSRPTypeFactory.createPortletDescription(handle, markupTypes);
// group ID
desc.setGroupID(info.getApplicationName());
@@ -243,22 +222,95 @@
}
}
+ // events
+ EventingInfo eventsInfo = info.getEventing();
+ if (eventsInfo != null)
+ {
+ Map<QName, ? extends EventInfo> producedEvents = eventsInfo.getProducedEvents();
+ if (ParameterValidation.existsAndIsNotEmpty(producedEvents))
+ {
+ List<QName> publishedEvents = desc.getPublishedEvents();
+ for (Map.Entry<QName, ? extends EventInfo> entry : producedEvents.entrySet())
+ {
+ publishedEvents.add(entry.getKey());
+
+ // record event info in ServiceDescriptionInfo
+ if (sdi != null)
+ {
+ sdi.addEventInfo(entry.getValue(), desiredLocales);
+ }
+ }
+ }
+ Map<QName, ? extends EventInfo> consumedEvents = eventsInfo.getConsumedEvents();
+ if (ParameterValidation.existsAndIsNotEmpty(consumedEvents))
+ {
+ List<QName> handledEvents = desc.getHandledEvents();
+ for (Map.Entry<QName, ? extends EventInfo> entry : consumedEvents.entrySet())
+ {
+ handledEvents.add(entry.getKey());
+
+ // record event info in ServiceDescriptionInfo
+ if (sdi != null)
+ {
+ sdi.addEventInfo(entry.getValue(), desiredLocales);
+ }
+ }
+ }
+ }
+
+ // public parameters
+ NavigationInfo navigationInfo = info.getNavigation();
+ if (navigationInfo != null)
+ {
+ Collection<? extends ParameterInfo> parameterInfos = navigationInfo.getPublicParameters();
+ if (ParameterValidation.existsAndIsNotEmpty(parameterInfos))
+ {
+ List<ParameterDescription> publicValueDescriptions = desc.getNavigationalPublicValueDescriptions();
+ for (ParameterInfo parameterInfo : parameterInfos)
+ {
+ String id = parameterInfo.getId();
+ ParameterDescription paramDesc = WSRPTypeFactory.createParameterDescription(id);
+ paramDesc.setDescription(Utils.convertToWSRPLocalizedString(parameterInfo.getDescription(), desiredLocales));
+ paramDesc.setLabel(WSRPTypeFactory.createLocalizedString(id));
+ List<QName> names = paramDesc.getNames();
+ names.add(parameterInfo.getName());
+ Collection<QName> aliases = parameterInfo.getAliases();
+ if (ParameterValidation.existsAndIsNotEmpty(aliases))
+ {
+ names.addAll(aliases);
+ }
+
+ publicValueDescriptions.add(paramDesc);
+ }
+ }
+ }
+
+ // security
+ SecurityInfo secInfo = info.getSecurity();
+ if (secInfo.containsTransportGuarantee(TransportGuarantee.INTEGRAL)
+ || secInfo.containsTransportGuarantee(TransportGuarantee.CONFIDENTIAL))
+ {
+ desc.setOnlySecure(true);
+ }
+
/* todo:
+ * [O] ID portletID
* [O] string userCategories[]
* [O] string userProfileItems[]
+ * [O] string portletManagedModes[]
* [O] boolean usesMethodGet
* [O] boolean defaultMarkupSecure
- * [O] boolean onlySecure
* [O] boolean userContextStoredInSession
* [O] boolean templatesStoredInSession
* [O] boolean hasUserSpecificState
* [O] boolean doesUrlTemplateProcessing
- * [O] Extension extensions
+ * [O] boolean mayReturnPortletState
+ * [O] Extension extensions[]
*/
return desc;
}
- private List<String> getLocaleNamesFrom(Collection<Locale> locales)
+ private static List<String> getLocaleNamesFrom(Collection<Locale> locales)
{
if (locales == null || locales.isEmpty())
{
@@ -273,7 +325,7 @@
return localeNames;
}
- private List<String> getWindowStateNamesFrom(Collection<WindowStateInfo> windowStates)
+ private static List<String> getWindowStateNamesFrom(Collection<WindowStateInfo> windowStates)
{
List<String> result = new ArrayList<String>(windowStates.size());
for (WindowStateInfo windowStateInfo : windowStates)
@@ -283,7 +335,7 @@
return result;
}
- private List<String> getModeNamesFrom(Collection<ModeInfo> modes)
+ private static List<String> getModeNamesFrom(Collection<ModeInfo> modes)
{
List<String> result = new ArrayList<String>(modes.size());
for (ModeInfo modeInfo : modes)
@@ -292,4 +344,132 @@
}
return result;
}
+
+ private static class ServiceDescriptionInfo
+ {
+ /** Empty service description: no registration properties, no offered portlets */
+ private ServiceDescription noRegistrationNoPortletsServiceDescription;
+ /** No registration properties, offered portles */
+ private ServiceDescription noRegistrationPortletsServiceDescription;
+ /** Registration properties, no offered portlets */
+ private ServiceDescription registrationNoPortletsServiceDescription;
+ /** Registration properties, offered portlets */
+ private ServiceDescription registrationPortletsServiceDescription;
+
+ private long lastGenerated;
+ private List<EventDescription> eventDescriptions;
+
+ private static final List<String> OPTIONS = new ArrayList<String>(5);
+
+ static
+ {
+ OPTIONS.add(WSRP2Constants.OPTIONS_EVENTS);
+ OPTIONS.add(WSRP2Constants.OPTIONS_IMPORT);
+ OPTIONS.add(WSRP2Constants.OPTIONS_EXPORT);
+ }
+
+ private ServiceDescriptionInfo(WSRPProducerImpl producer)
+ {
+ noRegistrationNoPortletsServiceDescription = WSRPTypeFactory.createServiceDescription(false);
+ noRegistrationNoPortletsServiceDescription.setRequiresInitCookie(BEA_8_CONSUMER_FIX);
+ noRegistrationNoPortletsServiceDescription.getLocales().addAll(producer.getSupportedLocales());
+ noRegistrationNoPortletsServiceDescription.getSupportedOptions().addAll(OPTIONS);
+
+ noRegistrationPortletsServiceDescription = WSRPTypeFactory.createServiceDescription(false);
+ noRegistrationPortletsServiceDescription.setRequiresInitCookie(BEA_8_CONSUMER_FIX);
+ noRegistrationPortletsServiceDescription.getLocales().addAll(producer.getSupportedLocales());
+ noRegistrationPortletsServiceDescription.getSupportedOptions().addAll(OPTIONS);
+
+ registrationNoPortletsServiceDescription = WSRPTypeFactory.createServiceDescription(false);
+ registrationNoPortletsServiceDescription.setRequiresInitCookie(BEA_8_CONSUMER_FIX);
+ registrationNoPortletsServiceDescription.getLocales().addAll(producer.getSupportedLocales());
+ registrationNoPortletsServiceDescription.getSupportedOptions().addAll(OPTIONS);
+
+ registrationPortletsServiceDescription = WSRPTypeFactory.createServiceDescription(false);
+ registrationPortletsServiceDescription.setRequiresInitCookie(BEA_8_CONSUMER_FIX);
+ registrationPortletsServiceDescription.getLocales().addAll(producer.getSupportedLocales());
+ registrationPortletsServiceDescription.getSupportedOptions().addAll(OPTIONS);
+ }
+
+ private void updateRegistrationProperties(ProducerRegistrationRequirements requirements)
+ {
+ long lastModified = requirements.getLastModified();
+ if (lastModified > lastGenerated)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Re-generating registration properties information for service description.");
+ }
+
+ // do not create a ModelDescription if there is no registration properties
+ Map<QName, RegistrationPropertyDescription> info = requirements.getRegistrationProperties();
+ ModelDescription registrationProperties = null;
+ if (ParameterValidation.existsAndIsNotEmpty(info))
+ {
+ registrationProperties = Utils.convertRegistrationPropertiesToModelDescription(info);
+ }
+ registrationNoPortletsServiceDescription.setRegistrationPropertyDescription(registrationProperties);
+ registrationPortletsServiceDescription.setRegistrationPropertyDescription(registrationProperties);
+
+ lastGenerated = System.currentTimeMillis();
+ }
+ }
+
+ private void updatePortletDescriptions(Set<Portlet> portlets, List<String> desiredLocales, Registration registration)
+ {
+ if (ParameterValidation.existsAndIsNotEmpty(portlets))
+ {
+ Collection<PortletDescription> offeredPortletDescriptions = new ArrayList<PortletDescription>(portlets.size());
+
+ // reset event descriptions as they will be repopulated when we build the portlet descriptions
+ eventDescriptions = new ArrayList<EventDescription>(portlets.size());
+
+ for (Portlet portlet : portlets)
+ {
+ PortletDescription desc = getPortletDescription(portlet, desiredLocales);
+ offeredPortletDescriptions.add(desc);
+ }
+
+ // events
+ registrationPortletsServiceDescription.getEventDescriptions().addAll(eventDescriptions);
+ registrationNoPortletsServiceDescription.getEventDescriptions().addAll(eventDescriptions);
+ noRegistrationPortletsServiceDescription.getEventDescriptions().addAll(eventDescriptions);
+ noRegistrationNoPortletsServiceDescription.getEventDescriptions().addAll(eventDescriptions);
+
+ List<PortletDescription> offeredPortlets = registrationPortletsServiceDescription.getOfferedPortlets();
+ offeredPortlets.clear();
+ offeredPortlets.addAll(offeredPortletDescriptions);
+
+ offeredPortlets = noRegistrationPortletsServiceDescription.getOfferedPortlets();
+ offeredPortlets.clear();
+ offeredPortlets.addAll(offeredPortletDescriptions);
+ }
+ }
+
+ private ServiceDescription getServiceDescription(boolean needsRegistrationProperties, boolean needsPortletDescriptions)
+ {
+ if (needsRegistrationProperties)
+ {
+ return needsPortletDescriptions ? registrationPortletsServiceDescription : registrationNoPortletsServiceDescription;
+ }
+ else
+ {
+ return needsPortletDescriptions ? noRegistrationPortletsServiceDescription : noRegistrationNoPortletsServiceDescription;
+ }
+ }
+
+ public void addEventInfo(EventInfo info, List<String> desiredLocales)
+ {
+ EventDescription desc = WSRPTypeFactory.createEventDescription(info.getName());
+ desc.setDescription(Utils.convertToWSRPLocalizedString(info.getDescription(), desiredLocales));
+ desc.setLabel(Utils.convertToWSRPLocalizedString(info.getDisplayName(), desiredLocales));
+ Collection<QName> aliases = info.getAliases();
+ if (ParameterValidation.existsAndIsNotEmpty(aliases))
+ {
+ desc.getAliases().addAll(aliases);
+ }
+ // todo: deal with type info...
+ eventDescriptions.add(desc);
+ }
+ }
}
14 years, 6 months
gatein SVN: r3343 - in components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config: impl and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-06-15 18:29:02 -0400 (Tue, 15 Jun 2010)
New Revision: 3343
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirements.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
Log:
- Added last modification date so that clients can know whether they can use cached data or not.
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirements.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirements.java 2010-06-15 22:27:28 UTC (rev 3342)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirements.java 2010-06-15 22:29:02 UTC (rev 3343)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * 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.
@@ -114,4 +114,6 @@
Set<RegistrationPropertyChangeListener> getPropertyChangeListeners();
Set<RegistrationPolicyChangeListener> getPolicyChangeListeners();
+
+ long getLastModified();
}
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2010-06-15 22:27:28 UTC (rev 3342)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2010-06-15 22:29:02 UTC (rev 3343)
@@ -58,6 +58,7 @@
private RegistrationPolicy policy;
private String policyClassName;
private String validatorClassName;
+ private long lastModified;
private Map<QName, RegistrationPropertyDescription> registrationProperties;
@@ -69,6 +70,7 @@
this();
this.requiresRegistration = requiresRegistration;
this.fullServiceDescriptionRequiresRegistration = fullServiceDescriptionRequiresRegistration;
+ modifyNow();
}
public ProducerRegistrationRequirementsImpl()
@@ -76,6 +78,16 @@
registrationProperties = new HashMap<QName, RegistrationPropertyDescription>(7);
}
+ private void modifyNow()
+ {
+ lastModified = System.currentTimeMillis();
+ }
+
+ public long getLastModified()
+ {
+ return lastModified;
+ }
+
public boolean isRegistrationRequired()
{
return requiresRegistration;
@@ -89,7 +101,11 @@
clearRegistrationProperties();
}
- this.requiresRegistration = requiresRegistration;
+ if (this.requiresRegistration != requiresRegistration)
+ {
+ this.requiresRegistration = requiresRegistration;
+ modifyNow();
+ }
}
public boolean isRegistrationRequiredForFullDescription()
@@ -99,7 +115,11 @@
public void setRegistrationRequiredForFullDescription(boolean fullServiceDescriptionRequiresRegistration)
{
- this.fullServiceDescriptionRequiresRegistration = fullServiceDescriptionRequiresRegistration;
+ if (this.fullServiceDescriptionRequiresRegistration != fullServiceDescriptionRequiresRegistration)
+ {
+ this.fullServiceDescriptionRequiresRegistration = fullServiceDescriptionRequiresRegistration;
+ modifyNow();
+ }
}
public Map<QName, RegistrationPropertyDescription> getRegistrationProperties()
@@ -114,6 +134,7 @@
ParameterValidation.throwIllegalArgExceptionIfNull(name, "Property name");
registrationProperties.put(name, propertyDescription);
+ modifyNow();
propertyDescription.setValueChangeListener(this);
notifyRegistrationPropertyChangeListeners();
}
@@ -137,13 +158,13 @@
public boolean acceptValueFor(String propertyName, Object value)
{
- return acceptValueFor(new QName(propertyName), value);
+ return acceptValueFor(QName.valueOf(propertyName), value);
}
public RegistrationPropertyDescription getRegistrationPropertyWith(String name)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "Property name", null);
- return getRegistrationPropertyWith(new QName(name));
+ return getRegistrationPropertyWith(QName.valueOf(name));
}
@@ -162,19 +183,23 @@
public void removeRegistrationProperty(QName propertyName)
{
ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property name");
- registrationProperties.remove(propertyName);
- notifyRegistrationPropertyChangeListeners();
+ if (registrationProperties.remove(propertyName) != null)
+ {
+ modifyNow();
+ notifyRegistrationPropertyChangeListeners();
+ }
}
public void clearRegistrationProperties()
{
registrationProperties.clear();
+ modifyNow();
notifyRegistrationPropertyChangeListeners();
}
public void removeRegistrationProperty(String propertyName)
{
- removeRegistrationProperty(new QName(propertyName));
+ removeRegistrationProperty(QName.valueOf(propertyName));
}
/*
@@ -183,6 +208,7 @@
public void valueHasChanged(RegistrationPropertyDescription originatingProperty, Object oldValue, Object newValue, boolean isName)
{
+ modifyNow();
notifyRegistrationPropertyChangeListeners();
if (isName && oldValue instanceof QName)
{
@@ -196,9 +222,10 @@
public void notifyRegistrationPropertyChangeListeners()
{
+ Map<QName, RegistrationPropertyDescription> newRegistrationProperties = Collections.unmodifiableMap(registrationProperties);
for (RegistrationPropertyChangeListener listener : propertyChangeListeners)
{
- listener.propertiesHaveChanged(registrationProperties);
+ listener.propertiesHaveChanged(newRegistrationProperties);
}
}
@@ -275,6 +302,7 @@
}
}
+ modifyNow();
notifyRegistrationPolicyChangeListeners();
}
}
@@ -291,69 +319,80 @@
public void reloadPolicyFrom(String policyClassName, String validatorClassName)
{
- if (policyClassName != null && !DEFAULT_POLICY_CLASS_NAME.equals(policyClassName))
+ // only reload if we don't already have a policy or if the requested policy/validator classes are different
+ // from the ones we already have
+ if (
+ policy == null ||
+ (
+ ParameterValidation.isOldAndNewDifferent(this.policyClassName, policyClassName) &&
+ ParameterValidation.isOldAndNewDifferent(this.validatorClassName, validatorClassName)
+ )
+ )
{
- log.debug("Using registration policy: " + policyClassName);
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- try
+ if (policyClassName != null && !DEFAULT_POLICY_CLASS_NAME.equals(policyClassName))
{
- Class policyClass = loader.loadClass(policyClassName);
- if (!RegistrationPolicy.class.isAssignableFrom(policyClass))
- {
- throw new IllegalArgumentException("Policy class does not implement RegistrationPolicy!");
- }
- RegistrationPolicy policy = (RegistrationPolicy)policyClass.newInstance();
-
- // wrap policy so that we can perform minimal sanitization of values
- RegistrationPolicyWrapper wrapper = new RegistrationPolicyWrapper(policy);
-
- setPolicy(wrapper);
- }
- catch (ClassNotFoundException e)
- {
- throw new IllegalArgumentException("Couldn't find policy class " + policyClassName + ".", e);
- }
- catch (Exception e)
- {
- throw new IllegalArgumentException("Couldn't instantiate policy class.", e);
- }
- }
- else
- {
- log.debug("Using default registration policy: " + DEFAULT_POLICY_CLASS_NAME);
- RegistrationPropertyValidator validator;
- if (validatorClassName != null && !DEFAULT_VALIDATOR_CLASS_NAME.equals(validatorClassName))
- {
- log.debug("Using registration property validator: " + validatorClassName);
+ log.debug("Using registration policy: " + policyClassName);
ClassLoader loader = Thread.currentThread().getContextClassLoader();
try
{
- Class validatorClass = loader.loadClass(validatorClassName);
- if (!RegistrationPropertyValidator.class.isAssignableFrom(validatorClass))
+ Class policyClass = loader.loadClass(policyClassName);
+ if (!RegistrationPolicy.class.isAssignableFrom(policyClass))
{
- throw new IllegalArgumentException("Validator class does not implement RegistrationPropertyValidator!");
+ throw new IllegalArgumentException("Policy class does not implement RegistrationPolicy!");
}
- validator = (RegistrationPropertyValidator)validatorClass.newInstance();
+ RegistrationPolicy policy = (RegistrationPolicy)policyClass.newInstance();
+
+ // wrap policy so that we can perform minimal sanitization of values
+ RegistrationPolicyWrapper wrapper = new RegistrationPolicyWrapper(policy);
+
+ setPolicy(wrapper);
}
catch (ClassNotFoundException e)
{
- throw new IllegalArgumentException("Couldn't find validator class " + validatorClassName + ".", e);
+ throw new IllegalArgumentException("Couldn't find policy class " + policyClassName + ".", e);
}
catch (Exception e)
{
- throw new IllegalArgumentException("Couldn't instantiate validator class.", e);
+ throw new IllegalArgumentException("Couldn't instantiate policy class.", e);
}
}
else
{
- log.debug("Using default registration property validator: " + DEFAULT_VALIDATOR_CLASS_NAME);
- validator = new DefaultRegistrationPropertyValidator();
- }
+ log.debug("Using default registration policy: " + DEFAULT_POLICY_CLASS_NAME);
+ RegistrationPropertyValidator validator;
+ if (validatorClassName != null && !DEFAULT_VALIDATOR_CLASS_NAME.equals(validatorClassName))
+ {
+ log.debug("Using registration property validator: " + validatorClassName);
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Class validatorClass = loader.loadClass(validatorClassName);
+ if (!RegistrationPropertyValidator.class.isAssignableFrom(validatorClass))
+ {
+ throw new IllegalArgumentException("Validator class does not implement RegistrationPropertyValidator!");
+ }
+ validator = (RegistrationPropertyValidator)validatorClass.newInstance();
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new IllegalArgumentException("Couldn't find validator class " + validatorClassName + ".", e);
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("Couldn't instantiate validator class.", e);
+ }
+ }
+ else
+ {
+ log.debug("Using default registration property validator: " + DEFAULT_VALIDATOR_CLASS_NAME);
+ validator = new DefaultRegistrationPropertyValidator();
+ }
- DefaultRegistrationPolicy policy = new DefaultRegistrationPolicy();
- policy.setValidator(validator);
- setPolicy(policy);
+ DefaultRegistrationPolicy policy = new DefaultRegistrationPolicy();
+ policy.setValidator(validator);
+ setPolicy(policy);
+ }
}
}
@@ -368,6 +407,7 @@
{
registrationProperties.remove(oldName);
registrationProperties.put(propertyDescription.getName(), propertyDescription);
+ modifyNow();
}
}
}
14 years, 6 months
gatein SVN: r3342 - components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-06-15 18:27:28 -0400 (Tue, 15 Jun 2010)
New Revision: 3342
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerConfiguration.java
Log:
- Minor javadoc fix.
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerConfiguration.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerConfiguration.java 2010-06-15 22:22:01 UTC (rev 3341)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerConfiguration.java 2010-06-15 22:27:28 UTC (rev 3342)
@@ -62,14 +62,13 @@
/**
* Indicates whether or not the Producer requires the Consumer to assist with cookie support of the HTTP protocol.
* Supported values and semantics: <ul> <li>{@link org.oasis.wsrp.v2.CookieProtocol#NONE}: The Producer does not need
- * the Consumer to ever invoke {@link org.oasis.wsrp.v2.WSRPV1MarkupPortType#initCookie(org.oasis.wsrp.v2.RegistrationContext)}.</li>
- * <li>{@link org.oasis.wsrp.v2.CookieProtocol#PER_USER}: The Consumer MUST invoke {@link
- * org.oasis.wsrp.v2.WSRPV1MarkupPortType#initCookie(org.oasis.wsrp.v2.RegistrationContext)} once per user of the
- * Consumer, and associate any returned cookies with subsequent invocations on behalf of that user.</li> <li>{@link
- * org.oasis.wsrp.v2.CookieProtocol#PER_GROUP}: The Consumer MUST invoke {@link org.oasis.wsrp.v2.WSRPV1MarkupPortType#initCookie(org.oasis.wsrp.v2.RegistrationContext)}
- * once per unique groupID from the PortletDescriptions for the Portlets it is aggregating on a page for each user of
- * the Consumer, and associate any returned cookies with subsequent invocations on behalf of that user targeting
- * Portlets with identical groupIDs.</li> </ul>
+ * the Consumer to ever invoke {@link org.oasis.wsrp.v2.WSRPV2MarkupPortType#initCookie}.</li> <li>{@link
+ * org.oasis.wsrp.v2.CookieProtocol#PER_USER}: The Consumer MUST invoke {@link org.oasis.wsrp.v2.WSRPV2MarkupPortType#initCookie}
+ * once per user of the Consumer, and associate any returned cookies with subsequent invocations on behalf of that
+ * user.</li> <li>{@link org.oasis.wsrp.v2.CookieProtocol#PER_GROUP}: The Consumer MUST invoke {@link
+ * org.oasis.wsrp.v2.WSRPV2MarkupPortType#initCookie} once per unique groupID from the PortletDescriptions for the
+ * Portlets it is aggregating on a page for each user of the Consumer, and associate any returned cookies with
+ * subsequent invocations on behalf of that user targeting Portlets with identical groupIDs.</li> </ul>
*
* @return the level of cookie support required from the Consumer
*/
14 years, 6 months
gatein SVN: r3341 - components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v2.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-06-15 18:22:01 -0400 (Tue, 15 Jun 2010)
New Revision: 3341
Added:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v2/WSRP2Constants.java
Log:
- Added WSRP2Constants for, well, WSRP 2 constants! :)
Added: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v2/WSRP2Constants.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v2/WSRP2Constants.java (rev 0)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v2/WSRP2Constants.java 2010-06-15 22:22:01 UTC (rev 3341)
@@ -0,0 +1,41 @@
+/*
+ * 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.spec.v2;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public final class WSRP2Constants
+{
+ private WSRP2Constants()
+ {
+ }
+
+ public static final String OPTIONS_EVENTS = "wsrp:events";
+ public static final String OPTIONS_LEASING = "wsrp:leasing";
+ public static final String OPTIONS_COPYPORTLETS = "wsrp:copyPortlets";
+ public static final String OPTIONS_IMPORT = "wsrp:import";
+ public static final String OPTIONS_EXPORT = "wsrp:export";
+}
14 years, 6 months
gatein SVN: r3340 - components/wsrp/trunk/common/src/main/java/org/gatein/wsrp.
by do-not-reply@jboss.org
Author: mwringe
Date: 2010-06-15 18:19:42 -0400 (Tue, 15 Jun 2010)
New Revision: 3340
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
Log:
GTNWSRP-42: Checking for conformity against XSD. Initial check-in, still needs some more investigation.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-06-15 18:36:05 UTC (rev 3339)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-06-15 22:19:42 UTC (rev 3340)
@@ -215,9 +215,7 @@
public static GetPortletDescription createGetPortletDescription(RegistrationContext registrationContext, PortletContext portletContext, UserContext userContext)
{
- ParameterValidation.throwIllegalArgExceptionIfNull(registrationContext, "registration context");
ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "portlet context");
- ParameterValidation.throwIllegalArgExceptionIfNull(userContext, "user context");
GetPortletDescription description = new GetPortletDescription();
description.setPortletContext(portletContext);
description.setRegistrationContext(registrationContext);
@@ -255,12 +253,6 @@
public static GetPortletProperties createGetPortletProperties(RegistrationContext registrationContext, PortletContext portletContext, UserContext userContext, List<String> names)
{
ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "PortletContext");
- ParameterValidation.throwIllegalArgExceptionIfNull(registrationContext, "RegistrationContext");
- ParameterValidation.throwIllegalArgExceptionIfNull(userContext, "UserContext");
- if (!ParameterValidation.existsAndIsNotEmpty(names))
- {
- throw new IllegalArgumentException("Must pass a non-null list of property names");
- }
GetPortletProperties properties = new GetPortletProperties();
properties.setRegistrationContext(registrationContext);
properties.setPortletContext(portletContext);
@@ -272,7 +264,7 @@
/** ====== WSRP Response objects ====== * */
public static BlockingInteractionResponse createBlockingInteractionResponse(UpdateResponse updateResponse)
- {
+ {
if (updateResponse == null)
{
throw new IllegalArgumentException("BlockingInteractionResponse requires either an UpdateResponse or a redirect URL.");
@@ -311,6 +303,7 @@
PortletDescription portletDescription = new PortletDescription();
portletDescription.setPortletHandle(context.getPortletHandle());
portletDescription.getMarkupTypes().addAll(markupTypes);
+
return portletDescription;
}
@@ -392,6 +385,7 @@
public static RuntimeContext createRuntimeContext(String userAuthentication)
{
+ //TODO: portletInstanceKey and NameSpacepPrefix are also required;
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(userAuthentication, "user authentication", "RuntimeContext");
RuntimeContext runtimeContext = new RuntimeContext();
@@ -509,6 +503,7 @@
*/
public static SessionContext createSessionContext(String sessionID, int expires)
{
+ //TODO: a sessionID is minOccurs 0, it shouldn't be required, expires also is minOccurs 0
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(sessionID, "session Id", "SessionContext");
if (expires < 0)
{
@@ -540,6 +535,7 @@
*/
public static RegistrationData createRegistrationData(String consumerName, boolean methodGetSupported)
{
+ //TODO: consumer agent requirement
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName, "consumer name", "RegistrationData");
RegistrationData regData = createDefaultRegistrationData();
regData.setConsumerName(consumerName);
@@ -572,6 +568,7 @@
public static Property createProperty(QName name, String lang, String stringValue)
{
+ //TODO: stringValue is not required
ParameterValidation.throwIllegalArgExceptionIfNull(name, "name");
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(lang, "language", "Property");
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(stringValue, "String value", "Property");
@@ -728,7 +725,6 @@
*/
public static ClientData createClientData(String userAgent)
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(userAgent, "user agent", "ClientData");
ClientData clientData = new ClientData();
clientData.setUserAgent(userAgent);
return clientData;
@@ -954,7 +950,6 @@
public static DestroyPortlets createDestroyPortlets(RegistrationContext registrationContext, List<String> portletHandles)
{
- ParameterValidation.throwIllegalArgExceptionIfNull(registrationContext, "RegistrationContext");
ParameterValidation.throwIllegalArgExceptionIfNull(portletHandles, "Portlet handles");
if (!ParameterValidation.existsAndIsNotEmpty(portletHandles))
{
@@ -1060,6 +1055,8 @@
public static MarkupType createMarkupType(String mimeType, List<String> modeNames, List<String> windowStateNames, List<String> localeNames)
{
+ //TODO: modes and windowstates might need a check for null
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mimeType, "MIME Type", "MarkupContext");
MarkupType markupType = new MarkupType();
markupType.setMimeType(mimeType);
@@ -1090,6 +1087,7 @@
{
if (ParameterValidation.existsAndIsNotEmpty(portletHandles))
{
+ //TODO: reason should be able to be null
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(reason, "Reason for failure", "createFailedPortlets");
FailedPortlets failedPortlets = new FailedPortlets();
failedPortlets.getPortletHandles().addAll(portletHandles);
14 years, 6 months
gatein SVN: r3339 - in components/wsrp/trunk: producer/src/test/java/org/gatein/wsrp/protocol/v1 and 54 other directories.
by do-not-reply@jboss.org
Author: mwringe
Date: 2010-06-15 14:36:05 -0400 (Tue, 15 Jun 2010)
New Revision: 3339
Added:
components/wsrp/trunk/test/.settings/
components/wsrp/trunk/wsrp-producer-war/src/test/
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-applicationscope-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-basic-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-dispatcher-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-encodeurl-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-getlocales-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-implicitcloning-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-markup-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-multivalued-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-producer.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-renderparam-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resource-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resourcenoencodeurl-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-session-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-usercontext-portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/java/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/AbstractRegistrationPersistenceManagerTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerGroupTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/DefaultRegistrationPolicyTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationManagerTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationPersistenceManagerTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/config/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/config/FileSystemXmlProducerConfigWithReload.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeGetPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeSetPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/BasicPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/DispatcherPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EncodeURLPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/GetLocalesPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ImplicitCloningPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MarkupPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MultiValuedPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/RenderParamPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourceNoEncodeURLPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourcePortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/SessionPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/UserContextPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/ProducerConfigurationTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestEntityResolver.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestRegistrationPolicy.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/NeedPortletHandleTest.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/RegistrationTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/registration/
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/registration/RegistrationPropertyDescriptionTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/jboss-resources/
components/wsrp/trunk/wsrp-producer-war/src/test/jboss-resources/jndi.properties
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/META-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/META-INF/jboss-beans.xml
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/conf/
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/conf/producer-config.xml
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/context.xml
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-beans.xml
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/index.jsp
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/jsp/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/jsp/help.jsp
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/gif/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/gif/logo.gif
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/gif/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/gif/logo.gif
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/web.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/portlet.xml
components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/web.xml
Removed:
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java
Modified:
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java
components/wsrp/trunk/wsrp-producer-war/pom.xml
Log:
Initial commit of WSRP V1 producer tests, needs a lot of work and cleanup right now :(
Modified: components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java
===================================================================
--- components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java 2010-06-15 17:58:11 UTC (rev 3338)
+++ components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -23,6 +23,11 @@
package org.gatein.wsrp.producer;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.nio.channels.FileChannel;
+
import junit.framework.TestCase;
import org.gatein.common.NotYetImplemented;
@@ -32,6 +37,8 @@
*/
public abstract class WSRPProducerBaseTest extends TestCase
{
+ protected WSRPProducerImpl producer = WSRPProducerImpl.getInstance();
+
protected WSRPProducerBaseTest(String name) throws Exception
{
super(name);
@@ -39,11 +46,85 @@
public void deploy(String warFileName) throws Exception
{
- throw new NotYetImplemented("deploy");
+ File archiveDirectory = getDirectory("test.deployables.dir");
+ File deployDirectory = getDirectory("jboss.server.home.dir", "deploy");
+ File archiveFile = getArchive(warFileName, archiveDirectory, true);
+ File deployArchive = getArchive(warFileName, deployDirectory, false);
+
+ FileChannel inputChannel = new FileInputStream(archiveFile).getChannel();
+ FileChannel outputChannel = new FileOutputStream(deployArchive).getChannel();
+
+ inputChannel.transferTo(0, inputChannel.size(), outputChannel);
+
+ Thread.currentThread().sleep(10000);
}
public void undeploy(String warFileName) throws Exception
{
- throw new NotYetImplemented("undeploy");
+ File deployDirectory = getDirectory("jboss.server.home.dir", "deploy");
+ File archive = getArchive(warFileName, deployDirectory, true);
+
+ archive.delete();
+
+ Thread.currentThread().sleep(10000);
}
+
+ private File getDirectory (String property) throws Exception
+ {
+ return getDirectory(property, null);
+ }
+
+ private File getDirectory (String property, String subDirectory) throws Exception
+ {
+ String deployableProperty = System.getProperty(property);
+ if (deployableProperty != null)
+ {
+ if (subDirectory != null)
+ {
+ deployableProperty += File.separator + subDirectory;
+ }
+
+ File deployableDir = new File(deployableProperty);
+ if (deployableDir.exists() && deployableDir.isDirectory())
+ {
+ return deployableDir;
+ }
+ else
+ {
+ throw new Error("Found a system property for \'" + property + "\' [" + deployableProperty + "] but value does not correspond to a directory.");
+ }
+ }
+ else
+ {
+ throw new Error ("Could not find the system property \'" + property + "\' cannot deploy test archives.");
+ }
}
+
+
+ private File getArchive(String fileName, File deployDirectory, boolean shouldExist) throws Exception
+ {
+ if (fileName != null && deployDirectory != null && deployDirectory.exists() && deployDirectory.isDirectory())
+ {
+ File archiveFile = new File(deployDirectory.getAbsoluteFile() + File.separator + fileName);
+ return archiveFile;
+// if (archiveFile.exists() && shouldExist)
+// {
+// return archiveFile;
+// }
+// else if (!archiveFile.exists() && !shouldExist)
+// {
+// return archiveFile;
+// }
+// else
+// {
+// //since its not what we are expecting we need to throw the opposite error message
+// String existsString = shouldExist ? "does not exist" : "exists";
+// throw new Exception("Archive " + fileName + " in directory " + deployDirectory + " " + existsString + " which is not expected.");
+// }
+ }
+ else
+ {
+ throw new Exception("Cannot find archive to deploy. Archive name [" + fileName + "] is null or the deploy directory + [" + deployDirectory + "] is not a directory");
+ }
+ }
+}
Deleted: components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
===================================================================
--- components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-06-15 17:58:11 UTC (rev 3338)
+++ components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -1,778 +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.protocol.v1;
-
-import org.gatein.wsrp.WSRPActionURL;
-import org.gatein.wsrp.WSRPConstants;
-import org.gatein.wsrp.WSRPPortletURL;
-import org.gatein.wsrp.WSRPRenderURL;
-import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
-import org.gatein.wsrp.test.ExtendedAssert;
-import org.oasis.wsrp.v1.V1BlockingInteractionResponse;
-import org.oasis.wsrp.v1.V1CacheControl;
-import org.oasis.wsrp.v1.V1GetMarkup;
-import org.oasis.wsrp.v1.V1InitCookie;
-import org.oasis.wsrp.v1.V1InteractionParams;
-import org.oasis.wsrp.v1.V1InvalidRegistration;
-import org.oasis.wsrp.v1.V1MarkupContext;
-import org.oasis.wsrp.v1.V1MarkupResponse;
-import org.oasis.wsrp.v1.V1NamedString;
-import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1PerformBlockingInteraction;
-import org.oasis.wsrp.v1.V1PortletContext;
-import org.oasis.wsrp.v1.V1RuntimeContext;
-import org.oasis.wsrp.v1.V1SessionContext;
-import org.oasis.wsrp.v1.V1StateChange;
-import org.oasis.wsrp.v1.V1UnsupportedMode;
-import org.oasis.wsrp.v1.V1UpdateResponse;
-
-import java.rmi.RemoteException;
-import java.util.List;
-import java.util.Locale;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision: 13149 $
- * @since 2.4
- */
-public class MarkupTestCase extends NeedPortletHandleTest
-{
- private static final String DEFAULT_VIEW_MARKUP = "<p>symbol unset stock value: value unset</p>";
- private static final String DEFAULT_MARKUP_PORTLET_WAR = "test-markup-portlet.war";
-
- public MarkupTestCase()
- throws Exception
- {
- super("MarkupTestCase", DEFAULT_MARKUP_PORTLET_WAR);
- }
-
- public void testGetMarkupViewNoSession() throws Exception
- {
- V1GetMarkup getMarkup = createMarkupRequest();
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
-
- checkMarkupResponse(response, DEFAULT_VIEW_MARKUP);
- }
-
- public void testInvalidGetMarkup() throws Exception
- {
- V1GetMarkup getMarkup = createMarkupRequest();
- getMarkup.getMarkupParams().setMode("invalid mode");
-
- try
- {
- producer.getMarkup(getMarkup);
- ExtendedAssert.fail();
- }
- catch (V1UnsupportedMode unsupportedMode)
- {
- // expected
- }
- }
-
- public void testGetMarkupWithSessionID() throws Exception
- {
- // The consumer should never have access to or be able to set a sessionID. Sessions are handled by the Producer using cookies.
- V1GetMarkup getMarkup = createMarkupRequest();
- getMarkup.getRuntimeContext().setSessionID("Hello World");
-
- try
- {
- producer.getMarkup(getMarkup);
- ExtendedAssert.fail("A sessionID should not be allowed to be passed in GetMarkup()");
- }
- catch (V1OperationFailed operationFailed)
- {
- // expected
- }
- }
-
- public void testGetMarkupEditNoSession() throws Exception
- {
- V1GetMarkup getMarkup = createMarkupRequest();
- getMarkup.getMarkupParams().setMode(WSRPConstants.EDIT_MODE);
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
-
- checkMarkupResponse(response, "<form method='post' action='wsrp_rewrite?wsrp-urlType=blockingAction&wsrp" +
- "-interactionState=JBPNS_/wsrp_rewrite' id='wsrp_rewrite_portfolioManager'><table><tr><td>Stock symbol</t" +
- "d><td><input name='symbol'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>");
- }
-
- public void testGetMarkupRenderParameters() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String archiveName = "test-renderparam-portlet.war";
- deploy(archiveName);
-
- try
- {
- V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
- V1MarkupResponse res = producer.getMarkup(gm);
-
- String markupString = res.getMarkupContext().getMarkupString();
-
- String julienLink = extractLink(markupString, 0);
- WSRPPortletURL julienURL = WSRPPortletURL.create(julienLink);
-
- ExtendedAssert.assertString1ContainsString2(markupString, "Hello, Anonymous!");
- ExtendedAssert.assertString1ContainsString2(markupString, "Counter: 0");
-
- ExtendedAssert.assertTrue(julienURL instanceof WSRPRenderURL);
- WSRPRenderURL julienRender = (WSRPRenderURL)julienURL;
-
- // We're now trying to get a hello for Julien ;)
- gm.getMarkupParams().setNavigationalState(julienRender.getNavigationalState().getStringValue());
- res = producer.getMarkup(gm);
- markupString = res.getMarkupContext().getMarkupString();
- ExtendedAssert.assertString1ContainsString2(markupString, "Hello, Julien!");
-
- // julien.length() * 2 to bypass second link
- WSRPPortletURL incrementURL = WSRPPortletURL.create(extractLink(markupString, julienLink.length() * 2));
- ExtendedAssert.assertTrue(incrementURL instanceof WSRPActionURL);
- WSRPActionURL incrementAction = (WSRPActionURL)incrementURL;
-
- // let's see now if we can increment the counter
- V1PerformBlockingInteraction performBlockingInteraction =
- WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
- V1InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
- interactionParams.setInteractionState(incrementAction.getInteractionState().getStringValue());
- producer.performBlockingInteraction(performBlockingInteraction);
- res = producer.getMarkup(gm);
- markupString = res.getMarkupContext().getMarkupString();
- ExtendedAssert.assertString1ContainsString2(markupString, "Counter: 1");
- }
- finally
- {
- undeploy(archiveName);
- }
- }
-
- private String extractLink(String markupString, int fromIndex)
- {
- int urlStartIndex = markupString.indexOf("='", fromIndex);
- int urlEndIndex = markupString.indexOf("'>", urlStartIndex);
- return markupString.substring(urlStartIndex + 2, urlEndIndex);
- }
-
- // fix-me: add more tests
-
- public void testGetMarkupSession() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- // deploy session-manipulating portlet
- String sessionPortletArchive = "test-session-portlet.war";
- deploy(sessionPortletArchive);
-
-
- try
- {
- V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
-
- checkMarkupResponseWithSession(response, 0);
-
- response = producer.getMarkup(getMarkup);
- checkMarkupResponseWithSession(response, 1);
-
- // fix-me: try to reuse the old session id: what should happen?
-// runtimeContext.setSessionID(sessionID);
-// getMarkup.setRuntimeContext(runtimeContext);
-// try
-// {
-// producer.getMarkup(getMarkup);
-// fail("The session should be invalid...");
-// }
-// catch (InvalidSessionFault expected)
-// {
-// }
- }
- finally
- {
- // reset state
- undeploy(sessionPortletArchive);
- }
- }
-
- public void testPerformBlockingInteractionNoRedirect() throws Exception
- {
- checkPBIAndGetNavigationalState("RHAT");
- }
-
- public void testPerformBlockingInteractionRedirect() throws Exception
- {
- V1PerformBlockingInteraction performBlockingInteraction =
- WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
- V1InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
-
- // crappy way but this is a test! ;)
- V1NamedString namedString = new V1NamedString();
- namedString.setName("symbol");
- namedString.setValue("HELP");
- interactionParams.getFormParameters().add(namedString);
-
- V1BlockingInteractionResponse response = producer.performBlockingInteraction(performBlockingInteraction);
- ExtendedAssert.assertNotNull(response);
-
- // this is a redirect...
- String redirectURL = response.getRedirectURL();
- ExtendedAssert.assertNotNull(redirectURL);
- ExtendedAssert.assertEquals("/WEB-INF/jsp/help.jsp", redirectURL); // fix-me: handle URL re-writing
-
- // no update response
- V1UpdateResponse updateResponse = response.getUpdateResponse();
- ExtendedAssert.assertNull(updateResponse);
- }
-
- public void testGMAndPBIInteraction() throws Exception
- {
- testGetMarkupViewNoSession();
- String symbol = "AAPL";
- String navigationalState = checkPBIAndGetNavigationalState(symbol);
-
- V1GetMarkup getMarkup = createMarkupRequest();
- getMarkup.getMarkupParams().setNavigationalState(navigationalState);
- V1MarkupResponse response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response, "<p>" + symbol + " stock value: 123.45</p>");
- }
-
-
- public void testPBIWithSessionID() throws Exception
- {
- String portletHandle = getDefaultHandle();
- V1PerformBlockingInteraction performBlockingInteraction = WSRP1TypeFactory.createDefaultPerformBlockingInteraction(portletHandle);
-
- V1RuntimeContext runtimeContext = performBlockingInteraction.getRuntimeContext();
- //the sessionID should never be set by the consumer. Sessions are handled by cookies instead
- runtimeContext.setSessionID("Hello World");
-
- try
- {
- producer.performBlockingInteraction(performBlockingInteraction);
- ExtendedAssert.fail("Should not be able to pass a sessionID in a PerformBlockingInteraction()");
- }
- catch (V1OperationFailed expected)
- {
- // expected
- }
- }
-
- public void testMarkupCaching() throws Exception
- {
- V1GetMarkup getMarkup = createMarkupRequest();
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
-
- V1CacheControl cacheControl = response.getMarkupContext().getCacheControl();
- ExtendedAssert.assertNotNull(cacheControl);
- ExtendedAssert.assertEquals(WSRPConstants.CACHE_PER_USER, cacheControl.getUserScope());
- ExtendedAssert.assertEquals(15, cacheControl.getExpires());
-
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String sessionPortletArchive = "test-session-portlet.war";
- deploy(sessionPortletArchive);
-
- response = producer.getMarkup(createMarkupRequestForCurrentlyDeployedPortlet());
-
- cacheControl = response.getMarkupContext().getCacheControl();
- ExtendedAssert.assertNull(cacheControl);
-
- undeploy(sessionPortletArchive);
- }
-
- public void testGetMarkupWithDispatcherPortlet() throws Exception
- {
-
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String dispatcherPortletArchive = "test-dispatcher-portlet.war";
- deploy(dispatcherPortletArchive);
-
- try
- {
- V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response, "test");
- }
- finally
- {
- undeploy(dispatcherPortletArchive);
- }
- }
-
- public void testGetMarkupWithNoContent() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String basicPortletArchive = "test-basic-portlet.war";
- deploy(basicPortletArchive);
-
- try
- {
- V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response, "");
- }
- finally
- {
- undeploy(basicPortletArchive);
- }
- }
-
- public void testGetMarkupWithNonStandardLocalesStrictMode() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String getLocalesPortletArchive = "test-getlocales-portlet.war";
- deploy(getLocalesPortletArchive);
-
- V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
- getMarkup.getMarkupParams().getLocales().add("en_US");
-
- try
- {
- producer.getMarkup(getMarkup);
- //fail("Should have trown an UnsupportetLocaleFault"); // ideally cf http://jira.jboss.com/jira/browse/JBPORTAL-857
- ExtendedAssert.fail("Should have trown an exception"); // right now
- }
- catch (Exception expected)
- {
- // expected
- }
- finally
- {
- // checkMarkupResponse(response, "GetLocalesPortlet"); // should we return try to generate markup regardless?
- undeploy(getLocalesPortletArchive);
- }
- }
-
- public void testGetMarkupWithNonStandardLocalesLenientMode() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String getLocalesPortletArchive = "test-getlocales-portlet.war";
- deploy(getLocalesPortletArchive);
-
- V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
- getMarkup.getMarkupParams().getLocales().add("en_US");
-
- // Use the lenient mode
- producer.usingStrictModeChangedTo(false);
-
- // markup should be properly generated
- checkMarkupResponse(producer.getMarkup(getMarkup), "English (United States)");
- undeploy(getLocalesPortletArchive);
- }
-
- public void testGetMarkupWithoutDeclaredLocale() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String getLocalesPortletArchive = "test-getlocales-portlet.war";
- deploy(getLocalesPortletArchive);
-
- V1GetMarkup getMarkup = createMarkupRequest(getPortletHandleFrom("No Declared"));
-
- try
- {
- checkMarkupResponse(producer.getMarkup(getMarkup), Locale.getDefault().getDisplayName());
- }
- finally
- {
- undeploy(getLocalesPortletArchive);
- }
- }
-
- public void testGetMarkupLocales() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String getLocalesPortletArchive = "test-getlocales-portlet.war";
- deploy(getLocalesPortletArchive);
-
- V1GetMarkup getMarkup = createMarkupRequest(getPortletHandleFrom("Simple"));
-
- try
- {
- List<String> locales = getMarkup.getMarkupParams().getLocales();
- locales.add("en");
- locales.add("fr");
- V1MarkupResponse response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response, Locale.ENGLISH.getDisplayName());
-
- locales.clear();
- locales.add("fr");
- locales.add("en");
- response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response, Locale.FRENCH.getDisplayName());
-
- locales.clear();
- locales.add("de");
- locales.add("en");
- response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response, Locale.ENGLISH.getDisplayName());
- }
- finally
- {
- undeploy(getLocalesPortletArchive);
- }
- }
-
- public void testGetMarkupWithEncodedURLs() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String encodeURLPortletArchive = "test-encodeurl-portlet.war";
- deploy(encodeURLPortletArchive);
-
- try
- {
- V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response, "wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-interactionState=JBPNS_/wsrp_rewrite\n" +
- "wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewrite");
- }
- finally
- {
- undeploy(encodeURLPortletArchive);
- }
- }
-
- public void testGetMarkupWithUserContext() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String userContextPortletArchive = "test-usercontext-portlet.war";
- deploy(userContextPortletArchive);
-
- try
- {
- V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
- getMarkup.setUserContext(WSRP1TypeFactory.createUserContext("johndoe"));
-
- V1MarkupResponse response = producer.getMarkup(getMarkup);
- checkMarkupResponse(response, "user: johndoe");
- }
- finally
- {
- undeploy(userContextPortletArchive);
- }
- }
-
- public void testGetMarkupMultiValuedFormParams() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String multiValuedPortletArchive = "test-multivalued-portlet.war";
- deploy(multiValuedPortletArchive);
-
- V1NamedString namedString = createNamedString("multi", "value1");
- try
- {
- V1PerformBlockingInteraction action =
- WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
- List<V1NamedString> formParameters = action.getInteractionParams().getFormParameters();
- formParameters.add(namedString);
- V1BlockingInteractionResponse actionResponse = producer.performBlockingInteraction(action);
- V1GetMarkup markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
- markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
- V1MarkupResponse response = producer.getMarkup(markupRequest);
- checkMarkupResponse(response, "multi: value1");
-
- formParameters.clear();
- formParameters.add(namedString);
- formParameters.add(createNamedString("multi", "value2"));
- actionResponse = producer.performBlockingInteraction(action);
- markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
- markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
- response = producer.getMarkup(markupRequest);
- checkMarkupResponse(response, "multi: value1, value2");
-
- formParameters.clear();
- formParameters.add(new V1NamedString());
- actionResponse = producer.performBlockingInteraction(action);
- markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
- markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
- response = producer.getMarkup(markupRequest);
- checkMarkupResponse(response, "multi: ");
- }
- finally
- {
- undeploy(multiValuedPortletArchive);
- }
- }
-
- public void testImplicitCloning() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String archiveName = "test-implicitcloning-portlet.war";
- deploy(archiveName);
-
- try
- {
- // check the initial value
- V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
- V1MarkupResponse res = producer.getMarkup(gm);
- String markupString = res.getMarkupContext().getMarkupString();
- ExtendedAssert.assertEquals("initial", markupString);
-
- // modify the preference value
- V1PerformBlockingInteraction pbi = WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
- pbi.getInteractionParams().setPortletStateChange(V1StateChange.CLONE_BEFORE_WRITE); // request cloning if needed
- String value = "new value";
- pbi.getInteractionParams().getFormParameters().add(createNamedString("value", value));
- V1BlockingInteractionResponse response = producer.performBlockingInteraction(pbi);
- ExtendedAssert.assertNotNull(response);
-
- // check that we got a new portlet context
- V1PortletContext pc = response.getUpdateResponse().getPortletContext();
- ExtendedAssert.assertNotNull(pc);
-
- // get the markup again and check that we still get the initial value with the initial portlet context
- res = producer.getMarkup(gm);
- markupString = res.getMarkupContext().getMarkupString();
- ExtendedAssert.assertEquals("initial", markupString);
-
- // retrieving the markup with the new portlet context should return the new value
- gm.setPortletContext(pc);
- res = producer.getMarkup(gm);
- markupString = res.getMarkupContext().getMarkupString();
- ExtendedAssert.assertEquals(value, markupString);
- }
- finally
- {
- undeploy(archiveName);
- }
- }
-
- private V1NamedString createNamedString(String name, String value)
- {
- V1NamedString namedString = new V1NamedString();
- namedString.setName(name);
- namedString.setValue(value);
- return namedString;
- }
-
- public void testGetMarkupWithResource() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String archive = "test-resource-portlet.war";
- deploy(archive);
-
- try
- {
- V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
- V1MarkupResponse res = producer.getMarkup(gm);
- String markupString = res.getMarkupContext().getMarkupString();
-
- // accept either localhost or 127.0.0.1 for the host part of the generated markup
- String markupStart = "<img src='wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2F";
- String markupEnd = "%3A8080%2Ftest-resource-portlet%2Fgif%2Flogo.gif&wsrp-requiresRewrite=true/wsrp_rewrite'/>";
- String localhostMarkup = markupStart + "localhost" + markupEnd;
- String homeIPMarkup = markupStart + "127.0.0.1" + markupEnd;
- boolean result = localhostMarkup.equals(markupString) || homeIPMarkup.equals(markupString);
- ExtendedAssert.assertTrue(result);
- }
- finally
- {
- undeploy(archive);
- }
- }
-
- public void testGetMarkupWithNonURLEncodedResource() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String archive = "test-resourcenoencodeurl-portlet.war";
- deploy(archive);
-
- try
- {
- V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
- V1MarkupResponse res = producer.getMarkup(gm);
- String markupString = res.getMarkupContext().getMarkupString();
-
- // accept either localhost or 127.0.0.1 for the host part of the generated markup
- String markupStart = "<img src='http://";
- String markupEnd = ":8080/test-resourcenoencodeurl-portlet/gif/logo.gif'/>";
- String localhostMarkup = markupStart + "localhost" + markupEnd;
- String homeIPMarkup = markupStart + "127.0.0.1" + markupEnd;
- boolean result = localhostMarkup.equals(markupString) || homeIPMarkup.equals(markupString);
- ExtendedAssert.assertTrue(result);
- }
- finally
- {
- undeploy(archive);
- }
- }
-
- public void testApplicationScopeVariableHandling() throws Exception
- {
- undeploy(DEFAULT_MARKUP_PORTLET_WAR);
- String archive = "test-applicationscope-portlet.war";
- deploy(archive);
-
- try
- {
- // set appVar to value in the application scope by the first portlet
- V1PerformBlockingInteraction pbi = WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getPortletHandleFrom("Set"));
- pbi.getInteractionParams().getFormParameters().add(createNamedString("appVar", "value"));
- producer.performBlockingInteraction(pbi);
-
- // the second portlet reads the appVar value and outputs it
- V1GetMarkup gm = createMarkupRequest(getPortletHandleFrom("Get"));
- V1MarkupResponse res = producer.getMarkup(gm);
- checkMarkupResponse(res, "appVar=value");
- }
- finally
- {
- undeploy(archive);
- }
- }
-
- public void testGetMarkupNoRegistrationWhenRegistrationRequired() throws Exception
- {
- configureRegistrationSettings(true, false);
-
- V1GetMarkup gm = createMarkupRequest();
- try
- {
- producer.getMarkup(gm);
- ExtendedAssert.fail("Should have thrown InvalidRegistration!");
- }
- catch (V1InvalidRegistration invalidRegistration)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- public void testPerformBlockingInteractionNoRegistrationWhenRegistrationRequired() throws Exception
- {
- configureRegistrationSettings(true, false);
-
- V1PerformBlockingInteraction pbi = WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
- try
- {
- producer.performBlockingInteraction(pbi);
- ExtendedAssert.fail("Should have thrown InvalidRegistration!");
- }
- catch (V1InvalidRegistration invalidRegistration)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- public void testInitCookieNoRegistrationWhenRegistrationRequired() throws Exception
- {
- configureRegistrationSettings(true, false);
-
- V1InitCookie initCookie = WSRP1TypeFactory.createInitCookie(null);
- try
- {
- producer.initCookie(initCookie);
- ExtendedAssert.fail("Should have thrown InvalidRegistration!");
- }
- catch (V1InvalidRegistration invalidRegistration)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- private String checkPBIAndGetNavigationalState(String symbol) throws Exception
- {
- V1PerformBlockingInteraction performBlockingInteraction =
- WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
- V1InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
- interactionParams.getFormParameters().add(createNamedString("symbol", symbol));
-
- V1BlockingInteractionResponse response = producer.performBlockingInteraction(performBlockingInteraction);
- ExtendedAssert.assertNotNull(response);
-
- // this is not a redirect...
- ExtendedAssert.assertNull(response.getRedirectURL());
-
- // check update response
- V1UpdateResponse updateResponse = response.getUpdateResponse();
- ExtendedAssert.assertNotNull(updateResponse);
- // request was readOnly so no updated portlet context
- ExtendedAssert.assertNull(updateResponse.getPortletContext());
- // check that no sessionId is getting passed.
- ExtendedAssert.assertNull(updateResponse.getSessionContext());
-
- String navigationalState = updateResponse.getNavigationalState();
- ExtendedAssert.assertNotNull(navigationalState);
- ExtendedAssert.assertEquals(updateResponse.getNewMode(), WSRPConstants.VIEW_MODE);
- V1MarkupContext markupContext = updateResponse.getMarkupContext();
- ExtendedAssert.assertNull(markupContext); // we don't return markup for now
-
- return navigationalState;
- }
-
- private void checkMarkupResponseWithSession(V1MarkupResponse response, int count) throws RemoteException, V1InvalidRegistration, V1OperationFailed
- {
- ExtendedAssert.assertNotNull(response);
-
- // Markup context
- V1MarkupContext markupContext = response.getMarkupContext();
- ExtendedAssert.assertNotNull(markupContext);
- String markupString = markupContext.getMarkupString();
- ExtendedAssert.assertString1ContainsString2(markupString, "count = " + count);
- ExtendedAssert.assertString1ContainsString2(markupString, "<a href='wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewrite'>render</a>");
-
- // checking session
- checkSessionForCurrentlyDeployedPortlet(response);
- }
-
- private V1MarkupContext checkMarkupResponse(V1MarkupResponse response, String markupString)
- {
- ExtendedAssert.assertNotNull(response);
-
- // Markup context
- V1MarkupContext markupContext = response.getMarkupContext();
- ExtendedAssert.assertNotNull(markupContext);
- ExtendedAssert.assertEquals("text/html", markupContext.getMimeType());
- ExtendedAssert.assertEquals("title", markupContext.getPreferredTitle());
- ExtendedAssert.assertTrue(markupContext.isRequiresUrlRewriting());
- ExtendedAssert.assertEquals(markupString, markupContext.getMarkupString());
-
- // Session context
- V1SessionContext sessionContext = response.getSessionContext();
- // The session information is should never be sent to the consumer, Cookies are used instead.
- ExtendedAssert.assertNull(sessionContext);
-
- return markupContext;
- }
-
- protected String getMostUsedPortletWARFileName()
- {
- return DEFAULT_MARKUP_PORTLET_WAR;
- }
-}
Deleted: components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java
===================================================================
--- components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java 2010-06-15 17:58:11 UTC (rev 3338)
+++ components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -1,411 +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.protocol.v1;
-
-import org.gatein.wsrp.WSRPConstants;
-import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
-import org.gatein.wsrp.test.ExtendedAssert;
-import org.oasis.wsrp.v1.V1AccessDenied;
-import org.oasis.wsrp.v1.V1ClonePortlet;
-import org.oasis.wsrp.v1.V1DestroyFailed;
-import org.oasis.wsrp.v1.V1DestroyPortlets;
-import org.oasis.wsrp.v1.V1DestroyPortletsResponse;
-import org.oasis.wsrp.v1.V1GetPortletDescription;
-import org.oasis.wsrp.v1.V1GetPortletProperties;
-import org.oasis.wsrp.v1.V1GetPortletPropertyDescription;
-import org.oasis.wsrp.v1.V1GetServiceDescription;
-import org.oasis.wsrp.v1.V1InconsistentParameters;
-import org.oasis.wsrp.v1.V1InvalidHandle;
-import org.oasis.wsrp.v1.V1InvalidRegistration;
-import org.oasis.wsrp.v1.V1InvalidUserCategory;
-import org.oasis.wsrp.v1.V1MissingParameters;
-import org.oasis.wsrp.v1.V1ModelDescription;
-import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1PortletContext;
-import org.oasis.wsrp.v1.V1PortletDescriptionResponse;
-import org.oasis.wsrp.v1.V1PortletPropertyDescriptionResponse;
-import org.oasis.wsrp.v1.V1Property;
-import org.oasis.wsrp.v1.V1PropertyDescription;
-import org.oasis.wsrp.v1.V1PropertyList;
-import org.oasis.wsrp.v1.V1SetPortletProperties;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision: 11547 $
- * @since 2.4
- */
-public class PortletManagementTestCase extends NeedPortletHandleTest
-{
- private static final String TEST_BASIC_PORTLET_WAR = "test-basic-portlet.war";
-
- public PortletManagementTestCase() throws Exception
- {
- super("PortletManagementTestCase", TEST_BASIC_PORTLET_WAR);
- }
-
- public void testClonePortlet() throws Exception
- {
- String handle = getDefaultHandle();
- V1PortletContext initialContext = WSRP1TypeFactory.createPortletContext(handle);
-
- // first check that we get a new PortletContext
- V1PortletContext cloneContext = clonePortlet(handle);
- ExtendedAssert.assertNotNull(cloneContext);
- ExtendedAssert.assertFalse(initialContext.equals(cloneContext));
-
- // then check that the initial state is identical
- V1GetPortletProperties getPortletProperties = WSRP1TypeFactory.createGetPortletProperties(null, cloneContext);
- List<V1Property> result = producer.getPortletProperties(getPortletProperties).getProperties();
- getPortletProperties = WSRP1TypeFactory.createGetPortletProperties(null, initialContext);
- checkGetPropertiesResponse(producer.getPortletProperties(getPortletProperties), result);
-
- // check that new clone is not listed in service description
- V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
- checkServiceDescriptionWithOnlyBasicPortlet(gs);
- }
-
- public void testClonePortletNoRegistrationWhenRequired()
- {
- producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
-
- String handle = getDefaultHandle();
- V1ClonePortlet clonePortlet = WSRP1TypeFactory.createSimpleClonePortlet(handle);
-
- try
- {
- producer.clonePortlet(clonePortlet);
- ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
- }
- catch (V1InvalidRegistration invalidRegistrationFault)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- public void testDestroyPortlets() throws Exception
- {
- // first try to destroy POP, should fail
- String handle = getDefaultHandle();
- V1DestroyPortlets destroyPortlets = WSRP1TypeFactory.createDestroyPortlets(null, Collections.<String>singletonList(handle));
- V1DestroyPortletsResponse response = producer.destroyPortlets(destroyPortlets);
- ExtendedAssert.assertNotNull(response);
- List<V1DestroyFailed> failures = response.getDestroyFailed();
- ExtendedAssert.assertNotNull(failures);
- ExtendedAssert.assertEquals(1, failures.size());
- V1DestroyFailed failure = failures.get(0);
- ExtendedAssert.assertNotNull(failure);
- ExtendedAssert.assertEquals(handle, failure.getPortletHandle());
- ExtendedAssert.assertNotNull(failure.getReason());
-
- // clone portlet and try to destroy it
- V1PortletContext portletContext = clonePortlet(handle);
- destroyPortlets = WSRP1TypeFactory.createDestroyPortlets(null, Collections.<String>singletonList(portletContext.getPortletHandle()));
- response = producer.destroyPortlets(destroyPortlets);
- ExtendedAssert.assertNotNull(response);
- failures = response.getDestroyFailed();
- ExtendedAssert.assertNull(failures);
- }
-
- public void testDestroyPortletsNoRegistrationWhenRequired()
- {
- producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
-
- String handle = getDefaultHandle();
- V1DestroyPortlets dp = WSRP1TypeFactory.createDestroyPortlets(null, Collections.<String>singletonList(handle));
-
- try
- {
- producer.destroyPortlets(dp);
- ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
- }
- catch (V1InvalidRegistration invalidRegistrationFault)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- public void testGetPortletDescription() throws Exception
- {
- String handle = getDefaultHandle();
- V1GetPortletDescription gpd = WSRP1TypeFactory.createGetPortletDescription(null, handle);
-
- V1PortletDescriptionResponse response = producer.getPortletDescription(gpd);
- ExtendedAssert.assertNotNull(response);
-
- checkBasicPortletDescription(response.getPortletDescription(), handle);
- }
-
- public void testGetPortletDescriptionNoRegistrationWhenRequired()
- {
- producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
-
- String handle = getDefaultHandle();
- V1GetPortletDescription gpd = WSRP1TypeFactory.createGetPortletDescription(null, handle);
-
- try
- {
- producer.getPortletDescription(gpd);
- ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
- }
- catch (V1InvalidRegistration invalidRegistrationFault)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- public void testGetPortletPropertiesNoRegistration() throws Exception
- {
- String handle = getDefaultHandle();
- V1PortletContext initialContext = WSRP1TypeFactory.createPortletContext(handle);
- V1GetPortletProperties getPortletProperties = WSRP1TypeFactory.createGetPortletProperties(null, initialContext);
-
- List<String> names = getPortletProperties.getNames();
- Collections.addAll(names, "prefName1", "prefName2");
-
- V1PropertyList response = producer.getPortletProperties(getPortletProperties);
- List<V1Property> expected = new ArrayList<V1Property>(2);
- Collections.addAll(expected, WSRP1TypeFactory.createProperty("prefName1", "en", "prefValue1"),
- WSRP1TypeFactory.createProperty("prefName2", "en", "prefValue2"));
- checkGetPropertiesResponse(response, expected);
-
- names.clear();
- response = producer.getPortletProperties(getPortletProperties);
- checkGetPropertiesResponse(response, expected);
-
- names.add("prefName2");
- response = producer.getPortletProperties(getPortletProperties);
- checkGetPropertiesResponse(response, Collections.<V1Property>singletonList(WSRP1TypeFactory.createProperty("prefName2", "en", "prefValue2")));
- }
-
- public void testGetPortletPropertyDescription() throws Exception
- {
- String handle = getDefaultHandle();
- V1GetPortletPropertyDescription getPortletPropertyDescription = WSRP1TypeFactory.createSimpleGetPortletPropertyDescription(handle);
-
- V1PortletPropertyDescriptionResponse response = producer.getPortletPropertyDescription(getPortletPropertyDescription);
-
- V1ModelDescription desc = response.getModelDescription();
- ExtendedAssert.assertNotNull(desc);
- List<V1PropertyDescription> propertyDescriptions = desc.getPropertyDescriptions();
- ExtendedAssert.assertNotNull(propertyDescriptions);
-
- List<V1PropertyDescription> expected = new ArrayList<V1PropertyDescription>(2);
- V1PropertyDescription description = WSRP1TypeFactory.createPropertyDescription("prefName1", WSRPConstants.XSD_STRING);
- description.setHint(WSRP1TypeFactory.createLocalizedString("prefName1"));
- description.setLabel(WSRP1TypeFactory.createLocalizedString("prefName1"));
- expected.add(description);
- description = WSRP1TypeFactory.createPropertyDescription("prefName2", WSRPConstants.XSD_STRING);
- description.setHint(WSRP1TypeFactory.createLocalizedString("prefName2"));
- description.setLabel(WSRP1TypeFactory.createLocalizedString("prefName2"));
- expected.add(description);
-
- checkPropertyDescriptions(expected, propertyDescriptions);
- }
-
- public void testGetPortletPropertiesNoRegistrationWhenRequired()
- {
- producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
-
- String handle = getDefaultHandle();
- V1GetPortletPropertyDescription getPortletPropertyDescription = WSRP1TypeFactory.createSimpleGetPortletPropertyDescription(handle);
-
- try
- {
- producer.getPortletPropertyDescription(getPortletPropertyDescription);
- ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
- }
- catch (V1InvalidRegistration invalidRegistrationFault)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- public void testSetPortletProperties() throws Exception
- {
- String handle = getDefaultHandle();
-
- V1PortletContext portletContext = clonePortlet(handle);
- V1PropertyList propertyList = WSRP1TypeFactory.createPropertyList();
- List<V1Property> properties = propertyList.getProperties();
- Collections.addAll(properties, WSRP1TypeFactory.createProperty("prefName1", "en", "newPrefValue1"),
- WSRP1TypeFactory.createProperty("prefName2", "en", "newPrefValue2"));
- V1SetPortletProperties setPortletProperties = WSRP1TypeFactory.createSetPortletProperties(null, portletContext, propertyList);
-
- V1PortletContext response = producer.setPortletProperties(setPortletProperties);
- V1GetPortletProperties getPortletProperties = WSRP1TypeFactory.createGetPortletProperties(null, response);
- checkGetPropertiesResponse(producer.getPortletProperties(getPortletProperties), properties);
-
- portletContext = WSRP1TypeFactory.createPortletContext(handle);
- setPortletProperties.setPortletContext(portletContext);
- try
- {
- response = producer.setPortletProperties(setPortletProperties);
- ExtendedAssert.fail("Setting properties on Producer-Offered Portlet should fail...");
- }
- catch (V1InconsistentParameters expected)
- {
- // expected
- }
- }
-
- public void testSetPortletPropertiesNoRegistrationWhenRequired()
- {
- producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
-
- V1PropertyList propertyList = WSRP1TypeFactory.createPropertyList();
- List<V1Property> properties = propertyList.getProperties();
- Collections.addAll(properties, WSRP1TypeFactory.createProperty("prefName1", "en", "newPrefValue1"),
- WSRP1TypeFactory.createProperty("prefName2", "en", "newPrefValue2"));
- V1SetPortletProperties setPortletProperties = WSRP1TypeFactory.createSetPortletProperties(null,
- WSRP1TypeFactory.createPortletContext(getDefaultHandle()), propertyList);
-
- try
- {
- producer.setPortletProperties(setPortletProperties);
- ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
- }
- catch (V1InvalidRegistration invalidRegistration)
- {
- // expected
- }
- catch (Exception e)
- {
- ExtendedAssert.fail(e.getMessage());
- }
- }
-
- private V1PortletContext clonePortlet(String handle) throws V1InvalidUserCategory, V1InconsistentParameters,
- V1InvalidRegistration, V1MissingParameters, V1OperationFailed, V1AccessDenied, V1InvalidHandle
- {
- V1ClonePortlet clonePortlet = WSRP1TypeFactory.createSimpleClonePortlet(handle);
- return producer.clonePortlet(clonePortlet);
- }
-
- private List<V1Property> checkGetPropertiesResponse(V1PropertyList response, List<V1Property> expected)
- {
- ExtendedAssert.assertNotNull(response);
- List<V1Property> properties = response.getProperties();
- ExtendedAssert.assertEquals(expected.toArray(), properties.toArray(), false, "Didn't receive expected properties!", new PropertyDecorator());
- return properties;
- }
-
- private void checkPropertyDescriptions(List<V1PropertyDescription> expected, List<V1PropertyDescription> propertyDescriptions)
- {
- ExtendedAssert.assertEquals(expected.size(), propertyDescriptions.size());
- V1PropertyDescription propDesc = propertyDescriptions.get(0);
- ExtendedAssert.assertNotNull(propDesc);
- String name = propDesc.getName();
- if ("prefName1".equals(name))
- {
- assertEquals(expected.get(0), propDesc);
- assertEquals(expected.get(1), propertyDescriptions.get(1));
- }
- else if ("prefName2".equals(name))
- {
- assertEquals(expected.get(1), propDesc);
- assertEquals(expected.get(0), propertyDescriptions.get(1));
- }
- else
- {
- ExtendedAssert.fail("Unexpected PropertyDescription named '" + name + "'");
- }
- }
-
- protected String getMostUsedPortletWARFileName()
- {
- return TEST_BASIC_PORTLET_WAR;
- }
-
- private static class PropertyDecorator implements ExtendedAssert.Decorator
- {
- private V1Property prop;
-
- public void decorate(Object decorated)
- {
- prop = (V1Property)decorated;
- }
-
- public boolean equals(Object o)
- {
- if (o instanceof ExtendedAssert.DecoratedObject)
- {
- ExtendedAssert.DecoratedObject decoratedObject = (ExtendedAssert.DecoratedObject)o;
- V1Property that = (V1Property)decoratedObject.getDecorated();
-
- String name = prop.getName();
- if (name != null ? !name.equals(that.getName()) : that.getName() != null)
- {
- return false;
- }
-
- String value = prop.getStringValue();
- if (value != null ? !value.equals(that.getStringValue()) : that.getStringValue() != null)
- {
- return false;
- }
-
- String lang = prop.getLang();
- if (lang != null ? !lang.equals(that.getLang()) : that.getLang() != null)
- {
- return false;
- }
-
- List<Object> any = prop.getAny();
- return !(any != null ? !any.equals(that.getAny()) : that.getAny() != null);
-
- }
- else
- {
- return false;
- }
- }
-
-
- public String toString()
- {
- return new StringBuffer().append("Property: ").append(prop.getName()).append("=")
- .append(prop.getStringValue()).append(" (").append(prop.getLang()).append(")").toString();
- }
- }
-}
\ No newline at end of file
Deleted: components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java
===================================================================
--- components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java 2010-06-15 17:58:11 UTC (rev 3338)
+++ components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -1,154 +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.protocol.v1;
-
-import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
-import org.gatein.wsrp.test.ExtendedAssert;
-import org.jboss.logging.Logger;
-import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1RegistrationContext;
-import org.oasis.wsrp.v1.V1ReleaseSessions;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Tests the behavior of the ReleaseSession method.
- *
- * @author Matt Wringe
- */
-public class ReleaseSessionTestCase extends NeedPortletHandleTest
-{
-
- // default portlet war used in this test
- private static final String DEFAULT_SESSION_PORTLET_WAR = "test-session-portlet.war";
-
- private static final Logger log = Logger.getLogger(ReleaseSessionTestCase.class);
-
-
- protected String getMostUsedPortletWARFileName()
- {
- return DEFAULT_SESSION_PORTLET_WAR;
- }
-
- public ReleaseSessionTestCase() throws Exception
- {
- super("SessionWar", DEFAULT_SESSION_PORTLET_WAR);
- log.debug("Instantiating ReleaseSessionTestCase");
- }
-
-
- public void testReleaseSession() throws Exception
- {
- // possible registration contexts are: actual RegistrationContext, null, and a made up value
- V1RegistrationContext fakeRegContext = WSRP1TypeFactory.createRegistrationContext("Fake Registration Handle");
- V1RegistrationContext[] regContexts = new V1RegistrationContext[]{null, null, fakeRegContext};
-
- // possible types of sessionIDs include null and a made up value.
- // Note: a valid session id cannot be used since the sessionID should never be sent to the consumer
- String nullSessionID = null;
- String fakeSessionID = "Fake Session ID";
-
- String[][] sessionIDs = new String[][]{{nullSessionID},
- {nullSessionID, nullSessionID},
- {fakeSessionID},
- {fakeSessionID, fakeSessionID},
- {fakeSessionID, nullSessionID},
- {nullSessionID, fakeSessionID}};
-
- for (int i = 0; i < regContexts.length; i++)
- {
- for (String[] sessionID : sessionIDs)
- {
- V1ReleaseSessions releaseSession = WSRP1TypeFactory.createReleaseSessions(regContexts[i], Arrays.asList(sessionID));
- releaseSessions(releaseSession, false, i);
- releaseSessions(releaseSession, true, i);
- }
- }
- }
-
- private void releaseSessions(V1ReleaseSessions releaseSessions, boolean useRegistration, int index) throws Exception
- {
- setUp();
- try
- {
- if (useRegistration)
- {
- configureRegistrationSettings(true, false);
-
- // faking correct registration context when we're supposed to have one... previous impl registered consumer
- // all the time but this cannot be done anymore since we prevent registering if no registration is required
- // so we need to wait for the proper case to init the registration context... Hackish! :(
- if (index == 0)
- {
- releaseSessions.setRegistrationContext(registerConsumer());
- }
- }
- log.info(getSetupString(releaseSessions));
- producer.releaseSessions(releaseSessions);
- ExtendedAssert.fail("ReleaseSessions did not thrown an OperationFailed Fault." + getSetupString(releaseSessions));
- }
- catch (V1OperationFailed operationFailedFault)
- {
- // expected fault.
- }
- finally
- {
- tearDown();
- }
- }
-
- private String getSetupString(V1ReleaseSessions releaseSessions)
- {
- StringBuffer message = new StringBuffer("ReleaseSessions Setup:\n");
-
- if (releaseSessions == null)
- {
- message.append(" ReleaseSessions : null");
- }
- else
- {
- V1RegistrationContext regContext = releaseSessions.getRegistrationContext();
- List<String> sessionIDs = releaseSessions.getSessionIDs();
- message.append(" RegistrationContext : ").append(regContext != null ? regContext.getRegistrationHandle() : null);
- message.append(" | SessionIDs : ");
- if (sessionIDs != null)
- {
- for (int i = 0; i < sessionIDs.size(); i++)
- {
- message.append(sessionIDs.get(i)).append(i == sessionIDs.size() - 1 ? "" : ", ");
- }
- }
-
- }
-
- if (producer.getConfigurationService().getConfiguration().getRegistrationRequirements().isRegistrationRequired())
- {
- message.append(" | with registration required.");
- }
-
- return message.toString();
- }
-
-}
\ No newline at end of file
Deleted: components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java
===================================================================
--- components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java 2010-06-15 17:58:11 UTC (rev 3338)
+++ components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -1,153 +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.
- */
-
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.gatein.wsrp.protocol.v1;
-
-import org.gatein.wsrp.WSRPUtils;
-import org.gatein.wsrp.registration.RegistrationPropertyDescription;
-import org.gatein.wsrp.test.ExtendedAssert;
-import org.oasis.wsrp.v1.V1GetServiceDescription;
-import org.oasis.wsrp.v1.V1ModelDescription;
-import org.oasis.wsrp.v1.V1PropertyDescription;
-import org.oasis.wsrp.v1.V1ServiceDescription;
-
-import java.util.List;
-
-/**
- * Tests WSRP Service Description
- *
- * @author <a href="mailto:Anil.Saldhana@jboss.org">Anil Saldhana</a>
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision: 11547 $
- * @since 2.4 (Feb 20, 2006)
- */
-public class ServiceDescriptionTestCase extends V1ProducerBaseTest
-{
- public ServiceDescriptionTestCase() throws Exception
- {
- super("ServiceDescriptionTestCase");
- }
-
- public void testNotRequiringRegistration() throws Throwable
- {
- producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(false);
-
- V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
-
- V1ServiceDescription sd = checkServiceDescriptionWithOnlyBasicPortlet(gs);
-
- // registration is not required
- ExtendedAssert.assertFalse(sd.isRequiresRegistration());
-
- // No registration properties
- ExtendedAssert.assertNull(sd.getRegistrationPropertyDescription());
- }
-
- public void testRequiringRegistrationNotProvidingPortlets() throws Throwable
- {
- RegistrationPropertyDescription regProp = configureRegistrationSettings(true, false);
-
- // service description request without registration info
- V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
-
- //Invoke the Web Service
- V1ServiceDescription sd = producer.getServiceDescription(gs);
- ExtendedAssert.assertNotNull(sd);
- ExtendedAssert.assertTrue(sd.isRequiresRegistration());
-
- // Check registration properties
- checkRequiredRegistrationProperties(sd, regProp);
-
- // No offered portlets without registration!
- ExtendedAssert.assertNull(sd.getOfferedPortlets());
- }
-
- public void testRequiringRegistrationProvidingPortlets() throws Throwable
- {
- RegistrationPropertyDescription regProp = configureRegistrationSettings(true, true);
-
- // service description request without registration info
- V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
-
- //Invoke the Web Service, we should have the complete description
- V1ServiceDescription sd = checkServiceDescriptionWithOnlyBasicPortlet(gs);
- ExtendedAssert.assertNotNull(sd);
- ExtendedAssert.assertTrue(sd.isRequiresRegistration());
-
- // Check registration properties
- checkRequiredRegistrationProperties(sd, regProp);
- }
-
- public void testLiveDeployment() throws Throwable
- {
- try
- {
- V1GetServiceDescription gsd = getNoRegistrationServiceDescriptionRequest();
-
- deploy("test-basic-portlet.war");
- V1ServiceDescription sd = producer.getServiceDescription(gsd);
- ExtendedAssert.assertEquals(1, sd.getOfferedPortlets().size());
-
- deploy("test-markup-portlet.war");
- sd = producer.getServiceDescription(gsd);
- // should now have 2 offered portlets
- ExtendedAssert.assertEquals(2, sd.getOfferedPortlets().size());
-
- deploy("test-session-portlet.war");
- sd = producer.getServiceDescription(gsd);
- // should now have 3 offered portlets
- ExtendedAssert.assertEquals(3, sd.getOfferedPortlets().size());
-
- undeploy("test-markup-portlet.war");
- sd = producer.getServiceDescription(gsd);
- // should now have only 2 offered portlets again
- ExtendedAssert.assertEquals(2, sd.getOfferedPortlets().size());
-
- undeploy("test-session-portlet.war");
- // only basic portlet should still be offered
- checkServiceDescriptionWithOnlyBasicPortlet(gsd);
- }
- finally
- {
- undeploy("test-basic-portlet.war");
- undeploy("test-markup-portlet.war");
- undeploy("test-session-portlet.war");
- }
- }
-
- private void checkRequiredRegistrationProperties(V1ServiceDescription sd, RegistrationPropertyDescription regProp)
- {
- V1ModelDescription registrationPropertyDescription = sd.getRegistrationPropertyDescription();
- ExtendedAssert.assertNotNull(registrationPropertyDescription);
- List<V1PropertyDescription> propertyDescriptions = registrationPropertyDescription.getPropertyDescriptions();
- ExtendedAssert.assertNotNull(propertyDescriptions);
- ExtendedAssert.assertEquals(1, propertyDescriptions.size());
- assertEquals(WSRPUtils.convertToPropertyDescription(regProp), propertyDescriptions.get(0));
- }
-}
\ No newline at end of file
Modified: components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java
===================================================================
--- components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java 2010-06-15 17:58:11 UTC (rev 3338)
+++ components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -29,7 +29,9 @@
import org.gatein.registration.policies.DefaultRegistrationPropertyValidator;
import org.gatein.wsrp.WSRPConstants;
import org.gatein.wsrp.producer.ProducerHolder;
+import org.gatein.wsrp.producer.WSRPProducer;
import org.gatein.wsrp.producer.WSRPProducerBaseTest;
+import org.gatein.wsrp.producer.WSRPProducerImpl;
import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
import org.gatein.wsrp.producer.v1.WSRP1Producer;
import org.gatein.wsrp.registration.RegistrationPropertyDescription;
@@ -59,7 +61,7 @@
public abstract class V1ProducerBaseTest extends WSRPProducerBaseTest
{
private static final String CONSUMER = "test-consumer";
- protected WSRP1Producer producer = ProducerHolder.getV1Producer();
+ protected WSRP1Producer producer = WSRP1Producer.getInstance();
public V1ProducerBaseTest() throws Exception
Modified: components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java
===================================================================
--- components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java 2010-06-15 17:58:11 UTC (rev 3338)
+++ components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/support/MockHttpServletRequest.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -23,12 +23,14 @@
package org.gatein.wsrp.test.support;
+import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
+import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
@@ -125,6 +127,55 @@
{
return serverPort;
}
+ if ("getHeaderNames".equals(methodName))
+ {
+ return new Enumeration<String>()
+ {
+
+ public boolean hasMoreElements()
+ {
+ return false;
+ }
+
+ public String nextElement()
+ {
+ return null;
+ }
+ };
+ }
+ if ("getCookies".equals(methodName))
+ {
+ return new Cookie[0];
+ }
+ if ("getMethod".equals(methodName))
+ {
+ return "GET";
+ }
+ if ("getContextPath".equals(methodName))
+ {
+ return "/";
+ }
+ if ("getPathInfo".equals(methodName))
+ {
+ return "/";
+ }
+ if ("getQueryString".equals(methodName))
+ {
+ return "";
+ }
+ if ("getQueryURI".equals(methodName))
+ {
+ return "";
+ }
+ if ("getRequestURI".equals(methodName))
+ {
+ return "";
+ }
+ if ("getServletPath".equals(methodName))
+ {
+ return "/";
+ }
+
throw new UnsupportedOperationException("MockHttpServletRequest does not support: " + method);
}
}
Modified: components/wsrp/trunk/wsrp-producer-war/pom.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/pom.xml 2010-06-15 17:58:11 UTC (rev 3338)
+++ components/wsrp/trunk/wsrp-producer-war/pom.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -57,6 +57,127 @@
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.gatein.common</groupId>
+ <artifactId>common-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-portlet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-federation</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-producer-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>test-framework</artifactId>
+ <scope>test</scope>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Producer Sar Test Dependencies -->
+ <!-- TODO: move versioning to the main pom.xml -->
+ <dependency>
+ <groupId>org.gatein.wci</groupId>
+ <artifactId>wci-tomcat</artifactId>
+ <scope>test</scope>
+ <version>${version.gatein.wci}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-integration-api</artifactId>
+ <scope>test</scope>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-controller</artifactId>
+ <scope>test</scope>
+ <version>${version.gatein.pc}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-mc</artifactId>
+ <scope>test</scope>
+ <version>${version.gatein.pc}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-api</artifactId>
+ <version>1.0.0.Alpha2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.6</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ <version>1.0.0.Alpha2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-remote-51</artifactId>
+ <version>1.0.0.Alpha2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <version>5.1.0.GA</version>
+ <scope>test</scope>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-server-manager</artifactId>
+ <version>1.0.3.GA</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -73,7 +194,160 @@
</archive>
</configuration>
</plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <finalName>test</finalName>
+ <appendAssemblyId>true</appendAssemblyId>
+ <!-- we don't want to add these archives into the repo -->
+ <attach>false</attach>
+ <outputDirectory>${project.build.directory}/test-archives</outputDirectory>
+ <descriptors>
+ <descriptor>src/test/assembly/test-producer.xml</descriptor>
+ <descriptor>src/test/assembly/test-markup-portlet.xml</descriptor>
+ <descriptor>src/test/assembly/test-renderparam-portlet.xml</descriptor>
+ <descriptor>src/test/assembly/test-session-portlet.xml</descriptor>
+ <descriptor>src/test/assembly/test-basic-portlet.xml</descriptor>
+ <descriptor>src/test/assembly/test-dispatcher-portlet.xml</descriptor>
+ <descriptor>src/test/assembly/test-getlocales-portlet.xml</descriptor>
+ <descriptor>src/test/assembly/test-encodeurl-portlet.xml</descriptor>
+ <descriptor>src/test/assembly/test-usercontext-portlet.xml</descriptor>
+ <descriptor>src/test/assembly/test-multivalued-portlet.xml</descriptor>
+ <descriptor>src/test/assembly/test-implicitcloning-portlet.xml</descriptor>
+ <descriptor>src/test/assembly/test-resource-portlet.xml</descriptor>
+ <descriptor>src/test/assembly/test-resourcenoencodeurl-portlet.xml</descriptor>
+ <descriptor>src/test/assembly/test-applicationscope-portlet.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>assemble</id>
+ <!-- note that package phase happens after the test phase and before the integration test phase -->
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <version>2.1.1</version>
+ </dependency>
+ </dependencies>
+
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ <excludes>
+ <exclude>org/gatein/wsrp/protocol/v1/*</exclude>
+ <exclude>org/gatein/wsrp/protocol/v1a/*</exclude>
+ </excludes>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <!--<skip>false</skip>-->
+ <includes>
+ <include>org/gatein/wsrp/protocol/v1/MarkupTestCase.class</include>
+ <include>org/gatein/wsrp/protocol/v1/PortletManagementTestCase.class</include>
+ <!-- <include>org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.class</include> -->
+ <include>org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.class</include>
+ </includes>
+ <excludes>
+ <exclude>org/gatein/wsrp/producer/**</exclude>
+ <exclude>org/gatein/wsrp/registration/**</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0.1</version>
+ <configuration>
+ <container>
+ <containerId>jboss51x</containerId>
+ <home>${JBOSS_HOME}</home>
+ <log>${basedir}/target/jboss51x/container.log</log>
+ <systemProperties>
+ <!-- Since the tests run on the server, we need to pass system properties to the
+ server so that the tests can use them. -->
+ <!-- The tests need to deploy and undeploy artifacts during the test so we need to pass
+ properties to enable this behaviour. -->
+ <jboss.deploy.dir>${jboss.server.home.dir}/conf</jboss.deploy.dir>
+ <test.deployables.dir>${basedir}/target/test-archives</test.deployables.dir>
+ </systemProperties>
+ </container>
+ <wait>false</wait>
+ <configuration>
+ <properties>
+ <cargo.jvmargs>-Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=false</cargo.jvmargs>
+ </properties>
+ <deployables>
+ <deployable>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-producer</artifactId>
+ <type>war</type>
+ <properties>
+ <context>wsrp-producer</context>
+ </properties>
+ <pingURL>http://localhost:8080/wsrp-producer/MarkupService?WSDL</pingURL>
+ </deployable>
+ <deployable>
+ <location>${basedir}/target/test-archives/test-producer.sar</location>
+ <type>sar</type>
+ </deployable>
+ </deployables>
+ </configuration>
+ </configuration>
+ <executions>
+ <execution>
+ <id>pre-integration-start-server</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>post-integration-stop-server</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
+ <testResources>
+ <testResource>
+ <directory>src/test/jboss-resources</directory>
+ </testResource>
+ </testResources>
</build>
-</project>
\ No newline at end of file
+</project>
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-applicationscope-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-applicationscope-portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-applicationscope-portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>applicationscope-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-applicationscope-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-basic-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-basic-portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-basic-portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>basic-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-basic-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-dispatcher-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-dispatcher-portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-dispatcher-portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>dispatcher-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-dispatcher-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-encodeurl-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-encodeurl-portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-encodeurl-portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>encodeurl-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-encodeurl-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-getlocales-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-getlocales-portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-getlocales-portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>getlocales-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-getlocales-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-implicitcloning-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-implicitcloning-portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-implicitcloning-portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>implicitcloning-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-implicitcloning-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-markup-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-markup-portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-markup-portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>markup-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-markup-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-multivalued-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-multivalued-portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-multivalued-portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>multivalued-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-multivalued-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-producer.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-producer.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-producer.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,72 @@
+<assembly>
+ <id>producer</id>
+ <formats>
+ <format>sar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/producer-sar</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+ <moduleSets>
+ <moduleSet>
+<!-- <includes>
+ <include>org.gatein.wsrp:wsrp-producer-lib</include>
+ </includes> -->
+ <binaries/>
+ </moduleSet>
+ </moduleSets>
+
+ <dependencySets>
+ <dependencySet>
+ <scope>test</scope>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org.gatein.wsrp:test-framework</include>
+
+ <include>org.gatein.wci:wci-tomcat</include>
+ <include>org.gatein.wci:wci-wci</include>
+
+ <include>org.gatein.pc:pc-portlet</include>
+ <include>org.gatein.pc:pc-api</include>
+ <include>javax.portlet:portlet-api</include>
+
+ <include>org.gatein.pc:pc-controller</include>
+ <include>org.gatein.pc:pc-mc</include>
+
+ <include>org.gatein.common:common-common</include>
+ <include>org.gatein.common:common-logging</include>
+
+ <include>javax.ccpp:ccpp</include>
+
+ <include>org.gatein.wsrp:wsrp-common</include>
+ <include>org.gatein.wsrp:wsrp-integration-api</include>
+ <include>org.gatein.wsrp:wsrp-producer-lib</include>
+ <include>org.gatein.wsrp:wsrp-wsrp1-ws</include>
+ <include>org.gatein.wsrp:wsrp-wsrp2-ws</include>
+
+ <include>junit:junit</include>
+ <include>commons-fileupload:commons-fileupload</include>
+
+ <include>com.google.collections:google-collections</include>
+
+ </includes>
+ </dependencySet>
+ </dependencySets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-renderparam-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-renderparam-portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-renderparam-portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>renderparam-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-renderparam-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resource-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resource-portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resource-portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>resource-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-resource-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resourcenoencodeurl-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resourcenoencodeurl-portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-resourcenoencodeurl-portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>resourcenoencodeurl-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-resourcenoencodeurl-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-session-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-session-portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-session-portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>session-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-session-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-usercontext-portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-usercontext-portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/assembly/test-usercontext-portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,26 @@
+<assembly>
+ <id>usercontext-portlet</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <!-- Test Classes -->
+ <!-- TODO: we probably shouldn't be using all of these classes here -->
+ <fileSet>
+ <directory>target/test-classes</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org/**MarkupPortlet.java</include>
+ </includes>
+ </fileSet>
+ <!-- Fileset for the sar strucuture -->
+ <fileSet>
+ <directory>src/test/test-portlets/test-usercontext-portlet-war</directory>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/AbstractRegistrationPersistenceManagerTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/AbstractRegistrationPersistenceManagerTestCase.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/AbstractRegistrationPersistenceManagerTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,431 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.gatein.registration;
+
+import junit.framework.TestCase;
+import org.gatein.common.util.MapBuilder;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 9218 $
+ * @since 2.6
+ */
+public abstract class AbstractRegistrationPersistenceManagerTestCase extends TestCase
+{
+
+ /** . */
+ private Map<QName, Object> registrationProperties;
+
+ public abstract RegistrationPersistenceManager getManager();
+
+ public void startInteraction()
+ {
+ }
+
+ public void stopInteraction()
+ {
+ }
+
+ public void setUp() throws Exception
+ {
+ registrationProperties = new HashMap<QName, Object>();
+ registrationProperties.put(new QName("prop1"), "value1");
+ registrationProperties.put(new QName("prop2"), "value2");
+ }
+
+ protected void tearDown() throws Exception
+ {
+ registrationProperties = null;
+ }
+
+ public void testGetGroupThrowsIAE() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ getManager().getConsumerGroup(null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testAddGroup() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ assertNotNull(group);
+ assertEquals("Foo", group.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
+ stopInteraction();
+
+ // Test by retrieving the same consumer
+ startInteraction();
+ group = getManager().getConsumerGroup("Foo");
+ assertNotNull(group);
+ assertEquals("Foo", group.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
+ stopInteraction();
+
+ // Test by retrieving the consumer list
+ startInteraction();
+ Collection groups = getManager().getConsumerGroups();
+ assertNotNull(groups);
+ assertEquals(1, groups.size());
+ group = (ConsumerGroup)groups.iterator().next();
+ assertNotNull(group);
+ assertEquals("Foo", group.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
+ stopInteraction();
+ }
+
+ public void testAddDuplicateGroup() throws Exception
+ {
+ startInteraction();
+ getManager().createConsumerGroup("Foo");
+ try
+ {
+ getManager().createConsumerGroup("Foo");
+ fail();
+ }
+ catch (DuplicateRegistrationException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testAddGroupThrowsIAE() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ getManager().createConsumerGroup(null);
+ }
+ catch (IllegalArgumentException expected)
+ {
+ assertEquals(Collections.EMPTY_SET, new HashSet(getManager().getConsumerGroups()));
+ }
+ stopInteraction();
+ }
+
+ public void testRemoveGroup() throws Exception
+ {
+ startInteraction();
+ getManager().createConsumerGroup("Foo");
+ stopInteraction();
+
+ startInteraction();
+ getManager().removeConsumerGroup("Foo");
+ assertNull(getManager().getConsumerGroup("Foo"));
+ assertEquals(Collections.EMPTY_SET, new HashSet(getManager().getConsumerGroups()));
+ stopInteraction();
+ }
+
+ public void testRemoveGroupThrowsIAE() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ getManager().removeConsumerGroup(null);
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testRemoveNonExistingGroup() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ getManager().removeConsumerGroup("Foo");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testGetConsumerThrowsIAE() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ group.getConsumer(null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testAddConsumer() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ stopInteraction();
+
+ startInteraction();
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ assertNotNull(consumer);
+ assertEquals("Bar", consumer.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
+ assertEquals("Foo", consumer.getGroup().getName());
+ stopInteraction();
+
+ // Test by retrieving the same consumer
+ startInteraction();
+ consumer = group.getConsumer("Bar");
+ assertNotNull(consumer);
+ assertEquals("Bar", consumer.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
+ assertEquals("Foo", consumer.getGroup().getName());
+ stopInteraction();
+
+ // Test by retrieving the consumer list
+ startInteraction();
+ Collection consumers = group.getConsumers();
+ assertNotNull(consumers);
+ assertEquals(1, consumers.size());
+ consumer = (Consumer)consumers.iterator().next();
+ assertNotNull(consumer);
+ assertEquals("Bar", consumer.getName());
+ assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
+ assertEquals("Foo", consumer.getGroup().getName());
+ stopInteraction();
+ }
+
+ public void testAddDuplicateConsumer() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ stopInteraction();
+
+ startInteraction();
+ try
+ {
+ group.addConsumer(consumer);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testAddConsumerThrowsIAE() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ try
+ {
+ group.addConsumer(null);
+ }
+ catch (IllegalArgumentException expected)
+ {
+ assertEquals(Collections.EMPTY_SET, new HashSet(group.getConsumers()));
+ }
+ stopInteraction();
+ }
+
+ public void testRemoveConsumer() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ group.removeConsumer(consumer);
+ assertNull(group.getConsumer("Bar"));
+ assertEquals(Collections.EMPTY_SET, new HashSet(group.getConsumers()));
+ stopInteraction();
+ }
+
+ public void testRemoveConsumerThrowsIAE() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ try
+ {
+ group.removeConsumer(null);
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testAddRegistration() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ stopInteraction();
+
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ Registration reg1 = getManager().addRegistrationFor("Bar", registrationProperties);
+ assertNotNull(reg1);
+ String regId = reg1.getPersistentKey();
+ assertNotNull(regId);
+ assertEquals(consumer, reg1.getConsumer());
+ Map expectedProps = new HashMap();
+ expectedProps.put(new QName("prop1"), "value1");
+ expectedProps.put(new QName("prop2"), "value2");
+ assertEquals(expectedProps, reg1.getProperties());
+ stopInteraction();
+
+ // Retrieve it from the list of consumer registrations
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ Collection registrations = consumer.getRegistrations();
+ assertNotNull(registrations);
+ assertEquals(1, registrations.size());
+ Registration reg3 = (Registration)registrations.iterator().next();
+ assertEquals(regId, reg3.getPersistentKey());
+ assertEquals(consumer, reg3.getConsumer());
+ assertEquals(expectedProps, reg3.getProperties());
+ stopInteraction();
+
+ // Retrieve the same registration from the registry
+ startInteraction();
+ Registration reg2 = getManager().getRegistration(regId);
+ consumer = getManager().getConsumerById("Bar");
+ assertNotNull(reg2);
+ assertEquals(regId, reg2.getPersistentKey());
+ assertEquals(consumer, reg2.getConsumer());
+ assertEquals(expectedProps, reg2.getProperties());
+ stopInteraction();
+ }
+
+ public void testAddRegistrationThrowsIAE() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+
+ try
+ {
+ getManager().addRegistrationFor(consumer.getId(), null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testRemoveRegistrationThrowsIAE() throws Exception
+ {
+ startInteraction();
+ try
+ {
+ getManager().removeRegistration(null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ stopInteraction();
+ }
+
+ public void testRemoveRegistration() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ Registration reg = getManager().addRegistrationFor("Bar", registrationProperties);
+ String regId = reg.getPersistentKey();
+ getManager().removeRegistration(regId);
+ stopInteraction();
+
+ // remove registration is the only method on RegistrationPersistenceManager that needs to "cascade"
+ // this is needed because there is no remove method on Consumer, hence the manager needs to remove the
+ // registration from its consumer since it's the only class that has access to the specific consumer impl
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ Collection registrations = consumer.getRegistrations();
+ assertNotNull(registrations);
+ assertEquals(0, registrations.size());
+ stopInteraction();
+
+ //
+ startInteraction();
+ assertEquals(null, getManager().getRegistration(regId));
+ stopInteraction();
+ }
+
+ public void testBulkUpdateRegistrationProperties() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ getManager().addRegistrationFor("Bar", registrationProperties);
+ stopInteraction();
+
+ //
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ Registration reg = (Registration)consumer.getRegistrations().iterator().next();
+ registrationProperties.remove(new QName("prop1"));
+ reg.updateProperties(registrationProperties);
+ assertEquals(Collections.singletonMap(new QName("prop2"), "value2"), reg.getProperties());
+ stopInteraction();
+
+ //
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ reg = (Registration)consumer.getRegistrations().iterator().next();
+ assertEquals(Collections.singletonMap(new QName("prop2"), "value2"), reg.getProperties());
+ registrationProperties.put(new QName("prop3"), "value3");
+ reg.updateProperties(registrationProperties);
+ assertEquals(MapBuilder.hashMap().put(new QName("prop2"), "value2").put(new QName("prop3"), "value3").get(), reg.getProperties());
+ stopInteraction();
+
+ //
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ reg = (Registration)consumer.getRegistrations().iterator().next();
+ assertEquals(MapBuilder.hashMap().put(new QName("prop2"), "value2").put(new QName("prop3"), "value3").get(), reg.getProperties());
+ stopInteraction();
+ }
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/AbstractRegistrationPersistenceManagerTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerGroupTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerGroupTestCase.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerGroupTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,113 @@
+/*
+ * 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.registration;
+
+import junit.framework.TestCase;
+import org.gatein.registration.impl.RegistrationManagerImpl;
+import org.gatein.registration.impl.RegistrationPersistenceManagerImpl;
+import org.gatein.registration.policies.DefaultRegistrationPolicy;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class ConsumerGroupTestCase extends TestCase
+{
+ private RegistrationManager manager;
+ private ConsumerGroup group;
+ private static final String NAME = "name";
+
+
+ protected void setUp() throws Exception
+ {
+ manager = new RegistrationManagerImpl();
+ RegistrationPolicy policy = new DefaultRegistrationPolicy();
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+ group = manager.createConsumerGroup(NAME);
+ }
+
+ public void testGetName()
+ {
+ assertEquals(NAME, group.getName());
+ }
+
+ public void testConsumersManagement() throws RegistrationException
+ {
+ assertTrue(group.isEmpty());
+ assertEquals(0, group.getConsumers().size());
+
+ Consumer c1 = manager.createConsumer("c1");
+ group.addConsumer(c1);
+ assertTrue(!group.isEmpty());
+ assertEquals(1, group.getConsumers().size());
+ assertTrue(group.contains(c1));
+ assertEquals(group, c1.getGroup());
+ assertEquals(c1, group.getConsumer(c1.getId()));
+
+ Consumer c2 = manager.createConsumer("c2");
+ group.addConsumer(c2);
+ assertEquals(2, group.getConsumers().size());
+ assertTrue(group.contains(c2));
+ assertEquals(group, c2.getGroup());
+
+ group.removeConsumer(c1);
+ assertEquals(1, group.getConsumers().size());
+ assertTrue(!group.contains(c1));
+ assertTrue(group.contains(c2));
+ assertEquals(null, c1.getGroup());
+ }
+
+ public void testAddNullConsumer() throws RegistrationException
+ {
+ try
+ {
+ group.addConsumer(null);
+ fail("Shouldn't be possible to add null consumer");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+
+ public void testStatus()
+ {
+ assertEquals(RegistrationStatus.PENDING, group.getStatus());
+ group.setStatus(RegistrationStatus.VALID);
+ assertEquals(RegistrationStatus.VALID, group.getStatus());
+ }
+
+ public void testIllegalStatus()
+ {
+ try
+ {
+ group.setStatus(null);
+ fail("Shouldn't be possible to set the status to null");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+ }
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerGroupTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerTestCase.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,122 @@
+/*
+ * 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.registration;
+
+import junit.framework.TestCase;
+import org.gatein.registration.impl.RegistrationManagerImpl;
+import org.gatein.registration.impl.RegistrationPersistenceManagerImpl;
+import org.gatein.registration.policies.DefaultRegistrationPolicy;
+import org.gatein.registration.policies.DefaultRegistrationPropertyValidator;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+
+import javax.xml.namespace.QName;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class ConsumerTestCase extends TestCase
+{
+ private Consumer consumer;
+ private RegistrationManager manager;
+ private static final Map<QName, RegistrationPropertyDescription> EMPTY_EXPECTATIONS = Collections.emptyMap();
+
+ protected void setUp() throws Exception
+ {
+ manager = new RegistrationManagerImpl();
+ DefaultRegistrationPolicy policy = new DefaultRegistrationPolicy();
+ policy.setValidator(new DefaultRegistrationPropertyValidator());
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+ consumer = manager.createConsumer("name");
+ }
+
+ public void testGetName()
+ {
+ assertEquals("name", consumer.getName());
+ }
+
+ public void testStatus() throws RegistrationException
+ {
+ assertEquals(RegistrationStatus.PENDING, consumer.getStatus());
+
+ String name = consumer.getName();
+
+ // adding a registration that isn't validated doesn't change the status
+ Registration registration = manager.addRegistrationTo(name, Collections.<QName, Object>emptyMap(), EMPTY_EXPECTATIONS, false);
+ assertEquals(RegistrationStatus.PENDING, consumer.getStatus());
+
+ // but the consumer's status should become valid if the registration becomes so as well
+ registration.setStatus(RegistrationStatus.VALID);
+ assertEquals(RegistrationStatus.VALID, consumer.getStatus());
+
+ // adding a new registration makes the consumer's status pending
+ // need to change the registration props to register this consumer again
+ Map<QName, Object> props = new HashMap<QName, Object>(1);
+ QName propName = new QName("prop");
+ props.put(propName, "value");
+ // need to change the expectations to allow the new registration property
+ Map<QName, RegistrationPropertyDescription> expectations = new HashMap<QName, RegistrationPropertyDescription>();
+ expectations.put(propName, new RegistrationPropertyDescription(propName, WSRPConstants.XSD_STRING));
+ registration = manager.addRegistrationTo(name, props, expectations, false);
+ assertEquals(2, consumer.getRegistrations().size());
+ assertEquals(RegistrationStatus.PENDING, consumer.getStatus());
+
+ // and if the new registration is marked as invalid, so does the consumer's status
+ registration.setStatus(RegistrationStatus.INVALID);
+ assertEquals(RegistrationStatus.INVALID, consumer.getStatus());
+
+ // if the registration is returned to pending, then so is the consumer
+ registration.setStatus(RegistrationStatus.PENDING);
+ assertEquals(RegistrationStatus.PENDING, consumer.getStatus());
+
+ // if all the registrations are valid, then so is the consumer
+ registration.setStatus(RegistrationStatus.VALID);
+ assertEquals(RegistrationStatus.VALID, consumer.getStatus());
+ }
+
+ public void testSetGroup() throws Exception
+ {
+ ConsumerGroup group = manager.createConsumerGroup("group");
+ assertTrue(!group.getConsumers().contains(consumer));
+
+ consumer.setGroup(group);
+ assertEquals(group, consumer.getGroup());
+ assertTrue(group.getConsumers().contains(consumer));
+
+ consumer.setGroup(null);
+ assertNull(consumer.getGroup());
+ assertTrue(!group.getConsumers().contains(consumer));
+ }
+
+ public void testGetIdentity() throws Exception
+ {
+ assertNotNull(consumer.getId());
+ }
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/ConsumerTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/DefaultRegistrationPolicyTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/DefaultRegistrationPolicyTestCase.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/DefaultRegistrationPolicyTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,178 @@
+/*
+ * 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.registration;
+
+import junit.framework.TestCase;
+import org.gatein.registration.impl.RegistrationManagerImpl;
+import org.gatein.registration.impl.RegistrationPersistenceManagerImpl;
+import org.gatein.registration.policies.DefaultRegistrationPolicy;
+import org.gatein.registration.policies.DefaultRegistrationPropertyValidator;
+import org.gatein.wsrp.registration.PropertyDescription;
+
+import javax.xml.namespace.QName;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 9180 $
+ * @since 2.6.3
+ */
+public class DefaultRegistrationPolicyTestCase extends TestCase
+{
+ DefaultRegistrationPolicy policy;
+ Map<QName, Object> registrationProperties;
+ Map<QName, PropertyDescription> expectations;
+ private static final String CONSUMER = "consumer";
+ private static final QName PROP1 = new QName("prop1");
+ private static final QName PROP2 = new QName("prop2");
+ private static final QName PROP3 = new QName("prop3");
+ private RegistrationManager manager;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ policy = new DefaultRegistrationPolicy();
+
+ policy.setValidator(new DefaultRegistrationPropertyValidator());
+
+ manager = new RegistrationManagerImpl();
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+ manager.createConsumer(CONSUMER);
+
+ registrationProperties = new HashMap<QName, Object>();
+ registrationProperties.put(PROP1, "value1");
+ registrationProperties.put(PROP2, "value2");
+
+ expectations = new HashMap<QName, PropertyDescription>();
+ }
+
+ public void testValidateRegistrationDataForNull() throws RegistrationException
+ {
+ try
+ {
+ policy.validateRegistrationDataFor(null, "foo", expectations, manager);
+ fail("null data cannot be validated");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+
+ try
+ {
+ policy.validateRegistrationDataFor(Collections.<QName, Object>emptyMap(), null, expectations, manager);
+ fail("null data cannot be validated");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ }
+
+ public void testValidateRegistrationDataForInexistentConsumer()
+ {
+ try
+ {
+ policy.validateRegistrationDataFor(Collections.<QName, Object>emptyMap(), "foo", expectations, manager);
+ }
+ catch (RegistrationException e)
+ {
+ fail("Should be possible to validate information for inexistent consumer (otherwise, how would we register!)");
+ }
+ }
+
+ public void testValidateRegistrationDataMissingProps()
+ {
+ expectations.put(PROP1, new TestPropertyDescription(PROP1));
+ expectations.put(PROP2, new TestPropertyDescription(PROP2));
+ expectations.put(PROP3, new TestPropertyDescription(PROP3));
+
+ try
+ {
+ policy.validateRegistrationDataFor(registrationProperties, CONSUMER, expectations, manager);
+ fail("Missing prop3 should have been detected");
+ }
+ catch (RegistrationException e)
+ {
+ assertTrue(e.getLocalizedMessage().contains("prop3"));
+ }
+ }
+
+ public void testValidateRegistrationDataExtraProps()
+ {
+ expectations.put(PROP1, new TestPropertyDescription(PROP1));
+
+ try
+ {
+ policy.validateRegistrationDataFor(registrationProperties, CONSUMER, expectations, manager);
+ fail("Extra prop2 should have been detected");
+ }
+ catch (RegistrationException e)
+ {
+ assertTrue(e.getLocalizedMessage().contains("prop2"));
+ }
+ }
+
+ public void testValidateRegistrationDataInvalidValue()
+ {
+ expectations.put(PROP1, new TestPropertyDescription(PROP1));
+
+ registrationProperties.remove(PROP2);
+ registrationProperties.put(PROP1, null);
+
+ try
+ {
+ policy.validateRegistrationDataFor(registrationProperties, CONSUMER, expectations, manager);
+ fail("Should have detected null value for prop1");
+ }
+ catch (RegistrationException e)
+ {
+ assertTrue(e.getLocalizedMessage().contains("prop1"));
+ }
+ }
+
+ static class TestPropertyDescription implements PropertyDescription
+ {
+ private QName name;
+ private static final QName TYPE = new QName("type");
+
+ TestPropertyDescription(QName name)
+ {
+ this.name = name;
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public QName getType()
+ {
+ return TYPE;
+ }
+ }
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/DefaultRegistrationPolicyTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationManagerTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationManagerTestCase.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationManagerTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,432 @@
+/*
+ * 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.registration;
+
+import junit.framework.TestCase;
+import org.gatein.registration.impl.RegistrationManagerImpl;
+import org.gatein.registration.impl.RegistrationPersistenceManagerImpl;
+import org.gatein.registration.policies.DefaultRegistrationPolicy;
+import org.gatein.registration.policies.DefaultRegistrationPropertyValidator;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class RegistrationManagerTestCase extends TestCase
+{
+
+ private RegistrationManager manager;
+ private Map<QName, Object> registrationProperties;
+ private Map<QName, RegistrationPropertyDescription> expectations;
+
+ protected void setUp() throws Exception
+ {
+ manager = new RegistrationManagerImpl();
+
+ DefaultRegistrationPolicy policy = new DefaultRegistrationPolicy();
+ policy.setValidator(new DefaultRegistrationPropertyValidator());
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+
+ //todo: registration properties setup will need to be updated when property validation is implemented
+ QName prop1Name = new QName("prop1");
+ QName prop2Name = new QName("prop2");
+ registrationProperties = new HashMap<QName, Object>();
+ registrationProperties.put(prop1Name, "value1");
+ registrationProperties.put(prop2Name, "value2");
+
+ expectations = new HashMap<QName, RegistrationPropertyDescription>();
+ expectations.put(prop1Name, new RegistrationPropertyDescription(prop1Name, WSRPConstants.XSD_STRING));
+ expectations.put(prop2Name, new RegistrationPropertyDescription(prop2Name, WSRPConstants.XSD_STRING));
+ }
+
+ public void testPolicy()
+ {
+ RegistrationPolicy policy = manager.getPolicy();
+ assertNotNull(policy);
+ }
+
+ public void testAddRegistrationTo() throws Exception
+ {
+ Registration registration = manager.addRegistrationTo("consumerName", registrationProperties, expectations, true);
+ assertNotNull(registration);
+ assertNotNull(registration.getPersistentKey());
+
+ Consumer consumer = manager.getConsumerByIdentity("consumerName");
+ assertNotNull(consumer); // default policy: name == identity
+ assertEquals(consumer, registration.getConsumer());
+
+ String registrationHandle = registration.getRegistrationHandle();
+ assertNotNull(registrationHandle);
+ assertEquals(consumer, manager.getConsumerFor(registrationHandle));
+ }
+
+ public void testAddRegistrationToInexistentConsumer() throws RegistrationException
+ {
+ try
+ {
+ manager.addRegistrationTo("consumerName", registrationProperties, expectations, false);
+ fail("Should have failed: consumer does not exist");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+
+ assertNull(manager.getConsumerByIdentity("consumerName")); // default policy: name == identity
+ }
+
+ public void testGetConsumerForNullRegistrationHandle() throws Exception
+ {
+ try
+ {
+ manager.getConsumerFor(null);
+ fail("Should have failed: cannot find a consumer for a null registration handle");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+
+ public void testCreateConsumer() throws Exception
+ {
+ String name = "consumerName";
+ Consumer consumer = manager.createConsumer(name);
+ assertNotNull(consumer);
+ assertEquals(name, consumer.getName());
+ assertNotNull(consumer.getId());
+ assertNull(consumer.getGroup());
+
+ Collection consumers = manager.getConsumers();
+ assertEquals(1, consumers.size());
+ assertTrue(consumers.contains(consumer));
+ assertEquals(consumer, manager.getConsumerByIdentity(name)); // default policy: name == identity
+
+ try
+ {
+ consumers.add(consumer);
+ fail("Shouldn't be possible to directly modify consumer collection");
+ }
+ catch (UnsupportedOperationException expected)
+ {
+ }
+ }
+
+ public void testCreateConsumerWithGroupFromPolicy() throws RegistrationException
+ {
+ // use a different policy: now specifies that when creating a consumer, it should be added to a group with the same name
+ DefaultRegistrationPolicy policy = new DefaultRegistrationPolicy()
+ {
+ public String getAutomaticGroupNameFor(String consumerName)
+ {
+ return "group_" + consumerName;
+ }
+ };
+ manager.setPolicy(policy);
+
+ String name = "name";
+ Consumer consumer = manager.createConsumer(name);
+ assertNotNull(consumer);
+
+ ConsumerGroup group = manager.getConsumerGroup("group_" + name);
+ assertNotNull(group);
+ assertEquals(group, consumer.getGroup());
+ assertTrue(group.getConsumers().contains(consumer));
+ }
+
+ public void testCreateDuplicateConsumer() throws RegistrationException
+ {
+ String name = "name";
+ assertNotNull(manager.createConsumer(name));
+
+ try
+ {
+ manager.createConsumer(name);
+ fail("Should have failed when trying to create a consumer with an existing name");
+ }
+ catch (DuplicateRegistrationException expected)
+ {
+ }
+ }
+
+ public void testAddAutomaticallyCreatedConsumerToInexistentGroup() throws RegistrationException
+ {
+ try
+ {
+ manager.addConsumerToGroupNamed("foo", "bar", false, true);
+ fail("Shouldn't be possible to add a consumer to an inexistent group without first creating it");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+
+ assertNull(manager.getConsumerByIdentity("foo"));
+ assertNull(manager.getConsumerGroup("bar"));
+ }
+
+ public void testAddInexistentConsumerToAutomaticallyCreatedGroup() throws RegistrationException
+ {
+ try
+ {
+ manager.addConsumerToGroupNamed("foo", "bar", true, false);
+ fail("Shouldn't be possible to add an inexistent consumer to a group without first creating it");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+
+ assertNull(manager.getConsumerByIdentity("foo"));
+ assertNull(manager.getConsumerGroup("bar"));
+ }
+
+ public void testAddInexistentConsumerToGroup() throws RegistrationException
+ {
+ manager.createConsumerGroup("bar");
+ try
+ {
+ manager.addConsumerToGroupNamed("foo", "bar", false, false);
+ fail("Shouldn't be possible to add an inexistent consumer to a group without first creating it");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+
+ assertNull(manager.getConsumerByIdentity("foo"));
+ assertNotNull(manager.getConsumerGroup("bar"));
+ }
+
+ public void testAddInexistentConsumerToInexistentGroup() throws RegistrationException
+ {
+ try
+ {
+ manager.addConsumerToGroupNamed("foo", "bar", false, false);
+ fail("Shouldn't be possible to add a consumer to an inexistent group without first creating it");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+
+ assertNull(manager.getConsumerByIdentity("foo"));
+ assertNull(manager.getConsumerGroup("bar"));
+ }
+
+ public void testAddConsumerToGroup() throws Exception
+ {
+ String groupName = "group";
+ String consumerName = "consumer";
+ Consumer consumer = manager.addConsumerToGroupNamed(consumerName, groupName, true, true);
+
+ Consumer consumer1 = manager.getConsumerByIdentity(consumerName);
+ assertNotNull(consumer1);
+ assertEquals(consumer1, consumer); // default policy: identity == name
+
+ ConsumerGroup group = manager.getConsumerGroup(groupName);
+ assertNotNull(group);
+ assertEquals(group, consumer.getGroup());
+ }
+
+ public void testCreateConsumerGroup() throws Exception
+ {
+ String groupName = "name";
+ ConsumerGroup group = manager.createConsumerGroup(groupName);
+ assertNotNull(group);
+ assertEquals(groupName, group.getName());
+
+ Collection groups = manager.getConsumerGroups();
+ assertEquals(1, groups.size());
+ assertTrue(groups.contains(group));
+ assertEquals(group, manager.getConsumerGroup(groupName));
+
+ try
+ {
+ groups.add(group);
+ fail("Shouldn't be possible to directly modify group collection");
+ }
+ catch (UnsupportedOperationException expected)
+ {
+ }
+ }
+
+ public void testRemoveConsumerGroup() throws RegistrationException
+ {
+ String groupName = "name";
+ ConsumerGroup group = manager.createConsumerGroup(groupName);
+ manager.removeConsumerGroup(group);
+ assertNull(manager.getConsumerGroup(groupName));
+
+ manager.createConsumerGroup(groupName);
+ manager.removeConsumerGroup(groupName);
+ assertNull(manager.getConsumerGroup(groupName));
+ }
+
+ public void testCascadeRemovalOnConsumerGroupRemoval() throws Exception
+ {
+ String groupName = "group";
+ String consumerName = "consumer";
+ Consumer consumer = manager.addConsumerToGroupNamed(consumerName, groupName, true, true);
+ String consumerIdentity = consumer.getId();
+
+ Registration reg = manager.addRegistrationTo(consumerName, registrationProperties, expectations, false);
+ String handle = reg.getRegistrationHandle();
+
+ ConsumerGroup group = manager.getConsumerGroup(groupName);
+
+ manager.removeConsumerGroup(group);
+ assertNull(manager.getConsumerByIdentity(consumerIdentity));
+ assertNull(manager.getRegistration(handle));
+ }
+
+ public void testCascadeRemovalOnConsumerRemoval() throws Exception
+ {
+ String consumerName = "consumer";
+ Consumer consumer = manager.createConsumer(consumerName);
+ String consumerIdentity = consumer.getId();
+
+ Registration reg = manager.addRegistrationTo(consumerName, registrationProperties, expectations, false);
+ String handle = reg.getRegistrationHandle();
+
+ manager.removeConsumer(consumer);
+ assertNull(manager.getConsumerByIdentity(consumerIdentity));
+ assertNull(manager.getRegistration(handle));
+ }
+
+ public void testRemoveSingleRegistration() throws Exception
+ {
+ String consumerName = "consumer";
+ Consumer consumer = manager.createConsumer(consumerName);
+
+ Registration reg = manager.addRegistrationTo(consumerName, registrationProperties, expectations, false);
+ String handle = reg.getRegistrationHandle();
+
+ assertTrue(consumer.getRegistrations().contains(reg));
+
+ manager.removeRegistration(handle);
+ assertTrue(!consumer.getRegistrations().contains(reg));
+ assertNull(manager.getRegistration(handle));
+
+ // since the consumer doesn't have any registration anymore, its status should become pending
+ assertEquals(RegistrationStatus.PENDING, consumer.getStatus());
+
+ // shouldn't be possible anymore to retrieve the consumer from the registration handle
+ assertNull(manager.getConsumerFor(handle));
+ }
+
+ public void testRemoveRegistrationOnConsumerWithOtherRegistrations() throws Exception
+ {
+ String consumerName = "consumer";
+ Consumer consumer = manager.createConsumer(consumerName);
+
+ Registration reg = manager.addRegistrationTo(consumerName, registrationProperties, expectations, false);
+ String handle = reg.getRegistrationHandle();
+
+ RegistrationStatus status = consumer.getStatus();
+ manager.removeRegistration(handle);
+
+ // consumer status shouldn't have changed
+ assertEquals(status, consumer.getStatus());
+
+ // Shouldn't be possible to retrieve consumer from handle anymore
+ assertNull(manager.getConsumerFor(handle));
+ }
+
+ public void testAddRegistrationWithInvalidRegistrationProperties() throws Exception
+ {
+ String consumerName = "consumer";
+ Consumer consumer = manager.createConsumer(consumerName);
+
+ registrationProperties.put(new QName("prop3"), "value3");
+ try
+ {
+ manager.addRegistrationTo(consumerName, registrationProperties, expectations, false);
+ fail("Expectations does not contain prop3, so trying to register with a value for it should fail");
+ }
+ catch (RegistrationException e)
+ {
+ assertTrue(e.getMessage().contains("prop3"));
+ assertEquals(0, consumer.getRegistrations().size());
+ }
+ }
+
+ public void testRemoveInexistentRegistration() throws RegistrationException
+ {
+ try
+ {
+ manager.removeRegistration((Registration)null);
+ fail("Should be possible to remove a null registration");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ try
+ {
+ manager.removeRegistration((String)null);
+ fail("Should be possible to remove a registration with a null handle");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ try
+ {
+ manager.removeRegistration("");
+ fail("Should be possible to remove a registration with an empty handle");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ try
+ {
+ manager.removeRegistration("doesn't exist");
+ fail("Should be possible to remove a registration with an invalid handle");
+ }
+ catch (NoSuchRegistrationException expected)
+ {
+ }
+ }
+
+ public void testClear() throws Exception
+ {
+ manager.createConsumer("c1");
+ manager.createConsumer("c2");
+ manager.addConsumerToGroupNamed("c1g1", "g1", true, true);
+ manager.createConsumerGroup("g2");
+ Registration r1 = manager.addRegistrationTo("c1", registrationProperties, expectations, false);
+ Registration r2 = manager.addRegistrationTo("c3", registrationProperties, expectations, true);
+
+ manager.clear();
+ assertTrue(manager.getConsumerGroups().isEmpty());
+ assertTrue(manager.getConsumers().isEmpty());
+ assertNull(manager.getRegistration(r1.getRegistrationHandle()));
+ assertNull(manager.getRegistration(r2.getRegistrationHandle()));
+ }
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationManagerTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationPersistenceManagerTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationPersistenceManagerTestCase.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationPersistenceManagerTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+
+package org.gatein.registration;
+
+import org.gatein.registration.impl.RegistrationPersistenceManagerImpl;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class RegistrationPersistenceManagerTestCase extends AbstractRegistrationPersistenceManagerTestCase
+{
+
+ /** . */
+ private RegistrationPersistenceManager manager;
+
+ public void setUp() throws Exception
+ {
+ manager = new RegistrationPersistenceManagerImpl();
+
+ //
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ //
+ this.manager = null;
+ }
+
+ public RegistrationPersistenceManager getManager()
+ {
+ return manager;
+ }
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationPersistenceManagerTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationTestCase.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,163 @@
+/*
+ * 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.registration;
+
+import junit.framework.TestCase;
+import org.gatein.registration.impl.RegistrationManagerImpl;
+import org.gatein.registration.impl.RegistrationPersistenceManagerImpl;
+import org.gatein.registration.policies.DefaultRegistrationPolicy;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.registration.PropertyDescription;
+import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+
+import javax.xml.namespace.QName;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 11406 $
+ * @since 2.6
+ */
+public class RegistrationTestCase extends TestCase
+{
+ private Registration registration;
+ private Map<QName, Object> registrationProperties;
+
+ protected void setUp() throws Exception
+ {
+ RegistrationManager manager = new RegistrationManagerImpl();
+ RegistrationPolicy policy = new DefaultRegistrationPolicy()
+ {
+ public void validateRegistrationDataFor(Map<QName, Object> registrationProperties, String consumerIdentity, final Map<QName, ? extends PropertyDescription> expectations, final RegistrationManager manager) throws IllegalArgumentException, RegistrationException, DuplicateRegistrationException
+ {
+ // accept any registration data here
+ }
+ };
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+
+ registrationProperties = new HashMap<QName, Object>();
+ QName prop1Name = new QName("prop1");
+ registrationProperties.put(prop1Name, "value1");
+ QName prop2Name = new QName("prop2");
+ registrationProperties.put(prop2Name, "value2");
+
+ Map<QName, RegistrationPropertyDescription> expectations = new HashMap<QName, RegistrationPropertyDescription>();
+ expectations.put(prop1Name, new RegistrationPropertyDescription(prop1Name, WSRPConstants.XSD_STRING));
+ expectations.put(prop2Name, new RegistrationPropertyDescription(prop2Name, WSRPConstants.XSD_STRING));
+
+ registration = manager.addRegistrationTo("name", registrationProperties, expectations, true);
+ }
+
+ public void testGetPropertiesIsUnmodifiable()
+ {
+ Map properties = registration.getProperties();
+
+ try
+ {
+ properties.remove("foo");
+ fail("Properties shouldn't be directly modifiable");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testPropertiesAreClonedNotLive()
+ {
+ QName prop = new QName("prop3");
+ registrationProperties.put(prop, "value3");
+
+ assertNull(registration.getProperties().get(prop));
+ }
+
+ public void testSetNullPropertyValueThrowsIAE()
+ {
+ try
+ {
+ registration.setPropertyValueFor("foo", null);
+ fail("Shouldn't accept null values for properties");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testSetNullPropertyNameThrowsIAE()
+ {
+ try
+ {
+ registration.setPropertyValueFor((QName)null, null);
+ fail("Shouldn't accept null names for properties");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testProperties()
+ {
+ QName name = new QName("prop1");
+ assertEquals("value1", registration.getProperties().get(name));
+ assertEquals("value2", registration.getProperties().get(new QName("prop2")));
+
+ String newValue = "new value";
+ registration.setPropertyValueFor("prop1", newValue);
+ assertEquals(newValue, registration.getProperties().get(name));
+
+ registration.removeProperty(name);
+ assertNull(registration.getPropertyValueFor(name));
+ }
+
+ public void testUpdateProperties()
+ {
+ registrationProperties.remove(new QName("prop1"));
+
+ registration.updateProperties(registrationProperties);
+ assertNull(registration.getPropertyValueFor("prop1"));
+
+ QName name = new QName("prop3");
+ String value = "value3";
+ registrationProperties.put(name, value);
+ registration.updateProperties(registrationProperties);
+ assertEquals(value, registration.getPropertyValueFor(name));
+ }
+
+ public void testHasEqualProperties()
+ {
+ assertTrue(registration.hasEqualProperties(registration));
+
+ assertTrue(registration.hasEqualProperties(registrationProperties));
+
+ registrationProperties.put(new QName("prop3"), "value3");
+ assertTrue(!registration.hasEqualProperties(registrationProperties));
+ }
+
+ public void testClearAssociatedState()
+ {
+ //todo: implement
+ }
+
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/registration/RegistrationTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/config/FileSystemXmlProducerConfigWithReload.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/config/FileSystemXmlProducerConfigWithReload.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/config/FileSystemXmlProducerConfigWithReload.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * 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.config;
+
+import java.io.FileInputStream;
+import java.net.URL;
+import java.util.Enumeration;
+
+import org.gatein.common.net.URLTools;
+import org.gatein.wsrp.producer.config.impl.xml.FileSystemXMLProducerConfigurationService;
+import org.gatein.wsrp.producer.config.impl.xml.SimpleXMLProducerConfigurationService;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class FileSystemXmlProducerConfigWithReload extends SimpleXMLProducerConfigurationService
+{
+
+ // Hack to force the producer to reload when the configuration property is set.
+ // If unused then we will have issues with the producer not being loaded when we try
+ // and get an instance.
+ public void setConfigFile(String configLocation) throws Exception
+ {
+// this.inputStream = new FileInputStream(configLocation);
+// this.reloadConfiguration();
+ Enumeration<URL> resources = Thread.currentThread().getContextClassLoader().getResources(configLocation);
+
+ URL configURL = null;
+ while (resources.hasMoreElements())
+ {
+ configURL = (URL)resources.nextElement();
+ }
+
+ if (configURL == null)
+ {
+ throw new Exception("The config " + configLocation + " does not exist");
+ }
+ if (!URLTools.exists(configURL))
+ {
+ throw new Exception("The config " + configURL + " does not exist");
+ }
+
+ this.inputStream = configURL.openStream();
+ this.reloadConfiguration();
+ }
+
+}
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeGetPortlet.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeGetPortlet.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeGetPortlet.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ApplicationScopeGetPortlet extends GenericPortlet
+{
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, PortletSecurityException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ Writer writer = renderResponse.getWriter();
+ writer.write("appVar=" + renderRequest.getPortletSession().getAttribute("appVar", PortletSession.APPLICATION_SCOPE));
+ }
+}
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeSetPortlet.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeSetPortlet.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ApplicationScopeSetPortlet.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -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.portlet;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletSession;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ApplicationScopeSetPortlet extends GenericPortlet
+{
+ public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, PortletSecurityException, IOException
+ {
+ PortletSession session = actionRequest.getPortletSession();
+ session.setAttribute("appVar", actionRequest.getParameter("appVar"), PortletSession.APPLICATION_SCOPE);
+ }
+}
+
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/BasicPortlet.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/BasicPortlet.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/BasicPortlet.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -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.portlet;
+
+import java.io.IOException;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class BasicPortlet extends GenericPortlet
+{
+
+ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ System.out.println("do view");
+ }
+
+}
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/DispatcherPortlet.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/DispatcherPortlet.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/DispatcherPortlet.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * 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.portlet;
+
+import java.io.IOException;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.com">Boleslaw Dawidowicz</a>
+ * @version $Revision$
+ */
+public class DispatcherPortlet extends GenericPortlet
+{
+ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ System.out.println("## before dispatch");
+ response.setContentType("text/html");
+ PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/index.jsp");
+ rd.include(request, response);
+ System.out.println("## after dispatch");
+ }
+}
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EncodeURLPortlet.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EncodeURLPortlet.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EncodeURLPortlet.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * 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.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class EncodeURLPortlet extends GenericPortlet
+{
+ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ writer.write(response.encodeURL(response.createActionURL().toString()));
+ writer.write("\n");
+ writer.write(response.encodeURL(response.createRenderURL().toString()));
+ }
+}
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/GetLocalesPortlet.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/GetLocalesPortlet.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/GetLocalesPortlet.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -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.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.com">Boleslaw Dawidowicz</a>
+ * @version $Revision$
+ */
+public class GetLocalesPortlet extends GenericPortlet
+{
+
+ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ System.out.println("#GetLocalesPortlet doView()");
+ Locale locale = request.getLocale();
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+ writer.print(locale.getDisplayName());
+ writer.close();
+ }
+
+}
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ImplicitCloningPortlet.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ImplicitCloningPortlet.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ImplicitCloningPortlet.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.portlet;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ImplicitCloningPortlet extends GenericPortlet
+{
+
+ public void processAction(ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ String value = request.getParameter("value");
+ if (value == null)
+ {
+ value = "default";
+ }
+
+ PortletPreferences pp = request.getPreferences();
+ pp.setValue("name", value);
+ pp.store();
+ }
+
+
+ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ PortletPreferences pp = request.getPreferences();
+ String value = pp.getValue("name", "default");
+ response.getWriter().write(value);
+ }
+}
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MarkupPortlet.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MarkupPortlet.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MarkupPortlet.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,114 @@
+/******************************************************************************
+ * 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.portlet;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class MarkupPortlet extends GenericPortlet
+{
+ private final String SYMBOL = "symbol";
+ private final String VALUE = "value";
+ private final String RHAT = "RHAT";
+ private final String AAPL = "AAPL";
+ private final String HELP = "HELP";
+ private final String RHAT_VALUE = "50.50";
+ private final String AAPL_VALUE = "123.45";
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletModeException, IOException
+ {
+ String symbol = req.getParameter(SYMBOL);
+ if (HELP.equalsIgnoreCase(symbol)) // fix-me: should use help mode but will do for now
+ {
+ resp.sendRedirect("/WEB-INF/jsp/help.jsp");
+ return;
+ }
+
+ resp.setRenderParameter(SYMBOL, symbol.toUpperCase());
+ if (RHAT.equalsIgnoreCase(symbol))
+ {
+ resp.setRenderParameter(VALUE, RHAT_VALUE);
+ }
+ else if (AAPL.equalsIgnoreCase(symbol))
+ {
+ resp.setRenderParameter(VALUE, AAPL_VALUE);
+ }
+ else
+ {
+ resp.setRenderParameter(VALUE, "5.55");
+ }
+ resp.setPortletMode(PortletMode.VIEW);
+ }
+
+ protected void doView(RenderRequest request, RenderResponse response) throws IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ writer.write("<p>");
+ writer.write(getSymbol(request));
+ writer.write(" stock value: ");
+ writer.write(getValue(request));
+ writer.write("</p>");
+ }
+
+ private String getValue(RenderRequest request)
+ {
+ String value = request.getParameter(VALUE);
+ return value == null ? "value unset" : value;
+ }
+
+ private String getSymbol(RenderRequest request)
+ {
+ String symbol = request.getParameter(SYMBOL);
+ return symbol == null ? "symbol unset" : symbol;
+ }
+
+ protected void doEdit(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ StringBuffer sb = new StringBuffer(256);
+ sb.append("<form method='post' action='")
+ .append(response.createActionURL())
+ .append("' id='").append(response.getNamespace())
+ .append("portfolioManager'><table><tr><td>Stock symbol</td><td><input name='").append(SYMBOL)
+ .append("'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>");
+
+ writer.write(sb.toString());
+ }
+}
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MultiValuedPortlet.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MultiValuedPortlet.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/MultiValuedPortlet.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,76 @@
+/******************************************************************************
+ * 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.portlet;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com?subject=org.jboss.portal.test.wsrp.portlet.MultiValuedPortlet">Chris
+ * Laprun</a>
+ * @version $Revision$
+ */
+public class MultiValuedPortlet extends GenericPortlet
+{
+ private static final String MULTI = "multi";
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletModeException, IOException
+ {
+ String[] multi = req.getParameterValues(MULTI);
+
+ if (multi != null)
+ {
+ resp.setRenderParameter(MULTI, multi);
+ }
+ resp.setPortletMode(PortletMode.VIEW);
+ }
+
+ protected void doView(RenderRequest request, RenderResponse response) throws IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ writer.write("multi: ");
+ String[] values = request.getParameterValues(MULTI);
+ if (values != null)
+ {
+ StringBuffer sb = new StringBuffer(32);
+ for (int i = 0; i < values.length; i++)
+ {
+ sb.append(values[i]);
+ if (i != values.length - 1)
+ {
+ sb.append(", ");
+ }
+ }
+ writer.write(sb.toString());
+ }
+ }
+}
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/RenderParamPortlet.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/RenderParamPortlet.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/RenderParamPortlet.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,91 @@
+/******************************************************************************
+ * 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.portlet;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class RenderParamPortlet extends GenericPortlet
+{
+ private static final String NAME = "name";
+ private int count = 0;
+ private static final String OP = "op";
+ private static final String INC = "++";
+ private static final String DEC = "--";
+
+ public void processAction(ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ String op = request.getParameter(OP);
+ if (INC.equals(op))
+ {
+ count++;
+ }
+ else if (DEC.equals(op))
+ {
+ count--;
+ }
+ else
+ {
+ throw new PortletException("Unrecognized operation!");
+ }
+ }
+
+ public void render(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+
+ String name = request.getParameter(NAME);
+ if (name == null)
+ {
+ name = "Anonymous";
+ }
+
+ writer.println("Hello, " + name + "!");
+ writer.println("Counter: " + count);
+ PortletURL url = response.createRenderURL();
+ url.setParameter(NAME, "Julien");
+ writer.println("<a href='" + url + "'>My name is Julien</a>");
+ url.setParameter(NAME, "Roy");
+ writer.println("<a href='" + url + "'>My name is Roy</a>");
+ url = response.createActionURL();
+ url.setParameter(OP, INC);
+ writer.println("<a href='" + url + "'>counter++</a>");
+ url.setParameter(OP, DEC);
+ writer.println("<a href='" + url + "'>counter--</a>");
+ }
+}
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourceNoEncodeURLPortlet.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourceNoEncodeURLPortlet.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourceNoEncodeURLPortlet.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ResourceNoEncodeURLPortlet extends GenericPortlet
+{
+ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ writer.write("<img src='" + request.getContextPath() + "/gif/logo.gif'/>");
+ }
+}
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourcePortlet.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourcePortlet.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/ResourcePortlet.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -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.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ResourcePortlet extends GenericPortlet
+{
+ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ writer.write("<img src='" + response.encodeURL(request.getContextPath() + "/gif/logo.gif") + "'/>");
+ }
+}
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/SessionPortlet.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/SessionPortlet.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/SessionPortlet.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,64 @@
+package org.gatein.wsrp.portlet;
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * A simple portlet to test session handling in WSRP.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class SessionPortlet extends GenericPortlet
+{
+ private static final String COUNT = "count";
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ PortletSession session = req.getPortletSession();
+ int count = 0;
+ if (session.getAttribute(COUNT) != null)
+ {
+ count = ((Integer)session.getAttribute(COUNT)).intValue() + 1;
+ }
+ session.setAttribute(COUNT, new Integer(count));
+ writer.write("<p>Session id: " + session.getId() + "</p>");
+ writer.write("<p>count = " + count + "</p>");
+ writer.write("<a href='" + resp.createRenderURL() + "'>render</a>");
+
+ //
+ writer.close();
+ }
+}
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/UserContextPortlet.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/UserContextPortlet.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/UserContextPortlet.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * 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.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class UserContextPortlet extends GenericPortlet
+{
+
+ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ writer.write("user: " + request.getRemoteUser());
+ }
+
+}
+
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -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.producer;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.nio.channels.FileChannel;
+
+import junit.framework.TestCase;
+import org.gatein.common.NotYetImplemented;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 8808 $
+ */
+public abstract class WSRPProducerBaseTest extends TestCase
+{
+ protected WSRPProducerImpl producer = WSRPProducerImpl.getInstance();
+
+ protected WSRPProducerBaseTest(String name) throws Exception
+ {
+ super(name);
+ }
+
+ public void deploy(String warFileName) throws Exception
+ {
+ File archiveDirectory = getDirectory("test.deployables.dir");
+ File deployDirectory = getDirectory("jboss.server.home.dir", "deploy");
+ File archiveFile = getArchive(warFileName, archiveDirectory, true);
+ File deployArchive = getArchive(warFileName, deployDirectory, false);
+
+ FileChannel inputChannel = new FileInputStream(archiveFile).getChannel();
+ FileChannel outputChannel = new FileOutputStream(deployArchive).getChannel();
+
+ inputChannel.transferTo(0, inputChannel.size(), outputChannel);
+
+ Thread.currentThread().sleep(10000);
+ }
+
+ public void undeploy(String warFileName) throws Exception
+ {
+ File deployDirectory = getDirectory("jboss.server.home.dir", "deploy");
+ File archive = getArchive(warFileName, deployDirectory, true);
+
+ archive.delete();
+
+ Thread.currentThread().sleep(10000);
+ }
+
+ private File getDirectory (String property) throws Exception
+ {
+ return getDirectory(property, null);
+ }
+
+ private File getDirectory (String property, String subDirectory) throws Exception
+ {
+ String deployableProperty = System.getProperty(property);
+ if (deployableProperty != null)
+ {
+ if (subDirectory != null)
+ {
+ deployableProperty += File.separator + subDirectory;
+ }
+
+ File deployableDir = new File(deployableProperty);
+ if (deployableDir.exists() && deployableDir.isDirectory())
+ {
+ return deployableDir;
+ }
+ else
+ {
+ throw new Error("Found a system property for \'" + property + "\' [" + deployableProperty + "] but value does not correspond to a directory.");
+ }
+ }
+ else
+ {
+ throw new Error ("Could not find the system property \'" + property + "\' cannot deploy test archives.");
+ }
+ }
+
+
+ private File getArchive(String fileName, File deployDirectory, boolean shouldExist) throws Exception
+ {
+ if (fileName != null && deployDirectory != null && deployDirectory.exists() && deployDirectory.isDirectory())
+ {
+ File archiveFile = new File(deployDirectory.getAbsoluteFile() + File.separator + fileName);
+ return archiveFile;
+// if (archiveFile.exists() && shouldExist)
+// {
+// return archiveFile;
+// }
+// else if (!archiveFile.exists() && !shouldExist)
+// {
+// return archiveFile;
+// }
+// else
+// {
+// //since its not what we are expecting we need to throw the opposite error message
+// String existsString = shouldExist ? "does not exist" : "exists";
+// throw new Exception("Archive " + fileName + " in directory " + deployDirectory + " " + existsString + " which is not expected.");
+// }
+ }
+ else
+ {
+ throw new Exception("Cannot find archive to deploy. Archive name [" + fileName + "] is null or the deploy directory + [" + deployDirectory + "] is not a directory");
+ }
+ }
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/ProducerConfigurationTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/ProducerConfigurationTestCase.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/ProducerConfigurationTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,360 @@
+/*
+ * 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.producer.config;
+
+import junit.framework.TestCase;
+import org.gatein.registration.RegistrationPolicy;
+import org.gatein.registration.policies.DefaultRegistrationPolicy;
+import org.gatein.registration.policies.DefaultRegistrationPropertyValidator;
+import org.gatein.registration.policies.RegistrationPolicyWrapper;
+import org.gatein.registration.policies.RegistrationPropertyValidator;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.producer.config.impl.ProducerConfigurationImpl;
+import org.gatein.wsrp.producer.config.impl.xml.ProducerConfigurationFactory;
+import org.gatein.wsrp.producer.config.impl.xml.ProducerConfigurationProvider;
+import org.gatein.wsrp.registration.LocalizedString;
+import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.ObjectModelProvider;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.XercesXsMarshaller;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.xml.sax.SAXException;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.URL;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 10408 $
+ * @since 2.6
+ */
+public class ProducerConfigurationTestCase extends TestCase
+{
+ private Unmarshaller unmarshaller;
+ private ObjectModelFactory factory;
+
+ private static DefaultSchemaResolver RESOLVER;
+
+ static
+ {
+ RESOLVER = new DefaultSchemaResolver();
+ RESOLVER.setCacheResolvedSchemas(true);
+ RESOLVER.addSchemaLocation("http://www.w3.org/XML/1998/namespace", "xsd/xml.xsd");
+ RESOLVER.addSchemaLocation("urn:jboss:portal:wsrp:producer:v2_7", "xsd/jboss-wsrp-producer_2_7.xsd");
+ }
+
+ protected void setUp() throws Exception
+ {
+ unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ factory = new ProducerConfigurationFactory();
+ unmarshaller.setEntityResolver(new org.gatein.wsrp.producer.config.TestEntityResolver());
+ }
+
+ public void testCustomPolicyUnmarshalling() throws Exception
+ {
+ ProducerConfiguration producerConfiguration = getProducerConfiguration("custom-policy.xml");
+ assertTrue(producerConfiguration.isUsingStrictMode());
+
+ ProducerRegistrationRequirements requirements = producerConfiguration.getRegistrationRequirements();
+ assertNotNull(requirements);
+ RegistrationPolicy policy = requirements.getPolicy();
+
+ // check that the policy is properly wrapped
+ assertTrue(policy instanceof RegistrationPolicyWrapper);
+
+ // and that the delegate is indeed the expected policy
+ RegistrationPolicyWrapper wrapper = (RegistrationPolicyWrapper)policy;
+ assertTrue(wrapper.getDelegate() instanceof TestRegistrationPolicy);
+ }
+
+ public void testExtendedUnmarshalling() throws Exception
+ {
+ ProducerConfiguration producerConfiguration = getProducerConfiguration("extended.xml");
+ assertTrue(producerConfiguration.isUsingStrictMode());
+
+ ProducerRegistrationRequirements requirements = producerConfiguration.getRegistrationRequirements();
+ assertNotNull(requirements);
+ RegistrationPolicy policy = requirements.getPolicy();
+ assertTrue(policy instanceof DefaultRegistrationPolicy);
+ RegistrationPropertyValidator propertyValidator = ((DefaultRegistrationPolicy)policy).getValidator();
+ assertNotNull(propertyValidator);
+ assertTrue(propertyValidator instanceof DefaultRegistrationPropertyValidator);
+ assertTrue(requirements.isRegistrationRequired());
+ assertTrue(requirements.isRegistrationRequiredForFullDescription());
+ Map properties = requirements.getRegistrationProperties();
+ assertNotNull(properties);
+ assertEquals(2, properties.size());
+
+ checkRegistrationProperty(requirements, 1);
+ checkRegistrationProperty(requirements, 2);
+ }
+
+ public void testMinimalRegistrationUnmarshalling() throws Exception
+ {
+ ProducerConfiguration producerConfiguration = getProducerConfiguration("minimal-registration.xml");
+ assertTrue(producerConfiguration.isUsingStrictMode());
+
+ ProducerRegistrationRequirements requirements = producerConfiguration.getRegistrationRequirements();
+ assertNotNull(requirements);
+ assertTrue(requirements.isRegistrationRequired());
+ assertTrue(!requirements.isRegistrationRequiredForFullDescription());
+ Map properties = requirements.getRegistrationProperties();
+ assertNotNull(properties);
+ assertTrue(properties.isEmpty());
+ assertNotNull(requirements.getPolicy());
+ }
+
+ public void testMinimalUnmarshalling() throws Exception
+ {
+ ProducerConfiguration producerConfiguration = getProducerConfiguration("minimal.xml");
+ assertTrue(producerConfiguration.isUsingStrictMode());
+
+ ProducerRegistrationRequirements requirements = producerConfiguration.getRegistrationRequirements();
+ assertNotNull(requirements);
+ assertFalse(requirements.isRegistrationRequired());
+ assertFalse(requirements.isRegistrationRequiredForFullDescription());
+ assertTrue(requirements.getRegistrationProperties().isEmpty());
+ assertNull(requirements.getPolicy());
+ }
+
+ public void testInvalidMultipleRegistrationConfiguration() throws Exception
+ {
+ try
+ {
+ getProducerConfiguration("invalid2.xml");
+ fail("Only one registration-configuration element allowed!");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testInvalidTypeValue() throws Exception
+ {
+ try
+ {
+ getProducerConfiguration("invalid-type.xml");
+ fail("Invalid type for property description should fail.");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testInvalidPropertyValidator()
+ {
+ try
+ {
+ getProducerConfiguration("invalid3.xml");
+ fail("Doesn't make sense to define a property validator if a registration policy other than DefaultRegistrationPolicy");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testInvalidFullServiceDescriptionValue()
+ {
+ try
+ {
+ getProducerConfiguration("invalid1.xml");
+ fail("Invalid value for fullServiceDescriptionRequiresRegistration should have caused failure");
+ }
+ catch (Exception expected)
+ {
+ }
+ }
+
+ public void testUseStrictMode() throws IOException, JBossXBException
+ {
+ ProducerConfiguration producerConfiguration = getProducerConfiguration("strict-mode.xml");
+ assertFalse(producerConfiguration.isUsingStrictMode());
+ }
+
+ public void testChangeListeners() throws IOException, JBossXBException
+ {
+ ProducerConfiguration producerConfiguration = getProducerConfiguration("minimal.xml");
+ assertTrue(producerConfiguration.isUsingStrictMode());
+
+ TestProducerConfigurationChangeListener listener = new TestProducerConfigurationChangeListener();
+ producerConfiguration.addChangeListener(listener);
+ assertFalse(listener.called);
+
+ // we're not changing the value, the listeners shouldn't be called
+ producerConfiguration.setUsingStrictMode(true);
+ assertFalse(listener.called);
+
+ producerConfiguration.setUsingStrictMode(false);
+ assertFalse(producerConfiguration.isUsingStrictMode());
+ assertTrue(listener.called);
+ }
+
+ public void testSaveAndReload() throws IOException, ParserConfigurationException, SAXException, JBossXBException
+ {
+ ProducerConfiguration configuration = new ProducerConfigurationImpl();
+ configuration.setUsingStrictMode(false);
+ ProducerRegistrationRequirements registrationRequirements = configuration.getRegistrationRequirements();
+ registrationRequirements.setRegistrationRequiredForFullDescription(true);
+ registrationRequirements.setRegistrationRequired(true);
+ String prop1 = "prop1";
+ registrationRequirements.addEmptyRegistrationProperty(prop1);
+ registrationRequirements.getRegistrationPropertyWith(prop1).setDefaultLabel("label1");
+ String prop2 = "prop2";
+ registrationRequirements.addEmptyRegistrationProperty(prop2);
+ registrationRequirements.getRegistrationPropertyWith(prop2).setDefaultHint("hint2");
+ String prop3 = "prop3";
+ registrationRequirements.addEmptyRegistrationProperty(prop3);
+ registrationRequirements.getRegistrationPropertyWith(prop3).setDefaultDescription("description3");
+ String prop4 = "prop4";
+ registrationRequirements.addEmptyRegistrationProperty(prop4);
+ RegistrationPropertyDescription propDesc4 = registrationRequirements.getRegistrationPropertyWith(prop4);
+ propDesc4.setDefaultLabel("label4");
+ propDesc4.setDefaultHint("hint4");
+ propDesc4.setDefaultDescription("description4");
+
+ File tmp = File.createTempFile("producer-configuration-test-case", "xml");
+ tmp.deleteOnExit();
+
+ writeConfigToFile(configuration, tmp);
+
+ configuration = getProducerConfiguration(tmp.toURL());
+
+ assertFalse(configuration.isUsingStrictMode());
+
+ registrationRequirements = configuration.getRegistrationRequirements();
+ assertTrue(registrationRequirements.isRegistrationRequired());
+ assertTrue(registrationRequirements.isRegistrationRequiredForFullDescription());
+
+ assertEquals(4, registrationRequirements.getRegistrationProperties().size());
+ assertEquals("label1", registrationRequirements.getRegistrationPropertyWith(prop1).getLabel().getValue());
+ assertEquals("hint2", registrationRequirements.getRegistrationPropertyWith(prop2).getHint().getValue());
+ assertEquals("description3", registrationRequirements.getRegistrationPropertyWith(prop3).getDescription().getValue());
+ propDesc4 = registrationRequirements.getRegistrationPropertyWith(prop4);
+ assertEquals("label4", propDesc4.getLabel().getValue());
+ assertEquals("hint4", propDesc4.getHint().getValue());
+ assertEquals("description4", propDesc4.getDescription().getValue());
+ }
+
+ private void writeConfigToFile(ProducerConfiguration configuration, File file)
+ throws IOException, ParserConfigurationException, SAXException
+ {
+ StringWriter xmlOutput = new StringWriter();
+
+ // get the XML Schema source
+ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("xsd/jboss-wsrp-producer_2_7.xsd");
+
+ Reader xsReader = new InputStreamReader(is);
+
+ // create an instance of XML Schema marshaller
+ XercesXsMarshaller marshaller = new XercesXsMarshaller();
+
+ marshaller.setSchemaResolver(RESOLVER);
+
+ // we need to specify what elements are top most (roots) providing namespace URI, prefix and local name
+ marshaller.addRootElement("urn:jboss:portal:wsrp:producer:v2_7", "", "producer-configuration");
+
+ // declare default namespace
+ marshaller.declareNamespace("wpc", "urn:jboss:portal:wsrp:producer:v2_7");
+
+ // add schema location by declaring xsi namespace and adding xsi:schemaLocation attribute
+ marshaller.declareNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
+ marshaller.addAttribute("xsi", "schemaLocation", "string",
+ "urn:jboss:portal:wsrp:producer:v2_7 http://www.jboss.org/portal/xsd/jboss-wsrp-producer_2_7.xsd");
+
+ // create an instance of Object Model Provider
+ ObjectModelProvider provider = new ProducerConfigurationProvider();
+
+ marshaller.setProperty("org.jboss.xml.binding.marshalling.indent", "true");
+ marshaller.marshal(xsReader, provider, configuration, xmlOutput);
+
+ // close XML Schema reader
+ xsReader.close();
+
+ file.createNewFile();
+ Writer configFile = new BufferedWriter(new FileWriter(file));
+ configFile.write(xmlOutput.toString());
+ configFile.flush();
+ configFile.close();
+ }
+
+ private ProducerConfiguration getProducerConfiguration(String fileName) throws JBossXBException, IOException
+ {
+ URL location = Thread.currentThread().getContextClassLoader().getResource(fileName);
+ assertNotNull(location);
+ System.out.println("location = " + location);
+
+ return getProducerConfiguration(location);
+ }
+
+ private ProducerConfiguration getProducerConfiguration(URL location) throws JBossXBException, IOException
+ {
+ Object o = unmarshaller.unmarshal(location.openStream(), factory, null);
+ assertNotNull(o);
+ assertTrue(o instanceof ProducerConfiguration);
+ return (ProducerConfiguration)o;
+ }
+
+ private void checkRegistrationProperty(ProducerRegistrationRequirements requirements, int index)
+ {
+ RegistrationPropertyDescription desc = requirements.getRegistrationPropertyWith("name" + index);
+ assertNotNull(desc);
+ assertEquals(new QName("name" + index), desc.getName());
+ assertEquals(WSRPConstants.XSD_STRING, desc.getType());
+
+ LocalizedString localizedString = new LocalizedString("hint" + index, Locale.ENGLISH);
+ localizedString.setResourceName("resource.hint" + index);
+ localizedString.setValue("hint" + index);
+ assertEquals(localizedString, desc.getHint());
+
+ localizedString = new LocalizedString("label" + index, Locale.ENGLISH);
+ localizedString.setResourceName("resource.label" + index);
+ localizedString.setValue("label" + index);
+ assertEquals(localizedString, desc.getLabel());
+ }
+
+ private static class TestProducerConfigurationChangeListener implements ProducerConfigurationChangeListener
+ {
+ boolean called = false;
+
+ public void usingStrictModeChangedTo(boolean strictMode)
+ {
+ called = true;
+ }
+ }
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/ProducerConfigurationTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestEntityResolver.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestEntityResolver.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestEntityResolver.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,66 @@
+/*
+* 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.
+*/
+
+package org.gatein.wsrp.producer.config;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.6
+ */
+public class TestEntityResolver implements EntityResolver
+{
+ private static final String CONSUMER = "-//JBoss Portal//DTD WSRP Remote Producer Configuration 2.6//EN";
+ private static final String PRODUCER = "-//JBoss Portal//DTD WSRP Local Producer Configuration 2.6//EN";
+
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
+ {
+ String dtd;
+ if (PRODUCER.equals(publicId))
+ {
+ dtd = "jboss-wsrp-producer_2_6.dtd";
+ }
+ else if (CONSUMER.equals(publicId))
+ {
+ dtd = "jboss-wsrp-consumer_2_6.dtd";
+ }
+ else
+ {
+ return null;
+ }
+
+ InputStream dtdStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(dtd);
+ if (dtdStream != null)
+ {
+ return new InputSource(dtdStream);
+ }
+
+ return null;
+ }
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestEntityResolver.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestRegistrationPolicy.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestRegistrationPolicy.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestRegistrationPolicy.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,69 @@
+/*
+ * 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.producer.config;
+
+import org.gatein.registration.InvalidConsumerDataException;
+import org.gatein.registration.RegistrationException;
+import org.gatein.registration.RegistrationManager;
+import org.gatein.registration.RegistrationPolicy;
+import org.gatein.wsrp.registration.PropertyDescription;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 11406 $
+ * @since 2.6
+ */
+public class TestRegistrationPolicy implements RegistrationPolicy
+{
+ public void validateRegistrationDataFor(Map<QName, Object> registrationProperties, String consumerIdentity, final Map<QName, ? extends PropertyDescription> expectations, final RegistrationManager manager) throws IllegalArgumentException, RegistrationException
+ {
+ }
+
+ public String createRegistrationHandleFor(String registrationId) throws IllegalArgumentException
+ {
+ return null;
+ }
+
+ public String getAutomaticGroupNameFor(String consumerName) throws IllegalArgumentException
+ {
+ return null;
+ }
+
+ public String getConsumerIdFrom(String consumerName, Map<QName, Object> registrationProperties) throws IllegalArgumentException, InvalidConsumerDataException
+ {
+ return null;
+ }
+
+ public void validateConsumerName(String consumerName, final RegistrationManager manager) throws IllegalArgumentException, RegistrationException
+ {
+ }
+
+ public void validateConsumerGroupName(String groupName, RegistrationManager manager) throws IllegalArgumentException, RegistrationException
+ {
+ }
+
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/config/TestRegistrationPolicy.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,844 @@
+/******************************************************************************
+ * 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.wsrp.WSRPActionURL;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.WSRPPortletURL;
+import org.gatein.wsrp.WSRPRenderURL;
+import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
+import org.gatein.wsrp.servlet.ServletAccess;
+import org.gatein.wsrp.test.ExtendedAssert;
+import org.gatein.wsrp.test.support.MockHttpServletRequest;
+import org.gatein.wsrp.test.support.MockHttpServletResponse;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.oasis.wsrp.v1.V1BlockingInteractionResponse;
+import org.oasis.wsrp.v1.V1CacheControl;
+import org.oasis.wsrp.v1.V1GetMarkup;
+import org.oasis.wsrp.v1.V1InitCookie;
+import org.oasis.wsrp.v1.V1InteractionParams;
+import org.oasis.wsrp.v1.V1InvalidRegistration;
+import org.oasis.wsrp.v1.V1MarkupContext;
+import org.oasis.wsrp.v1.V1MarkupResponse;
+import org.oasis.wsrp.v1.V1NamedString;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1PerformBlockingInteraction;
+import org.oasis.wsrp.v1.V1PortletContext;
+import org.oasis.wsrp.v1.V1RuntimeContext;
+import org.oasis.wsrp.v1.V1SessionContext;
+import org.oasis.wsrp.v1.V1StateChange;
+import org.oasis.wsrp.v1.V1UnsupportedMode;
+import org.oasis.wsrp.v1.V1UpdateResponse;
+
+import java.rmi.RemoteException;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 13149 $
+ * @since 2.4
+ */
+
+(a)RunWith(Arquillian.class)
+public class MarkupTestCase extends NeedPortletHandleTest
+{
+ private static final String DEFAULT_VIEW_MARKUP = "<p>symbol unset stock value: value unset</p>";
+ private static final String DEFAULT_MARKUP_PORTLET_WAR = "test-markup-portlet.war";
+
+ public MarkupTestCase()
+ throws Exception
+ {
+ super("MarkupTestCase", DEFAULT_MARKUP_PORTLET_WAR);
+ }
+
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ return ShrinkWrap.create("test.jar", JavaArchive.class);
+ }
+
+ @Before
+ public void setUp() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.setUp();
+ //hack to get around having to have a httpservletrequest when accessing the producer services
+ //I don't know why its really needed, seems to be a dependency where wsrp connects with the pc module
+ ServletAccess.setRequestAndResponse(MockHttpServletRequest.createMockRequest(null), MockHttpServletResponse.createMockResponse());
+ }
+ }
+
+
+ @After
+ public void tearDown() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.tearDown();
+ }
+ }
+
+ @Test
+ public void testGetMarkupViewNoSession() throws Exception
+ {
+ V1GetMarkup getMarkup = createMarkupRequest();
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+
+ checkMarkupResponse(response, DEFAULT_VIEW_MARKUP);
+ }
+
+ @Test
+ public void testInvalidGetMarkup() throws Exception
+ {
+ V1GetMarkup getMarkup = createMarkupRequest();
+ getMarkup.getMarkupParams().setMode("invalid mode");
+
+ try
+ {
+ producer.getMarkup(getMarkup);
+ ExtendedAssert.fail();
+ }
+ catch (V1UnsupportedMode unsupportedMode)
+ {
+ // expected
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithSessionID() throws Exception
+ {
+ // The consumer should never have access to or be able to set a sessionID. Sessions are handled by the Producer using cookies.
+ V1GetMarkup getMarkup = createMarkupRequest();
+ getMarkup.getRuntimeContext().setSessionID("Hello World");
+
+ try
+ {
+ producer.getMarkup(getMarkup);
+ ExtendedAssert.fail("A sessionID should not be allowed to be passed in GetMarkup()");
+ }
+ catch (V1OperationFailed operationFailed)
+ {
+ // expected
+ }
+ }
+
+ @Test
+ public void testGetMarkupEditNoSession() throws Exception
+ {
+ V1GetMarkup getMarkup = createMarkupRequest();
+ getMarkup.getMarkupParams().setMode(WSRPConstants.EDIT_MODE);
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+
+ checkMarkupResponse(response, "<form method='post' action='wsrp_rewrite?wsrp-urlType=blockingAction&wsrp" +
+ "-interactionState=JBPNS_/wsrp_rewrite' id='wsrp_rewrite_portfolioManager'><table><tr><td>Stock symbol</t" +
+ "d><td><input name='symbol'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>");
+ }
+
+ @Test
+ public void testGetMarkupRenderParameters() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String archiveName = "test-renderparam-portlet.war";
+ deploy(archiveName);
+
+ try
+ {
+ V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
+ V1MarkupResponse res = producer.getMarkup(gm);
+
+ String markupString = res.getMarkupContext().getMarkupString();
+
+ String julienLink = extractLink(markupString, 0);
+ WSRPPortletURL julienURL = WSRPPortletURL.create(julienLink);
+
+ ExtendedAssert.assertString1ContainsString2(markupString, "Hello, Anonymous!");
+ ExtendedAssert.assertString1ContainsString2(markupString, "Counter: 0");
+
+ ExtendedAssert.assertTrue(julienURL instanceof WSRPRenderURL);
+ WSRPRenderURL julienRender = (WSRPRenderURL)julienURL;
+
+ // We're now trying to get a hello for Julien ;)
+ gm.getMarkupParams().setNavigationalState(julienRender.getNavigationalState().getStringValue());
+ res = producer.getMarkup(gm);
+ markupString = res.getMarkupContext().getMarkupString();
+ ExtendedAssert.assertString1ContainsString2(markupString, "Hello, Julien!");
+
+ // julien.length() * 2 to bypass second link
+ WSRPPortletURL incrementURL = WSRPPortletURL.create(extractLink(markupString, julienLink.length() * 2));
+ ExtendedAssert.assertTrue(incrementURL instanceof WSRPActionURL);
+ WSRPActionURL incrementAction = (WSRPActionURL)incrementURL;
+
+ // let's see now if we can increment the counter
+ V1PerformBlockingInteraction performBlockingInteraction =
+ WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ V1InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
+ interactionParams.setInteractionState(incrementAction.getInteractionState().getStringValue());
+ producer.performBlockingInteraction(performBlockingInteraction);
+ res = producer.getMarkup(gm);
+ markupString = res.getMarkupContext().getMarkupString();
+ ExtendedAssert.assertString1ContainsString2(markupString, "Counter: 1");
+ }
+ finally
+ {
+ undeploy(archiveName);
+ }
+ }
+
+ private String extractLink(String markupString, int fromIndex)
+ {
+ int urlStartIndex = markupString.indexOf("='", fromIndex);
+ int urlEndIndex = markupString.indexOf("'>", urlStartIndex);
+ return markupString.substring(urlStartIndex + 2, urlEndIndex);
+ }
+
+ // fix-me: add more tests
+ @Test
+ public void testGetMarkupSession() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ // deploy session-manipulating portlet
+ String sessionPortletArchive = "test-session-portlet.war";
+ deploy(sessionPortletArchive);
+
+
+ try
+ {
+ V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+
+ checkMarkupResponseWithSession(response, 0);
+
+ response = producer.getMarkup(getMarkup);
+ checkMarkupResponseWithSession(response, 1);
+
+ // fix-me: try to reuse the old session id: what should happen?
+// runtimeContext.setSessionID(sessionID);
+// getMarkup.setRuntimeContext(runtimeContext);
+// try
+// {
+// producer.getMarkup(getMarkup);
+// fail("The session should be invalid...");
+// }
+// catch (InvalidSessionFault expected)
+// {
+// }
+ }
+ finally
+ {
+ // reset state
+ undeploy(sessionPortletArchive);
+ }
+ }
+
+ @Test
+ public void testPerformBlockingInteractionNoRedirect() throws Exception
+ {
+ checkPBIAndGetNavigationalState("RHAT");
+ }
+
+ @Test
+ public void testPerformBlockingInteractionRedirect() throws Exception
+ {
+ V1PerformBlockingInteraction performBlockingInteraction =
+ WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
+ V1InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
+
+ // crappy way but this is a test! ;)
+ V1NamedString namedString = new V1NamedString();
+ namedString.setName("symbol");
+ namedString.setValue("HELP");
+ interactionParams.getFormParameters().add(namedString);
+
+ V1BlockingInteractionResponse response = producer.performBlockingInteraction(performBlockingInteraction);
+ ExtendedAssert.assertNotNull(response);
+
+ // this is a redirect...
+ String redirectURL = response.getRedirectURL();
+ ExtendedAssert.assertNotNull(redirectURL);
+ ExtendedAssert.assertEquals("/WEB-INF/jsp/help.jsp", redirectURL); // fix-me: handle URL re-writing
+
+ // no update response
+ V1UpdateResponse updateResponse = response.getUpdateResponse();
+ ExtendedAssert.assertNull(updateResponse);
+ }
+
+ @Test
+ public void testGMAndPBIInteraction() throws Exception
+ {
+ testGetMarkupViewNoSession();
+ String symbol = "AAPL";
+ String navigationalState = checkPBIAndGetNavigationalState(symbol);
+
+ V1GetMarkup getMarkup = createMarkupRequest();
+ getMarkup.getMarkupParams().setNavigationalState(navigationalState);
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, "<p>" + symbol + " stock value: 123.45</p>");
+ }
+
+ @Test
+ public void testPBIWithSessionID() throws Exception
+ {
+ String portletHandle = getDefaultHandle();
+ V1PerformBlockingInteraction performBlockingInteraction = WSRP1TypeFactory.createDefaultPerformBlockingInteraction(portletHandle);
+
+ V1RuntimeContext runtimeContext = performBlockingInteraction.getRuntimeContext();
+ //the sessionID should never be set by the consumer. Sessions are handled by cookies instead
+ runtimeContext.setSessionID("Hello World");
+
+ try
+ {
+ producer.performBlockingInteraction(performBlockingInteraction);
+ ExtendedAssert.fail("Should not be able to pass a sessionID in a PerformBlockingInteraction()");
+ }
+ catch (V1OperationFailed expected)
+ {
+ // expected
+ }
+ }
+
+ @Test
+ public void testMarkupCaching() throws Exception
+ {
+ V1GetMarkup getMarkup = createMarkupRequest();
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+
+ V1CacheControl cacheControl = response.getMarkupContext().getCacheControl();
+ ExtendedAssert.assertNotNull(cacheControl);
+ ExtendedAssert.assertEquals(WSRPConstants.CACHE_PER_USER, cacheControl.getUserScope());
+ ExtendedAssert.assertEquals(15, cacheControl.getExpires());
+
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String sessionPortletArchive = "test-session-portlet.war";
+ deploy(sessionPortletArchive);
+
+ response = producer.getMarkup(createMarkupRequestForCurrentlyDeployedPortlet());
+
+ cacheControl = response.getMarkupContext().getCacheControl();
+ ExtendedAssert.assertNull(cacheControl);
+
+ undeploy(sessionPortletArchive);
+ }
+
+ @Test
+ public void testGetMarkupWithDispatcherPortlet() throws Exception
+ {
+
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String dispatcherPortletArchive = "test-dispatcher-portlet.war";
+ deploy(dispatcherPortletArchive);
+
+ try
+ {
+ V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, "test");
+ }
+ finally
+ {
+ undeploy(dispatcherPortletArchive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithNoContent() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String basicPortletArchive = "test-basic-portlet.war";
+ deploy(basicPortletArchive);
+
+ try
+ {
+ V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, "");
+ }
+ finally
+ {
+ undeploy(basicPortletArchive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithNonStandardLocalesStrictMode() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String getLocalesPortletArchive = "test-getlocales-portlet.war";
+ deploy(getLocalesPortletArchive);
+
+ V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
+ getMarkup.getMarkupParams().getLocales().add("en_US");
+
+ try
+ {
+ producer.getMarkup(getMarkup);
+ //fail("Should have trown an UnsupportetLocaleFault"); // ideally cf http://jira.jboss.com/jira/browse/JBPORTAL-857
+ ExtendedAssert.fail("Should have trown an exception"); // right now
+ }
+ catch (Exception expected)
+ {
+ // expected
+ }
+ finally
+ {
+ // checkMarkupResponse(response, "GetLocalesPortlet"); // should we return try to generate markup regardless?
+ undeploy(getLocalesPortletArchive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithNonStandardLocalesLenientMode() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String getLocalesPortletArchive = "test-getlocales-portlet.war";
+ deploy(getLocalesPortletArchive);
+
+ V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
+ getMarkup.getMarkupParams().getLocales().add("en_US");
+
+ // Use the lenient mode
+ producer.usingStrictModeChangedTo(false);
+
+ // markup should be properly generated
+ checkMarkupResponse(producer.getMarkup(getMarkup), "English (United States)");
+ undeploy(getLocalesPortletArchive);
+ }
+
+ @Test
+ public void testGetMarkupWithoutDeclaredLocale() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String getLocalesPortletArchive = "test-getlocales-portlet.war";
+ deploy(getLocalesPortletArchive);
+
+ V1GetMarkup getMarkup = createMarkupRequest(getPortletHandleFrom("No Declared"));
+
+ try
+ {
+ checkMarkupResponse(producer.getMarkup(getMarkup), Locale.getDefault().getDisplayName());
+ }
+ finally
+ {
+ undeploy(getLocalesPortletArchive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupLocales() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String getLocalesPortletArchive = "test-getlocales-portlet.war";
+ deploy(getLocalesPortletArchive);
+
+ V1GetMarkup getMarkup = createMarkupRequest(getPortletHandleFrom("Simple"));
+
+ try
+ {
+ List<String> locales = getMarkup.getMarkupParams().getLocales();
+ locales.add("en");
+ locales.add("fr");
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, Locale.ENGLISH.getDisplayName());
+
+ locales.clear();
+ locales.add("fr");
+ locales.add("en");
+ response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, Locale.FRENCH.getDisplayName());
+
+ locales.clear();
+ locales.add("de");
+ locales.add("en");
+ response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, Locale.ENGLISH.getDisplayName());
+ }
+ finally
+ {
+ undeploy(getLocalesPortletArchive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithEncodedURLs() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String encodeURLPortletArchive = "test-encodeurl-portlet.war";
+ deploy(encodeURLPortletArchive);
+
+ try
+ {
+ V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, "wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-interactionState=JBPNS_/wsrp_rewrite\n" +
+ "wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewrite");
+ }
+ finally
+ {
+ undeploy(encodeURLPortletArchive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithUserContext() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String userContextPortletArchive = "test-usercontext-portlet.war";
+ deploy(userContextPortletArchive);
+
+ try
+ {
+ V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet();
+ getMarkup.setUserContext(WSRP1TypeFactory.createUserContext("johndoe"));
+
+ V1MarkupResponse response = producer.getMarkup(getMarkup);
+ checkMarkupResponse(response, "user: johndoe");
+ }
+ finally
+ {
+ undeploy(userContextPortletArchive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupMultiValuedFormParams() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String multiValuedPortletArchive = "test-multivalued-portlet.war";
+ deploy(multiValuedPortletArchive);
+
+ V1NamedString namedString = createNamedString("multi", "value1");
+ try
+ {
+ V1PerformBlockingInteraction action =
+ WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ List<V1NamedString> formParameters = action.getInteractionParams().getFormParameters();
+ formParameters.add(namedString);
+ V1BlockingInteractionResponse actionResponse = producer.performBlockingInteraction(action);
+ V1GetMarkup markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
+ markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
+ V1MarkupResponse response = producer.getMarkup(markupRequest);
+ checkMarkupResponse(response, "multi: value1");
+
+ formParameters.clear();
+ formParameters.add(namedString);
+ formParameters.add(createNamedString("multi", "value2"));
+ actionResponse = producer.performBlockingInteraction(action);
+ markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
+ markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
+ response = producer.getMarkup(markupRequest);
+ checkMarkupResponse(response, "multi: value1, value2");
+
+ formParameters.clear();
+ formParameters.add(new V1NamedString());
+ actionResponse = producer.performBlockingInteraction(action);
+ markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
+ markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
+ response = producer.getMarkup(markupRequest);
+ checkMarkupResponse(response, "multi: ");
+ }
+ finally
+ {
+ undeploy(multiValuedPortletArchive);
+ }
+ }
+
+ @Test
+ public void testImplicitCloning() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String archiveName = "test-implicitcloning-portlet.war";
+ deploy(archiveName);
+
+ try
+ {
+ // check the initial value
+ V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
+ V1MarkupResponse res = producer.getMarkup(gm);
+ String markupString = res.getMarkupContext().getMarkupString();
+ ExtendedAssert.assertEquals("initial", markupString);
+
+ // modify the preference value
+ V1PerformBlockingInteraction pbi = WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ pbi.getInteractionParams().setPortletStateChange(V1StateChange.CLONE_BEFORE_WRITE); // request cloning if needed
+ String value = "new value";
+ pbi.getInteractionParams().getFormParameters().add(createNamedString("value", value));
+ V1BlockingInteractionResponse response = producer.performBlockingInteraction(pbi);
+ ExtendedAssert.assertNotNull(response);
+
+ // check that we got a new portlet context
+ V1PortletContext pc = response.getUpdateResponse().getPortletContext();
+ ExtendedAssert.assertNotNull(pc);
+
+ // get the markup again and check that we still get the initial value with the initial portlet context
+ res = producer.getMarkup(gm);
+ markupString = res.getMarkupContext().getMarkupString();
+ ExtendedAssert.assertEquals("initial", markupString);
+
+ // retrieving the markup with the new portlet context should return the new value
+ gm.setPortletContext(pc);
+ res = producer.getMarkup(gm);
+ markupString = res.getMarkupContext().getMarkupString();
+ ExtendedAssert.assertEquals(value, markupString);
+ }
+ finally
+ {
+ undeploy(archiveName);
+ }
+ }
+
+ private V1NamedString createNamedString(String name, String value)
+ {
+ V1NamedString namedString = new V1NamedString();
+ namedString.setName(name);
+ namedString.setValue(value);
+ return namedString;
+ }
+
+ @Test
+ public void testGetMarkupWithResource() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String archive = "test-resource-portlet.war";
+ deploy(archive);
+
+ try
+ {
+ V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
+ V1MarkupResponse res = producer.getMarkup(gm);
+ String markupString = res.getMarkupContext().getMarkupString();
+
+ // accept either localhost or 127.0.0.1 for the host part of the generated markup
+ String markupStart = "<img src='wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2F";
+ String markupEnd = "%3A8080%2Ftest-resource-portlet%2Fgif%2Flogo.gif&wsrp-requiresRewrite=true/wsrp_rewrite'/>";
+ String localhostMarkup = markupStart + "localhost" + markupEnd;
+ String homeIPMarkup = markupStart + "127.0.0.1" + markupEnd;
+ boolean result = localhostMarkup.equals(markupString) || homeIPMarkup.equals(markupString);
+ ExtendedAssert.assertTrue(result);
+ }
+ finally
+ {
+ undeploy(archive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupWithNonURLEncodedResource() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String archive = "test-resourcenoencodeurl-portlet.war";
+ deploy(archive);
+
+ try
+ {
+ V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
+ V1MarkupResponse res = producer.getMarkup(gm);
+ String markupString = res.getMarkupContext().getMarkupString();
+
+ // accept either localhost or 127.0.0.1 for the host part of the generated markup
+ String markupStart = "<img src='http://";
+ String markupEnd = ":8080/test-resourcenoencodeurl-portlet/gif/logo.gif'/>";
+ String localhostMarkup = markupStart + "localhost" + markupEnd;
+ String homeIPMarkup = markupStart + "127.0.0.1" + markupEnd;
+ boolean result = localhostMarkup.equals(markupString) || homeIPMarkup.equals(markupString);
+ ExtendedAssert.assertTrue(result);
+ }
+ finally
+ {
+ undeploy(archive);
+ }
+ }
+
+ @Test
+ public void testApplicationScopeVariableHandling() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String archive = "test-applicationscope-portlet.war";
+ deploy(archive);
+
+ try
+ {
+ // set appVar to value in the application scope by the first portlet
+ V1PerformBlockingInteraction pbi = WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getPortletHandleFrom("Set"));
+ pbi.getInteractionParams().getFormParameters().add(createNamedString("appVar", "value"));
+ producer.performBlockingInteraction(pbi);
+
+ // the second portlet reads the appVar value and outputs it
+ V1GetMarkup gm = createMarkupRequest(getPortletHandleFrom("Get"));
+ V1MarkupResponse res = producer.getMarkup(gm);
+ checkMarkupResponse(res, "appVar=value");
+ }
+ finally
+ {
+ undeploy(archive);
+ }
+ }
+
+ @Test
+ public void testGetMarkupNoRegistrationWhenRegistrationRequired() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ V1GetMarkup gm = createMarkupRequest();
+ try
+ {
+ producer.getMarkup(gm);
+ ExtendedAssert.fail("Should have thrown InvalidRegistration!");
+ }
+ catch (V1InvalidRegistration invalidRegistration)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testPerformBlockingInteractionNoRegistrationWhenRegistrationRequired() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ V1PerformBlockingInteraction pbi = WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ try
+ {
+ producer.performBlockingInteraction(pbi);
+ ExtendedAssert.fail("Should have thrown InvalidRegistration!");
+ }
+ catch (V1InvalidRegistration invalidRegistration)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testInitCookieNoRegistrationWhenRegistrationRequired() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ V1InitCookie initCookie = WSRP1TypeFactory.createInitCookie(null);
+ try
+ {
+ producer.initCookie(initCookie);
+ ExtendedAssert.fail("Should have thrown InvalidRegistration!");
+ }
+ catch (V1InvalidRegistration invalidRegistration)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ private String checkPBIAndGetNavigationalState(String symbol) throws Exception
+ {
+ V1PerformBlockingInteraction performBlockingInteraction =
+ WSRP1TypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
+ V1InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
+ interactionParams.getFormParameters().add(createNamedString("symbol", symbol));
+
+ V1BlockingInteractionResponse response = producer.performBlockingInteraction(performBlockingInteraction);
+ ExtendedAssert.assertNotNull(response);
+
+ // this is not a redirect...
+ ExtendedAssert.assertNull(response.getRedirectURL());
+
+ // check update response
+ V1UpdateResponse updateResponse = response.getUpdateResponse();
+ ExtendedAssert.assertNotNull(updateResponse);
+ // request was readOnly so no updated portlet context
+ ExtendedAssert.assertNull(updateResponse.getPortletContext());
+ // check that no sessionId is getting passed.
+ ExtendedAssert.assertNull(updateResponse.getSessionContext());
+
+ String navigationalState = updateResponse.getNavigationalState();
+ ExtendedAssert.assertNotNull(navigationalState);
+ ExtendedAssert.assertEquals(updateResponse.getNewMode(), WSRPConstants.VIEW_MODE);
+ V1MarkupContext markupContext = updateResponse.getMarkupContext();
+ ExtendedAssert.assertNull(markupContext); // we don't return markup for now
+
+ return navigationalState;
+ }
+
+ private void checkMarkupResponseWithSession(V1MarkupResponse response, int count) throws RemoteException, V1InvalidRegistration, V1OperationFailed
+ {
+ ExtendedAssert.assertNotNull(response);
+
+ // Markup context
+ V1MarkupContext markupContext = response.getMarkupContext();
+ ExtendedAssert.assertNotNull(markupContext);
+ String markupString = markupContext.getMarkupString();
+ ExtendedAssert.assertString1ContainsString2(markupString, "count = " + count);
+ ExtendedAssert.assertString1ContainsString2(markupString, "<a href='wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewrite'>render</a>");
+
+ // checking session
+ checkSessionForCurrentlyDeployedPortlet(response);
+ }
+
+ private V1MarkupContext checkMarkupResponse(V1MarkupResponse response, String markupString)
+ {
+ ExtendedAssert.assertNotNull(response);
+
+ // Markup context
+ V1MarkupContext markupContext = response.getMarkupContext();
+ ExtendedAssert.assertNotNull(markupContext);
+ ExtendedAssert.assertEquals("text/html", markupContext.getMimeType());
+ ExtendedAssert.assertEquals("title", markupContext.getPreferredTitle());
+ ExtendedAssert.assertTrue(markupContext.isRequiresUrlRewriting());
+ ExtendedAssert.assertEquals(markupString, markupContext.getMarkupString());
+
+ // Session context
+ V1SessionContext sessionContext = response.getSessionContext();
+ // The session information is should never be sent to the consumer, Cookies are used instead.
+ ExtendedAssert.assertNull(sessionContext);
+
+ return markupContext;
+ }
+
+ protected String getMostUsedPortletWARFileName()
+ {
+ return DEFAULT_MARKUP_PORTLET_WAR;
+ }
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/NeedPortletHandleTest.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/NeedPortletHandleTest.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/NeedPortletHandleTest.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,248 @@
+/*
+ * 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.wsrp.WSRPConstants;
+import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
+import org.oasis.wsrp.v1.V1GetMarkup;
+import org.oasis.wsrp.v1.V1GetServiceDescription;
+import org.oasis.wsrp.v1.V1InvalidRegistration;
+import org.oasis.wsrp.v1.V1InvalidRegistrationFault;
+import org.oasis.wsrp.v1.V1MarkupResponse;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1OperationFailedFault;
+import org.oasis.wsrp.v1.V1PortletDescription;
+import org.oasis.wsrp.v1.V1ServiceDescription;
+
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 11547 $
+ * @since 2.4
+ */
+public abstract class NeedPortletHandleTest extends V1ProducerBaseTest
+{
+ private String mostUsedPortletWARFileName;
+ private String currentlyDeployedArchiveName;
+ private Map<String, List<String>> war2Handles = new HashMap<String, List<String>>(7);
+
+
+ public NeedPortletHandleTest(String portletWARFileName)
+ throws Exception
+ {
+ this("NeedPortletHandleTest", portletWARFileName);
+ this.mostUsedPortletWARFileName = portletWARFileName;
+ }
+
+ protected NeedPortletHandleTest(String name, String portletWARFileName)
+ throws Exception
+ {
+ super(name);
+ this.mostUsedPortletWARFileName = portletWARFileName;
+ }
+
+ protected String getDefaultHandle()
+ {
+ return getFirstHandleFor(mostUsedPortletWARFileName);
+ }
+
+ /**
+ * @param archiveName
+ * @return
+ * @since 2.6.3
+ */
+ private String getFirstHandleFor(String archiveName)
+ {
+ return war2Handles.get(archiveName).get(0);
+ }
+
+ protected String getHandleForCurrentlyDeployedArchive()
+ {
+ return getFirstHandleFor(currentlyDeployedArchiveName);
+ }
+
+ /**
+ * @return
+ * @since 2.6.3
+ */
+ protected List<String> getHandlesForCurrentlyDeployedArchive()
+ {
+ return war2Handles.get(currentlyDeployedArchiveName);
+ }
+
+ /**
+ * Each time we deploy a new archive, check to see if the service description has changed and add any new portlet
+ * handles found.
+ *
+ * @param archiveName
+ * @throws Exception
+ */
+ public void deploy(String archiveName) throws Exception
+ {
+ super.deploy(archiveName);
+ currentlyDeployedArchiveName = archiveName;
+
+ if (!war2Handles.containsKey(archiveName))
+ {
+ V1GetServiceDescription getServiceDescription = WSRP1TypeFactory.createGetServiceDescription();
+ V1ServiceDescription serviceDescription = producer.getServiceDescription(getServiceDescription);
+ List<V1PortletDescription> offered = serviceDescription.getOfferedPortlets();
+ if (offered != null)
+ {
+ for (V1PortletDescription portletDescription : offered)
+ {
+ String handle = portletDescription.getPortletHandle();
+ String warName = handle.substring(1, handle.indexOf('.')) + ".war";
+ if (warName.equals(archiveName))
+ {
+ List<String> handles = war2Handles.get(warName);
+ if (handles == null)
+ {
+ handles = new ArrayList<String>(3);
+ war2Handles.put(warName, handles);
+ }
+
+ handles.add(handle);
+ }
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException(archiveName + " didn't contain any portlets...");
+ }
+ }
+ }
+
+ public void undeploy(String archiveName) throws Exception
+ {
+ try
+ {
+ super.undeploy(archiveName);
+ }
+ catch (Exception e)
+ {
+ // if an exception occurred the portlet is still probably deployed, so just exit
+ e.printStackTrace();
+ return;
+ }
+
+ currentlyDeployedArchiveName = null;
+
+ // only remove the mapping if we're not undeploying the most used portlet (optimization, as it avoids parsing the SD)
+ if (!mostUsedPortletWARFileName.equals(archiveName))
+ {
+ war2Handles.remove(archiveName);
+ }
+ }
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.mostUsedPortletWARFileName = getMostUsedPortletWARFileName();
+ deploy(mostUsedPortletWARFileName);
+
+ // reset strict mode
+ producer.usingStrictModeChangedTo(true);
+ }
+
+ /**
+ * Sub-classes need to implement this method to return the local WAR file name of the portlet being deployed most of
+ * the time in the context of the test case. This is required since we cannot rely on the name to be properly set at
+ * all time via the constructor.
+ *
+ * @return
+ */
+ protected abstract String getMostUsedPortletWARFileName();
+
+ public void tearDown() throws Exception
+ {
+ undeploy(mostUsedPortletWARFileName);
+ super.tearDown();
+ }
+
+ /**
+ * Creates a valid Markup request.
+ *
+ * @return a basic, valid GetMarkup object representing the markup request
+ */
+ protected V1GetMarkup createMarkupRequestForCurrentlyDeployedPortlet() throws Exception
+ {
+ return createMarkupRequest(getHandleForCurrentlyDeployedArchive());
+ }
+
+ /**
+ * @param handle
+ * @return
+ * @throws RemoteException
+ * @throws V1InvalidRegistrationFault
+ * @throws V1OperationFailedFault
+ * @since 2.6.3
+ */
+ protected V1GetMarkup createMarkupRequest(String handle) throws RemoteException, V1InvalidRegistration, V1OperationFailed
+ {
+ V1GetMarkup getMarkup = WSRP1TypeFactory.createDefaultMarkupRequest(handle);
+ getMarkup.getMarkupParams().getMarkupCharacterSets().add(WSRPConstants.DEFAULT_CHARACTER_SET);
+
+ return getMarkup;
+ }
+
+ protected String getPortletHandleFrom(String partialHandle)
+ {
+ List<String> handles = getHandlesForCurrentlyDeployedArchive();
+ for (String handle : handles)
+ {
+ if (handle.contains(partialHandle))
+ {
+ return handle;
+ }
+ }
+
+ throw new IllegalArgumentException("Couldn't find a portlet handle matching '" + partialHandle + "' in " + currentlyDeployedArchiveName);
+ }
+
+ protected V1GetMarkup createMarkupRequest() throws Exception
+ {
+ return createMarkupRequestForCurrentlyDeployedPortlet();
+ }
+
+ protected void checkSessionForCurrentlyDeployedPortlet(V1MarkupResponse response)
+ throws RemoteException, V1InvalidRegistration, V1OperationFailed
+ {
+ // We don't send any portlet session information, just user cookies... The producer takes care of the details
+ // What this means, though is that we don't have access to individual portlet session ids... so we can only
+ // check that we get a cookie... Not very test-friendly...
+ /*ProducerSessionInformation sessionInfo = RequestHeaderClientHandler.getCurrentProducerSessionInformation();
+ ExtendedAssert.assertNotNull(sessionInfo);
+ ExtendedAssert.assertTrue(sessionInfo.getUserCookie().lastIndexOf("JSESSIONID") != -1);
+
+ // Check that we are not sending sessionID's
+ SessionContext sessionContext = response.getSessionContext();
+ ExtendedAssert.assertNull(sessionContext);*/
+ }
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/NeedPortletHandleTest.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,461 @@
+/*
+ * 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.wsrp.WSRPConstants;
+import org.gatein.wsrp.servlet.ServletAccess;
+import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
+import org.gatein.wsrp.test.ExtendedAssert;
+import org.gatein.wsrp.test.support.MockHttpServletRequest;
+import org.gatein.wsrp.test.support.MockHttpServletResponse;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.oasis.wsrp.v1.V1AccessDenied;
+import org.oasis.wsrp.v1.V1ClonePortlet;
+import org.oasis.wsrp.v1.V1DestroyFailed;
+import org.oasis.wsrp.v1.V1DestroyPortlets;
+import org.oasis.wsrp.v1.V1DestroyPortletsResponse;
+import org.oasis.wsrp.v1.V1GetPortletDescription;
+import org.oasis.wsrp.v1.V1GetPortletProperties;
+import org.oasis.wsrp.v1.V1GetPortletPropertyDescription;
+import org.oasis.wsrp.v1.V1GetServiceDescription;
+import org.oasis.wsrp.v1.V1InconsistentParameters;
+import org.oasis.wsrp.v1.V1InvalidHandle;
+import org.oasis.wsrp.v1.V1InvalidRegistration;
+import org.oasis.wsrp.v1.V1InvalidUserCategory;
+import org.oasis.wsrp.v1.V1MissingParameters;
+import org.oasis.wsrp.v1.V1ModelDescription;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1PortletContext;
+import org.oasis.wsrp.v1.V1PortletDescriptionResponse;
+import org.oasis.wsrp.v1.V1PortletPropertyDescriptionResponse;
+import org.oasis.wsrp.v1.V1Property;
+import org.oasis.wsrp.v1.V1PropertyDescription;
+import org.oasis.wsrp.v1.V1PropertyList;
+import org.oasis.wsrp.v1.V1SetPortletProperties;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 11547 $
+ * @since 2.4
+ */
+(a)RunWith(Arquillian.class)
+public class PortletManagementTestCase extends NeedPortletHandleTest
+{
+ private static final String TEST_BASIC_PORTLET_WAR = "test-basic-portlet.war";
+
+ public PortletManagementTestCase() throws Exception
+ {
+ super("PortletManagementTestCase", TEST_BASIC_PORTLET_WAR);
+ }
+
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ return ShrinkWrap.create("test.jar", JavaArchive.class);
+ }
+
+ @Before
+ public void setUp() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.setUp();
+ //hack to get around having to have a httpservletrequest when accessing the producer services
+ //I don't know why its really needed, seems to be a dependency where wsrp connects with the pc module
+ ServletAccess.setRequestAndResponse(MockHttpServletRequest.createMockRequest(null), MockHttpServletResponse.createMockResponse());
+ }
+ }
+
+
+ @After
+ public void tearDown() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.tearDown();
+ }
+ }
+
+ @Test
+ public void testClonePortlet() throws Exception
+ {
+ String handle = getDefaultHandle();
+ V1PortletContext initialContext = WSRP1TypeFactory.createPortletContext(handle);
+
+ // first check that we get a new PortletContext
+ V1PortletContext cloneContext = clonePortlet(handle);
+ ExtendedAssert.assertNotNull(cloneContext);
+ ExtendedAssert.assertFalse(initialContext.equals(cloneContext));
+
+ // then check that the initial state is identical
+ V1GetPortletProperties getPortletProperties = WSRP1TypeFactory.createGetPortletProperties(null, cloneContext);
+ List<V1Property> result = producer.getPortletProperties(getPortletProperties).getProperties();
+ getPortletProperties = WSRP1TypeFactory.createGetPortletProperties(null, initialContext);
+ checkGetPropertiesResponse(producer.getPortletProperties(getPortletProperties), result);
+
+ // check that new clone is not listed in service description
+ V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+ checkServiceDescriptionWithOnlyBasicPortlet(gs);
+ }
+
+ @Test
+ public void testClonePortletNoRegistrationWhenRequired()
+ {
+ producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
+
+ String handle = getDefaultHandle();
+ V1ClonePortlet clonePortlet = WSRP1TypeFactory.createSimpleClonePortlet(handle);
+
+ try
+ {
+ producer.clonePortlet(clonePortlet);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
+ }
+ catch (V1InvalidRegistration invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testDestroyPortlets() throws Exception
+ {
+ // first try to destroy POP, should fail
+ String handle = getDefaultHandle();
+ V1DestroyPortlets destroyPortlets = WSRP1TypeFactory.createDestroyPortlets(null, Collections.<String>singletonList(handle));
+ V1DestroyPortletsResponse response = producer.destroyPortlets(destroyPortlets);
+ ExtendedAssert.assertNotNull(response);
+ List<V1DestroyFailed> failures = response.getDestroyFailed();
+ ExtendedAssert.assertNotNull(failures);
+ ExtendedAssert.assertEquals(1, failures.size());
+ V1DestroyFailed failure = failures.get(0);
+ ExtendedAssert.assertNotNull(failure);
+ ExtendedAssert.assertEquals(handle, failure.getPortletHandle());
+ ExtendedAssert.assertNotNull(failure.getReason());
+
+ // clone portlet and try to destroy it
+ V1PortletContext portletContext = clonePortlet(handle);
+ destroyPortlets = WSRP1TypeFactory.createDestroyPortlets(null, Collections.<String>singletonList(portletContext.getPortletHandle()));
+ response = producer.destroyPortlets(destroyPortlets);
+ ExtendedAssert.assertNotNull(response);
+ failures = response.getDestroyFailed();
+ ExtendedAssert.assertNull(failures);
+ }
+
+ @Test
+ public void testDestroyPortletsNoRegistrationWhenRequired()
+ {
+ producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
+
+ String handle = getDefaultHandle();
+ V1DestroyPortlets dp = WSRP1TypeFactory.createDestroyPortlets(null, Collections.<String>singletonList(handle));
+
+ try
+ {
+ producer.destroyPortlets(dp);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
+ }
+ catch (V1InvalidRegistration invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testGetPortletDescription() throws Exception
+ {
+ String handle = getDefaultHandle();
+ V1GetPortletDescription gpd = WSRP1TypeFactory.createGetPortletDescription(null, handle);
+
+ V1PortletDescriptionResponse response = producer.getPortletDescription(gpd);
+ ExtendedAssert.assertNotNull(response);
+
+ checkBasicPortletDescription(response.getPortletDescription(), handle);
+ }
+
+ @Test
+ public void testGetPortletDescriptionNoRegistrationWhenRequired()
+ {
+ producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
+
+ String handle = getDefaultHandle();
+ V1GetPortletDescription gpd = WSRP1TypeFactory.createGetPortletDescription(null, handle);
+
+ try
+ {
+ producer.getPortletDescription(gpd);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
+ }
+ catch (V1InvalidRegistration invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testGetPortletPropertiesNoRegistration() throws Exception
+ {
+ String handle = getDefaultHandle();
+ V1PortletContext initialContext = WSRP1TypeFactory.createPortletContext(handle);
+ V1GetPortletProperties getPortletProperties = WSRP1TypeFactory.createGetPortletProperties(null, initialContext);
+
+ List<String> names = getPortletProperties.getNames();
+ Collections.addAll(names, "prefName1", "prefName2");
+
+ V1PropertyList response = producer.getPortletProperties(getPortletProperties);
+ List<V1Property> expected = new ArrayList<V1Property>(2);
+ Collections.addAll(expected, WSRP1TypeFactory.createProperty("prefName1", "en", "prefValue1"),
+ WSRP1TypeFactory.createProperty("prefName2", "en", "prefValue2"));
+ checkGetPropertiesResponse(response, expected);
+
+ names.clear();
+ response = producer.getPortletProperties(getPortletProperties);
+ checkGetPropertiesResponse(response, expected);
+
+ names.add("prefName2");
+ response = producer.getPortletProperties(getPortletProperties);
+ checkGetPropertiesResponse(response, Collections.<V1Property>singletonList(WSRP1TypeFactory.createProperty("prefName2", "en", "prefValue2")));
+ }
+
+ public void testGetPortletPropertyDescription() throws Exception
+ {
+ String handle = getDefaultHandle();
+ V1GetPortletPropertyDescription getPortletPropertyDescription = WSRP1TypeFactory.createSimpleGetPortletPropertyDescription(handle);
+
+ V1PortletPropertyDescriptionResponse response = producer.getPortletPropertyDescription(getPortletPropertyDescription);
+
+ V1ModelDescription desc = response.getModelDescription();
+ ExtendedAssert.assertNotNull(desc);
+ List<V1PropertyDescription> propertyDescriptions = desc.getPropertyDescriptions();
+ ExtendedAssert.assertNotNull(propertyDescriptions);
+
+ List<V1PropertyDescription> expected = new ArrayList<V1PropertyDescription>(2);
+ V1PropertyDescription description = WSRP1TypeFactory.createPropertyDescription("prefName1", WSRPConstants.XSD_STRING);
+ description.setHint(WSRP1TypeFactory.createLocalizedString("prefName1"));
+ description.setLabel(WSRP1TypeFactory.createLocalizedString("prefName1"));
+ expected.add(description);
+ description = WSRP1TypeFactory.createPropertyDescription("prefName2", WSRPConstants.XSD_STRING);
+ description.setHint(WSRP1TypeFactory.createLocalizedString("prefName2"));
+ description.setLabel(WSRP1TypeFactory.createLocalizedString("prefName2"));
+ expected.add(description);
+
+ checkPropertyDescriptions(expected, propertyDescriptions);
+ }
+
+ @Test
+ public void testGetPortletPropertiesNoRegistrationWhenRequired()
+ {
+ producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
+
+ String handle = getDefaultHandle();
+ V1GetPortletPropertyDescription getPortletPropertyDescription = WSRP1TypeFactory.createSimpleGetPortletPropertyDescription(handle);
+
+ try
+ {
+ producer.getPortletPropertyDescription(getPortletPropertyDescription);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
+ }
+ catch (V1InvalidRegistration invalidRegistrationFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testSetPortletProperties() throws Exception
+ {
+ String handle = getDefaultHandle();
+
+ V1PortletContext portletContext = clonePortlet(handle);
+ V1PropertyList propertyList = WSRP1TypeFactory.createPropertyList();
+ List<V1Property> properties = propertyList.getProperties();
+ Collections.addAll(properties, WSRP1TypeFactory.createProperty("prefName1", "en", "newPrefValue1"),
+ WSRP1TypeFactory.createProperty("prefName2", "en", "newPrefValue2"));
+ V1SetPortletProperties setPortletProperties = WSRP1TypeFactory.createSetPortletProperties(null, portletContext, propertyList);
+
+ V1PortletContext response = producer.setPortletProperties(setPortletProperties);
+ V1GetPortletProperties getPortletProperties = WSRP1TypeFactory.createGetPortletProperties(null, response);
+ checkGetPropertiesResponse(producer.getPortletProperties(getPortletProperties), properties);
+
+ portletContext = WSRP1TypeFactory.createPortletContext(handle);
+ setPortletProperties.setPortletContext(portletContext);
+ try
+ {
+ response = producer.setPortletProperties(setPortletProperties);
+ ExtendedAssert.fail("Setting properties on Producer-Offered Portlet should fail...");
+ }
+ catch (V1InconsistentParameters expected)
+ {
+ // expected
+ }
+ }
+
+ @Test
+ public void testSetPortletPropertiesNoRegistrationWhenRequired()
+ {
+ producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(true);
+
+ V1PropertyList propertyList = WSRP1TypeFactory.createPropertyList();
+ List<V1Property> properties = propertyList.getProperties();
+ Collections.addAll(properties, WSRP1TypeFactory.createProperty("prefName1", "en", "newPrefValue1"),
+ WSRP1TypeFactory.createProperty("prefName2", "en", "newPrefValue2"));
+ V1SetPortletProperties setPortletProperties = WSRP1TypeFactory.createSetPortletProperties(null,
+ WSRP1TypeFactory.createPortletContext(getDefaultHandle()), propertyList);
+
+ try
+ {
+ producer.setPortletProperties(setPortletProperties);
+ ExtendedAssert.fail("Should have thrown InvalidRegistrationFault");
+ }
+ catch (V1InvalidRegistration invalidRegistration)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ private V1PortletContext clonePortlet(String handle) throws V1InvalidUserCategory, V1InconsistentParameters,
+ V1InvalidRegistration, V1MissingParameters, V1OperationFailed, V1AccessDenied, V1InvalidHandle
+ {
+ V1ClonePortlet clonePortlet = WSRP1TypeFactory.createSimpleClonePortlet(handle);
+ return producer.clonePortlet(clonePortlet);
+ }
+
+ private List<V1Property> checkGetPropertiesResponse(V1PropertyList response, List<V1Property> expected)
+ {
+ ExtendedAssert.assertNotNull(response);
+ List<V1Property> properties = response.getProperties();
+ ExtendedAssert.assertEquals(expected.toArray(), properties.toArray(), false, "Didn't receive expected properties!", new PropertyDecorator());
+ return properties;
+ }
+
+ private void checkPropertyDescriptions(List<V1PropertyDescription> expected, List<V1PropertyDescription> propertyDescriptions)
+ {
+ ExtendedAssert.assertEquals(expected.size(), propertyDescriptions.size());
+ V1PropertyDescription propDesc = propertyDescriptions.get(0);
+ ExtendedAssert.assertNotNull(propDesc);
+ String name = propDesc.getName();
+ if ("prefName1".equals(name))
+ {
+ assertEquals(expected.get(0), propDesc);
+ assertEquals(expected.get(1), propertyDescriptions.get(1));
+ }
+ else if ("prefName2".equals(name))
+ {
+ assertEquals(expected.get(1), propDesc);
+ assertEquals(expected.get(0), propertyDescriptions.get(1));
+ }
+ else
+ {
+ ExtendedAssert.fail("Unexpected PropertyDescription named '" + name + "'");
+ }
+ }
+
+ protected String getMostUsedPortletWARFileName()
+ {
+ return TEST_BASIC_PORTLET_WAR;
+ }
+
+ private static class PropertyDecorator implements ExtendedAssert.Decorator
+ {
+ private V1Property prop;
+
+ public void decorate(Object decorated)
+ {
+ prop = (V1Property)decorated;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (o instanceof ExtendedAssert.DecoratedObject)
+ {
+ ExtendedAssert.DecoratedObject decoratedObject = (ExtendedAssert.DecoratedObject)o;
+ V1Property that = (V1Property)decoratedObject.getDecorated();
+
+ String name = prop.getName();
+ if (name != null ? !name.equals(that.getName()) : that.getName() != null)
+ {
+ return false;
+ }
+
+ String value = prop.getStringValue();
+ if (value != null ? !value.equals(that.getStringValue()) : that.getStringValue() != null)
+ {
+ return false;
+ }
+
+ String lang = prop.getLang();
+ if (lang != null ? !lang.equals(that.getLang()) : that.getLang() != null)
+ {
+ return false;
+ }
+
+ List<Object> any = prop.getAny();
+ return !(any != null ? !any.equals(that.getAny()) : that.getAny() != null);
+
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+
+ public String toString()
+ {
+ return new StringBuffer().append("Property: ").append(prop.getName()).append("=")
+ .append(prop.getStringValue()).append(" (").append(prop.getLang()).append(")").toString();
+ }
+ }
+}
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/PortletManagementTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/RegistrationTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/RegistrationTestCase.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/RegistrationTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,365 @@
+/*
+ * 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.registration.Registration;
+import org.gatein.registration.RegistrationException;
+import org.gatein.registration.RegistrationManager;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.WSRPUtils;
+import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
+import org.gatein.wsrp.test.ExtendedAssert;
+import org.oasis.wsrp.v1.V1GetMarkup;
+import org.oasis.wsrp.v1.V1GetServiceDescription;
+import org.oasis.wsrp.v1.V1InvalidRegistration;
+import org.oasis.wsrp.v1.V1MissingParameters;
+import org.oasis.wsrp.v1.V1ModifyRegistration;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1PropertyDescription;
+import org.oasis.wsrp.v1.V1RegistrationContext;
+import org.oasis.wsrp.v1.V1RegistrationData;
+
+import javax.xml.namespace.QName;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 12309 $
+ * @since 2.4
+ */
+public class RegistrationTestCase extends V1ProducerBaseTest
+{
+ public RegistrationTestCase() throws Exception
+ {
+ super("RegistrationTestCase");
+ }
+
+ /**
+ * R355: The portal MUST pass a name for itself that uniquely identifies it.
+ *
+ * @throws Exception
+ */
+ public void testUniqueNameRegistration() throws Exception
+ {
+ // not sure how to test this...
+ }
+
+ /**
+ * R356: The portal MAY pass information describing the portal [vendor] type and version.
+ * <p/>
+ * However, WSRP v1 7.1.1 states: The consumerAgent value MUST start with "productName.majorVersion.minorVersion"
+ * where "productName" identifies the product the Consumer installed for its deployment, and majorVersion and
+ * minorVersion are vendor-defined indications of the version of its product. This string can then contain any
+ * additional characters/words the product or Consumer wish to supply.
+ *
+ * @throws Exception
+ */
+ public void testConsumerAgent() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+ V1RegistrationData regData = createBaseRegData();
+ regData.setConsumerAgent("invalid consumer agent");
+
+ try
+ {
+ producer.register(regData);
+ ExtendedAssert.fail("Trying to register with an invalid consumer agent String should fail.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ }
+
+
+ regData.setConsumerAgent(WSRPConstants.CONSUMER_AGENT);
+ producer.register(regData);
+ }
+
+ public void testRegistrationHandle() throws V1OperationFailed, V1MissingParameters, RegistrationException
+ {
+ // check that a registration handle was created
+ V1RegistrationContext rc = registerConsumer();
+ String registrationHandle = rc.getRegistrationHandle();
+ assertNotNull(registrationHandle);
+
+ // check that a registration was created with that handle
+ RegistrationManager registrationManager = producer.getRegistrationManager();
+ Registration registration = registrationManager.getRegistration(registrationHandle);
+ assertNotNull(registration);
+
+ // check that the registration was persisted...
+ String key = registration.getPersistentKey();
+ assertNotNull(key);
+
+ // ... and that the handle was created by the policy based on the registration key
+ String expectedHandle = registrationManager.getPolicy().createRegistrationHandleFor(key);
+ assertEquals(expectedHandle, registrationHandle);
+ }
+
+ public void testDeregister() throws Exception
+ {
+ // initiate registration
+ configureRegistrationSettings(true, false);
+ V1RegistrationContext rc = registerConsumer();
+
+ // deregister
+ producer.deregister(rc);
+
+ // try to get markup, portlet handle doesn't matter since it should fail before trying to retrieve the portlet
+ V1GetMarkup getMarkup = WSRP1TypeFactory.createDefaultMarkupRequest("foo");
+ getMarkup.getMarkupParams().getMarkupCharacterSets().add(WSRPConstants.DEFAULT_CHARACTER_SET);
+
+ try
+ {
+ producer.getMarkup(getMarkup);
+ ExtendedAssert.fail("Consumer tried to access info with a de-registered context. Operations should fail.");
+ }
+ catch (V1InvalidRegistration invalidRegistrationFault)
+ {
+ // expected
+ }
+
+ // Get description with old registration context should fail
+ V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+ gs.setRegistrationContext(rc);
+
+ try
+ {
+ producer.getServiceDescription(gs);
+ ExtendedAssert.fail("Required registration info has been modified: operations should fail until registration is modified.");
+ }
+ catch (V1InvalidRegistration invalidRegistrationFault)
+ {
+ // expected
+ }
+
+ // Get description should still work without registration context
+ gs = getNoRegistrationServiceDescriptionRequest();
+
+ ExtendedAssert.assertNotNull(producer.getServiceDescription(gs));
+ }
+
+ public void testModifyRegistration() throws Exception
+ {
+ // initiate registration
+ configureRegistrationSettings(true, false);
+ V1RegistrationContext rc = registerConsumer();
+
+ // now modify Producer's set of required registration info
+ String newPropName = "New Prop";
+ RegistrationPropertyDescription regProp = new RegistrationPropertyDescription(newPropName,
+ new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
+ regProp.setDefaultLabel("New Registration Property");
+ producer.getConfigurationService().getConfiguration().getRegistrationRequirements().addRegistrationProperty(regProp);
+
+ // try to get markup, portlet handle doesn't matter since it should fail before trying to retrieve the portlet
+ V1GetMarkup getMarkup = WSRP1TypeFactory.createDefaultMarkupRequest("foo");
+ getMarkup.getMarkupParams().getMarkupCharacterSets().add(WSRPConstants.DEFAULT_CHARACTER_SET);
+ getMarkup.setRegistrationContext(rc);
+
+ try
+ {
+ producer.getMarkup(getMarkup);
+ ExtendedAssert.fail("Required registration info has been modified: operations should fail until registration is modified.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ // WSRP primer recommends returning OperationFailedFault and NOT InvalidRegistrationFault
+ // kinda weird... will be replaced by ModifyRegistrationRequiredFault in WSRP 2.0
+ }
+
+ // Get description should return information just as if consumer wasn't registered
+ V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+ gs.setRegistrationContext(rc);
+
+ try
+ {
+ producer.getServiceDescription(gs);
+ ExtendedAssert.fail("Required registration info has been modified: operations should fail until registration is modified.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ // WSRP primer recommends returning OperationFailedFault and NOT InvalidRegistrationFault
+ // kinda weird... will be replaced by ModifyRegistrationRequiredFault in WSRP 2.0
+ }
+
+ // remove registration context, try again and check that we get new registration info
+ gs.setRegistrationContext(null);
+ List<V1PropertyDescription> pds = producer.getServiceDescription(gs)
+ .getRegistrationPropertyDescription().getPropertyDescriptions();
+ ExtendedAssert.assertEquals(2, pds.size());
+
+ // Check that one of the returned property description is equal to the one we just added
+ V1PropertyDescription description = pds.get(1);
+ if (description.getName().startsWith("New"))
+ {
+ assertEquals(WSRPUtils.convertToPropertyDescription(regProp), description);
+ }
+ else
+ {
+ assertEquals(WSRPUtils.convertToPropertyDescription(regProp), pds.get(0));
+ }
+
+ // Update registration data
+ V1RegistrationData regData = createBaseRegData();
+ regData.getRegistrationProperties().add(WSRP1TypeFactory.createProperty(newPropName, "en", "blah"));
+
+ // Modify registration and get service description
+ V1ModifyRegistration registration = new V1ModifyRegistration();
+ registration.setRegistrationContext(rc);
+ registration.setRegistrationData(regData);
+ producer.modifyRegistration(registration);
+ gs.setRegistrationContext(rc);
+ checkServiceDescriptionWithOnlyBasicPortlet(gs);
+ }
+
+ public void testModifyRegistrationIncorrectData() throws Exception
+ {
+ // initiate registration
+ configureRegistrationSettings(true, false);
+ V1RegistrationContext rc = registerConsumer();
+
+ // now modify Producer's set of required registration info
+ String newPropName = "New Prop";
+ RegistrationPropertyDescription regProp = new RegistrationPropertyDescription(newPropName,
+ new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
+ regProp.setDefaultLabel("New Registration Property");
+ producer.getConfigurationService().getConfiguration().getRegistrationRequirements().addRegistrationProperty(regProp);
+
+ try
+ {
+ V1ModifyRegistration registration = new V1ModifyRegistration();
+ registration.setRegistrationContext(rc);
+ registration.setRegistrationData(createBaseRegData());
+ producer.modifyRegistration(registration);
+ ExtendedAssert.fail("Passing incorrect data should fail");
+ }
+ catch (V1OperationFailed operationFailed)
+ {
+ // expected
+ }
+ }
+
+ public void testRegister() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ // service description request without registration info
+ V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+
+ V1RegistrationContext registrationContext = registerConsumer();
+ ExtendedAssert.assertNotNull(registrationContext);
+ ExtendedAssert.assertNotNull(registrationContext.getRegistrationHandle());
+
+ gs.setRegistrationContext(registrationContext);
+
+ checkServiceDescriptionWithOnlyBasicPortlet(gs);
+ }
+
+ public void testRegisterWhenRegistrationNotRequired() throws Exception
+ {
+ configureRegistrationSettings(false, false);
+
+ try
+ {
+ registerConsumer();
+ ExtendedAssert.fail("Shouldn't be possible to register if no registration is required.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ }
+ }
+
+ public void testDeregisterWhenRegistrationNotRequired() throws Exception
+ {
+ configureRegistrationSettings(false, false);
+
+ try
+ {
+ producer.deregister(null);
+ ExtendedAssert.fail("Shouldn't be possible to deregister if no registration is required.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ }
+ }
+
+ public void testModifyRegistrationWhenRegistrationNotRequired() throws Exception
+ {
+ configureRegistrationSettings(false, false);
+
+ try
+ {
+ producer.modifyRegistration(null);
+ ExtendedAssert.fail("Shouldn't be possible to modify registration if no registration is required.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ }
+ }
+
+ public void testModifyRegistrationNoRegistrationWhenRegistrationRequired() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ try
+ {
+ producer.modifyRegistration(null);
+ ExtendedAssert.fail("Shouldn't be possible to modify registration if no registration is required.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+
+ public void testDeregisterNoRegistrationWhenRegistrationRequired() throws Exception
+ {
+ configureRegistrationSettings(true, false);
+
+ try
+ {
+ producer.deregister(null);
+ ExtendedAssert.fail("Shouldn't be possible to modify registration if no registration is required.");
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected
+ }
+ catch (Exception e)
+ {
+ ExtendedAssert.fail(e.getMessage());
+ }
+ }
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/RegistrationTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,194 @@
+/*
+ * 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.wsrp.servlet.ServletAccess;
+import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
+import org.gatein.wsrp.test.ExtendedAssert;
+import org.gatein.wsrp.test.support.MockHttpServletRequest;
+import org.gatein.wsrp.test.support.MockHttpServletResponse;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.logging.Logger;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1RegistrationContext;
+import org.oasis.wsrp.v1.V1ReleaseSessions;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Tests the behavior of the ReleaseSession method.
+ *
+ * @author Matt Wringe
+ */
+(a)RunWith(Arquillian.class)
+public class ReleaseSessionTestCase extends NeedPortletHandleTest
+{
+
+ // default portlet war used in this test
+ private static final String DEFAULT_SESSION_PORTLET_WAR = "test-session-portlet.war";
+
+ private static final Logger log = Logger.getLogger(ReleaseSessionTestCase.class);
+
+
+ protected String getMostUsedPortletWARFileName()
+ {
+ return DEFAULT_SESSION_PORTLET_WAR;
+ }
+
+ public ReleaseSessionTestCase() throws Exception
+ {
+ super("SessionWar", DEFAULT_SESSION_PORTLET_WAR);
+ log.debug("Instantiating ReleaseSessionTestCase");
+ }
+
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ return ShrinkWrap.create("test.jar", JavaArchive.class);
+ }
+
+ @Before
+ public void setUp() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.setUp();
+ //hack to get around having to have a httpservletrequest when accessing the producer services
+ //I don't know why its really needed, seems to be a dependency where wsrp connects with the pc module
+ ServletAccess.setRequestAndResponse(MockHttpServletRequest.createMockRequest(null), MockHttpServletResponse.createMockResponse());
+ }
+ }
+
+
+ @After
+ public void tearDown() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.tearDown();
+ }
+ }
+
+ @Test
+ public void testReleaseSession() throws Exception
+ {
+ // possible registration contexts are: actual RegistrationContext, null, and a made up value
+ V1RegistrationContext fakeRegContext = WSRP1TypeFactory.createRegistrationContext("Fake Registration Handle");
+ V1RegistrationContext[] regContexts = new V1RegistrationContext[]{null, null, fakeRegContext};
+
+ // possible types of sessionIDs include null and a made up value.
+ // Note: a valid session id cannot be used since the sessionID should never be sent to the consumer
+ String nullSessionID = null;
+ String fakeSessionID = "Fake Session ID";
+
+ String[][] sessionIDs = new String[][]{{nullSessionID},
+ {nullSessionID, nullSessionID},
+ {fakeSessionID},
+ {fakeSessionID, fakeSessionID},
+ {fakeSessionID, nullSessionID},
+ {nullSessionID, fakeSessionID}};
+
+ for (int i = 0; i < regContexts.length; i++)
+ {
+ for (String[] sessionID : sessionIDs)
+ {
+ V1ReleaseSessions releaseSession = WSRP1TypeFactory.createReleaseSessions(regContexts[i], Arrays.asList(sessionID));
+ releaseSessions(releaseSession, false, i);
+ releaseSessions(releaseSession, true, i);
+ }
+ }
+ }
+
+ private void releaseSessions(V1ReleaseSessions releaseSessions, boolean useRegistration, int index) throws Exception
+ {
+ setUp();
+ try
+ {
+ if (useRegistration)
+ {
+ configureRegistrationSettings(true, false);
+
+ // faking correct registration context when we're supposed to have one... previous impl registered consumer
+ // all the time but this cannot be done anymore since we prevent registering if no registration is required
+ // so we need to wait for the proper case to init the registration context... Hackish! :(
+ if (index == 0)
+ {
+ releaseSessions.setRegistrationContext(registerConsumer());
+ }
+ }
+ log.info(getSetupString(releaseSessions));
+ producer.releaseSessions(releaseSessions);
+ ExtendedAssert.fail("ReleaseSessions did not thrown an OperationFailed Fault." + getSetupString(releaseSessions));
+ }
+ catch (V1OperationFailed operationFailedFault)
+ {
+ // expected fault.
+ }
+ finally
+ {
+ tearDown();
+ }
+ }
+
+ private String getSetupString(V1ReleaseSessions releaseSessions)
+ {
+ StringBuffer message = new StringBuffer("ReleaseSessions Setup:\n");
+
+ if (releaseSessions == null)
+ {
+ message.append(" ReleaseSessions : null");
+ }
+ else
+ {
+ V1RegistrationContext regContext = releaseSessions.getRegistrationContext();
+ List<String> sessionIDs = releaseSessions.getSessionIDs();
+ message.append(" RegistrationContext : ").append(regContext != null ? regContext.getRegistrationHandle() : null);
+ message.append(" | SessionIDs : ");
+ if (sessionIDs != null)
+ {
+ for (int i = 0; i < sessionIDs.size(); i++)
+ {
+ message.append(sessionIDs.get(i)).append(i == sessionIDs.size() - 1 ? "" : ", ");
+ }
+ }
+
+ }
+
+ if (producer.getConfigurationService().getConfiguration().getRegistrationRequirements().isRegistrationRequired())
+ {
+ message.append(" | with registration required.");
+ }
+
+ return message.toString();
+ }
+
+}
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,197 @@
+/*
+ * 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.
+ */
+
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.gatein.wsrp.protocol.v1;
+
+import org.gatein.wsrp.WSRPUtils;
+import org.gatein.wsrp.protocol.v1.V1ProducerBaseTest;
+import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+import org.gatein.wsrp.servlet.ServletAccess;
+import org.gatein.wsrp.test.ExtendedAssert;
+import org.gatein.wsrp.test.support.MockHttpServletRequest;
+import org.gatein.wsrp.test.support.MockHttpServletResponse;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.oasis.wsrp.v1.V1GetServiceDescription;
+import org.oasis.wsrp.v1.V1ModelDescription;
+import org.oasis.wsrp.v1.V1PropertyDescription;
+import org.oasis.wsrp.v1.V1ServiceDescription;
+
+import java.util.List;
+
+/**
+ * Tests WSRP Service Description
+ *
+ * @author <a href="mailto:Anil.Saldhana@jboss.org">Anil Saldhana</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 11547 $
+ * @since 2.4 (Feb 20, 2006)
+ */
+(a)RunWith(Arquillian.class)
+public class ServiceDescriptionTestCase extends V1ProducerBaseTest
+{
+ public ServiceDescriptionTestCase() throws Exception
+ {
+ super("ServiceDescriptionTestCase");
+ }
+
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ return ShrinkWrap.create("test.jar", JavaArchive.class);
+ }
+
+ @Before
+ public void setUp() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.setUp();
+ //hack to get around having to have a httpservletrequest when accessing the producer services
+ //I don't know why its really needed, seems to be a dependency where wsrp connects with the pc module
+ ServletAccess.setRequestAndResponse(MockHttpServletRequest.createMockRequest(null), MockHttpServletResponse.createMockResponse());
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.tearDown();
+ }
+ }
+
+ @Test
+ public void testNotRequiringRegistration() throws Throwable
+ {
+ producer.getConfigurationService().getConfiguration().getRegistrationRequirements().setRegistrationRequired(false);
+
+ V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+
+ V1ServiceDescription sd = checkServiceDescriptionWithOnlyBasicPortlet(gs);
+
+ // registration is not required
+ ExtendedAssert.assertFalse(sd.isRequiresRegistration());
+
+ // No registration properties
+ ExtendedAssert.assertNull(sd.getRegistrationPropertyDescription());
+ }
+
+ @Test
+ public void testRequiringRegistrationNotProvidingPortlets() throws Throwable
+ {
+ RegistrationPropertyDescription regProp = configureRegistrationSettings(true, false);
+
+ // service description request without registration info
+ V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+
+ //Invoke the Web Service
+ V1ServiceDescription sd = producer.getServiceDescription(gs);
+ ExtendedAssert.assertNotNull(sd);
+ ExtendedAssert.assertTrue(sd.isRequiresRegistration());
+
+ // Check registration properties
+ checkRequiredRegistrationProperties(sd, regProp);
+
+ // No offered portlets without registration!
+ ExtendedAssert.assertNull(sd.getOfferedPortlets());
+ }
+
+ @Test
+ public void testRequiringRegistrationProvidingPortlets() throws Throwable
+ {
+ RegistrationPropertyDescription regProp = configureRegistrationSettings(true, true);
+
+ // service description request without registration info
+ V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+
+ //Invoke the Web Service, we should have the complete description
+ V1ServiceDescription sd = checkServiceDescriptionWithOnlyBasicPortlet(gs);
+ ExtendedAssert.assertNotNull(sd);
+ ExtendedAssert.assertTrue(sd.isRequiresRegistration());
+
+ // Check registration properties
+ checkRequiredRegistrationProperties(sd, regProp);
+ }
+
+ @Test
+ public void testLiveDeployment() throws Throwable
+ {
+ try
+ {
+ V1GetServiceDescription gsd = getNoRegistrationServiceDescriptionRequest();
+
+ deploy("test-basic-portlet.war");
+ V1ServiceDescription sd = producer.getServiceDescription(gsd);
+ ExtendedAssert.assertEquals(1, sd.getOfferedPortlets().size());
+
+ deploy("test-markup-portlet.war");
+ sd = producer.getServiceDescription(gsd);
+ // should now have 2 offered portlets
+ ExtendedAssert.assertEquals(2, sd.getOfferedPortlets().size());
+
+ deploy("test-session-portlet.war");
+ sd = producer.getServiceDescription(gsd);
+ // should now have 3 offered portlets
+ ExtendedAssert.assertEquals(3, sd.getOfferedPortlets().size());
+
+ undeploy("test-markup-portlet.war");
+ sd = producer.getServiceDescription(gsd);
+ // should now have only 2 offered portlets again
+ ExtendedAssert.assertEquals(2, sd.getOfferedPortlets().size());
+
+ undeploy("test-session-portlet.war");
+ // only basic portlet should still be offered
+ checkServiceDescriptionWithOnlyBasicPortlet(gsd);
+ }
+ finally
+ {
+ undeploy("test-basic-portlet.war");
+ undeploy("test-markup-portlet.war");
+ undeploy("test-session-portlet.war");
+ }
+ }
+
+ private void checkRequiredRegistrationProperties(V1ServiceDescription sd, RegistrationPropertyDescription regProp)
+ {
+ V1ModelDescription registrationPropertyDescription = sd.getRegistrationPropertyDescription();
+ ExtendedAssert.assertNotNull(registrationPropertyDescription);
+ List<V1PropertyDescription> propertyDescriptions = registrationPropertyDescription.getPropertyDescriptions();
+ ExtendedAssert.assertNotNull(propertyDescriptions);
+ ExtendedAssert.assertEquals(1, propertyDescriptions.size());
+ assertEquals(WSRPUtils.convertToPropertyDescription(regProp), propertyDescriptions.get(0));
+ }
+}
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,285 @@
+/*
+ * 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.registration.RegistrationException;
+import org.gatein.registration.RegistrationManager;
+import org.gatein.registration.policies.DefaultRegistrationPolicy;
+import org.gatein.registration.policies.DefaultRegistrationPropertyValidator;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.producer.ProducerHolder;
+import org.gatein.wsrp.producer.WSRPProducer;
+import org.gatein.wsrp.producer.WSRPProducerBaseTest;
+import org.gatein.wsrp.producer.WSRPProducerImpl;
+import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
+import org.gatein.wsrp.producer.v1.WSRP1Producer;
+import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+import org.gatein.wsrp.spec.v1.WSRP1TypeFactory;
+import org.gatein.wsrp.test.ExtendedAssert;
+import org.oasis.wsrp.v1.V1GetServiceDescription;
+import org.oasis.wsrp.v1.V1LocalizedString;
+import org.oasis.wsrp.v1.V1MarkupType;
+import org.oasis.wsrp.v1.V1MissingParameters;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1PortletDescription;
+import org.oasis.wsrp.v1.V1PropertyDescription;
+import org.oasis.wsrp.v1.V1RegistrationContext;
+import org.oasis.wsrp.v1.V1RegistrationData;
+import org.oasis.wsrp.v1.V1ServiceDescription;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 12302 $
+ * @since 2.4
+ */
+public abstract class V1ProducerBaseTest extends WSRPProducerBaseTest
+{
+ private static final String CONSUMER = "test-consumer";
+ protected WSRP1Producer producer = WSRP1Producer.getInstance();
+
+
+ public V1ProducerBaseTest() throws Exception
+ {
+ this("V1ProducerBaseTest");
+ }
+
+ protected V1ProducerBaseTest(String name) throws Exception
+ {
+ super(name);
+ }
+
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ resetRegistrationInfo();
+ }
+
+ public void tearDown() throws Exception
+ {
+ resetRegistrationInfo();
+ super.tearDown();
+ }
+
+ /**
+ * Checks that the specified portlet description corresponds to the expected description of test-basic-portlet. If
+ * the handle parameter is not null, checks that it corresponds to the specified portlet decription.
+ *
+ * @param desc the tested PortletDescription
+ * @param handle the PortletHandle to be checked
+ */
+ public void checkBasicPortletDescription(V1PortletDescription desc, String handle)
+ {
+ ExtendedAssert.assertNotNull(desc);
+ /**
+ * @wsrp.specification
+ * Portlet handle must be less than 255 characters (WSRP 1.0 5.1.2)
+ */
+ ExtendedAssert.assertTrue(desc.getPortletHandle().length() <= 255);
+ if (handle != null)
+ {
+ ExtendedAssert.assertEquals(handle, desc.getPortletHandle());
+ }
+ ExtendedAssert.assertEquals("title", desc.getTitle().getValue());
+ List<V1MarkupType> markupTypes = desc.getMarkupTypes();
+ ExtendedAssert.assertEquals(1, markupTypes.size());
+ V1MarkupType markupType = markupTypes.get(0);
+
+ List<String> states = new ArrayList<String>(3);
+ states.add(WSRPConstants.NORMAL_WINDOW_STATE);
+ states.add(WSRPConstants.MAXIMIZED_WINDOW_STATE);
+ states.add(WSRPConstants.MINIMIZED_WINDOW_STATE);
+ V1MarkupType expected = WSRP1TypeFactory.createMarkupType("text/html",
+ Collections.<String>singletonList(WSRPConstants.VIEW_MODE), states, Collections.<String>singletonList("en"));
+ assertEquals(expected, markupType);
+ }
+
+ protected V1ServiceDescription checkServiceDescriptionWithOnlyBasicPortlet(V1GetServiceDescription gs)
+ throws Exception
+ {
+ deploy("test-basic-portlet.war");
+ //Invoke the Web Service
+ V1ServiceDescription sd = producer.getServiceDescription(gs);
+
+ ExtendedAssert.assertNotNull("sd != null", sd);
+
+ // Check offered portlets
+ List<V1PortletDescription> offeredPortlets = sd.getOfferedPortlets();
+ ExtendedAssert.assertNotNull(offeredPortlets);
+ ExtendedAssert.assertEquals(1, offeredPortlets.size());
+
+ // Check portlet description
+ V1PortletDescription desc = offeredPortlets.get(0);
+
+ checkBasicPortletDescription(desc, null);
+
+ undeploy("test-basic-portlet.war");
+ return sd; // for further testing...
+ }
+
+ protected V1RegistrationContext registerConsumer() throws V1OperationFailed, V1MissingParameters
+ {
+ V1RegistrationData registrationData = createBaseRegData();
+ return producer.register(registrationData);
+ }
+
+ protected V1RegistrationData createBaseRegData()
+ {
+ V1RegistrationData regData = WSRP1TypeFactory.createDefaultRegistrationData();
+ regData.setConsumerName(CONSUMER);
+ regData.getRegistrationProperties().add(WSRP1TypeFactory.createProperty("regProp", "en", "regValue"));
+ return regData;
+ }
+
+ protected RegistrationPropertyDescription configureRegistrationSettings(boolean requiresRegistration, boolean provideUnregisteredFullDescription)
+ {
+ // define expected registration infos
+ ProducerRegistrationRequirements registrationRequirements = producer.getConfigurationService().getConfiguration().getRegistrationRequirements();
+ registrationRequirements.setRegistrationRequired(requiresRegistration);
+ registrationRequirements.setRegistrationRequiredForFullDescription(!provideUnregisteredFullDescription);
+
+ if (requiresRegistration)
+ {
+ // fix-me: http://jira.jboss.com/jira/browse/JBPORTAL-821
+ RegistrationPropertyDescription regProp = new RegistrationPropertyDescription("regProp",
+ new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
+ regProp.setDefaultLabel("Registration Property");
+ registrationRequirements.addRegistrationProperty(regProp);
+
+ // Use default registration policy: this wiring is normally handled at the producer start, should maybe use a
+ // registration policy that is automatically configured when none is provided to avoid having a null one?
+ DefaultRegistrationPolicy defaultRegistrationPolicy = new DefaultRegistrationPolicy();
+ defaultRegistrationPolicy.setValidator(new DefaultRegistrationPropertyValidator());
+ registrationRequirements.setPolicy(defaultRegistrationPolicy);
+
+ RegistrationManager registrationManager = producer.getRegistrationManager();
+ registrationManager.setPolicy(defaultRegistrationPolicy);
+ registrationRequirements.addRegistrationPropertyChangeListener(registrationManager);
+
+ // create consumer for policy to be able to make decisions properly
+ try
+ {
+ registrationManager.createConsumer(CONSUMER);
+ }
+ catch (RegistrationException e)
+ {
+ ExtendedAssert.fail("Couldn't create consumer. Cause: " + e.getLocalizedMessage());
+ }
+
+ return regProp;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ protected void resetRegistrationInfo() throws RegistrationException
+ {
+ ProducerRegistrationRequirements registrationRequirements = producer.getConfigurationService().getConfiguration().getRegistrationRequirements();
+ registrationRequirements.setRegistrationRequired(false);
+ registrationRequirements.clearRegistrationProperties();
+ registrationRequirements.clearRegistrationPropertyChangeListeners();
+ producer.getRegistrationManager().clear();
+ registrationRequirements.removeRegistrationPropertyChangeListener(producer.getRegistrationManager());
+ }
+
+ protected V1GetServiceDescription getNoRegistrationServiceDescriptionRequest()
+ {
+ V1GetServiceDescription gs = WSRP1TypeFactory.createGetServiceDescription();
+ gs.getDesiredLocales().add("en-US");
+ gs.getDesiredLocales().add("en");
+ return gs;
+ }
+
+ /** === asserts === * */
+
+ protected static void assertEquals(V1MarkupType expected, V1MarkupType tested)
+ {
+ String message = "Expected: <" + expected + ">, got: <" + tested + ">. Failed on: ";
+
+ if (expected != tested)
+ {
+ if (expected == null || tested == null)
+ {
+ ExtendedAssert.fail(message + "Different classes or not both null.");
+ }
+
+
+ assertEquals(message + "Extensions", expected.getExtensions(), tested.getExtensions());
+ assertEquals(message + "Locales", expected.getLocales(), tested.getLocales());
+ assertEquals(message + "Modes", expected.getModes(), tested.getModes());
+ assertEquals(message + "Window states", expected.getWindowStates(), tested.getWindowStates());
+ }
+ }
+
+ protected static void assertEquals(V1PropertyDescription expected, V1PropertyDescription tested)
+ {
+ String message = "Expected: <" + expected + ">, got: <" + tested + ">. Failed on ";
+
+ if (expected != tested)
+ {
+ if (expected == null || tested == null)
+ {
+ ExtendedAssert.fail(message + "Different classes or not both null.");
+ }
+
+ assertEquals(message + "extensions.", expected.getExtensions(), tested.getExtensions());
+ assertEquals(message + "hint.", expected.getHint(), tested.getHint());
+ assertEquals(message + "label.", expected.getLabel(), tested.getLabel());
+ ExtendedAssert.assertEquals(message + "name.", expected.getName(), tested.getName());
+ ExtendedAssert.assertEquals(message + "type.", expected.getType(), tested.getType());
+ }
+ }
+
+ protected static void assertEquals(String message, V1LocalizedString expected, V1LocalizedString tested)
+ {
+ String precise = "Expected: <" + expected + ">, got: <" + tested + ">. Failed on ";
+
+ if (expected != tested)
+ {
+ if (expected == null || tested == null)
+ {
+ ExtendedAssert.fail(message + ": Different classes or not both null.");
+ }
+
+ ExtendedAssert.assertEquals(precise + "lang.", expected.getLang(), tested.getLang());
+ ExtendedAssert.assertEquals(precise + "resource name.", expected.getResourceName(), tested.getResourceName());
+ ExtendedAssert.assertEquals(precise + "value.", expected.getValue(), tested.getValue());
+ }
+ }
+
+ protected void checkException(Exception e, String errorCode)
+ {
+ Throwable cause = e.getCause();
+// ExtendedAssert.assertTrue(cause instanceof SOAPFaultException);
+// ExtendedAssert.assertEquals(errorCode, ((SOAPFaultException)cause).getFault().getLocalPart());
+ }
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/registration/RegistrationPropertyDescriptionTestCase.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/registration/RegistrationPropertyDescriptionTestCase.java (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/registration/RegistrationPropertyDescriptionTestCase.java 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, 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.registration;
+
+import junit.framework.TestCase;
+import org.gatein.wsrp.WSRPConstants;
+
+import javax.xml.namespace.QName;
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 12017 $
+ * @since 2.6
+ */
+public class RegistrationPropertyDescriptionTestCase extends TestCase
+{
+ private RegistrationPropertyDescription desc;
+
+ protected void setUp() throws Exception
+ {
+ desc = new RegistrationPropertyDescription("foo", WSRPConstants.XSD_STRING);
+ }
+
+ public void testNotify()
+ {
+ TestParent parent = new TestParent();
+ desc.setValueChangeListener(parent);
+ desc.setDefaultHint(null);
+ assertFalse(parent.notifyCalled);
+ parent.resetNotifyCalled();
+ desc.setDefaultHint("hint");
+ assertTrue(parent.notifyCalled);
+ }
+
+ public void testChangingNameUpdatesParent()
+ {
+ TestParent parent = new TestParent();
+ desc.setValueChangeListener(parent);
+ assertNotNull(parent.getRegistrationPropertyWith("foo"));
+
+ desc.setName(QName.valueOf("bar"));
+ assertEquals(desc, parent.getRegistrationPropertyWith("bar"));
+ assertNull(parent.getRegistrationPropertyWith("foo"));
+ }
+
+ public void testModifyIfNeeded()
+ {
+ String oldValue = "old";
+ String newValue = "new";
+ assertEquals(oldValue, desc.modifyIfNeeded(oldValue, oldValue));
+ assertEquals(newValue, desc.modifyIfNeeded(oldValue, newValue));
+ assertEquals(null, desc.modifyIfNeeded(null, null));
+ assertEquals(newValue, desc.modifyIfNeeded(null, newValue));
+ assertEquals(null, desc.modifyIfNeeded(oldValue, null));
+ }
+
+ public void testGetLang()
+ {
+ assertEquals(Locale.getDefault(), desc.getLang());
+ desc.setLabel(new LocalizedString("etiquette", Locale.FRENCH));
+ assertEquals(Locale.FRENCH, desc.getLang());
+ }
+
+ class TestParent implements ValueChangeListener
+ {
+ private boolean notifyCalled;
+
+ // prop name fakes the existence of a property as only one property exists for the tests
+ private String propName = "foo";
+
+ void resetNotifyCalled()
+ {
+ notifyCalled = false;
+ }
+
+ public RegistrationPropertyDescription getRegistrationPropertyWith(String name)
+ {
+ // return desc only if it matches the name we know about (used to fake property name updates)
+ if (propName.equals(name))
+ {
+ return desc;
+ }
+
+ return null;
+ }
+
+ public void valueHasChanged(RegistrationPropertyDescription originating, Object oldValue, Object newValue, boolean isName)
+ {
+ // fake updating the property map if the old name was foo...
+ String oldValueString = oldValue == null ? null : oldValue.toString();
+ if ("foo".equals(oldValueString))
+ {
+ // then set the prop name to the new property name
+ propName = originating.getName().getLocalPart();
+ }
+
+ notifyCalled = true;
+ }
+ }
+}
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/registration/RegistrationPropertyDescriptionTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/jboss-resources/jndi.properties
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/jboss-resources/jndi.properties (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/jboss-resources/jndi.properties 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming\:org.jnp.interfaces
+java.naming.provider.url=jnp://localhost:1099
Added: components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/META-INF/jboss-beans.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/META-INF/jboss-beans.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/META-INF/jboss-beans.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+<!--
+ <bean name="TestDriverServer" class="org.jboss.unit.remote.driver.RemoteTestDriverServer"/>
+
+ <bean name="TestDriverServerExporter"
+ class="org.jboss.portal.test.framework.impl.generic.server.GenericServiceExporter">
+ <constructor>
+ <parameter>socket://localhost:5400</parameter>
+ <parameter><inject bean="TestDriverServer"/></parameter>
+ <parameter>org.jboss.unit.remote.driver.RemoteTestDriver</parameter>
+ </constructor>
+ </bean>
+-->
+ <bean name="WSRPProducer" class="org.gatein.wsrp.producer.WSRPProducerImpl">
+ <constructor factoryClass="org.gatein.wsrp.producer.ProducerHolder" factoryMethod="getProducer">
+ <parameter>true</parameter>
+ </constructor>
+ <property name="portletInvoker"><inject bean="PortletInvoker"/></property>
+ <property name="registrationManager"><inject bean="RegistrationManagerService"/></property>
+ <property name="configurationService"><inject bean="ConfigurationService"/></property>
+ </bean>
+
+ <bean name="PortletInvoker" class="org.gatein.pc.portlet.state.producer.ProducerPortletInvoker">
+ <property name="next"><inject bean="ContainerPortletInvoker"/></property>
+ <property name="persistenceManager"><inject bean="ProducerPersistenceManagerService"/></property>
+ <property name="stateManagementPolicy"><inject bean="StateManagmentPolicyService"/></property>
+ <property name="stateConverter"><inject bean="StateConverterService"/></property>
+ </bean>
+
+ <!-- TODO: may need to write a new class for this -->
+ <bean name="ProducerPersistenceManagerService" class="org.gatein.pc.portlet.impl.state.producer.PortletStatePersistenceManagerService"/>
+
+ <bean name="StateManagmentPolicyService" class="org.gatein.pc.portlet.impl.state.StateManagementPolicyService">
+ <property name="persistLocally">true</property>
+ </bean>
+
+ <bean name="StateConverterService" class="org.gatein.pc.portlet.impl.state.StateConverterV0"/>
+
+ <bean name="RegistrationManagerService" class="org.gatein.registration.impl.RegistrationManagerImpl">
+ <property name="persistenceManager"><inject bean="RegistrationPersistenceManagerService"/></property>
+ </bean>
+
+ <!-- TODO: may need to write a new class for this -->
+ <bean name="RegistrationPersistenceManagerService" class="org.gatein.registration.impl.RegistrationPersistenceManagerImpl">
+ </bean>
+
+ <bean name="ConfigurationService" class="org.gatein.wsrp.config.FileSystemXmlProducerConfigWithReload">
+ <property name="configFile">conf/producer-config.xml</property>
+ <!-- <property name="configFile">/tmp/producer-config.xml</property> -->
+ </bean>
+
+ <bean name="SerletAccess" class="org.gatein.wsrp.servlet.ServletAccess"/>
+
+</deployment>
+
+ <!-- Dummy test WSRP Producer implementation -->
+<!-- <bean name="DummyWSRPProducer" class="org.gatein.wsrp.test.TestWSRPProducerImpl"/> -->
+
+ <!-- Hack to get access to req/resp -->
+<!-- <bean name="ServletAccess" class="org.gatein.wsrp.servlet.ServletAccessFilter"/> -->
+
+<!-- <bean name="ServiceFactory" class="org.gatein.wsrp.services.PerEndpointSOAPInvokerServiceFactory">
+ <property name="ServiceDescriptionURL">http://localhost:8080/test-wsrp-consumer/ServiceDescriptionService</property>
+ <property name="MarkupURL">http://localhost:8080/test-wsrp-consumer/MarkupService</property>
+ <property name="RegistrationURL">http://localhost:8080/test-wsrp-consumer/RegistrationService</property>
+ <property name="PortletManagementURL">http://localhost:8080/test-wsrp-consumer/PortletManagementService</property>
+ <property name="Env">
+ java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+ java.naming.provider.url=jnp://localhost:1099
+ java.naming.factory.url.pkgs=org.jboss.naming.client
+ j2ee.clientName=wsrp-client
+ </property>
+ <property name="PortJNDIMapping">
+ org.gatein.wsrp.core.WSRP_v1_ServiceDescription_PortType=java:comp/env/service/ServiceDescriptionService
+ org.gatein.wsrp.core.WSRP_v1_Markup_PortType=java:comp/env/service/MarkupService
+ org.gatein.wsrp.core.WSRP_v1_Registration_PortType=java:comp/env/service/RegistrationService
+ org.gatein.wsrp.core.WSRP_v1_PortletManagement_PortType=java:comp/env/service/PortletManagementService
+ </property>
+ </bean>
+
+ <bean name="CachingServiceFactory" class="CachingServiceFactory">
+ <property name="Delegate"><inject bean="ServiceFactory"/></property>
+ </bean>
+
+ <bean name="WSRPConsumer" class="org.gatein.wsrp.consumer.WSRPConsumerImpl">
+ <property name="ServiceFactory"><inject bean="CachingServiceFactory"/></property>
+ </bean>
+-->
+<!--</deployment> -->
Added: components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/conf/producer-config.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/conf/producer-config.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/conf/producer-config.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1 @@
+<producer-configuration/>
Added: components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/context.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/context.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/context.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,24 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<Context privileged="true">
+</Context>
Added: components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-beans.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-beans.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-beans.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="PortletApplicationDeployer" class="org.gatein.pc.mc.PortletApplicationDeployer">
+ <alias>PortletApplicationRegistry</alias>
+ <property name="servletContainerFactory"><inject bean="ServletContainerFactory"/></property>
+ <property name="containerPortletInvoker"><inject bean="ContainerPortletInvoker"/></property>
+ </bean>
+
+ <!-- The ServletContainerFactory -->
+ <bean name="ServletContainerFactory" class="org.gatein.wci.impl.DefaultServletContainerFactory">
+ <constructor factoryClass="org.gatein.wci.impl.DefaultServletContainerFactory" factoryMethod="getInstance"/>
+ </bean>
+
+ <!-- The servlet container obtained from the ServletContainerFactory -->
+ <bean name="ServletContainer" class="org.gatein.wci.ServletContainer">
+ <constructor factoryMethod="getServletContainer">
+ <factory bean="ServletContainerFactory"/>
+ </constructor>
+ </bean>
+
+ <!-- The producer persistence manager -->
+ <bean name="ProducerPersistenceManager" class="org.gatein.pc.portlet.impl.state.producer.PortletStatePersistenceManagerService"/>
+
+ <!-- The producer state management policy -->
+ <bean name="ProducerStateManagementPolicy" class="org.gatein.pc.portlet.impl.state.StateManagementPolicyService">
+ <property name="persistLocally"><value>true</value></property>
+ </bean>
+
+ <!-- The producer state converter -->
+ <bean name="ProducerStateConverter" class="org.gatein.pc.portlet.impl.state.StateConverterV0"/>
+
+ <!-- The consumer portlet invoker -->
+ <bean name="ConsumerPortletInvoker" class="org.gatein.pc.portlet.PortletInvokerInterceptor">
+ <property name="next"><inject bean="ConsumerCacheInterceptor"/></property>
+ </bean>
+ <bean name="ConsumerCacheInterceptor" class="org.gatein.pc.portlet.aspects.ConsumerCacheInterceptor">
+ <property name="next"><inject bean="PortletCustomizationInterceptor"/></property>
+ </bean>
+ <bean name="PortletCustomizationInterceptor" class="org.gatein.pc.portlet.aspects.PortletCustomizationInterceptor">
+ <property name="next"><inject bean="ProducerPortletInvoker"/></property>
+ </bean>
+
+ <!-- The producer portlet invoker -->
+ <bean name="ProducerPortletInvoker" class="org.gatein.pc.portlet.state.producer.ProducerPortletInvoker">
+ <property name="next"><inject bean="ContainerPortletInvoker"/></property>
+ <property name="persistenceManager"><inject bean="ProducerPersistenceManager"/></property>
+ <property name="stateManagementPolicy"><inject bean="ProducerStateManagementPolicy"/></property>
+ <property name="stateConverter"><inject bean="ProducerStateConverter"/></property>
+ </bean>
+
+ <!-- The portlet container invoker -->
+ <bean name="ContainerPortletInvoker" class="org.gatein.pc.portlet.container.ContainerPortletInvoker">
+ <property name="next"><inject bean="ValveInterceptor"/></property>
+ </bean>
+
+ <!-- Container stack -->
+ <bean name="ValveInterceptor" class="org.gatein.pc.portlet.aspects.ValveInterceptor">
+ <property name="portletApplicationRegistry"><inject bean="PortletApplicationRegistry" state="Instantiated"/></property>
+ <property name="next"><inject bean="SecureTransportInterceptor"/></property>
+ </bean>
+ <bean name="SecureTransportInterceptor" class="org.gatein.pc.portlet.aspects.SecureTransportInterceptor">
+ <property name="next"><inject bean="ContextDispatcherInterceptor"/></property>
+ </bean>
+ <bean name="ContextDispatcherInterceptor" class="org.gatein.pc.portlet.aspects.ContextDispatcherInterceptor">
+ <property name="servletContainerFactory"><inject bean="ServletContainerFactory"/></property>
+ <property name="next"><inject bean="ProducerCacheInterceptor"/></property>
+ </bean>
+ <bean name="ProducerCacheInterceptor" class="org.gatein.pc.portlet.aspects.ProducerCacheInterceptor">
+ <property name="next"><inject bean="CCPPInterceptor"/></property>
+ </bean>
+ <bean name="CCPPInterceptor" class="org.gatein.pc.portlet.aspects.CCPPInterceptor">
+ <property name="next"><inject bean="RequestAttributeConversationInterceptor"/></property>
+ </bean>
+ <bean name="RequestAttributeConversationInterceptor" class="org.gatein.pc.portlet.aspects.RequestAttributeConversationInterceptor">
+ <property name="next"><inject bean="EventPayloadInterceptor"/></property>
+ </bean>
+ <bean name="EventPayloadInterceptor" class="org.gatein.pc.portlet.aspects.EventPayloadInterceptor">
+ <property name="next"><inject bean="PortletContainerDispatcher"/></property>
+ </bean>
+ <bean name="PortletContainerDispatcher" class="org.gatein.pc.portlet.container.ContainerPortletDispatcher">
+ </bean>
+
+</deployment>
Added: components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/jboss-web.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<!DOCTYPE jboss-web PUBLIC
+ "-//JBoss//DTD Web Application 4.2//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
+<jboss-web>
+ <class-loading java2ClassLoadingCompliance="false">
+ <loader-repository>test:loader=portlet</loader-repository>
+ </class-loading>
+</jboss-web>
Added: components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/portlet-container.war/WEB-INF/web.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <servlet>
+ <servlet-name>ContainerServlet</servlet-name>
+ <servlet-class>org.gatein.wci.tomcat.TC6ContainerServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>PortalServlet</servlet-name>
+ <servlet-class>org.gatein.pc.test.PortalServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>PortalServlet</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+</web-app>
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2007, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Application Scope Set Test Portlet</portlet-name>
+ <display-name>Application Scope Set Test Portlet</display-name>
+ <portlet-class>org.gatein.wsrp.portlet.ApplicationScopeSetPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Application Scope Get Test Portlet</portlet-name>
+ <display-name>Application Scope Get Test Portlet</display-name>
+ <portlet-class>org.gatein.wsrp.portlet.ApplicationScopeGetPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-applicationscope-portlet-war/WEB-INF/web.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2007, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Simple Test Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.BasicPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+
+ <portlet-preferences>
+ <preference>
+ <name>prefName1</name>
+ <value>prefValue1</value>
+ </preference>
+ <preference>
+ <name>prefName2</name>
+ <value>prefValue2</value>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/web.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-basic-portlet-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Simple Test Dispatcher Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.DispatcherPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/web.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/index.jsp
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/index.jsp (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/index.jsp 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1 @@
+test
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-dispatcher-portlet-war/index.jsp
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Encode URL Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.EncodeURLPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/web.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-encodeurl-portlet-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Simple Test Get Locales Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.GetLocalesPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>No Declared Supported Locale Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.GetLocalesPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>Incorrect Supported Locale Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.GetLocalesPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>blah</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+
+</portlet-app>
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/web.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-getlocales-portlet-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Implicit Cloning Test Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.ImplicitCloningPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+
+ <portlet-preferences>
+ <preference>
+ <name>name</name>
+ <value>initial</value>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-implicitcloning-portlet-war/WEB-INF/web.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2007, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/jsp/help.jsp
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/jsp/help.jsp (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/jsp/help.jsp 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,24 @@
+<%--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
+
+<p>Sorry, no help is available.</p>
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/jsp/help.jsp
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Markup Test Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.MarkupPortlet</portlet-class>
+ <expiration-cache>15</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ <portlet-mode>edit</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+
+ <portlet-preferences>
+ <preference>
+ <name>prefName</name>
+ <value>prefValue</value>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/web.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-markup-portlet-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Multi-valued Test Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.MultiValuedPortlet</portlet-class>
+ <expiration-cache>15</expiration-cache>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-multivalued-portlet-war/WEB-INF/web.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Render Parameters Test Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.RenderParamPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>Render Parameters Test</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/web.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-renderparam-portlet-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Resource Test Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.ResourcePortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <portlet-info>
+ <title>Resource Test</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/WEB-INF/web.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/gif/logo.gif
===================================================================
(Binary files differ)
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resource-portlet-war/gif/logo.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Resource Non URL Encoded Test Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.ResourceNoEncodeURLPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <portlet-info>
+ <title>Non URL Encoded Resource Test</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/gif/logo.gif
===================================================================
(Binary files differ)
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-resourcenoencodeurl-portlet-war/gif/logo.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>Session Test Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.SessionPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>Session Test</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/web.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Property changes on: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-session-portlet-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/portlet.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/portlet.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
+ <portlet>
+ <portlet-name>UserContext Test Portlet</portlet-name>
+ <portlet-class>org.gatein.wsrp.portlet.UserContextPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <supported-locale>en</supported-locale>
+
+ <portlet-info>
+ <title>title</title>
+ </portlet-info>
+ </portlet>
+
+ <container-runtime-option>
+ <name>org.gatein.pc.remotable</name>
+ <value>true</value>
+ </container-runtime-option>
+</portlet-app>
\ No newline at end of file
Added: components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/web.xml (rev 0)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/test-portlets/test-usercontext-portlet-war/WEB-INF/web.xml 2010-06-15 18:36:05 UTC (rev 3339)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
14 years, 6 months
gatein SVN: r3338 - in components/wsrp/trunk: producer/src/main/java/org/gatein/wsrp/producer/v1 and 1 other directory.
by do-not-reply@jboss.org
Author: mwringe
Date: 2010-06-15 13:58:11 -0400 (Tue, 15 Jun 2010)
New Revision: 3338
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java
Log:
Filling in empty methods and adding corresponding converter methods.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-06-15 10:03:19 UTC (rev 3337)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-06-15 17:58:11 UTC (rev 3338)
@@ -41,6 +41,7 @@
import org.oasis.wsrp.v1.V1EmployerInfo;
import org.oasis.wsrp.v1.V1Extension;
import org.oasis.wsrp.v1.V1GetMarkup;
+import org.oasis.wsrp.v1.V1GetPortletDescription;
import org.oasis.wsrp.v1.V1GetPortletProperties;
import org.oasis.wsrp.v1.V1GetPortletPropertyDescription;
import org.oasis.wsrp.v1.V1GetServiceDescription;
@@ -92,6 +93,7 @@
import org.oasis.wsrp.v2.Extension;
import org.oasis.wsrp.v2.FailedPortlets;
import org.oasis.wsrp.v2.GetMarkup;
+import org.oasis.wsrp.v2.GetPortletDescription;
import org.oasis.wsrp.v2.GetPortletProperties;
import org.oasis.wsrp.v2.GetPortletPropertyDescription;
import org.oasis.wsrp.v2.GetServiceDescription;
@@ -1048,6 +1050,25 @@
return null;
}
}
+
+ public static GetPortletDescription toV2GetPortletDescription (V1GetPortletDescription getPortletDescription)
+ {
+ if (getPortletDescription != null)
+ {
+ RegistrationContext registrationContext = toV2RegistrationContext(getPortletDescription.getRegistrationContext());
+ PortletContext portletContext = toV2PortletContext(getPortletDescription.getPortletContext());
+ UserContext userContext = toV2UserContext(getPortletDescription.getUserContext());
+ GetPortletDescription result = WSRPTypeFactory.createGetPortletDescription(registrationContext, portletContext, userContext);
+
+ result.getDesiredLocales().addAll(getPortletDescription.getDesiredLocales());
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
public static class V1ToV2Extension implements Function<V1Extension, Extension>
{
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java 2010-06-15 10:03:19 UTC (rev 3337)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java 2010-06-15 17:58:11 UTC (rev 3338)
@@ -50,6 +50,7 @@
import org.oasis.wsrp.v1.V1PersonName;
import org.oasis.wsrp.v1.V1PortletContext;
import org.oasis.wsrp.v1.V1PortletDescription;
+import org.oasis.wsrp.v1.V1PortletDescriptionResponse;
import org.oasis.wsrp.v1.V1PortletPropertyDescriptionResponse;
import org.oasis.wsrp.v1.V1Postal;
import org.oasis.wsrp.v1.V1Property;
@@ -97,6 +98,7 @@
import org.oasis.wsrp.v2.PersonName;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.PortletDescriptionResponse;
import org.oasis.wsrp.v2.PortletPropertyDescriptionResponse;
import org.oasis.wsrp.v2.Postal;
import org.oasis.wsrp.v2.Property;
@@ -123,6 +125,8 @@
import org.oasis.wsrp.v2.UserContext;
import org.oasis.wsrp.v2.UserProfile;
+import sun.reflect.generics.visitor.Reifier;
+
import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.List;
@@ -977,11 +981,18 @@
{
if (blockingInteractionResponse != null)
{
+ V1BlockingInteractionResponse result;
V1UpdateResponse updateResponse = toV1UpdateResponse(blockingInteractionResponse.getUpdateResponse());
- V1BlockingInteractionResponse result = WSRP1TypeFactory.createBlockingInteractionResponse(updateResponse);
-
- result.setRedirectURL(blockingInteractionResponse.getRedirectURL());
-
+ String redirectURL = blockingInteractionResponse.getRedirectURL();
+ if (redirectURL != null)
+ {
+ result = WSRP1TypeFactory.createBlockingInteractionResponse(redirectURL);
+ }
+ else
+ {
+ result = WSRP1TypeFactory.createBlockingInteractionResponse(updateResponse);
+ }
+
List<V1Extension> extensions = WSRPUtils.transform(blockingInteractionResponse.getExtensions(), EXTENSION);
if (extensions != null)
{
@@ -1041,6 +1052,27 @@
}
}
+ public static V1PortletDescriptionResponse toV1PortletDescriptionResponse(PortletDescriptionResponse portletDescriptionResponse)
+ {
+ if (portletDescriptionResponse != null)
+ {
+ V1PortletDescriptionResponse result = WSRP1TypeFactory.createPortletDescriptionResponse(toV1PortletDescription(portletDescriptionResponse.getPortletDescription()));
+ result.setResourceList(toV1ResourceList(portletDescriptionResponse.getResourceList()));
+
+ List<V1Extension> extensions = WSRPUtils.transform(portletDescriptionResponse.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
private static class V2ToV1Extension implements Function<Extension, V1Extension>
{
public V1Extension apply(Extension from)
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java 2010-06-15 10:03:19 UTC (rev 3337)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java 2010-06-15 17:58:11 UTC (rev 3338)
@@ -83,6 +83,7 @@
import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.PortletDescriptionResponse;
import org.oasis.wsrp.v2.PortletPropertyDescriptionResponse;
import org.oasis.wsrp.v2.PortletStateChangeRequired;
import org.oasis.wsrp.v2.PropertyList;
@@ -242,7 +243,40 @@
public V1PortletDescriptionResponse getPortletDescription(V1GetPortletDescription getPortletDescription) throws V1AccessDenied, V1InvalidHandle, V1InvalidUserCategory, V1InconsistentParameters, V1MissingParameters, V1InvalidRegistration, V1OperationFailed
{
- throw new NotYetImplemented();
+ try
+ {
+ PortletDescriptionResponse portletDescriptionResponse = producer.getPortletDescription(V1ToV2Converter.toV2GetPortletDescription(getPortletDescription));
+ return V2ToV1Converter.toV1PortletDescriptionResponse(portletDescriptionResponse);
+ }
+ catch (AccessDenied accessDenied)
+ {
+ throw V2ToV1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ }
+ catch (InvalidHandle invalidHandle)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidHandle.class, invalidHandle);
+ }
+ catch (InvalidUserCategory invalidUserCategory)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidUserCategory.class, invalidUserCategory);
+ }
+ catch (InconsistentParameters inconsistentParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InconsistentParameters.class, inconsistentParameters);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class, missingParameters);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class, invalidRegistration);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
+
}
public V1MarkupResponse getMarkup(V1GetMarkup getMarkup) throws V1UnsupportedWindowState, V1InvalidCookie, V1InvalidSession, V1AccessDenied, V1InconsistentParameters, V1InvalidHandle, V1UnsupportedLocale, V1UnsupportedMode, V1OperationFailed, V1MissingParameters, V1InvalidUserCategory, V1InvalidRegistration, V1UnsupportedMimeType
14 years, 6 months
gatein SVN: r3337 - in epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US: Common_Content and 1 other directory.
by do-not-reply@jboss.org
Author: smumford
Date: 2010-06-15 06:03:19 -0400 (Tue, 15 Jun 2010)
New Revision: 3337
Modified:
epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Book_Info.xml
epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Common_Content/Legal_Notice.xml
epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Installation.xml
epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Revision_History.xml
Log:
JBEPP-380: Changes to installation section based on packaging call
Modified: epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Book_Info.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Book_Info.xml 2010-06-15 06:55:01 UTC (rev 3336)
+++ epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Book_Info.xml 2010-06-15 10:03:19 UTC (rev 3337)
@@ -4,7 +4,7 @@
%BOOK_ENTITIES;
]>
<bookinfo id="book-Site_Publisher_Release_Notes-Site_Publisher_Release_Notes">
- <title>Site Publisher Release Notes</title>
+ <title>Site Publisher Technical Preview Release Notes</title>
<subtitle>Release Notes for the JBoss Enterprise Portal Platform Site Publisher (powered by eXo) Technical Preview</subtitle>
<productname>JBoss Enterprise Portal Platform</productname>
<productnumber>5.0</productnumber>
Modified: epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Common_Content/Legal_Notice.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Common_Content/Legal_Notice.xml 2010-06-15 06:55:01 UTC (rev 3336)
+++ epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Common_Content/Legal_Notice.xml 2010-06-15 10:03:19 UTC (rev 3337)
@@ -9,9 +9,6 @@
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
</para>
<para>
- Web Content Manager (WCM) is a trademark of eXo Platform.
- </para>
- <para>
<trademark class="registered">Linux</trademark> is the registered trademark of Linus Torvalds in the United States and other countries.
</para>
<para>
Modified: epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Installation.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Installation.xml 2010-06-15 06:55:01 UTC (rev 3336)
+++ epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Installation.xml 2010-06-15 10:03:19 UTC (rev 3337)
@@ -5,12 +5,12 @@
]>
<chapter id="chap-Site_Publisher_Release_Notes-Installation">
<title>Installation</title>
- <note>
+<!-- <note>
<title>DOC NOTE</title>
<para>
The instructions below require tech review to ensure they are correct.
</para>
- </note>
+ </note> -->
<formalpara>
<title>Configuration Locations</title>
<para>
@@ -18,7 +18,7 @@
</para>
</formalpara>
<para>
- There are three possible locations for this configuration location depending on your &PRODUCT; configuration setup:
+ There are three possible locations for these configuration files depending on your &PRODUCT; configuration setup:
</para>
<variablelist>
<varlistentry>
@@ -67,16 +67,11 @@
</step>
<step>
<para>
- Download the <filename>exo-wcm-2.0.0-tech-preview-for-epp-5.0.0.GA.zip</filename> file from the Red Hat JBoss Customer Support Portal.
+ Download the <filename>exo-wcm-2.0.0-tech-preview-for-epp-5.0.0.GA.zip</filename> file from the Red Hat JBoss Customer Support Portal and extract the it to an appropriate location.
</para>
</step>
<step>
<para>
- Extract the Site Publisher package to an appropriate location. Ensure the path to this location does not contain any spaces.
- </para>
- </step>
- <step>
- <para>
Copy the following files from the extracted location to the configuration location of your &PRODUCT; installation (as discussed above).
</para>
<itemizedlist>
@@ -87,16 +82,6 @@
</listitem>
<listitem>
<para>
- <filename>gatein-ecmdemo-portal-2.0.0-GA.ear</filename>
- </para>
- </listitem>
- <listitem>
- <para>
- <filename>gatein-exo-workflow-2.0.0-GA.ear</filename>
- </para>
- </listitem>
- <listitem>
- <para>
<filename>gatein-ds.xml</filename>
</para>
</listitem>
@@ -118,6 +103,17 @@
</step>
<step>
<para>
+ <emphasis role="bold">Optional step</emphasis>:
+ </para>
+ <para>
+ The extracted location will also contain a file named <filename>gatein-ecmdemo-portal-2.0.0-GA.ear</filename>. This file provides a sample portal and is not required for the Site Publisher add-on to operate.
+ </para>
+ <para>
+ Copying this file to the configuration location used in the previous step, however, will include a sample portal which can verify a successful installation of the Site Publisher component.
+ </para>
+ </step>
+ <step>
+ <para>
Start &PRODUCT; using your established method, the procedures outlined in the &PRODUCT; &VERSION; Installation Guide or by following the steps below.
</para>
<procedure>
@@ -147,5 +143,25 @@
</step>
</procedure>
</step>
+ <step>
+ <para>
+ If you included the <filename>gatein-ecmdemo-portal-2.0.0-GA.ear</filename> file from step five (5), navigate to <ulink type="http" url="http://localhost:8080/ecmdemo">http://localhost:8080/ecmdemo</ulink>.
+ </para>
+ <para>
+ If your installation has been successful, you will see the following homepage for the sample company, <emphasis role="bold">Acme Corp</emphasis>:
+ </para>
+ <mediaobject>
+ <imageobject role="html">
+ <imagedata fileref="images/ecmdemo.png" format="PNG" align="center" scale="90" />
+ </imageobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/ecmdemo.png" format="PNG" align="center" contentwidth="150mm" />
+ </imageobject>
+ </mediaobject>
+ <para>
+ If you did not include the <filename>gatein-ecmdemo-portal-2.0.0-GA.ear</filename> file, refer to the documentation discussed in <xref linkend="chap-Site_Publisher_Release_Notes-Documentation"/> for instructions on how to create a portal using Site Publisher's features.
+ </para>
+ </step>
+
</procedure>
</chapter>
Modified: epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Revision_History.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Revision_History.xml 2010-06-15 06:55:01 UTC (rev 3336)
+++ epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Revision_History.xml 2010-06-15 10:03:19 UTC (rev 3337)
@@ -8,8 +8,26 @@
<simpara>
<revhistory>
<revision>
+ <revnumber>1.6</revnumber>
+ <date>Tue Jun 15 2010</date>
+ <author>
+ <firstname>Scott</firstname>
+ <surname>Mumford</surname>
+ <email>smumford(a)redhat.com</email>
+
+ </author>
+ <revdescription>
+ <simplelist>
+ <member>Remove references to deprecated file and add information about the bundled sample portal.</member>
+
+ </simplelist>
+
+ </revdescription>
+
+ </revision>
+ <revision>
<revnumber>1.5</revnumber>
- <date>Mon Jun 15 2010</date>
+ <date>Tue Jun 15 2010</date>
<author>
<firstname>Scott</firstname>
<surname>Mumford</surname>
14 years, 6 months
gatein SVN: r3336 - in components/wsrp/trunk: producer/src/main/java/org/gatein/wsrp/producer/v1 and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-06-15 02:55:01 -0400 (Tue, 15 Jun 2010)
New Revision: 3336
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java
Log:
- Minor clean-up.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-06-15 06:24:46 UTC (rev 3335)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-06-15 06:55:01 UTC (rev 3336)
@@ -31,7 +31,6 @@
import org.gatein.wsrp.WSRPExceptionFactory;
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
-import org.oasis.wsrp.v1.V1BlockingInteractionResponse;
import org.oasis.wsrp.v1.V1CacheControl;
import org.oasis.wsrp.v1.V1ClientData;
import org.oasis.wsrp.v1.V1ClonePortlet;
@@ -83,7 +82,6 @@
import org.oasis.wsrp.v1.V1UploadContext;
import org.oasis.wsrp.v1.V1UserContext;
import org.oasis.wsrp.v1.V1UserProfile;
-import org.oasis.wsrp.v2.BlockingInteractionResponse;
import org.oasis.wsrp.v2.CacheControl;
import org.oasis.wsrp.v2.ClientData;
import org.oasis.wsrp.v2.ClonePortlet;
@@ -878,7 +876,7 @@
return null;
}
}
-
+
public static GetMarkup toV2GetMarkup(V1GetMarkup getMarkup)
{
if (getMarkup != null)
@@ -887,10 +885,10 @@
RuntimeContext runtimeContext = toV2RuntimeContext(getMarkup.getRuntimeContext());
MarkupParams markupParams = toV2MarkupParams(getMarkup.getMarkupParams());
GetMarkup result = WSRPTypeFactory.createMarkupRequest(portletContext, runtimeContext, markupParams);
-
+
result.setRegistrationContext(toV2RegistrationContext(getMarkup.getRegistrationContext()));
result.setUserContext(toV2UserContext(getMarkup.getUserContext()));
-
+
return result;
}
else
@@ -914,7 +912,7 @@
return null;
}
}
-
+
public static ClonePortlet toV2ClonePortlet(V1ClonePortlet clonePortlet)
{
if (clonePortlet != null)
@@ -931,7 +929,7 @@
return null;
}
}
-
+
public static PerformBlockingInteraction toV2PerformBlockingInteraction(V1PerformBlockingInteraction performBlockingInteraction)
{
if (performBlockingInteraction != null)
@@ -940,12 +938,12 @@
MarkupParams markupParams = toV2MarkupParams(performBlockingInteraction.getMarkupParams());
PortletContext portletContext = toV2PortletContext(performBlockingInteraction.getPortletContext());
RuntimeContext runtimeContext = toV2RuntimeContext(performBlockingInteraction.getRuntimeContext());
-
+
PerformBlockingInteraction result = WSRPTypeFactory.createPerformBlockingInteraction(portletContext, runtimeContext, markupParams, interactionParams);
-
+
result.setRegistrationContext(toV2RegistrationContext(performBlockingInteraction.getRegistrationContext()));
result.setUserContext(toV2UserContext(performBlockingInteraction.getUserContext()));
-
+
return result;
}
else
@@ -953,13 +951,13 @@
return null;
}
}
-
+
public static DestroyPortlets toV2DestroyPortlets(V1DestroyPortlets destroyPortlets)
{
if (destroyPortlets != null)
{
RegistrationContext registrationContext = toV2RegistrationContext(destroyPortlets.getRegistrationContext());
- DestroyPortlets result = WSRPTypeFactory.createDestroyPortlets(registrationContext, destroyPortlets.getPortletHandles());
+ DestroyPortlets result = WSRPTypeFactory.createDestroyPortlets(registrationContext, destroyPortlets.getPortletHandles());
return result;
}
else
@@ -967,7 +965,7 @@
return null;
}
}
-
+
public static SetPortletProperties toV2SetPortletProperties(V1SetPortletProperties setPortletProperties)
{
if (setPortletProperties != null)
@@ -975,8 +973,8 @@
RegistrationContext registrationContext = toV2RegistrationContext(setPortletProperties.getRegistrationContext());
PortletContext portletContext = toV2PortletContext(setPortletProperties.getPortletContext());
PropertyList propertyList = toV2PropertyList(setPortletProperties.getPropertyList());
- SetPortletProperties result = WSRPTypeFactory.createSetPortletProperties(registrationContext, portletContext, propertyList);
-
+ SetPortletProperties result = WSRPTypeFactory.createSetPortletProperties(registrationContext, portletContext, propertyList);
+
result.setUserContext(toV2UserContext(setPortletProperties.getUserContext()));
return result;
@@ -986,7 +984,7 @@
return null;
}
}
-
+
public static GetPortletProperties toV2GetPortletProperties(V1GetPortletProperties getPortletProperties)
{
if (getPortletProperties != null)
@@ -1003,14 +1001,14 @@
return null;
}
}
-
+
public static ReleaseSessions toV2ReleaseSessions(V1ReleaseSessions releaseSessions)
{
if (releaseSessions != null)
{
RegistrationContext registrationContext = toV2RegistrationContext(releaseSessions.getRegistrationContext());
ReleaseSessions result = WSRPTypeFactory.createReleaseSessions(registrationContext, releaseSessions.getSessionIDs());
-
+
return result;
}
else
@@ -1018,7 +1016,7 @@
return null;
}
}
-
+
public static InitCookie toV2InitCookie(V1InitCookie initCookie)
{
if (initCookie != null)
@@ -1033,7 +1031,7 @@
return null;
}
}
-
+
public static GetPortletPropertyDescription toV2GetPortletPropertyDescription(V1GetPortletPropertyDescription getPortletPropertyDescription)
{
if (getPortletPropertyDescription != null)
@@ -1042,7 +1040,7 @@
PortletContext portletContext = toV2PortletContext(getPortletPropertyDescription.getPortletContext());
UserContext userContext = toV2UserContext(getPortletPropertyDescription.getUserContext());
GetPortletPropertyDescription result = WSRPTypeFactory.createGetPortletPropertyDescription(registrationContext, portletContext, userContext, getPortletPropertyDescription.getDesiredLocales());
-
+
return result;
}
else
@@ -1050,7 +1048,7 @@
return null;
}
}
-
+
public static class V1ToV2Extension implements Function<V1Extension, Extension>
{
public Extension apply(V1Extension from)
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java 2010-06-15 06:24:46 UTC (rev 3335)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java 2010-06-15 06:55:01 UTC (rev 3336)
@@ -26,7 +26,6 @@
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import org.gatein.common.util.ParameterValidation;
-import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
import org.oasis.wsrp.v1.V1BlockingInteractionResponse;
import org.oasis.wsrp.v1.V1CacheControl;
@@ -37,8 +36,6 @@
import org.oasis.wsrp.v1.V1DestroyPortletsResponse;
import org.oasis.wsrp.v1.V1EmployerInfo;
import org.oasis.wsrp.v1.V1Extension;
-import org.oasis.wsrp.v1.V1Fault;
-import org.oasis.wsrp.v1.V1GetPortletPropertyDescription;
import org.oasis.wsrp.v1.V1InteractionParams;
import org.oasis.wsrp.v1.V1ItemDescription;
import org.oasis.wsrp.v1.V1LocalizedString;
@@ -86,7 +83,6 @@
import org.oasis.wsrp.v2.EmployerInfo;
import org.oasis.wsrp.v2.Extension;
import org.oasis.wsrp.v2.FailedPortlets;
-import org.oasis.wsrp.v2.GetPortletPropertyDescription;
import org.oasis.wsrp.v2.InteractionParams;
import org.oasis.wsrp.v2.ItemDescription;
import org.oasis.wsrp.v2.LocalizedString;
@@ -914,7 +910,7 @@
return null;
}
}
-
+
public static V1MarkupResponse toV1MarkupResponse(MarkupResponse markupResponse)
{
if (markupResponse != null)
@@ -935,19 +931,19 @@
return null;
}
}
-
+
public static V1ReturnAny toV1ReturnAny(ReturnAny returnAny)
{
if (returnAny != null)
{
V1ReturnAny result = new V1ReturnAny();
-
+
List<V1Extension> extensions = WSRPUtils.transform(returnAny.getExtensions(), EXTENSION);
if (extensions != null)
{
result.getExtensions().addAll(extensions);
}
-
+
return result;
}
else
@@ -962,13 +958,13 @@
{
V1RegistrationState result = new V1RegistrationState();
result.setRegistrationState(registrationState.getRegistrationState());
-
+
List<V1Extension> extensions = WSRPUtils.transform(registrationState.getExtensions(), EXTENSION);
if (extensions != null)
{
result.getExtensions().addAll(extensions);
}
-
+
return result;
}
else
@@ -976,22 +972,22 @@
return null;
}
}
-
+
public static V1BlockingInteractionResponse toV1BlockingInteractionResponse(BlockingInteractionResponse blockingInteractionResponse)
{
if (blockingInteractionResponse != null)
{
V1UpdateResponse updateResponse = toV1UpdateResponse(blockingInteractionResponse.getUpdateResponse());
V1BlockingInteractionResponse result = WSRP1TypeFactory.createBlockingInteractionResponse(updateResponse);
-
+
result.setRedirectURL(blockingInteractionResponse.getRedirectURL());
-
+
List<V1Extension> extensions = WSRPUtils.transform(blockingInteractionResponse.getExtensions(), EXTENSION);
if (extensions != null)
{
result.getExtensions().addAll(extensions);
}
-
+
return result;
}
else
@@ -999,12 +995,12 @@
return null;
}
}
-
+
public static V1DestroyPortletsResponse toV1DestroyPortlesResponse(DestroyPortletsResponse destroyPortletResponse)
{
if (destroyPortletResponse != null)
{
-
+
List<V1DestroyFailed> destroyedFailed = WSRPUtils.transform(destroyPortletResponse.getFailedPortlets(), FAILEDPORTLET);
V1DestroyPortletsResponse result = WSRP1TypeFactory.createDestroyPortletsResponse(destroyedFailed);
@@ -1013,7 +1009,7 @@
{
result.getExtensions().addAll(extensions);
}
-
+
return result;
}
else
@@ -1021,7 +1017,7 @@
return null;
}
}
-
+
public static V1PortletPropertyDescriptionResponse toV1PortletPropertyDescriptionResponse(PortletPropertyDescriptionResponse portletPropertyDescriptionResponse)
{
if (portletPropertyDescriptionResponse != null)
@@ -1030,13 +1026,13 @@
V1PortletPropertyDescriptionResponse result = new V1PortletPropertyDescriptionResponse();
result.setModelDescription(toV1ModelDescription(portletPropertyDescriptionResponse.getModelDescription()));
result.setResourceList(toV1ResourceList(portletPropertyDescriptionResponse.getResourceList()));
-
+
List<V1Extension> extensions = WSRPUtils.transform(portletPropertyDescriptionResponse.getExtensions(), EXTENSION);
if (extensions != null)
{
result.getExtensions().addAll(extensions);
}
-
+
return result;
}
else
@@ -1044,7 +1040,7 @@
return null;
}
}
-
+
private static class V2ToV1Extension implements Function<Extension, V1Extension>
{
public V1Extension apply(Extension from)
@@ -1336,7 +1332,7 @@
}
}
}
-
+
private static class V2ToV1FailedPortlets implements Function<FailedPortlets, V1DestroyFailed>
{
public V1ResetProperty apply(ResetProperty from)
@@ -1360,5 +1356,5 @@
return null;
}
}
-
+
}
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java 2010-06-15 06:24:46 UTC (rev 3335)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java 2010-06-15 06:55:01 UTC (rev 3336)
@@ -23,26 +23,20 @@
package org.gatein.wsrp.producer.v1;
-import java.security.AccessControlException;
-import java.util.List;
-
import org.gatein.common.NotYetImplemented;
import org.gatein.pc.api.PortletInvoker;
import org.gatein.registration.RegistrationManager;
-import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.producer.ProducerHolder;
import org.gatein.wsrp.producer.WSRPProducer;
import org.gatein.wsrp.producer.config.ProducerConfigurationService;
import org.gatein.wsrp.producer.v2.WSRP2Producer;
import org.gatein.wsrp.spec.v1.V1ToV2Converter;
import org.gatein.wsrp.spec.v1.V2ToV1Converter;
-import org.gatein.wsrp.spec.v1.V2ToV1Converter.V2ToV1NamedString;
import org.oasis.wsrp.v1.V1AccessDenied;
import org.oasis.wsrp.v1.V1BlockingInteractionResponse;
import org.oasis.wsrp.v1.V1ClonePortlet;
import org.oasis.wsrp.v1.V1DestroyPortlets;
import org.oasis.wsrp.v1.V1DestroyPortletsResponse;
-import org.oasis.wsrp.v1.V1Extension;
import org.oasis.wsrp.v1.V1GetMarkup;
import org.oasis.wsrp.v1.V1GetPortletDescription;
import org.oasis.wsrp.v1.V1GetPortletProperties;
@@ -211,8 +205,8 @@
{
try
{
- ReturnAny returnAny = producer.deregister(V1ToV2Converter.toV2RegistrationContext(deregister));
- return V2ToV1Converter.toV1ReturnAny(returnAny);
+ ReturnAny returnAny = producer.deregister(V1ToV2Converter.toV2RegistrationContext(deregister));
+ return V2ToV1Converter.toV1ReturnAny(returnAny);
}
catch (InvalidRegistration invalidRegistration)
{
@@ -228,8 +222,8 @@
{
try
{
- RegistrationState registrationState = producer.modifyRegistration(V1ToV2Converter.toV2ModifyRegistration(modifyRegistration));
- return V2ToV1Converter.toV1RegistrationState(registrationState);
+ RegistrationState registrationState = producer.modifyRegistration(V1ToV2Converter.toV2ModifyRegistration(modifyRegistration));
+ return V2ToV1Converter.toV1RegistrationState(registrationState);
}
catch (MissingParameters missingParameters)
{
@@ -243,7 +237,7 @@
{
throw V2ToV1Converter.toV1Exception(V1MissingParameters.class, invalidRegistration);
}
-
+
}
public V1PortletDescriptionResponse getPortletDescription(V1GetPortletDescription getPortletDescription) throws V1AccessDenied, V1InvalidHandle, V1InvalidUserCategory, V1InconsistentParameters, V1MissingParameters, V1InvalidRegistration, V1OperationFailed
@@ -255,8 +249,8 @@
{
try
{
- MarkupResponse markupResponse = producer.getMarkup(V1ToV2Converter.toV2GetMarkup(getMarkup));
- return V2ToV1Converter.toV1MarkupResponse(markupResponse);
+ MarkupResponse markupResponse = producer.getMarkup(V1ToV2Converter.toV2GetMarkup(getMarkup));
+ return V2ToV1Converter.toV1MarkupResponse(markupResponse);
}
catch (UnsupportedMimeType unsupportedMimeType)
{
@@ -316,8 +310,8 @@
{
try
{
- PortletContext portletContext = producer.clonePortlet(V1ToV2Converter.toV2ClonePortlet(clonePortlet));
- return V2ToV1Converter.toV1PortletContext(portletContext);
+ PortletContext portletContext = producer.clonePortlet(V1ToV2Converter.toV2ClonePortlet(clonePortlet));
+ return V2ToV1Converter.toV1PortletContext(portletContext);
}
catch (AccessDenied accessDenied)
{
@@ -563,8 +557,8 @@
{
try
{
- PortletPropertyDescriptionResponse portletPropertyDescriptionResponse = producer.getPortletPropertyDescription(V1ToV2Converter.toV2GetPortletPropertyDescription(getPortletPropertyDescription));
- return V2ToV1Converter.toV1PortletPropertyDescriptionResponse(portletPropertyDescriptionResponse);
+ PortletPropertyDescriptionResponse portletPropertyDescriptionResponse = producer.getPortletPropertyDescription(V1ToV2Converter.toV2GetPortletPropertyDescription(getPortletPropertyDescription));
+ return V2ToV1Converter.toV1PortletPropertyDescriptionResponse(portletPropertyDescriptionResponse);
}
catch (MissingParameters missingParameters)
{
14 years, 6 months