text
stringlengths
30
1.67M
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1CacheControl { protected int expires ; @ XmlElement ( required = true ) protected String userScope ; protected String validateTag ; protected List < V1Extension > extensions ; public int getExpires ( ) { return expires ; } public void setExpires ( int value ) { this . expires = value ; } public String getUserScope ( ) { return userScope ; } public void setUserScope ( String value ) { this . userScope = value ; } public String getValidateTag ( ) { return validateTag ; } public void setValidateTag ( String value ) { this . validateTag = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1RuntimeContext { @ XmlElement ( required = true ) protected String userAuthentication ; protected String portletInstanceKey ; protected String namespacePrefix ; protected V1Templates templates ; protected String sessionID ; protected List < V1Extension > extensions ; public String getUserAuthentication ( ) { return userAuthentication ; } public void setUserAuthentication ( String value ) { this . userAuthentication = value ; } public String getPortletInstanceKey ( ) { return portletInstanceKey ; } public void setPortletInstanceKey ( String value ) { this . portletInstanceKey = value ; } public String getNamespacePrefix ( ) { return namespacePrefix ; } public void setNamespacePrefix ( String value ) { this . namespacePrefix = value ; } public V1Templates getTemplates ( ) { return templates ; } public void setTemplates ( V1Templates value ) { this . templates = value ; } public String getSessionID ( ) { return sessionID ; } public void setSessionID ( String value ) { this . sessionID = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1InteractionParams { @ XmlElement ( required = true ) protected V1StateChange portletStateChange ; protected String interactionState ; protected List < V1NamedString > formParameters ; protected List < V1UploadContext > uploadContexts ; protected List < V1Extension > extensions ; public V1StateChange getPortletStateChange ( ) { return portletStateChange ; } public void setPortletStateChange ( V1StateChange value ) { this . portletStateChange = value ; } public String getInteractionState ( ) { return interactionState ; } public void setInteractionState ( String value ) { this . interactionState = value ; } public List < V1NamedString > getFormParameters ( ) { if ( formParameters == null ) { formParameters = new ArrayList < V1NamedString > ( ) ; } return this . formParameters ; } public List < V1UploadContext > getUploadContexts ( ) { if ( uploadContexts == null ) { uploadContexts = new ArrayList < V1UploadContext > ( ) ; } return this . uploadContexts ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlRootElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" } ) @ XmlRootElement ( name = "<STR_LIT>" ) public class V1GetServiceDescription { @ XmlElement ( required = true , nillable = true ) protected V1RegistrationContext registrationContext ; protected List < String > desiredLocales ; public V1RegistrationContext getRegistrationContext ( ) { return registrationContext ; } public void setRegistrationContext ( V1RegistrationContext value ) { this . registrationContext = value ; } public List < String > getDesiredLocales ( ) { if ( desiredLocales == null ) { desiredLocales = new ArrayList < String > ( ) ; } return this . desiredLocales ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" } ) public class V1ReturnAny { protected List < V1Extension > extensions ; public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlAttribute ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT:description>" , "<STR_LIT>" } ) public class V1ItemDescription { @ XmlElement ( required = true ) protected V1LocalizedString description ; protected List < V1Extension > extensions ; @ XmlAttribute ( required = true ) protected String itemName ; public V1LocalizedString getDescription ( ) { return description ; } public void setDescription ( V1LocalizedString value ) { this . description = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } public String getItemName ( ) { return itemName ; } public void setItemName ( String value ) { this . itemName = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1MarkupContext { @ XmlElement ( defaultValue = "<STR_LIT:false>" ) protected Boolean useCachedMarkup ; protected String mimeType ; protected String markupString ; protected byte [ ] markupBinary ; protected String locale ; @ XmlElement ( defaultValue = "<STR_LIT:false>" ) protected Boolean requiresUrlRewriting ; protected V1CacheControl cacheControl ; protected String preferredTitle ; protected List < V1Extension > extensions ; public Boolean isUseCachedMarkup ( ) { return useCachedMarkup ; } public void setUseCachedMarkup ( Boolean value ) { this . useCachedMarkup = value ; } public String getMimeType ( ) { return mimeType ; } public void setMimeType ( String value ) { this . mimeType = value ; } public String getMarkupString ( ) { return markupString ; } public void setMarkupString ( String value ) { this . markupString = value ; } public byte [ ] getMarkupBinary ( ) { return markupBinary ; } public void setMarkupBinary ( byte [ ] value ) { this . markupBinary = ( ( byte [ ] ) value ) ; } public String getLocale ( ) { return locale ; } public void setLocale ( String value ) { this . locale = value ; } public Boolean isRequiresUrlRewriting ( ) { return requiresUrlRewriting ; } public void setRequiresUrlRewriting ( Boolean value ) { this . requiresUrlRewriting = value ; } public V1CacheControl getCacheControl ( ) { return cacheControl ; } public void setCacheControl ( V1CacheControl value ) { this . cacheControl = value ; } public String getPreferredTitle ( ) { return preferredTitle ; } public void setPreferredTitle ( String value ) { this . preferredTitle = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" } ) public class V1DestroyFailed { @ XmlElement ( required = true ) protected String portletHandle ; @ XmlElement ( required = true ) protected String reason ; public String getPortletHandle ( ) { return portletHandle ; } public void setPortletHandle ( String value ) { this . portletHandle = value ; } public String getReason ( ) { return reason ; } public void setReason ( String value ) { this . reason = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . ws . WebFault ; @ WebFault ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public class V1InvalidCookie extends Exception { private V1InvalidCookieFault faultInfo ; public V1InvalidCookie ( String message , V1InvalidCookieFault faultInfo ) { super ( message ) ; this . faultInfo = faultInfo ; } public V1InvalidCookie ( String message , V1InvalidCookieFault faultInfo , Throwable cause ) { super ( message , cause ) ; this . faultInfo = faultInfo ; } public V1InvalidCookieFault getFaultInfo ( ) { return faultInfo ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . List ; import javax . jws . WebMethod ; import javax . jws . WebParam ; import javax . jws . WebService ; import javax . xml . ws . Holder ; import javax . xml . ws . RequestWrapper ; import javax . xml . ws . ResponseWrapper ; @ WebService ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public interface WSRPV1RegistrationPortType { @ WebMethod ( action = "<STR_LIT>" ) @ RequestWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) @ ResponseWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) public void register ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) String consumerName , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) String consumerAgent , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) boolean methodGetSupported , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > consumerModes , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > consumerWindowStates , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > consumerUserScopes , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > customUserProfileData , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < V1Property > registrationProperties , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . INOUT ) Holder < List < V1Extension > > extensions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < String > registrationHandle , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < byte [ ] > registrationState ) throws V1MissingParameters , V1OperationFailed ; @ WebMethod ( action = "<STR_LIT>" ) @ RequestWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) @ ResponseWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) public void deregister ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) String registrationHandle , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) byte [ ] registrationState , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . INOUT ) Holder < List < V1Extension > > extensions ) throws V1InvalidRegistration , V1OperationFailed ; @ WebMethod ( action = "<STR_LIT>" ) @ RequestWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) @ ResponseWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) public void modifyRegistration ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationData registrationData , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < byte [ ] > registrationState , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1Extension > > extensions ) throws V1InvalidRegistration , V1MissingParameters , V1OperationFailed ; } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" } ) public class V1RegistrationState { protected byte [ ] registrationState ; protected List < V1Extension > extensions ; public byte [ ] getRegistrationState ( ) { return registrationState ; } public void setRegistrationState ( byte [ ] value ) { this . registrationState = ( ( byte [ ] ) value ) ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> @ javax . xml . bind . annotation . XmlSchema ( namespace = "<STR_LIT>" , elementFormDefault = javax . xml . bind . annotation . XmlNsForm . QUALIFIED ) package org . oasis . wsrp . v1 ; </s>
<s> package org . oasis . wsrp . v1 ; import java . util . List ; import javax . jws . WebMethod ; import javax . jws . WebParam ; import javax . jws . WebService ; import javax . xml . ws . Holder ; import javax . xml . ws . RequestWrapper ; import javax . xml . ws . ResponseWrapper ; @ WebService ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public interface WSRPV1PortletManagementPortType { @ WebMethod ( action = "<STR_LIT>" ) @ RequestWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) @ ResponseWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) public void getPortletDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < V1PortletDescription > portletDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < V1ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1Extension > > extensions ) throws V1AccessDenied , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1MissingParameters , V1OperationFailed ; @ WebMethod ( action = "<STR_LIT>" ) @ RequestWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) @ ResponseWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) public void clonePortlet ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < String > portletHandle , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < byte [ ] > portletState , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1Extension > > extensions ) throws V1AccessDenied , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1MissingParameters , V1OperationFailed ; @ WebMethod ( action = "<STR_LIT>" ) @ RequestWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) @ ResponseWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) public void destroyPortlets ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > portletHandles , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1DestroyFailed > > destroyFailed , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1Extension > > extensions ) throws V1InconsistentParameters , V1InvalidRegistration , V1MissingParameters , V1OperationFailed ; @ WebMethod ( action = "<STR_LIT>" ) @ RequestWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) @ ResponseWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) public void setPortletProperties ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1PropertyList propertyList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < String > portletHandle , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < byte [ ] > portletState , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1Extension > > extensions ) throws V1AccessDenied , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1MissingParameters , V1OperationFailed ; @ WebMethod ( action = "<STR_LIT>" ) @ RequestWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) @ ResponseWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) public void getPortletProperties ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > names , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1Property > > properties , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1ResetProperty > > resetProperties , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1Extension > > extensions ) throws V1AccessDenied , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1MissingParameters , V1OperationFailed ; @ WebMethod ( action = "<STR_LIT>" ) @ RequestWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) @ ResponseWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) public void getPortletPropertyDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < V1ModelDescription > modelDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < V1ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1Extension > > extensions ) throws V1AccessDenied , V1InconsistentParameters , V1InvalidHandle , V1InvalidRegistration , V1InvalidUserCategory , V1MissingParameters , V1OperationFailed ; } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1UnsupportedLocaleFault extends V1Fault { } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlRootElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) @ XmlRootElement ( name = "<STR_LIT>" ) public class V1GetPortletProperties { @ XmlElement ( required = true , nillable = true ) protected V1RegistrationContext registrationContext ; @ XmlElement ( required = true ) protected V1PortletContext portletContext ; @ XmlElement ( required = true , nillable = true ) protected V1UserContext userContext ; @ XmlElement ( required = true , nillable = true ) protected List < String > names ; public V1RegistrationContext getRegistrationContext ( ) { return registrationContext ; } public void setRegistrationContext ( V1RegistrationContext value ) { this . registrationContext = value ; } public V1PortletContext getPortletContext ( ) { return portletContext ; } public void setPortletContext ( V1PortletContext value ) { this . portletContext = value ; } public V1UserContext getUserContext ( ) { return userContext ; } public void setUserContext ( V1UserContext value ) { this . userContext = value ; } public List < String > getNames ( ) { if ( names == null ) { names = new ArrayList < String > ( ) ; } return this . names ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . ws . WebFault ; @ WebFault ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public class V1MissingParameters extends Exception { private V1MissingParametersFault faultInfo ; public V1MissingParameters ( String message , V1MissingParametersFault faultInfo ) { super ( message ) ; this . faultInfo = faultInfo ; } public V1MissingParameters ( String message , V1MissingParametersFault faultInfo , Throwable cause ) { super ( message , cause ) ; this . faultInfo = faultInfo ; } public V1MissingParametersFault getFaultInfo ( ) { return faultInfo ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlEnum ; import javax . xml . bind . annotation . XmlEnumValue ; import javax . xml . bind . annotation . XmlType ; @ XmlType ( name = "<STR_LIT>" ) @ XmlEnum public enum V1CookieProtocol { @ XmlEnumValue ( "<STR_LIT:none>" ) NONE ( "<STR_LIT:none>" ) , @ XmlEnumValue ( "<STR_LIT>" ) PER_USER ( "<STR_LIT>" ) , @ XmlEnumValue ( "<STR_LIT>" ) PER_GROUP ( "<STR_LIT>" ) ; private final String value ; V1CookieProtocol ( String v ) { value = v ; } public String value ( ) { return value ; } public static V1CookieProtocol fromValue ( String v ) { for ( V1CookieProtocol c : V1CookieProtocol . values ( ) ) { if ( c . value . equals ( v ) ) { return c ; } } throw new IllegalArgumentException ( v ) ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . List ; import javax . jws . WebMethod ; import javax . jws . WebParam ; import javax . jws . WebResult ; import javax . jws . WebService ; import javax . xml . ws . Holder ; import javax . xml . ws . RequestWrapper ; import javax . xml . ws . ResponseWrapper ; @ WebService ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public interface WSRPV1MarkupPortType { @ WebMethod ( action = "<STR_LIT>" ) @ RequestWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) @ ResponseWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) public void getMarkup ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RuntimeContext runtimeContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1MarkupParams markupParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < V1MarkupContext > markupContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < V1SessionContext > sessionContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1Extension > > extensions ) throws V1AccessDenied , V1InconsistentParameters , V1InvalidCookie , V1InvalidHandle , V1InvalidRegistration , V1InvalidSession , V1InvalidUserCategory , V1MissingParameters , V1OperationFailed , V1UnsupportedLocale , V1UnsupportedMimeType , V1UnsupportedMode , V1UnsupportedWindowState ; @ WebMethod ( action = "<STR_LIT>" ) @ RequestWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) @ ResponseWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) public void performBlockingInteraction ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1PortletContext portletContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RuntimeContext runtimeContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1UserContext userContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1MarkupParams markupParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1InteractionParams interactionParams , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < V1UpdateResponse > updateResponse , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < String > redirectURL , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1Extension > > extensions ) throws V1AccessDenied , V1InconsistentParameters , V1InvalidCookie , V1InvalidHandle , V1InvalidRegistration , V1InvalidSession , V1InvalidUserCategory , V1MissingParameters , V1OperationFailed , V1PortletStateChangeRequired , V1UnsupportedLocale , V1UnsupportedMimeType , V1UnsupportedMode , V1UnsupportedWindowState ; @ WebMethod ( action = "<STR_LIT>" ) @ WebResult ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) @ RequestWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) @ ResponseWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) public List < V1Extension > releaseSessions ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > sessionIDs ) throws V1AccessDenied , V1InvalidRegistration , V1MissingParameters , V1OperationFailed ; @ WebMethod ( action = "<STR_LIT>" ) @ WebResult ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) @ RequestWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) @ ResponseWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) public List < V1Extension > initCookie ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext ) throws V1AccessDenied , V1InvalidRegistration , V1OperationFailed ; } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlRootElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" } ) @ XmlRootElement ( name = "<STR_LIT>" ) public class V1ModifyRegistration { @ XmlElement ( required = true , nillable = true ) protected V1RegistrationContext registrationContext ; @ XmlElement ( required = true ) protected V1RegistrationData registrationData ; public V1RegistrationContext getRegistrationContext ( ) { return registrationContext ; } public void setRegistrationContext ( V1RegistrationContext value ) { this . registrationContext = value ; } public V1RegistrationData getRegistrationData ( ) { return registrationData ; } public void setRegistrationData ( V1RegistrationData value ) { this . registrationData = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" } ) public class V1NamedStringArray { @ XmlElement ( name = "<STR_LIT>" ) protected List < V1NamedString > namedString ; public List < V1NamedString > getNamedString ( ) { if ( namedString == null ) { namedString = new ArrayList < V1NamedString > ( ) ; } return this . namedString ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlEnum ; import javax . xml . bind . annotation . XmlEnumValue ; import javax . xml . bind . annotation . XmlType ; @ XmlType ( name = "<STR_LIT>" ) @ XmlEnum public enum V1StateChange { @ XmlEnumValue ( "<STR_LIT>" ) READ_WRITE ( "<STR_LIT>" ) , @ XmlEnumValue ( "<STR_LIT>" ) CLONE_BEFORE_WRITE ( "<STR_LIT>" ) , @ XmlEnumValue ( "<STR_LIT>" ) READ_ONLY ( "<STR_LIT>" ) ; private final String value ; V1StateChange ( String v ) { value = v ; } public String value ( ) { return value ; } public static V1StateChange fromValue ( String v ) { for ( V1StateChange c : V1StateChange . values ( ) ) { if ( c . value . equals ( v ) ) { return c ; } } throw new IllegalArgumentException ( v ) ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1InvalidCookieFault extends V1Fault { } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . ws . WebFault ; @ WebFault ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public class V1InvalidHandle extends Exception { private V1InvalidHandleFault faultInfo ; public V1InvalidHandle ( String message , V1InvalidHandleFault faultInfo ) { super ( message ) ; this . faultInfo = faultInfo ; } public V1InvalidHandle ( String message , V1InvalidHandleFault faultInfo , Throwable cause ) { super ( message , cause ) ; this . faultInfo = faultInfo ; } public V1InvalidHandleFault getFaultInfo ( ) { return faultInfo ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlAnyElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" } ) public class V1ModelTypes { @ XmlAnyElement ( lax = true ) protected Object any ; public Object getAny ( ) { return any ; } public void setAny ( Object value ) { this . any = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1SessionContext { @ XmlElement ( required = true ) protected String sessionID ; protected int expires ; protected List < V1Extension > extensions ; public String getSessionID ( ) { return sessionID ; } public void setSessionID ( String value ) { this . sessionID = value ; } public int getExpires ( ) { return expires ; } public void setExpires ( int value ) { this . expires = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1PortletPropertyDescriptionResponse { protected V1ModelDescription modelDescription ; protected V1ResourceList resourceList ; protected List < V1Extension > extensions ; public V1ModelDescription getModelDescription ( ) { return modelDescription ; } public void setModelDescription ( V1ModelDescription value ) { this . modelDescription = value ; } public V1ResourceList getResourceList ( ) { return resourceList ; } public void setResourceList ( V1ResourceList value ) { this . resourceList = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT:email>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1Online { protected String email ; protected String uri ; protected List < V1Extension > extensions ; public String getEmail ( ) { return email ; } public void setEmail ( String value ) { this . email = value ; } public String getUri ( ) { return uri ; } public void setUri ( String value ) { this . uri = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . ws . WebFault ; @ WebFault ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public class V1UnsupportedMimeType extends Exception { private V1UnsupportedMimeTypeFault faultInfo ; public V1UnsupportedMimeType ( String message , V1UnsupportedMimeTypeFault faultInfo ) { super ( message ) ; this . faultInfo = faultInfo ; } public V1UnsupportedMimeType ( String message , V1UnsupportedMimeTypeFault faultInfo , Throwable cause ) { super ( message , cause ) ; this . faultInfo = faultInfo ; } public V1UnsupportedMimeTypeFault getFaultInfo ( ) { return faultInfo ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1UpdateResponse { protected V1SessionContext sessionContext ; protected V1PortletContext portletContext ; protected V1MarkupContext markupContext ; @ XmlElement ( required = true , nillable = true ) protected String navigationalState ; protected String newWindowState ; protected String newMode ; public V1SessionContext getSessionContext ( ) { return sessionContext ; } public void setSessionContext ( V1SessionContext value ) { this . sessionContext = value ; } public V1PortletContext getPortletContext ( ) { return portletContext ; } public void setPortletContext ( V1PortletContext value ) { this . portletContext = value ; } public V1MarkupContext getMarkupContext ( ) { return markupContext ; } public void setMarkupContext ( V1MarkupContext value ) { this . markupContext = value ; } public String getNavigationalState ( ) { return navigationalState ; } public void setNavigationalState ( String value ) { this . navigationalState = value ; } public String getNewWindowState ( ) { return newWindowState ; } public void setNewWindowState ( String value ) { this . newWindowState = value ; } public String getNewMode ( ) { return newMode ; } public void setNewMode ( String value ) { this . newMode = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1RegistrationData { @ XmlElement ( required = true ) protected String consumerName ; @ XmlElement ( required = true ) protected String consumerAgent ; protected boolean methodGetSupported ; protected List < String > consumerModes ; protected List < String > consumerWindowStates ; protected List < String > consumerUserScopes ; protected List < String > customUserProfileData ; protected List < V1Property > registrationProperties ; protected List < V1Extension > extensions ; public String getConsumerName ( ) { return consumerName ; } public void setConsumerName ( String value ) { this . consumerName = value ; } public String getConsumerAgent ( ) { return consumerAgent ; } public void setConsumerAgent ( String value ) { this . consumerAgent = value ; } public boolean isMethodGetSupported ( ) { return methodGetSupported ; } public void setMethodGetSupported ( boolean value ) { this . methodGetSupported = value ; } public List < String > getConsumerModes ( ) { if ( consumerModes == null ) { consumerModes = new ArrayList < String > ( ) ; } return this . consumerModes ; } public List < String > getConsumerWindowStates ( ) { if ( consumerWindowStates == null ) { consumerWindowStates = new ArrayList < String > ( ) ; } return this . consumerWindowStates ; } public List < String > getConsumerUserScopes ( ) { if ( consumerUserScopes == null ) { consumerUserScopes = new ArrayList < String > ( ) ; } return this . consumerUserScopes ; } public List < String > getCustomUserProfileData ( ) { if ( customUserProfileData == null ) { customUserProfileData = new ArrayList < String > ( ) ; } return this . customUserProfileData ; } public List < V1Property > getRegistrationProperties ( ) { if ( registrationProperties == null ) { registrationProperties = new ArrayList < V1Property > ( ) ; } return this . registrationProperties ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlRootElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) @ XmlRootElement ( name = "<STR_LIT>" ) public class V1SetPortletProperties { @ XmlElement ( required = true , nillable = true ) protected V1RegistrationContext registrationContext ; @ XmlElement ( required = true ) protected V1PortletContext portletContext ; @ XmlElement ( required = true , nillable = true ) protected V1UserContext userContext ; @ XmlElement ( required = true ) protected V1PropertyList propertyList ; public V1RegistrationContext getRegistrationContext ( ) { return registrationContext ; } public void setRegistrationContext ( V1RegistrationContext value ) { this . registrationContext = value ; } public V1PortletContext getPortletContext ( ) { return portletContext ; } public void setPortletContext ( V1PortletContext value ) { this . portletContext = value ; } public V1UserContext getUserContext ( ) { return userContext ; } public void setUserContext ( V1UserContext value ) { this . userContext = value ; } public V1PropertyList getPropertyList ( ) { return propertyList ; } public void setPropertyList ( V1PropertyList value ) { this . propertyList = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1InvalidHandleFault extends V1Fault { } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1MarkupResponse { @ XmlElement ( required = true ) protected V1MarkupContext markupContext ; protected V1SessionContext sessionContext ; protected List < V1Extension > extensions ; public V1MarkupContext getMarkupContext ( ) { return markupContext ; } public void setMarkupContext ( V1MarkupContext value ) { this . markupContext = value ; } public V1SessionContext getSessionContext ( ) { return sessionContext ; } public void setSessionContext ( V1SessionContext value ) { this . sessionContext = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" } ) public class V1ClientData { protected String userAgent ; protected List < V1Extension > extensions ; public String getUserAgent ( ) { return userAgent ; } public void setUserAgent ( String value ) { this . userAgent = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1ModelDescription { protected List < V1PropertyDescription > propertyDescriptions ; protected V1ModelTypes modelTypes ; protected List < V1Extension > extensions ; public List < V1PropertyDescription > getPropertyDescriptions ( ) { if ( propertyDescriptions == null ) { propertyDescriptions = new ArrayList < V1PropertyDescription > ( ) ; } return this . propertyDescriptions ; } public V1ModelTypes getModelTypes ( ) { return modelTypes ; } public void setModelTypes ( V1ModelTypes value ) { this . modelTypes = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1PropertyList { protected List < V1Property > properties ; protected List < V1ResetProperty > resetProperties ; protected List < V1Extension > extensions ; public List < V1Property > getProperties ( ) { if ( properties == null ) { properties = new ArrayList < V1Property > ( ) ; } return this . properties ; } public List < V1ResetProperty > getResetProperties ( ) { if ( resetProperties == null ) { resetProperties = new ArrayList < V1ResetProperty > ( ) ; } return this . resetProperties ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:number>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1TelephoneNum { protected String intcode ; protected String loccode ; protected String number ; protected String ext ; protected String comment ; protected List < V1Extension > extensions ; public String getIntcode ( ) { return intcode ; } public void setIntcode ( String value ) { this . intcode = value ; } public String getLoccode ( ) { return loccode ; } public void setLoccode ( String value ) { this . loccode = value ; } public String getNumber ( ) { return number ; } public void setNumber ( String value ) { this . number = value ; } public String getExt ( ) { return ext ; } public void setExt ( String value ) { this . ext = value ; } public String getComment ( ) { return comment ; } public void setComment ( String value ) { this . comment = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlAttribute ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT:value>" } ) public class V1NamedString { @ XmlElement ( required = true ) protected String value ; @ XmlAttribute ( required = true ) protected String name ; public String getValue ( ) { return value ; } public void setValue ( String value ) { this . value = value ; } public String getName ( ) { return name ; } public void setName ( String value ) { this . name = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1MissingParametersFault extends V1Fault { } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1PersonName { protected String prefix ; protected String given ; protected String family ; protected String middle ; protected String suffix ; protected String nickname ; protected List < V1Extension > extensions ; public String getPrefix ( ) { return prefix ; } public void setPrefix ( String value ) { this . prefix = value ; } public String getGiven ( ) { return given ; } public void setGiven ( String value ) { this . given = value ; } public String getFamily ( ) { return family ; } public void setFamily ( String value ) { this . family = value ; } public String getMiddle ( ) { return middle ; } public void setMiddle ( String value ) { this . middle = value ; } public String getSuffix ( ) { return suffix ; } public void setSuffix ( String value ) { this . suffix = value ; } public String getNickname ( ) { return nickname ; } public void setNickname ( String value ) { this . nickname = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1UnsupportedWindowStateFault extends V1Fault { } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . ws . WebFault ; @ WebFault ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public class V1AccessDenied extends Exception { private V1AccessDeniedFault faultInfo ; public V1AccessDenied ( String message , V1AccessDeniedFault faultInfo ) { super ( message ) ; this . faultInfo = faultInfo ; } public V1AccessDenied ( String message , V1AccessDeniedFault faultInfo , Throwable cause ) { super ( message , cause ) ; this . faultInfo = faultInfo ; } public V1AccessDeniedFault getFaultInfo ( ) { return faultInfo ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlRootElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) @ XmlRootElement ( name = "<STR_LIT>" ) public class V1GetMarkup { @ XmlElement ( required = true , nillable = true ) protected V1RegistrationContext registrationContext ; @ XmlElement ( required = true ) protected V1PortletContext portletContext ; @ XmlElement ( required = true ) protected V1RuntimeContext runtimeContext ; @ XmlElement ( required = true , nillable = true ) protected V1UserContext userContext ; @ XmlElement ( required = true ) protected V1MarkupParams markupParams ; public V1RegistrationContext getRegistrationContext ( ) { return registrationContext ; } public void setRegistrationContext ( V1RegistrationContext value ) { this . registrationContext = value ; } public V1PortletContext getPortletContext ( ) { return portletContext ; } public void setPortletContext ( V1PortletContext value ) { this . portletContext = value ; } public V1RuntimeContext getRuntimeContext ( ) { return runtimeContext ; } public void setRuntimeContext ( V1RuntimeContext value ) { this . runtimeContext = value ; } public V1UserContext getUserContext ( ) { return userContext ; } public void setUserContext ( V1UserContext value ) { this . userContext = value ; } public V1MarkupParams getMarkupParams ( ) { return markupParams ; } public void setMarkupParams ( V1MarkupParams value ) { this . markupParams = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlAttribute ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT:value>" , "<STR_LIT>" } ) public class V1ResourceValue { @ XmlElement ( required = true ) protected String value ; protected List < V1Extension > extensions ; @ XmlAttribute ( namespace = "<STR_LIT>" , required = true ) protected String lang ; public String getValue ( ) { return value ; } public void setValue ( String value ) { this . value = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } public String getLang ( ) { return lang ; } public void setLang ( String value ) { this . lang = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlAttribute ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT:value>" } ) public class V1LocalizedString { @ XmlElement ( required = true ) protected String value ; @ XmlAttribute ( namespace = "<STR_LIT>" , required = true ) protected String lang ; @ XmlAttribute protected String resourceName ; public String getValue ( ) { return value ; } public void setValue ( String value ) { this . value = value ; } public String getLang ( ) { return lang ; } public void setLang ( String value ) { this . lang = value ; } public String getResourceName ( ) { return resourceName ; } public void setResourceName ( String value ) { this . resourceName = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlAnyElement ; import javax . xml . bind . annotation . XmlAttribute ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" } ) public class V1Property { protected String stringValue ; @ XmlAnyElement ( lax = true ) protected List < Object > any ; @ XmlAttribute ( required = true ) protected String name ; @ XmlAttribute ( namespace = "<STR_LIT>" ) protected String lang ; public String getStringValue ( ) { return stringValue ; } public void setStringValue ( String value ) { this . stringValue = value ; } public List < Object > getAny ( ) { if ( any == null ) { any = new ArrayList < Object > ( ) ; } return this . any ; } public String getName ( ) { return name ; } public void setName ( String value ) { this . name = value ; } public String getLang ( ) { return lang ; } public void setLang ( String value ) { this . lang = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlRootElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) @ XmlRootElement ( name = "<STR_LIT>" ) public class V1GetPortletDescription { @ XmlElement ( required = true , nillable = true ) protected V1RegistrationContext registrationContext ; @ XmlElement ( required = true ) protected V1PortletContext portletContext ; @ XmlElement ( required = true , nillable = true ) protected V1UserContext userContext ; protected List < String > desiredLocales ; public V1RegistrationContext getRegistrationContext ( ) { return registrationContext ; } public void setRegistrationContext ( V1RegistrationContext value ) { this . registrationContext = value ; } public V1PortletContext getPortletContext ( ) { return portletContext ; } public void setPortletContext ( V1PortletContext value ) { this . portletContext = value ; } public V1UserContext getUserContext ( ) { return userContext ; } public void setUserContext ( V1UserContext value ) { this . userContext = value ; } public List < String > getDesiredLocales ( ) { if ( desiredLocales == null ) { desiredLocales = new ArrayList < String > ( ) ; } return this . desiredLocales ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1MarkupParams { protected boolean secureClientCommunication ; @ XmlElement ( required = true ) protected List < String > locales ; @ XmlElement ( required = true ) protected List < String > mimeTypes ; @ XmlElement ( required = true ) protected String mode ; @ XmlElement ( required = true ) protected String windowState ; protected V1ClientData clientData ; protected String navigationalState ; protected List < String > markupCharacterSets ; protected String validateTag ; protected List < String > validNewModes ; protected List < String > validNewWindowStates ; protected List < V1Extension > extensions ; public boolean isSecureClientCommunication ( ) { return secureClientCommunication ; } public void setSecureClientCommunication ( boolean value ) { this . secureClientCommunication = value ; } public List < String > getLocales ( ) { if ( locales == null ) { locales = new ArrayList < String > ( ) ; } return this . locales ; } public List < String > getMimeTypes ( ) { if ( mimeTypes == null ) { mimeTypes = new ArrayList < String > ( ) ; } return this . mimeTypes ; } public String getMode ( ) { return mode ; } public void setMode ( String value ) { this . mode = value ; } public String getWindowState ( ) { return windowState ; } public void setWindowState ( String value ) { this . windowState = value ; } public V1ClientData getClientData ( ) { return clientData ; } public void setClientData ( V1ClientData value ) { this . clientData = value ; } public String getNavigationalState ( ) { return navigationalState ; } public void setNavigationalState ( String value ) { this . navigationalState = value ; } public List < String > getMarkupCharacterSets ( ) { if ( markupCharacterSets == null ) { markupCharacterSets = new ArrayList < String > ( ) ; } return this . markupCharacterSets ; } public String getValidateTag ( ) { return validateTag ; } public void setValidateTag ( String value ) { this . validateTag = value ; } public List < String > getValidNewModes ( ) { if ( validNewModes == null ) { validNewModes = new ArrayList < String > ( ) ; } return this . validNewModes ; } public List < String > getValidNewWindowStates ( ) { if ( validNewWindowStates == null ) { validNewWindowStates = new ArrayList < String > ( ) ; } return this . validNewWindowStates ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1RegistrationContext { @ XmlElement ( required = true ) protected String registrationHandle ; protected byte [ ] registrationState ; protected List < V1Extension > extensions ; public String getRegistrationHandle ( ) { return registrationHandle ; } public void setRegistrationHandle ( String value ) { this . registrationHandle = value ; } public byte [ ] getRegistrationState ( ) { return registrationState ; } public void setRegistrationState ( byte [ ] value ) { this . registrationState = ( ( byte [ ] ) value ) ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT:name>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1Postal { protected String name ; protected String street ; protected String city ; protected String stateprov ; protected String postalcode ; protected String country ; protected String organization ; protected List < V1Extension > extensions ; public String getName ( ) { return name ; } public void setName ( String value ) { this . name = value ; } public String getStreet ( ) { return street ; } public void setStreet ( String value ) { this . street = value ; } public String getCity ( ) { return city ; } public void setCity ( String value ) { this . city = value ; } public String getStateprov ( ) { return stateprov ; } public void setStateprov ( String value ) { this . stateprov = value ; } public String getPostalcode ( ) { return postalcode ; } public void setPostalcode ( String value ) { this . postalcode = value ; } public String getCountry ( ) { return country ; } public void setCountry ( String value ) { this . country = value ; } public String getOrganization ( ) { return organization ; } public void setOrganization ( String value ) { this . organization = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlAttribute ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1ResetProperty { @ XmlAttribute ( required = true ) protected String name ; public String getName ( ) { return name ; } public void setName ( String value ) { this . name = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1PortletStateChangeRequiredFault extends V1Fault { } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1MarkupType { @ XmlElement ( required = true ) protected String mimeType ; @ XmlElement ( required = true ) protected List < String > modes ; @ XmlElement ( required = true ) protected List < String > windowStates ; protected List < String > locales ; protected List < V1Extension > extensions ; public String getMimeType ( ) { return mimeType ; } public void setMimeType ( String value ) { this . mimeType = value ; } public List < String > getModes ( ) { if ( modes == null ) { modes = new ArrayList < String > ( ) ; } return this . modes ; } public List < String > getWindowStates ( ) { if ( windowStates == null ) { windowStates = new ArrayList < String > ( ) ; } return this . windowStates ; } public List < String > getLocales ( ) { if ( locales == null ) { locales = new ArrayList < String > ( ) ; } return this . locales ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlAnyElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" } ) public class V1Extension { @ XmlAnyElement ( lax = true ) protected Object any ; public Object getAny ( ) { return any ; } public void setAny ( Object value ) { this . any = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1PortletContext { @ XmlElement ( required = true ) protected String portletHandle ; protected byte [ ] portletState ; protected List < V1Extension > extensions ; public String getPortletHandle ( ) { return portletHandle ; } public void setPortletHandle ( String value ) { this . portletHandle = value ; } public byte [ ] getPortletState ( ) { return portletState ; } public void setPortletState ( byte [ ] value ) { this . portletState = ( ( byte [ ] ) value ) ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlRootElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" } ) @ XmlRootElement ( name = "<STR_LIT>" ) public class V1ReleaseSessions { @ XmlElement ( required = true , nillable = true ) protected V1RegistrationContext registrationContext ; @ XmlElement ( required = true ) protected List < String > sessionIDs ; public V1RegistrationContext getRegistrationContext ( ) { return registrationContext ; } public void setRegistrationContext ( V1RegistrationContext value ) { this . registrationContext = value ; } public List < String > getSessionIDs ( ) { if ( sessionIDs == null ) { sessionIDs = new ArrayList < String > ( ) ; } return this . sessionIDs ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1Templates { @ XmlElement ( required = true , nillable = true ) protected String defaultTemplate ; protected String blockingActionTemplate ; protected String renderTemplate ; protected String resourceTemplate ; @ XmlElement ( required = true , nillable = true ) protected String secureDefaultTemplate ; protected String secureBlockingActionTemplate ; protected String secureRenderTemplate ; protected String secureResourceTemplate ; protected List < V1Extension > extensions ; public String getDefaultTemplate ( ) { return defaultTemplate ; } public void setDefaultTemplate ( String value ) { this . defaultTemplate = value ; } public String getBlockingActionTemplate ( ) { return blockingActionTemplate ; } public void setBlockingActionTemplate ( String value ) { this . blockingActionTemplate = value ; } public String getRenderTemplate ( ) { return renderTemplate ; } public void setRenderTemplate ( String value ) { this . renderTemplate = value ; } public String getResourceTemplate ( ) { return resourceTemplate ; } public void setResourceTemplate ( String value ) { this . resourceTemplate = value ; } public String getSecureDefaultTemplate ( ) { return secureDefaultTemplate ; } public void setSecureDefaultTemplate ( String value ) { this . secureDefaultTemplate = value ; } public String getSecureBlockingActionTemplate ( ) { return secureBlockingActionTemplate ; } public void setSecureBlockingActionTemplate ( String value ) { this . secureBlockingActionTemplate = value ; } public String getSecureRenderTemplate ( ) { return secureRenderTemplate ; } public void setSecureRenderTemplate ( String value ) { this . secureRenderTemplate = value ; } public String getSecureResourceTemplate ( ) { return secureResourceTemplate ; } public void setSecureResourceTemplate ( String value ) { this . secureResourceTemplate = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlRootElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) @ XmlRootElement ( name = "<STR_LIT>" ) public class V1GetPortletPropertyDescription { @ XmlElement ( required = true , nillable = true ) protected V1RegistrationContext registrationContext ; @ XmlElement ( required = true ) protected V1PortletContext portletContext ; @ XmlElement ( required = true , nillable = true ) protected V1UserContext userContext ; protected List < String > desiredLocales ; public V1RegistrationContext getRegistrationContext ( ) { return registrationContext ; } public void setRegistrationContext ( V1RegistrationContext value ) { this . registrationContext = value ; } public V1PortletContext getPortletContext ( ) { return portletContext ; } public void setPortletContext ( V1PortletContext value ) { this . portletContext = value ; } public V1UserContext getUserContext ( ) { return userContext ; } public void setUserContext ( V1UserContext value ) { this . userContext = value ; } public List < String > getDesiredLocales ( ) { if ( desiredLocales == null ) { desiredLocales = new ArrayList < String > ( ) ; } return this . desiredLocales ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . ws . WebFault ; @ WebFault ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public class V1InvalidSession extends Exception { private V1InvalidSessionFault faultInfo ; public V1InvalidSession ( String message , V1InvalidSessionFault faultInfo ) { super ( message ) ; this . faultInfo = faultInfo ; } public V1InvalidSession ( String message , V1InvalidSessionFault faultInfo , Throwable cause ) { super ( message , cause ) ; this . faultInfo = faultInfo ; } public V1InvalidSessionFault getFaultInfo ( ) { return faultInfo ; } } </s>
<s> package org . gatein . wsrp . protocol . v1 ; import org . apache . catalina . connector . Request ; import org . apache . catalina . connector . RequestFacade ; import org . gatein . registration . Registration ; import org . gatein . registration . RegistrationManager ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . api . servlet . ServletAccess ; import org . gatein . wsrp . portlet . utils . MockRequest ; import org . gatein . wsrp . registration . RegistrationPropertyDescription ; import org . gatein . wsrp . spec . v1 . V2ToV1Converter ; 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 . container . test . api . Deployment ; import org . jboss . arquillian . container . test . api . OverProtocol ; import org . jboss . arquillian . junit . Arquillian ; import org . jboss . shrinkwrap . api . Archive ; 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 . V1GetMarkup ; import org . oasis . wsrp . v1 . V1GetServiceDescription ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; 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 org . oasis . wsrp . v2 . PropertyDescription ; import javax . xml . namespace . QName ; import java . util . List ; @ RunWith ( Arquillian . class ) public class RegistrationTestCase extends V1ProducerBaseTest { public RegistrationTestCase ( ) throws Exception { super ( "<STR_LIT>" ) ; } @ Deployment @ OverProtocol ( "<STR_LIT>" ) public static Archive createDeployment ( ) { Archive archive = V1ProducerBaseTest . createDeployment ( ) ; return archive ; } @ Override protected boolean removeCurrent ( String archiveName ) { return true ; } @ Before public void setUp ( ) throws Exception { super . setUp ( ) ; Request request = new MockRequest ( ) ; request . setCoyoteRequest ( new org . apache . coyote . Request ( ) ) ; RequestFacade requestFacade = new RequestFacade ( request ) ; ServletAccess . setRequestAndResponse ( requestFacade , MockHttpServletResponse . createMockResponse ( ) ) ; } @ After public void tearDown ( ) throws Exception { super . tearDown ( ) ; } @ Test public void testUniqueNameRegistration ( ) throws Exception { } @ Test public void testConsumerAgent ( ) throws Exception { configureRegistrationSettings ( true , false ) ; V1RegistrationData regData = createBaseRegData ( ) ; regData . setConsumerAgent ( "<STR_LIT>" ) ; try { producer . register ( regData ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1OperationFailed operationFailedFault ) { } regData . setConsumerAgent ( WSRPConstants . CONSUMER_AGENT ) ; producer . register ( regData ) ; } public void testRegistrationHandle ( ) throws Exception { try { V1RegistrationContext rc = registerConsumer ( ) ; String registrationHandle = rc . getRegistrationHandle ( ) ; assertNotNull ( registrationHandle ) ; RegistrationManager registrationManager = producer . getRegistrationManager ( ) ; Registration registration = registrationManager . getRegistration ( registrationHandle ) ; assertNotNull ( registration ) ; String key = registration . getPersistentKey ( ) ; assertNotNull ( key ) ; String expectedHandle = registrationManager . getPolicy ( ) . createRegistrationHandleFor ( key ) ; assertEquals ( expectedHandle , registrationHandle ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; throw new Exception ( "<STR_LIT>" ) ; } } @ Test public void testDeregister ( ) throws Exception { configureRegistrationSettings ( true , false ) ; V1RegistrationContext rc = registerConsumer ( ) ; producer . deregister ( rc ) ; V1GetMarkup getMarkup = createDefaultMarkupRequest ( "<STR_LIT:foo>" ) ; getMarkup . getMarkupParams ( ) . getMarkupCharacterSets ( ) . add ( WSRPConstants . DEFAULT_CHARACTER_SET ) ; try { producer . getMarkup ( getMarkup ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1InvalidRegistration invalidRegistrationFault ) { } V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest ( ) ; gs . setRegistrationContext ( rc ) ; try { producer . getServiceDescription ( gs ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1InvalidRegistration invalidRegistrationFault ) { } gs = getNoRegistrationServiceDescriptionRequest ( ) ; ExtendedAssert . assertNotNull ( producer . getServiceDescription ( gs ) ) ; } @ Test public void testModifyRegistration ( ) throws Exception { configureRegistrationSettings ( true , false ) ; V1RegistrationContext rc = registerConsumer ( ) ; String newPropName = "<STR_LIT>" ; RegistrationPropertyDescription regProp = new RegistrationPropertyDescription ( newPropName , new QName ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ) ; regProp . setDefaultLabel ( "<STR_LIT>" ) ; producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . addRegistrationProperty ( regProp ) ; V1GetMarkup getMarkup = createDefaultMarkupRequest ( "<STR_LIT:foo>" ) ; getMarkup . getMarkupParams ( ) . getMarkupCharacterSets ( ) . add ( WSRPConstants . DEFAULT_CHARACTER_SET ) ; getMarkup . setRegistrationContext ( rc ) ; try { producer . getMarkup ( getMarkup ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1OperationFailed operationFailedFault ) { } V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest ( ) ; gs . setRegistrationContext ( rc ) ; try { producer . getServiceDescription ( gs ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1OperationFailed operationFailedFault ) { } gs . setRegistrationContext ( null ) ; List < V1PropertyDescription > pds = producer . getServiceDescription ( gs ) . getRegistrationPropertyDescription ( ) . getPropertyDescriptions ( ) ; ExtendedAssert . assertEquals ( <NUM_LIT:2> , pds . size ( ) ) ; V1PropertyDescription description = pds . get ( <NUM_LIT:1> ) ; if ( description . getName ( ) . startsWith ( "<STR_LIT>" ) ) { assertEquals ( WSRPUtils . convertToPropertyDescription ( regProp ) , description ) ; } else { PropertyDescription propertyDescription = WSRPUtils . convertToPropertyDescription ( regProp ) ; V1PropertyDescription v1PropertyDescription = V2ToV1Converter . toV1PropertyDescription ( propertyDescription ) ; assertEquals ( v1PropertyDescription , pds . get ( <NUM_LIT:0> ) ) ; } V1RegistrationData regData = createBaseRegData ( ) ; regData . getRegistrationProperties ( ) . add ( WSRP1TypeFactory . createProperty ( newPropName , "<STR_LIT:en>" , "<STR_LIT>" ) ) ; V1ModifyRegistration registration = new V1ModifyRegistration ( ) ; registration . setRegistrationContext ( rc ) ; registration . setRegistrationData ( regData ) ; producer . modifyRegistration ( registration ) ; gs . setRegistrationContext ( rc ) ; checkServiceDescriptionWithOnlyBasicPortlet ( gs ) ; } @ Test public void testModifyRegistrationIncorrectData ( ) throws Exception { configureRegistrationSettings ( true , false ) ; V1RegistrationContext rc = registerConsumer ( ) ; String newPropName = "<STR_LIT>" ; RegistrationPropertyDescription regProp = new RegistrationPropertyDescription ( newPropName , new QName ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ) ; regProp . setDefaultLabel ( "<STR_LIT>" ) ; producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . addRegistrationProperty ( regProp ) ; try { V1ModifyRegistration registration = new V1ModifyRegistration ( ) ; registration . setRegistrationContext ( rc ) ; registration . setRegistrationData ( createBaseRegData ( ) ) ; producer . modifyRegistration ( registration ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1OperationFailed operationFailed ) { } } @ Test public void testRegister ( ) throws Exception { configureRegistrationSettings ( true , false ) ; V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest ( ) ; V1RegistrationContext registrationContext = registerConsumer ( ) ; ExtendedAssert . assertNotNull ( registrationContext ) ; ExtendedAssert . assertNotNull ( registrationContext . getRegistrationHandle ( ) ) ; gs . setRegistrationContext ( registrationContext ) ; checkServiceDescriptionWithOnlyBasicPortlet ( gs ) ; } @ Test public void testRegisterWhenRegistrationNotRequired ( ) throws Exception { configureRegistrationSettings ( false , false ) ; try { registerConsumer ( ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1OperationFailed operationFailedFault ) { } } @ Test public void testDeregisterWhenRegistrationNotRequired ( ) throws Exception { configureRegistrationSettings ( false , false ) ; try { producer . deregister ( null ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1OperationFailed operationFailedFault ) { } } @ Test public void testModifyRegistrationWhenRegistrationNotRequired ( ) throws Exception { configureRegistrationSettings ( false , false ) ; try { producer . modifyRegistration ( null ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1OperationFailed operationFailedFault ) { } } @ Test public void testModifyRegistrationNoRegistrationWhenRegistrationRequired ( ) throws Exception { configureRegistrationSettings ( true , false ) ; try { producer . modifyRegistration ( null ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1OperationFailed operationFailedFault ) { } catch ( Exception e ) { ExtendedAssert . fail ( e . getMessage ( ) ) ; } } @ Test public void testDeregisterNoRegistrationWhenRegistrationRequired ( ) throws Exception { configureRegistrationSettings ( true , false ) ; try { producer . deregister ( null ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1OperationFailed operationFailedFault ) { } catch ( Exception e ) { ExtendedAssert . fail ( e . getMessage ( ) ) ; } } } </s>
<s> package org . gatein . wsrp . protocol . v1 ; import org . apache . catalina . connector . Request ; import org . apache . catalina . connector . RequestFacade ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . api . servlet . ServletAccess ; import org . gatein . wsrp . portlet . utils . MockRequest ; 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 . container . test . api . Deployment ; import org . jboss . arquillian . container . test . api . OverProtocol ; import org . jboss . arquillian . junit . Arquillian ; import org . jboss . shrinkwrap . api . Archive ; 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 ; @ RunWith ( Arquillian . class ) public class PortletManagementTestCase extends NeedPortletHandleTest { private static final String TEST_BASIC_PORTLET_WAR = "<STR_LIT>" ; public PortletManagementTestCase ( ) throws Exception { super ( "<STR_LIT>" , TEST_BASIC_PORTLET_WAR ) ; } @ Deployment @ OverProtocol ( "<STR_LIT>" ) public static Archive createDeployment ( ) { Archive archive = V1ProducerBaseTest . createDeployment ( ) ; return archive ; } @ Before public void setUp ( ) throws Exception { super . setUp ( ) ; Request request = new MockRequest ( ) ; request . setCoyoteRequest ( new org . apache . coyote . Request ( ) ) ; RequestFacade requestFacade = new RequestFacade ( request ) ; ServletAccess . setRequestAndResponse ( requestFacade , MockHttpServletResponse . createMockResponse ( ) ) ; } @ After public void tearDown ( ) throws Exception { super . tearDown ( ) ; } @ Test public void testClonePortlet ( ) throws Exception { String handle = getDefaultHandle ( ) ; V1PortletContext initialContext = WSRP1TypeFactory . createPortletContext ( handle ) ; V1PortletContext cloneContext = clonePortlet ( handle ) ; ExtendedAssert . assertNotNull ( cloneContext ) ; ExtendedAssert . assertFalse ( initialContext . equals ( cloneContext ) ) ; V1GetPortletProperties getPortletProperties = WSRP1TypeFactory . createGetPortletProperties ( null , cloneContext ) ; List < V1Property > result = producer . getPortletProperties ( getPortletProperties ) . getProperties ( ) ; getPortletProperties = WSRP1TypeFactory . createGetPortletProperties ( null , initialContext ) ; checkGetPropertiesResponse ( producer . getPortletProperties ( getPortletProperties ) , result ) ; 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 ( "<STR_LIT>" ) ; } catch ( V1InvalidRegistration invalidRegistrationFault ) { } catch ( Exception e ) { ExtendedAssert . fail ( e . getMessage ( ) ) ; } } @ Test public void testDestroyPortlets ( ) throws Exception { 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 ( <NUM_LIT:1> , failures . size ( ) ) ; V1DestroyFailed failure = failures . get ( <NUM_LIT:0> ) ; ExtendedAssert . assertNotNull ( failure ) ; ExtendedAssert . assertEquals ( handle , failure . getPortletHandle ( ) ) ; ExtendedAssert . assertNotNull ( failure . getReason ( ) ) ; V1PortletContext portletContext = clonePortlet ( handle ) ; destroyPortlets = WSRP1TypeFactory . createDestroyPortlets ( null , Collections . < String > singletonList ( portletContext . getPortletHandle ( ) ) ) ; response = producer . destroyPortlets ( destroyPortlets ) ; ExtendedAssert . assertNotNull ( response ) ; failures = response . getDestroyFailed ( ) ; ExtendedAssert . assertTrue ( "<STR_LIT>" + failures , ( failures == null || failures . isEmpty ( ) ) ) ; } @ 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 ( "<STR_LIT>" ) ; } catch ( V1InvalidRegistration invalidRegistrationFault ) { } 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 ( "<STR_LIT>" ) ; } catch ( V1InvalidRegistration invalidRegistrationFault ) { } catch ( Exception e ) { ExtendedAssert . fail ( e . getMessage ( ) ) ; } } @ Test public void testGetPortletPropertiesNoKeys ( ) throws Exception { String handle = getDefaultHandle ( ) ; V1PortletContext initialContext = WSRP1TypeFactory . createPortletContext ( handle ) ; V1GetPortletProperties getPortletProperties = WSRP1TypeFactory . createGetPortletProperties ( null , initialContext ) ; V1PropertyList response = producer . getPortletProperties ( getPortletProperties ) ; List < V1Property > expected = new ArrayList < V1Property > ( <NUM_LIT:2> ) ; Collections . addAll ( expected , WSRP1TypeFactory . createProperty ( "<STR_LIT>" , "<STR_LIT:en>" , "<STR_LIT>" ) , WSRP1TypeFactory . createProperty ( "<STR_LIT>" , "<STR_LIT:en>" , "<STR_LIT>" ) ) ; checkGetPropertiesResponse ( response , expected ) ; } @ 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 , "<STR_LIT>" , "<STR_LIT>" ) ; V1PropertyList response = producer . getPortletProperties ( getPortletProperties ) ; List < V1Property > expected = new ArrayList < V1Property > ( <NUM_LIT:2> ) ; Collections . addAll ( expected , WSRP1TypeFactory . createProperty ( "<STR_LIT>" , "<STR_LIT:en>" , "<STR_LIT>" ) , WSRP1TypeFactory . createProperty ( "<STR_LIT>" , "<STR_LIT:en>" , "<STR_LIT>" ) ) ; checkGetPropertiesResponse ( response , expected ) ; names . clear ( ) ; response = producer . getPortletProperties ( getPortletProperties ) ; names . add ( "<STR_LIT>" ) ; response = producer . getPortletProperties ( getPortletProperties ) ; checkGetPropertiesResponse ( response , Collections . < V1Property > singletonList ( WSRP1TypeFactory . createProperty ( "<STR_LIT>" , "<STR_LIT:en>" , "<STR_LIT>" ) ) ) ; } 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 > ( <NUM_LIT:2> ) ; V1PropertyDescription description = WSRP1TypeFactory . createPropertyDescription ( "<STR_LIT>" , WSRPConstants . XSD_STRING ) ; description . setHint ( WSRP1TypeFactory . createLocalizedString ( "<STR_LIT>" ) ) ; description . setLabel ( WSRP1TypeFactory . createLocalizedString ( "<STR_LIT>" ) ) ; expected . add ( description ) ; description = WSRP1TypeFactory . createPropertyDescription ( "<STR_LIT>" , WSRPConstants . XSD_STRING ) ; description . setHint ( WSRP1TypeFactory . createLocalizedString ( "<STR_LIT>" ) ) ; description . setLabel ( WSRP1TypeFactory . createLocalizedString ( "<STR_LIT>" ) ) ; 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 ( "<STR_LIT>" ) ; } catch ( V1InvalidRegistration invalidRegistrationFault ) { } 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 ( "<STR_LIT>" , "<STR_LIT:en>" , "<STR_LIT>" ) , WSRP1TypeFactory . createProperty ( "<STR_LIT>" , "<STR_LIT:en>" , "<STR_LIT>" ) ) ; V1SetPortletProperties setPortletProperties = WSRP1TypeFactory . createSetPortletProperties ( null , portletContext , propertyList ) ; V1PortletContext response = producer . setPortletProperties ( setPortletProperties ) ; V1GetPortletProperties getPortletProperties = WSRP1TypeFactory . createGetPortletProperties ( null , response ) ; Collections . addAll ( getPortletProperties . getNames ( ) , "<STR_LIT>" , "<STR_LIT>" ) ; checkGetPropertiesResponse ( producer . getPortletProperties ( getPortletProperties ) , properties ) ; portletContext = WSRP1TypeFactory . createPortletContext ( handle ) ; setPortletProperties . setPortletContext ( portletContext ) ; try { response = producer . setPortletProperties ( setPortletProperties ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1InconsistentParameters expected ) { } } @ Test public void testSetPortletPropertiesNoLanguage ( ) throws Exception { String handle = getDefaultHandle ( ) ; V1PortletContext portletContext = clonePortlet ( handle ) ; V1PropertyList propertyList = WSRP1TypeFactory . createPropertyList ( ) ; List < V1Property > properties = propertyList . getProperties ( ) ; Collections . addAll ( properties , WSRP1TypeFactory . createProperty ( "<STR_LIT>" , null , "<STR_LIT>" ) , WSRP1TypeFactory . createProperty ( "<STR_LIT>" , null , "<STR_LIT>" ) ) ; V1SetPortletProperties setPortletProperties = WSRP1TypeFactory . createSetPortletProperties ( null , portletContext , propertyList ) ; V1PortletContext response = producer . setPortletProperties ( setPortletProperties ) ; V1GetPortletProperties getPortletProperties = WSRP1TypeFactory . createGetPortletProperties ( null , response ) ; Collections . addAll ( getPortletProperties . getNames ( ) , "<STR_LIT>" , "<STR_LIT>" ) ; propertyList = WSRP1TypeFactory . createPropertyList ( ) ; properties = propertyList . getProperties ( ) ; Collections . addAll ( properties , WSRP1TypeFactory . createProperty ( "<STR_LIT>" , "<STR_LIT:en>" , "<STR_LIT>" ) , WSRP1TypeFactory . createProperty ( "<STR_LIT>" , "<STR_LIT:en>" , "<STR_LIT>" ) ) ; checkGetPropertiesResponse ( producer . getPortletProperties ( getPortletProperties ) , properties ) ; } @ Test public void testSetResetSamePortletProperty ( ) throws Exception { String handle = getDefaultHandle ( ) ; V1PortletContext portletContext = clonePortlet ( handle ) ; V1PropertyList propertyList = WSRP1TypeFactory . createPropertyList ( ) ; propertyList . getProperties ( ) . add ( WSRP1TypeFactory . createProperty ( "<STR_LIT>" , "<STR_LIT:en>" , "<STR_LIT>" ) ) ; propertyList . getResetProperties ( ) . add ( WSRP1TypeFactory . createResetProperty ( "<STR_LIT>" ) ) ; V1SetPortletProperties setPortletProperties = WSRP1TypeFactory . createSetPortletProperties ( null , portletContext , propertyList ) ; try { producer . setPortletProperties ( setPortletProperties ) ; fail ( "<STR_LIT>" ) ; } catch ( V1InconsistentParameters v1InconsistentParameters ) { } } @ Test public void testSetPortletPropertiesNoRegistrationWhenRequired ( ) { producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( true ) ; V1PropertyList propertyList = WSRP1TypeFactory . createPropertyList ( ) ; List < V1Property > properties = propertyList . getProperties ( ) ; Collections . addAll ( properties , WSRP1TypeFactory . createProperty ( "<STR_LIT>" , "<STR_LIT:en>" , "<STR_LIT>" ) , WSRP1TypeFactory . createProperty ( "<STR_LIT>" , "<STR_LIT:en>" , "<STR_LIT>" ) ) ; V1SetPortletProperties setPortletProperties = WSRP1TypeFactory . createSetPortletProperties ( null , WSRP1TypeFactory . createPortletContext ( getDefaultHandle ( ) ) , propertyList ) ; try { producer . setPortletProperties ( setPortletProperties ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1InvalidRegistration invalidRegistration ) { } 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 , "<STR_LIT>" , new PropertyDecorator ( ) ) ; return properties ; } private void checkPropertyDescriptions ( List < V1PropertyDescription > expected , List < V1PropertyDescription > propertyDescriptions ) { ExtendedAssert . assertEquals ( expected . size ( ) , propertyDescriptions . size ( ) ) ; V1PropertyDescription propDesc = propertyDescriptions . get ( <NUM_LIT:0> ) ; ExtendedAssert . assertNotNull ( propDesc ) ; String name = propDesc . getName ( ) ; if ( "<STR_LIT>" . equals ( name ) ) { assertEquals ( expected . get ( <NUM_LIT:0> ) , propDesc ) ; assertEquals ( expected . get ( <NUM_LIT:1> ) , propertyDescriptions . get ( <NUM_LIT:1> ) ) ; } else if ( "<STR_LIT>" . equals ( name ) ) { assertEquals ( expected . get ( <NUM_LIT:1> ) , propDesc ) ; assertEquals ( expected . get ( <NUM_LIT:0> ) , propertyDescriptions . get ( <NUM_LIT:1> ) ) ; } else { ExtendedAssert . fail ( "<STR_LIT>" + name + "<STR_LIT:'>" ) ; } } 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 ( "<STR_LIT>" ) . append ( prop . getName ( ) ) . append ( "<STR_LIT:=>" ) . append ( prop . getStringValue ( ) ) . append ( "<STR_LIT:U+0020(>" ) . append ( prop . getLang ( ) ) . append ( "<STR_LIT:)>" ) . toString ( ) ; } } } </s>
<s> package org . gatein . wsrp . protocol . v1 ; import org . apache . catalina . connector . Request ; import org . apache . catalina . connector . RequestFacade ; import org . gatein . common . util . ParameterValidation ; import org . gatein . wsrp . WSRPActionURL ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . WSRPPortletURL ; import org . gatein . wsrp . WSRPRenderURL ; import org . gatein . wsrp . api . servlet . ServletAccess ; import org . gatein . wsrp . portlet . utils . MockRequest ; import org . gatein . wsrp . producer . WSRPProducerBaseTest ; 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 . container . test . api . Deployment ; import org . jboss . arquillian . container . test . api . OverProtocol ; import org . jboss . arquillian . junit . Arquillian ; import org . jboss . shrinkwrap . api . Archive ; import org . jboss . shrinkwrap . api . ShrinkWrap ; import org . jboss . shrinkwrap . api . spec . EnterpriseArchive ; 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 ; import javax . servlet . ServletRequest ; @ RunWith ( Arquillian . class ) public class MarkupTestCase extends NeedPortletHandleTest { private static final String DEFAULT_VIEW_MARKUP = "<STR_LIT>" ; private static final String DEFAULT_MARKUP_PORTLET_WAR = "<STR_LIT>" ; public MarkupTestCase ( ) throws Exception { super ( "<STR_LIT>" , DEFAULT_MARKUP_PORTLET_WAR ) ; } @ Deployment @ OverProtocol ( "<STR_LIT>" ) public static Archive createDeployment ( ) { Archive archive = V1ProducerBaseTest . createDeployment ( ) ; return archive ; } @ Before public void setUp ( ) throws Exception { super . setUp ( ) ; Request request = new MockRequest ( ) ; request . setCoyoteRequest ( new org . apache . coyote . Request ( ) ) ; RequestFacade requestFacade = new RequestFacade ( request ) ; ServletAccess . setRequestAndResponse ( requestFacade , MockHttpServletResponse . createMockResponse ( ) ) ; } @ After public void tearDown ( ) throws Exception { super . tearDown ( ) ; } @ Test public void testGetMarkupViewNoSession ( ) throws Exception { V1GetMarkup getMarkup = createMarkupRequest ( ) ; V1MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , DEFAULT_VIEW_MARKUP ) ; } @ Test public void testGetMarkupNoPortletInstanceKeyNoNamespacePrefix ( ) throws Exception { V1GetMarkup getMarkup = createMarkupRequest ( ) ; getMarkup . getRuntimeContext ( ) . setNamespacePrefix ( null ) ; getMarkup . getRuntimeContext ( ) . setPortletInstanceKey ( null ) ; assertNull ( getMarkup . getRuntimeContext ( ) . getNamespacePrefix ( ) ) ; assertNull ( getMarkup . getRuntimeContext ( ) . getPortletInstanceKey ( ) ) ; V1MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , DEFAULT_VIEW_MARKUP ) ; getMarkup . getRuntimeContext ( ) . setNamespacePrefix ( "<STR_LIT>" ) ; getMarkup . getRuntimeContext ( ) . setPortletInstanceKey ( "<STR_LIT>" ) ; assertSame ( "<STR_LIT>" , getMarkup . getRuntimeContext ( ) . getNamespacePrefix ( ) ) ; assertSame ( "<STR_LIT>" , getMarkup . getRuntimeContext ( ) . getPortletInstanceKey ( ) ) ; response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , DEFAULT_VIEW_MARKUP ) ; } @ Test public void testInvalidGetMarkup ( ) throws Exception { V1GetMarkup getMarkup = createMarkupRequest ( ) ; getMarkup . getMarkupParams ( ) . setMode ( "<STR_LIT>" ) ; try { producer . getMarkup ( getMarkup ) ; ExtendedAssert . fail ( ) ; } catch ( V1UnsupportedMode unsupportedMode ) { } } @ Test public void testGetMarkupWithSessionID ( ) throws Exception { V1GetMarkup getMarkup = createMarkupRequest ( ) ; getMarkup . getRuntimeContext ( ) . setSessionID ( "<STR_LIT>" ) ; try { producer . getMarkup ( getMarkup ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1OperationFailed operationFailed ) { } } @ Test public void testGetMarkupEditNoSession ( ) throws Exception { V1GetMarkup getMarkup = createMarkupRequest ( ) ; getMarkup . getMarkupParams ( ) . setMode ( WSRPConstants . EDIT_MODE ) ; V1MarkupResponse response = producer . getMarkup ( getMarkup ) ; String namespacePrefix = getMarkup . getRuntimeContext ( ) . getNamespacePrefix ( ) ; checkMarkupResponse ( response , "<STR_LIT>" + "<STR_LIT>" + namespacePrefix + "<STR_LIT>" + "<STR_LIT>" ) ; } @ Test public void testGetMarkupRenderParameters ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String archiveName = "<STR_LIT>" ; deploy ( archiveName ) ; try { V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; V1MarkupResponse res = producer . getMarkup ( gm ) ; String markupString = res . getMarkupContext ( ) . getMarkupString ( ) ; String julienLink = extractLink ( markupString , <NUM_LIT:0> ) ; WSRPPortletURL julienURL = WSRPPortletURL . create ( julienLink ) ; ExtendedAssert . assertString1ContainsString2 ( markupString , "<STR_LIT>" ) ; ExtendedAssert . assertString1ContainsString2 ( markupString , "<STR_LIT>" ) ; ExtendedAssert . assertTrue ( julienURL instanceof WSRPRenderURL ) ; WSRPRenderURL julienRender = ( WSRPRenderURL ) julienURL ; gm . getMarkupParams ( ) . setNavigationalState ( julienRender . getNavigationalState ( ) . getStringValue ( ) ) ; res = producer . getMarkup ( gm ) ; markupString = res . getMarkupContext ( ) . getMarkupString ( ) ; ExtendedAssert . assertString1ContainsString2 ( markupString , "<STR_LIT>" ) ; WSRPPortletURL incrementURL = WSRPPortletURL . create ( extractLink ( markupString , julienLink . length ( ) * <NUM_LIT:2> ) ) ; ExtendedAssert . assertTrue ( incrementURL instanceof WSRPActionURL ) ; WSRPActionURL incrementAction = ( WSRPActionURL ) incrementURL ; V1PerformBlockingInteraction performBlockingInteraction = 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 , "<STR_LIT>" ) ; } finally { undeploy ( archiveName ) ; } } private String extractLink ( String markupString , int fromIndex ) { int urlStartIndex = markupString . indexOf ( "<STR_LIT>" , fromIndex ) ; int urlEndIndex = markupString . indexOf ( "<STR_LIT>" , urlStartIndex ) ; return markupString . substring ( urlStartIndex + <NUM_LIT:2> , urlEndIndex ) ; } @ Test public void testGetMarkupSession ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String sessionPortletArchive = "<STR_LIT>" ; deploy ( sessionPortletArchive ) ; try { V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; V1MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponseWithSession ( response , <NUM_LIT:0> ) ; response = producer . getMarkup ( getMarkup ) ; checkMarkupResponseWithSession ( response , <NUM_LIT:1> ) ; } finally { undeploy ( sessionPortletArchive ) ; } } @ Test public void testPerformBlockingInteractionNoRedirect ( ) throws Exception { checkPBIAndGetNavigationalState ( "<STR_LIT>" ) ; } @ Test public void testPerformBlockingInteractionRedirect ( ) throws Exception { V1PerformBlockingInteraction performBlockingInteraction = createDefaultPerformBlockingInteraction ( getDefaultHandle ( ) ) ; V1InteractionParams interactionParams = performBlockingInteraction . getInteractionParams ( ) ; V1NamedString namedString = new V1NamedString ( ) ; namedString . setName ( "<STR_LIT>" ) ; namedString . setValue ( "<STR_LIT>" ) ; interactionParams . getFormParameters ( ) . add ( namedString ) ; V1BlockingInteractionResponse response = producer . performBlockingInteraction ( performBlockingInteraction ) ; ExtendedAssert . assertNotNull ( response ) ; String redirectURL = response . getRedirectURL ( ) ; ExtendedAssert . assertNotNull ( redirectURL ) ; ExtendedAssert . assertEquals ( "<STR_LIT>" , redirectURL ) ; V1UpdateResponse updateResponse = response . getUpdateResponse ( ) ; ExtendedAssert . assertNull ( updateResponse ) ; } @ Test public void testGMAndPBIInteraction ( ) throws Exception { testGetMarkupViewNoSession ( ) ; String symbol = "<STR_LIT>" ; String navigationalState = checkPBIAndGetNavigationalState ( symbol ) ; V1GetMarkup getMarkup = createMarkupRequest ( ) ; getMarkup . getMarkupParams ( ) . setNavigationalState ( navigationalState ) ; V1MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , "<STR_LIT>" + symbol + "<STR_LIT>" ) ; } @ Test public void testPBIWithSessionID ( ) throws Exception { String portletHandle = getDefaultHandle ( ) ; V1PerformBlockingInteraction performBlockingInteraction = createDefaultPerformBlockingInteraction ( portletHandle ) ; V1RuntimeContext runtimeContext = performBlockingInteraction . getRuntimeContext ( ) ; runtimeContext . setSessionID ( "<STR_LIT>" ) ; try { producer . performBlockingInteraction ( performBlockingInteraction ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1OperationFailed 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 ( <NUM_LIT:15> , cacheControl . getExpires ( ) ) ; undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String sessionPortletArchive = "<STR_LIT>" ; 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 = "<STR_LIT>" ; deploy ( dispatcherPortletArchive ) ; try { V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; V1MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , "<STR_LIT:test>" ) ; } finally { undeploy ( dispatcherPortletArchive ) ; } } @ Test public void testGetMarkupWithNoContent ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String basicPortletArchive = "<STR_LIT>" ; deploy ( basicPortletArchive ) ; try { V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; V1MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , "<STR_LIT>" ) ; } finally { undeploy ( basicPortletArchive ) ; } } @ Test public void testGetMarkupWithNonStandardLocalesStrictMode ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String getLocalesPortletArchive = "<STR_LIT>" ; deploy ( getLocalesPortletArchive ) ; V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; getMarkup . getMarkupParams ( ) . getLocales ( ) . clear ( ) ; getMarkup . getMarkupParams ( ) . getLocales ( ) . add ( "<STR_LIT>" ) ; try { producer . getMarkup ( getMarkup ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( Exception expected ) { } finally { undeploy ( getLocalesPortletArchive ) ; } } @ Test public void testGetMarkupWithNonStandardLocalesLenientMode ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String getLocalesPortletArchive = "<STR_LIT>" ; deploy ( getLocalesPortletArchive ) ; V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; getMarkup . getMarkupParams ( ) . getLocales ( ) . clear ( ) ; getMarkup . getMarkupParams ( ) . getLocales ( ) . add ( "<STR_LIT>" ) ; producer . usingStrictModeChangedTo ( false ) ; checkMarkupResponse ( producer . getMarkup ( getMarkup ) , "<STR_LIT>" ) ; undeploy ( getLocalesPortletArchive ) ; } @ Test public void testGetMarkupWithoutDeclaredLocale ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String getLocalesPortletArchive = "<STR_LIT>" ; deploy ( getLocalesPortletArchive ) ; V1GetMarkup getMarkup = createMarkupRequest ( getPortletHandleFrom ( "<STR_LIT>" ) ) ; try { checkMarkupResponse ( producer . getMarkup ( getMarkup ) , Locale . getDefault ( ) . getDisplayName ( ) ) ; } finally { undeploy ( getLocalesPortletArchive ) ; } } @ Test public void testGetMarkupLocales ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String getLocalesPortletArchive = "<STR_LIT>" ; deploy ( getLocalesPortletArchive ) ; V1GetMarkup getMarkup = createMarkupRequest ( getPortletHandleFrom ( "<STR_LIT>" ) ) ; try { List < String > locales = getMarkup . getMarkupParams ( ) . getLocales ( ) ; locales . add ( "<STR_LIT:en>" ) ; locales . add ( "<STR_LIT>" ) ; V1MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , Locale . ENGLISH . getDisplayName ( ) ) ; locales . clear ( ) ; locales . add ( "<STR_LIT>" ) ; locales . add ( "<STR_LIT:en>" ) ; response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , Locale . FRENCH . getDisplayName ( ) ) ; locales . clear ( ) ; locales . add ( "<STR_LIT>" ) ; locales . add ( "<STR_LIT: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 = "<STR_LIT>" ; deploy ( encodeURLPortletArchive ) ; try { V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; V1MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , "<STR_LIT>" + "<STR_LIT>" ) ; } finally { undeploy ( encodeURLPortletArchive ) ; } } @ Test public void testGetMarkupWithUserContext ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String userContextPortletArchive = "<STR_LIT>" ; deploy ( userContextPortletArchive ) ; try { V1GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; getMarkup . setUserContext ( WSRP1TypeFactory . createUserContext ( "<STR_LIT>" ) ) ; V1MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , "<STR_LIT>" ) ; } finally { undeploy ( userContextPortletArchive ) ; } } @ Test public void testGetMarkupMultiValuedFormParams ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String multiValuedPortletArchive = "<STR_LIT>" ; deploy ( multiValuedPortletArchive ) ; V1NamedString namedString = createNamedString ( "<STR_LIT>" , "<STR_LIT:value1>" ) ; try { V1PerformBlockingInteraction action = 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 , "<STR_LIT>" ) ; formParameters . clear ( ) ; formParameters . add ( namedString ) ; formParameters . add ( createNamedString ( "<STR_LIT>" , "<STR_LIT>" ) ) ; actionResponse = producer . performBlockingInteraction ( action ) ; markupRequest = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; markupRequest . getMarkupParams ( ) . setNavigationalState ( actionResponse . getUpdateResponse ( ) . getNavigationalState ( ) ) ; response = producer . getMarkup ( markupRequest ) ; checkMarkupResponse ( response , "<STR_LIT>" ) ; formParameters . clear ( ) ; formParameters . add ( createNamedString ( "<STR_LIT:foo>" , null ) ) ; actionResponse = producer . performBlockingInteraction ( action ) ; markupRequest = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; markupRequest . getMarkupParams ( ) . setNavigationalState ( actionResponse . getUpdateResponse ( ) . getNavigationalState ( ) ) ; response = producer . getMarkup ( markupRequest ) ; checkMarkupResponse ( response , "<STR_LIT>" ) ; } catch ( Exception e ) { System . out . println ( "<STR_LIT>" ) ; e . printStackTrace ( ) ; throw new Exception ( e ) ; } finally { undeploy ( multiValuedPortletArchive ) ; } } @ Test public void testImplicitCloning ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String archiveName = "<STR_LIT>" ; deploy ( archiveName ) ; try { V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; V1MarkupResponse res = producer . getMarkup ( gm ) ; String markupString = res . getMarkupContext ( ) . getMarkupString ( ) ; ExtendedAssert . assertEquals ( "<STR_LIT>" , markupString ) ; V1PerformBlockingInteraction pbi = createDefaultPerformBlockingInteraction ( getHandleForCurrentlyDeployedArchive ( ) ) ; pbi . getInteractionParams ( ) . setPortletStateChange ( V1StateChange . CLONE_BEFORE_WRITE ) ; String value = "<STR_LIT>" ; pbi . getInteractionParams ( ) . getFormParameters ( ) . add ( createNamedString ( "<STR_LIT:value>" , value ) ) ; V1BlockingInteractionResponse response = producer . performBlockingInteraction ( pbi ) ; ExtendedAssert . assertNotNull ( response ) ; V1PortletContext pc = response . getUpdateResponse ( ) . getPortletContext ( ) ; ExtendedAssert . assertNotNull ( pc ) ; res = producer . getMarkup ( gm ) ; markupString = res . getMarkupContext ( ) . getMarkupString ( ) ; ExtendedAssert . assertEquals ( "<STR_LIT>" , markupString ) ; gm . setPortletContext ( pc ) ; res = producer . getMarkup ( gm ) ; markupString = res . getMarkupContext ( ) . getMarkupString ( ) ; ExtendedAssert . assertEquals ( value , markupString ) ; } finally { undeploy ( archiveName ) ; } } @ Test public void testGetMarkupWithResource ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String archive = "<STR_LIT>" ; deploy ( archive ) ; try { V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; V1MarkupResponse res = producer . getMarkup ( gm ) ; String markupString = res . getMarkupContext ( ) . getMarkupString ( ) ; String markupStart = "<STR_LIT>" ; String markupEnd = "<STR_LIT>" ; String localhostMarkup = markupStart + "<STR_LIT:localhost>" + markupEnd ; String homeIPMarkup = markupStart + "<STR_LIT:127.0.0.1>" + markupEnd ; boolean result = localhostMarkup . equals ( markupString ) || homeIPMarkup . equals ( markupString ) ; ExtendedAssert . assertTrue ( "<STR_LIT>" + localhostMarkup + "<STR_LIT>" + homeIPMarkup + "<STR_LIT>" + markupString + "<STR_LIT>" , result ) ; } finally { undeploy ( archive ) ; } } @ Test public void testGetMarkupWithNonURLEncodedResource ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String archive = "<STR_LIT>" ; deploy ( archive ) ; try { V1GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; V1MarkupResponse res = producer . getMarkup ( gm ) ; String markupString = res . getMarkupContext ( ) . getMarkupString ( ) ; String markupStart = "<STR_LIT>" ; String markupEnd = "<STR_LIT>" ; String localhostMarkup = markupStart + "<STR_LIT:localhost>" + markupEnd ; String homeIPMarkup = markupStart + "<STR_LIT:127.0.0.1>" + markupEnd ; boolean result = localhostMarkup . equals ( markupString ) || homeIPMarkup . equals ( markupString ) ; ExtendedAssert . assertTrue ( "<STR_LIT>" + localhostMarkup + "<STR_LIT>" + homeIPMarkup + "<STR_LIT>" + markupString + "<STR_LIT>" , result ) ; } finally { undeploy ( archive ) ; } } @ Test public void testApplicationScopeVariableHandling ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String archive = "<STR_LIT>" ; deploy ( archive ) ; try { V1PerformBlockingInteraction pbi = createDefaultPerformBlockingInteraction ( getPortletHandleFrom ( "<STR_LIT>" ) ) ; pbi . getInteractionParams ( ) . getFormParameters ( ) . add ( createNamedString ( "<STR_LIT>" , "<STR_LIT:value>" ) ) ; producer . performBlockingInteraction ( pbi ) ; V1GetMarkup gm = createMarkupRequest ( getPortletHandleFrom ( "<STR_LIT>" ) ) ; V1MarkupResponse res = producer . getMarkup ( gm ) ; checkMarkupResponse ( res , "<STR_LIT>" ) ; } finally { undeploy ( archive ) ; } } @ Test public void testGetMarkupNoRegistrationWhenRegistrationRequired ( ) throws Exception { configureRegistrationSettings ( true , false ) ; V1GetMarkup gm = createMarkupRequest ( ) ; try { producer . getMarkup ( gm ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1InvalidRegistration invalidRegistration ) { } catch ( Exception e ) { ExtendedAssert . fail ( e . getMessage ( ) ) ; } } @ Test public void testPerformBlockingInteractionNoRegistrationWhenRegistrationRequired ( ) throws Exception { configureRegistrationSettings ( true , false ) ; V1PerformBlockingInteraction pbi = createDefaultPerformBlockingInteraction ( getHandleForCurrentlyDeployedArchive ( ) ) ; try { producer . performBlockingInteraction ( pbi ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( V1InvalidRegistration invalidRegistration ) { } 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 ( "<STR_LIT>" ) ; } catch ( V1InvalidRegistration invalidRegistration ) { } catch ( Exception e ) { ExtendedAssert . fail ( e . getMessage ( ) ) ; } } private V1NamedString createNamedString ( String name , String value ) { V1NamedString namedString = new V1NamedString ( ) ; namedString . setName ( name ) ; namedString . setValue ( value ) ; return namedString ; } private String checkPBIAndGetNavigationalState ( String symbol ) throws Exception { V1PerformBlockingInteraction performBlockingInteraction = createDefaultPerformBlockingInteraction ( getDefaultHandle ( ) ) ; V1InteractionParams interactionParams = performBlockingInteraction . getInteractionParams ( ) ; interactionParams . getFormParameters ( ) . add ( createNamedString ( "<STR_LIT>" , symbol ) ) ; V1BlockingInteractionResponse response = producer . performBlockingInteraction ( performBlockingInteraction ) ; ExtendedAssert . assertNotNull ( response ) ; ExtendedAssert . assertNull ( response . getRedirectURL ( ) ) ; V1UpdateResponse updateResponse = response . getUpdateResponse ( ) ; ExtendedAssert . assertNotNull ( updateResponse ) ; ExtendedAssert . assertNull ( updateResponse . getPortletContext ( ) ) ; 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 ) ; return navigationalState ; } private void checkMarkupResponseWithSession ( V1MarkupResponse response , int count ) throws RemoteException , V1InvalidRegistration , V1OperationFailed { ExtendedAssert . assertNotNull ( response ) ; V1MarkupContext markupContext = response . getMarkupContext ( ) ; ExtendedAssert . assertNotNull ( markupContext ) ; String markupString = markupContext . getMarkupString ( ) ; ExtendedAssert . assertString1ContainsString2 ( markupString , "<STR_LIT>" + count ) ; ExtendedAssert . assertString1ContainsString2 ( markupString , "<STR_LIT>" ) ; checkSessionForCurrentlyDeployedPortlet ( response ) ; } private V1MarkupContext checkMarkupResponse ( V1MarkupResponse response , String markupString ) { ExtendedAssert . assertNotNull ( response ) ; V1MarkupContext markupContext = response . getMarkupContext ( ) ; ExtendedAssert . assertNotNull ( markupContext ) ; ExtendedAssert . assertEquals ( "<STR_LIT:text/html>" , markupContext . getMimeType ( ) ) ; ExtendedAssert . assertEquals ( "<STR_LIT:title>" , markupContext . getPreferredTitle ( ) ) ; if ( ! ParameterValidation . isNullOrEmpty ( markupString ) ) { ExtendedAssert . assertTrue ( markupContext . isRequiresUrlRewriting ( ) ) ; } else { ExtendedAssert . assertFalse ( markupContext . isRequiresUrlRewriting ( ) ) ; } ExtendedAssert . assertEquals ( markupString , markupContext . getMarkupString ( ) ) ; V1SessionContext sessionContext = response . getSessionContext ( ) ; ExtendedAssert . assertNull ( sessionContext ) ; return markupContext ; } protected String getMostUsedPortletWARFileName ( ) { return DEFAULT_MARKUP_PORTLET_WAR ; } } </s>
<s> package org . gatein . wsrp . protocol . v1 ; import org . apache . catalina . connector . Request ; import org . apache . catalina . connector . RequestFacade ; import org . gatein . wsrp . api . servlet . ServletAccess ; import org . gatein . wsrp . portlet . utils . MockRequest ; 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 . container . test . api . Deployment ; import org . jboss . arquillian . container . test . api . OverProtocol ; import org . jboss . arquillian . junit . Arquillian ; import org . jboss . logging . Logger ; import org . jboss . shrinkwrap . api . Archive ; 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 ; @ RunWith ( Arquillian . class ) public class ReleaseSessionTestCase extends NeedPortletHandleTest { private static final String DEFAULT_SESSION_PORTLET_WAR = "<STR_LIT>" ; private static final Logger log = Logger . getLogger ( ReleaseSessionTestCase . class ) ; protected String getMostUsedPortletWARFileName ( ) { return DEFAULT_SESSION_PORTLET_WAR ; } public ReleaseSessionTestCase ( ) throws Exception { super ( "<STR_LIT>" , DEFAULT_SESSION_PORTLET_WAR ) ; log . debug ( "<STR_LIT>" ) ; } @ Deployment @ OverProtocol ( "<STR_LIT>" ) public static Archive createDeployment ( ) { Archive archive = V1ProducerBaseTest . createDeployment ( ) ; return archive ; } @ Before public void setUp ( ) throws Exception { super . setUp ( ) ; Request request = new MockRequest ( ) ; request . setCoyoteRequest ( new org . apache . coyote . Request ( ) ) ; RequestFacade requestFacade = new RequestFacade ( request ) ; ServletAccess . setRequestAndResponse ( requestFacade , MockHttpServletResponse . createMockResponse ( ) ) ; } @ After public void tearDown ( ) throws Exception { super . tearDown ( ) ; } @ Test public void testReleaseSession ( ) throws Exception { V1RegistrationContext fakeRegContext = WSRP1TypeFactory . createRegistrationContext ( "<STR_LIT>" ) ; V1RegistrationContext [ ] regContexts = new V1RegistrationContext [ ] { null , null , fakeRegContext } ; String nullSessionID = null ; String fakeSessionID = "<STR_LIT>" ; String [ ] [ ] sessionIDs = new String [ ] [ ] { { nullSessionID } , { nullSessionID , nullSessionID } , { fakeSessionID } , { fakeSessionID , fakeSessionID } , { fakeSessionID , nullSessionID } , { nullSessionID , fakeSessionID } } ; for ( int i = <NUM_LIT: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 ) ; if ( index == <NUM_LIT:0> ) { releaseSessions . setRegistrationContext ( registerConsumer ( ) ) ; } } log . info ( getSetupString ( releaseSessions ) ) ; producer . releaseSessions ( releaseSessions ) ; ExtendedAssert . fail ( "<STR_LIT>" + getSetupString ( releaseSessions ) ) ; } catch ( V1OperationFailed operationFailedFault ) { operationFailedFault . printStackTrace ( ) ; } finally { if ( index == <NUM_LIT:0> && useRegistration ) { releaseSessions . setRegistrationContext ( null ) ; } tearDown ( ) ; } } private String getSetupString ( V1ReleaseSessions releaseSessions ) { StringBuffer message = new StringBuffer ( "<STR_LIT>" ) ; if ( releaseSessions == null ) { message . append ( "<STR_LIT>" ) ; } else { V1RegistrationContext regContext = releaseSessions . getRegistrationContext ( ) ; List < String > sessionIDs = releaseSessions . getSessionIDs ( ) ; message . append ( "<STR_LIT>" ) . append ( regContext != null ? regContext . getRegistrationHandle ( ) : null ) ; message . append ( "<STR_LIT>" ) ; if ( sessionIDs != null ) { for ( int i = <NUM_LIT:0> ; i < sessionIDs . size ( ) ; i ++ ) { message . append ( sessionIDs . get ( i ) ) . append ( i == sessionIDs . size ( ) - <NUM_LIT:1> ? "<STR_LIT>" : "<STR_LIT:U+002CU+0020>" ) ; } } } if ( producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . isRegistrationRequired ( ) ) { message . append ( "<STR_LIT>" ) ; } return message . toString ( ) ; } } </s>
<s> package org . gatein . wsrp . protocol . v1 ; import com . google . common . base . Function ; import com . google . common . collect . Collections2 ; 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 . config . ProducerRegistrationRequirements ; import org . gatein . wsrp . producer . handlers . processors . ProducerHelper ; 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 . jboss . arquillian . container . test . api . Deployment ; import org . jboss . arquillian . container . test . api . OverProtocol ; import org . jboss . shrinkwrap . api . Archive ; import org . jboss . shrinkwrap . api . ShrinkWrap ; import org . jboss . shrinkwrap . api . importer . ExplodedImporter ; import org . jboss . shrinkwrap . api . spec . EnterpriseArchive ; import org . jboss . shrinkwrap . api . spec . JavaArchive ; import org . jboss . shrinkwrap . api . spec . WebArchive ; import org . jboss . shrinkwrap . resolver . api . maven . Maven ; import org . oasis . wsrp . v1 . V1GetMarkup ; 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 . V1PerformBlockingInteraction ; import org . oasis . wsrp . v1 . V1PortletContext ; 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 . V1RuntimeContext ; import org . oasis . wsrp . v1 . V1ServiceDescription ; import javax . xml . namespace . QName ; import java . io . File ; import java . util . ArrayList ; import java . util . Collection ; import java . util . Collections ; import java . util . List ; public abstract class V1ProducerBaseTest extends WSRPProducerBaseTest { private static final String CONSUMER = "<STR_LIT>" ; private static final Function < V1PortletDescription , String > PORTLET_DESCRIPTION_TO_HANDLE = new Function < V1PortletDescription , String > ( ) { public String apply ( V1PortletDescription from ) { return from . getPortletHandle ( ) ; } } ; protected WSRP1Producer producer = ProducerHolder . getV1Producer ( ) ; public V1ProducerBaseTest ( ) throws Exception { this ( "<STR_LIT>" ) ; } protected V1ProducerBaseTest ( String name ) throws Exception { super ( name ) ; } @ Override protected WSRPProducer getProducer ( ) { return producer ; } @ Override protected ProducerHelper getProducerHelper ( ) { return producer ; } public void checkBasicPortletDescription ( V1PortletDescription desc , String handle ) { ExtendedAssert . assertNotNull ( desc ) ; ExtendedAssert . assertTrue ( desc . getPortletHandle ( ) . length ( ) <= <NUM_LIT:255> ) ; if ( handle != null ) { ExtendedAssert . assertEquals ( handle , desc . getPortletHandle ( ) ) ; } ExtendedAssert . assertEquals ( "<STR_LIT:title>" , desc . getTitle ( ) . getValue ( ) ) ; List < V1MarkupType > markupTypes = desc . getMarkupTypes ( ) ; ExtendedAssert . assertEquals ( <NUM_LIT:1> , markupTypes . size ( ) ) ; V1MarkupType markupType = markupTypes . get ( <NUM_LIT:0> ) ; List < String > states = new ArrayList < String > ( <NUM_LIT:3> ) ; states . add ( WSRPConstants . NORMAL_WINDOW_STATE ) ; states . add ( WSRPConstants . MAXIMIZED_WINDOW_STATE ) ; states . add ( WSRPConstants . MINIMIZED_WINDOW_STATE ) ; V1MarkupType expected = WSRP1TypeFactory . createMarkupType ( "<STR_LIT:text/html>" , Collections . < String > singletonList ( WSRPConstants . VIEW_MODE ) , states , Collections . < String > singletonList ( "<STR_LIT:en>" ) ) ; assertEquals ( expected , markupType ) ; } protected V1ServiceDescription checkServiceDescriptionWithOnlyBasicPortlet ( V1GetServiceDescription gs ) throws Exception { deploy ( "<STR_LIT>" ) ; V1ServiceDescription sd = producer . getServiceDescription ( gs ) ; ExtendedAssert . assertNotNull ( "<STR_LIT>" , sd ) ; List < V1PortletDescription > offeredPortlets = sd . getOfferedPortlets ( ) ; ExtendedAssert . assertNotNull ( offeredPortlets ) ; ExtendedAssert . assertEquals ( <NUM_LIT:1> , offeredPortlets . size ( ) ) ; V1PortletDescription desc = offeredPortlets . get ( <NUM_LIT:0> ) ; checkBasicPortletDescription ( desc , null ) ; undeploy ( "<STR_LIT>" ) ; return sd ; } 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 ( "<STR_LIT>" , "<STR_LIT:en>" , "<STR_LIT>" ) ) ; return regData ; } protected RegistrationPropertyDescription configureRegistrationSettings ( boolean requiresRegistration , boolean provideUnregisteredFullDescription ) { ProducerRegistrationRequirements registrationRequirements = producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) ; registrationRequirements . setRegistrationRequired ( requiresRegistration ) ; registrationRequirements . setRegistrationRequiredForFullDescription ( ! provideUnregisteredFullDescription ) ; if ( requiresRegistration ) { RegistrationPropertyDescription regProp = new RegistrationPropertyDescription ( "<STR_LIT>" , new QName ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ) ; regProp . setDefaultLabel ( "<STR_LIT>" ) ; registrationRequirements . addRegistrationProperty ( regProp ) ; DefaultRegistrationPolicy defaultRegistrationPolicy = new DefaultRegistrationPolicy ( ) ; defaultRegistrationPolicy . setValidator ( new DefaultRegistrationPropertyValidator ( ) ) ; registrationRequirements . setPolicy ( defaultRegistrationPolicy ) ; RegistrationManager registrationManager = producer . getRegistrationManager ( ) ; registrationManager . setPolicy ( defaultRegistrationPolicy ) ; registrationRequirements . addRegistrationPropertyChangeListener ( registrationManager ) ; try { registrationManager . createConsumer ( CONSUMER ) ; } catch ( RegistrationException e ) { ExtendedAssert . fail ( "<STR_LIT>" + e . getLocalizedMessage ( ) ) ; } return regProp ; } else { return null ; } } protected V1GetServiceDescription getNoRegistrationServiceDescriptionRequest ( ) { V1GetServiceDescription gs = WSRP1TypeFactory . createGetServiceDescription ( ) ; gs . getDesiredLocales ( ) . add ( "<STR_LIT>" ) ; gs . getDesiredLocales ( ) . add ( "<STR_LIT:en>" ) ; return gs ; } protected static void assertEquals ( V1MarkupType expected , V1MarkupType tested ) { String message = "<STR_LIT>" + expected + "<STR_LIT>" + tested + "<STR_LIT>" ; if ( expected != tested ) { if ( expected == null || tested == null ) { ExtendedAssert . fail ( message + "<STR_LIT>" ) ; } assertEquals ( message + "<STR_LIT>" , expected . getExtensions ( ) , tested . getExtensions ( ) ) ; assertEquals ( message + "<STR_LIT>" , expected . getLocales ( ) , tested . getLocales ( ) ) ; assertEquals ( message + "<STR_LIT>" , expected . getModes ( ) , tested . getModes ( ) ) ; Collections . sort ( expected . getWindowStates ( ) ) ; Collections . sort ( tested . getWindowStates ( ) ) ; assertEquals ( message + "<STR_LIT>" , expected . getWindowStates ( ) , tested . getWindowStates ( ) ) ; } } protected static void assertEquals ( V1PropertyDescription expected , V1PropertyDescription tested ) { String message = "<STR_LIT>" + expected + "<STR_LIT>" + tested + "<STR_LIT>" ; if ( expected != tested ) { if ( expected == null || tested == null ) { ExtendedAssert . fail ( message + "<STR_LIT>" ) ; } assertEquals ( message + "<STR_LIT>" , expected . getExtensions ( ) , tested . getExtensions ( ) ) ; assertEquals ( message + "<STR_LIT>" , expected . getHint ( ) , tested . getHint ( ) ) ; assertEquals ( message + "<STR_LIT>" , expected . getLabel ( ) , tested . getLabel ( ) ) ; ExtendedAssert . assertEquals ( message + "<STR_LIT>" , expected . getName ( ) , tested . getName ( ) ) ; ExtendedAssert . assertEquals ( message + "<STR_LIT>" , expected . getType ( ) , tested . getType ( ) ) ; } } protected static void assertEquals ( String message , V1LocalizedString expected , V1LocalizedString tested ) { String precise = "<STR_LIT>" + expected + "<STR_LIT>" + tested + "<STR_LIT>" ; if ( expected != tested ) { if ( expected == null || tested == null ) { ExtendedAssert . fail ( message + "<STR_LIT>" ) ; } ExtendedAssert . assertEquals ( precise + "<STR_LIT>" , expected . getLang ( ) , tested . getLang ( ) ) ; ExtendedAssert . assertEquals ( precise + "<STR_LIT>" , expected . getResourceName ( ) , tested . getResourceName ( ) ) ; ExtendedAssert . assertEquals ( precise + "<STR_LIT>" , expected . getValue ( ) , tested . getValue ( ) ) ; } } protected void checkException ( Exception e , String errorCode ) { Throwable cause = e . getCause ( ) ; } protected V1GetMarkup createDefaultMarkupRequest ( String handle ) { V1PortletContext portletContext = WSRP1TypeFactory . createPortletContext ( handle ) ; return WSRP1TypeFactory . createMarkupRequest ( portletContext , createDefaultRuntimeContext ( ) , WSRP1TypeFactory . createDefaultMarkupParams ( ) ) ; } protected V1PerformBlockingInteraction createDefaultPerformBlockingInteraction ( String handle ) { V1PortletContext portletContext = WSRP1TypeFactory . createPortletContext ( handle ) ; return WSRP1TypeFactory . createPerformBlockingInteraction ( portletContext , createDefaultRuntimeContext ( ) , WSRP1TypeFactory . createDefaultMarkupParams ( ) , WSRP1TypeFactory . createDefaultInteractionParams ( ) ) ; } protected V1RuntimeContext createDefaultRuntimeContext ( ) { return WSRP1TypeFactory . createRuntimeContext ( WSRPConstants . NONE_USER_AUTHENTICATION , "<STR_LIT:foo>" , "<STR_LIT:bar>" ) ; } @ Override protected Collection < String > getPortletHandles ( ) throws Exception { V1GetServiceDescription getServiceDescription = WSRP1TypeFactory . createGetServiceDescription ( ) ; V1ServiceDescription serviceDescription = producer . getServiceDescription ( getServiceDescription ) ; List < V1PortletDescription > offered = serviceDescription . getOfferedPortlets ( ) ; return Collections2 . transform ( offered , PORTLET_DESCRIPTION_TO_HANDLE ) ; } protected static Archive createDeployment ( ) { EnterpriseArchive archive = ShrinkWrap . createFromZipFile ( EnterpriseArchive . class , new File ( "<STR_LIT>" ) ) ; JavaArchive testJar = ShrinkWrap . create ( JavaArchive . class , "<STR_LIT>" ) . addClasses ( V1ProducerBaseTest . class , WSRPProducerBaseTest . class ) ; testJar = testJar . addClasses ( MarkupTestCase . class , NeedPortletHandleTest . class , PortletManagementTestCase . class , RegistrationTestCase . class , ReleaseSessionTestCase . class , ServiceDescriptionTestCase . class ) ; archive = archive . addAsLibraries ( testJar ) ; WebArchive pcWebArchive = ShrinkWrap . create ( WebArchive . class , "<STR_LIT>" ) ; pcWebArchive . merge ( ShrinkWrap . create ( WebArchive . class ) . as ( ExplodedImporter . class ) . importDirectory ( "<STR_LIT>" ) . as ( WebArchive . class ) ) ; archive . addAsModule ( pcWebArchive ) ; return archive ; } } </s>
<s> package org . gatein . wsrp . protocol . v1 ; import org . gatein . wsrp . WSRPConstants ; import org . oasis . wsrp . v1 . V1GetMarkup ; 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 java . rmi . RemoteException ; import java . util . List ; public abstract class NeedPortletHandleTest extends V1ProducerBaseTest { private String mostUsedPortletWARFileName ; public NeedPortletHandleTest ( String portletWARFileName ) throws Exception { this ( "<STR_LIT>" , portletWARFileName ) ; this . mostUsedPortletWARFileName = portletWARFileName ; } protected NeedPortletHandleTest ( String name , String portletWARFileName ) throws Exception { super ( name ) ; this . mostUsedPortletWARFileName = portletWARFileName ; } protected String getDefaultHandle ( ) { return getFirstHandleFor ( mostUsedPortletWARFileName ) ; } private String getFirstHandleFor ( String archiveName ) { return war2Handles . get ( archiveName ) . get ( <NUM_LIT:0> ) ; } protected String getHandleForCurrentlyDeployedArchive ( ) { return getFirstHandleFor ( currentlyDeployedArchiveName ) ; } protected List < String > getHandlesForCurrentlyDeployedArchive ( ) { return war2Handles . get ( currentlyDeployedArchiveName ) ; } protected boolean removeCurrent ( String archiveName ) { return ! mostUsedPortletWARFileName . equals ( archiveName ) ; } public void setUp ( ) throws Exception { super . setUp ( ) ; this . mostUsedPortletWARFileName = getMostUsedPortletWARFileName ( ) ; deploy ( mostUsedPortletWARFileName ) ; producer . usingStrictModeChangedTo ( true ) ; } protected abstract String getMostUsedPortletWARFileName ( ) ; public void tearDown ( ) throws Exception { undeploy ( mostUsedPortletWARFileName ) ; super . tearDown ( ) ; } protected V1GetMarkup createMarkupRequestForCurrentlyDeployedPortlet ( ) throws Exception { return createMarkupRequest ( getHandleForCurrentlyDeployedArchive ( ) ) ; } protected V1GetMarkup createMarkupRequest ( String handle ) throws RemoteException , V1InvalidRegistration , V1OperationFailed { V1GetMarkup getMarkup = 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 ( "<STR_LIT>" + partialHandle + "<STR_LIT>" + currentlyDeployedArchiveName ) ; } protected V1GetMarkup createMarkupRequest ( ) throws Exception { return createMarkupRequestForCurrentlyDeployedPortlet ( ) ; } protected void checkSessionForCurrentlyDeployedPortlet ( V1MarkupResponse response ) throws RemoteException , V1InvalidRegistration , V1OperationFailed { } } </s>
<s> package org . gatein . wsrp . protocol . v1 ; import org . apache . catalina . connector . Request ; import org . apache . catalina . connector . RequestFacade ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . api . servlet . ServletAccess ; import org . gatein . wsrp . portlet . utils . MockRequest ; import org . gatein . wsrp . registration . RegistrationPropertyDescription ; import org . gatein . wsrp . spec . v1 . V2ToV1Converter ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . support . MockHttpServletRequest ; import org . gatein . wsrp . test . support . MockHttpServletResponse ; import org . jboss . arquillian . container . test . api . Deployment ; import org . jboss . arquillian . container . test . api . OverProtocol ; import org . jboss . arquillian . junit . Arquillian ; import org . jboss . shrinkwrap . api . Archive ; 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 ; @ RunWith ( Arquillian . class ) public class ServiceDescriptionTestCase extends V1ProducerBaseTest { public ServiceDescriptionTestCase ( ) throws Exception { super ( "<STR_LIT>" ) ; } @ Deployment @ OverProtocol ( "<STR_LIT>" ) public static Archive createDeployment ( ) { Archive archive = V1ProducerBaseTest . createDeployment ( ) ; return archive ; } @ Before public void setUp ( ) throws Exception { super . setUp ( ) ; Request request = new MockRequest ( ) ; request . setCoyoteRequest ( new org . apache . coyote . Request ( ) ) ; RequestFacade requestFacade = new RequestFacade ( request ) ; ServletAccess . setRequestAndResponse ( requestFacade , MockHttpServletResponse . createMockResponse ( ) ) ; } @ After public void tearDown ( ) throws Exception { super . tearDown ( ) ; } @ Test public void testNotRequiringRegistration ( ) throws Throwable { producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( false ) ; V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest ( ) ; V1ServiceDescription sd = checkServiceDescriptionWithOnlyBasicPortlet ( gs ) ; ExtendedAssert . assertFalse ( sd . isRequiresRegistration ( ) ) ; ExtendedAssert . assertNull ( sd . getRegistrationPropertyDescription ( ) ) ; } @ Test public void testNotRequiringRegistrationSwitching ( ) throws Throwable { producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( false ) ; V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest ( ) ; V1ServiceDescription sd = producer . getServiceDescription ( gs ) ; ExtendedAssert . assertFalse ( sd . isRequiresRegistration ( ) ) ; producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( true ) ; gs = getNoRegistrationServiceDescriptionRequest ( ) ; sd = producer . getServiceDescription ( gs ) ; ExtendedAssert . assertTrue ( sd . isRequiresRegistration ( ) ) ; producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( false ) ; gs = getNoRegistrationServiceDescriptionRequest ( ) ; sd = producer . getServiceDescription ( gs ) ; ExtendedAssert . assertFalse ( sd . isRequiresRegistration ( ) ) ; } @ Test public void testRequiringRegistrationNotProvidingPortlets ( ) throws Throwable { RegistrationPropertyDescription regProp = configureRegistrationSettings ( true , false ) ; V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest ( ) ; V1ServiceDescription sd = producer . getServiceDescription ( gs ) ; ExtendedAssert . assertNotNull ( sd ) ; ExtendedAssert . assertTrue ( sd . isRequiresRegistration ( ) ) ; checkRequiredRegistrationProperties ( sd , regProp ) ; ExtendedAssert . assertTrue ( "<STR_LIT>" + sd . getOfferedPortlets ( ) , ( sd . getOfferedPortlets ( ) == null || sd . getOfferedPortlets ( ) . isEmpty ( ) ) ) ; } @ Test public void testRequiringRegistrationProvidingPortlets ( ) throws Throwable { RegistrationPropertyDescription regProp = configureRegistrationSettings ( true , true ) ; V1GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest ( ) ; V1ServiceDescription sd = checkServiceDescriptionWithOnlyBasicPortlet ( gs ) ; ExtendedAssert . assertNotNull ( sd ) ; ExtendedAssert . assertTrue ( sd . isRequiresRegistration ( ) ) ; checkRequiredRegistrationProperties ( sd , regProp ) ; } @ Test public void testLiveDeployment ( ) throws Throwable { try { V1GetServiceDescription gsd = getNoRegistrationServiceDescriptionRequest ( ) ; deploy ( "<STR_LIT>" ) ; V1ServiceDescription sd = producer . getServiceDescription ( gsd ) ; ExtendedAssert . assertEquals ( <NUM_LIT:1> , sd . getOfferedPortlets ( ) . size ( ) ) ; deploy ( "<STR_LIT>" ) ; sd = producer . getServiceDescription ( gsd ) ; ExtendedAssert . assertEquals ( <NUM_LIT:2> , sd . getOfferedPortlets ( ) . size ( ) ) ; deploy ( "<STR_LIT>" ) ; sd = producer . getServiceDescription ( gsd ) ; ExtendedAssert . assertEquals ( <NUM_LIT:3> , sd . getOfferedPortlets ( ) . size ( ) ) ; undeploy ( "<STR_LIT>" ) ; sd = producer . getServiceDescription ( gsd ) ; ExtendedAssert . assertEquals ( <NUM_LIT:2> , sd . getOfferedPortlets ( ) . size ( ) ) ; undeploy ( "<STR_LIT>" ) ; checkServiceDescriptionWithOnlyBasicPortlet ( gsd ) ; } finally { undeploy ( "<STR_LIT>" ) ; undeploy ( "<STR_LIT>" ) ; undeploy ( "<STR_LIT>" ) ; } } private void checkRequiredRegistrationProperties ( V1ServiceDescription sd , RegistrationPropertyDescription regProp ) { V1ModelDescription registrationPropertyDescription = sd . getRegistrationPropertyDescription ( ) ; ExtendedAssert . assertNotNull ( registrationPropertyDescription ) ; List < V1PropertyDescription > propertyDescriptions = registrationPropertyDescription . getPropertyDescriptions ( ) ; ExtendedAssert . assertNotNull ( propertyDescriptions ) ; ExtendedAssert . assertEquals ( <NUM_LIT:1> , propertyDescriptions . size ( ) ) ; assertEquals ( V2ToV1Converter . toV1PropertyDescription ( WSRPUtils . convertToPropertyDescription ( regProp ) ) , propertyDescriptions . get ( <NUM_LIT:0> ) ) ; } @ Override protected boolean removeCurrent ( String archiveName ) { return true ; } } </s>
<s> package org . gatein . wsrp . protocol . v2 ; import org . apache . catalina . connector . Request ; import org . apache . catalina . connector . RequestFacade ; import org . gatein . common . util . ParameterValidation ; import org . gatein . pc . api . StateString ; import org . gatein . pc . api . invocation . PortletInvocation ; import org . gatein . pc . api . invocation . response . PortletInvocationResponse ; import org . gatein . wsrp . WSRPActionURL ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . WSRPPortletURL ; import org . gatein . wsrp . WSRPRenderURL ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . api . extensions . ExtensionAccess ; import org . gatein . wsrp . api . extensions . InvocationHandlerDelegate ; import org . gatein . wsrp . api . extensions . UnmarshalledExtension ; import org . gatein . wsrp . api . servlet . ServletAccess ; import org . gatein . wsrp . payload . PayloadUtils ; import org . gatein . wsrp . payload . SerializableSimplePayload ; import org . gatein . wsrp . portlet . utils . MockRequest ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . support . MockHttpServletRequest ; import org . gatein . wsrp . test . support . MockHttpServletResponse ; import org . jboss . arquillian . container . test . api . Deployment ; import org . jboss . arquillian . container . test . api . OverProtocol ; import org . jboss . arquillian . junit . Arquillian ; import org . jboss . shrinkwrap . api . Archive ; 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 . v2 . BlockingInteractionResponse ; import org . oasis . wsrp . v2 . CacheControl ; import org . oasis . wsrp . v2 . Event ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . GetMarkup ; import org . oasis . wsrp . v2 . HandleEvents ; import org . oasis . wsrp . v2 . HandleEventsFailed ; import org . oasis . wsrp . v2 . HandleEventsResponse ; import org . oasis . wsrp . v2 . InitCookie ; import org . oasis . wsrp . v2 . InteractionParams ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . MarkupContext ; import org . oasis . wsrp . v2 . MarkupParams ; import org . oasis . wsrp . v2 . MarkupResponse ; import org . oasis . wsrp . v2 . NamedString ; import org . oasis . wsrp . v2 . NavigationalContext ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PerformBlockingInteraction ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . RuntimeContext ; import org . oasis . wsrp . v2 . SessionContext ; import org . oasis . wsrp . v2 . SessionParams ; import org . oasis . wsrp . v2 . StateChange ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UpdateResponse ; import javax . xml . namespace . QName ; import java . io . Serializable ; import java . rmi . RemoteException ; import java . util . List ; import java . util . Locale ; @ RunWith ( Arquillian . class ) public class MarkupTestCase extends org . gatein . wsrp . protocol . v2 . NeedPortletHandleTest { private static final String DEFAULT_VIEW_MARKUP = "<STR_LIT>" ; private static final String DEFAULT_MARKUP_PORTLET_WAR = "<STR_LIT>" ; public MarkupTestCase ( ) throws Exception { super ( "<STR_LIT>" , DEFAULT_MARKUP_PORTLET_WAR ) ; } @ Deployment @ OverProtocol ( "<STR_LIT>" ) public static Archive createDeployment ( ) { return V2ProducerBaseTest . createDeployment ( ) ; } @ Before public void setUp ( ) throws Exception { super . setUp ( ) ; Request request = new MockRequest ( ) ; request . setCoyoteRequest ( new org . apache . coyote . Request ( ) ) ; RequestFacade requestFacade = new RequestFacade ( request ) ; ServletAccess . setRequestAndResponse ( requestFacade , MockHttpServletResponse . createMockResponse ( ) ) ; } @ After public void tearDown ( ) throws Exception { super . tearDown ( ) ; } @ Test public void testGetMarkupViewNoSession ( ) throws Exception { try { GetMarkup getMarkup = createMarkupRequest ( ) ; MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , DEFAULT_VIEW_MARKUP ) ; } catch ( Exception e ) { System . out . println ( "<STR_LIT>" ) ; e . printStackTrace ( ) ; throw e ; } } @ Test public void testGetMarkupViewWithExtensions ( ) throws Exception { InvocationHandlerDelegate . registerProducerDelegate ( new InvocationHandlerDelegate ( ) { private boolean success ; @ Override public void processInvocation ( PortletInvocation invocation ) { final List < UnmarshalledExtension > extensions = ExtensionAccess . getProducerExtensionAccessor ( ) . getRequestExtensionsFor ( MarkupParams . class ) ; assertEquals ( <NUM_LIT:1> , extensions . size ( ) ) ; assertEquals ( "<STR_LIT:foo>" , extensions . get ( <NUM_LIT:0> ) . getValue ( ) ) ; success = true ; } @ Override public void processInvocationResponse ( PortletInvocationResponse response , PortletInvocation invocation ) { if ( success ) { ExtensionAccess . getProducerExtensionAccessor ( ) . addResponseExtension ( MarkupResponse . class , "<STR_LIT:bar>" ) ; } } } ) ; try { GetMarkup getMarkup = createMarkupRequest ( ) ; getMarkup . getMarkupParams ( ) . getExtensions ( ) . add ( WSRPTypeFactory . createExtension ( PayloadUtils . marshallExtension ( "<STR_LIT:foo>" ) ) ) ; MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , DEFAULT_VIEW_MARKUP ) ; final List < Extension > responseExtensions = response . getExtensions ( ) ; assertEquals ( <NUM_LIT:1> , responseExtensions . size ( ) ) ; assertEquals ( "<STR_LIT:bar>" , PayloadUtils . unmarshallExtension ( responseExtensions . get ( <NUM_LIT:0> ) . getAny ( ) ) . getValue ( ) ) ; } catch ( Exception e ) { System . out . println ( "<STR_LIT>" ) ; e . printStackTrace ( ) ; throw e ; } finally { InvocationHandlerDelegate . registerProducerDelegate ( null ) ; } } @ Test public void testInvalidGetMarkup ( ) throws Exception { GetMarkup getMarkup = createMarkupRequest ( ) ; getMarkup . getMarkupParams ( ) . setMode ( "<STR_LIT>" ) ; try { producer . getMarkup ( getMarkup ) ; ExtendedAssert . fail ( ) ; } catch ( UnsupportedMode unsupportedMode ) { } } @ Test public void testGetMarkupWithSessionID ( ) throws Exception { GetMarkup getMarkup = createMarkupRequest ( ) ; SessionParams sessionParams = WSRPTypeFactory . createSessionParams ( "<STR_LIT>" ) ; getMarkup . getRuntimeContext ( ) . setSessionParams ( sessionParams ) ; try { producer . getMarkup ( getMarkup ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( OperationFailed operationFailed ) { } } @ Test public void testGetMarkupEditNoSession ( ) throws Exception { GetMarkup getMarkup = createMarkupRequest ( ) ; getMarkup . getMarkupParams ( ) . setMode ( WSRPConstants . EDIT_MODE ) ; MarkupResponse response = producer . getMarkup ( getMarkup ) ; String namespacePrefix = getMarkup . getRuntimeContext ( ) . getNamespacePrefix ( ) ; checkMarkupResponse ( response , "<STR_LIT>" + "<STR_LIT>" + namespacePrefix + "<STR_LIT>" + "<STR_LIT>" ) ; } @ Test public void testGetMarkupRenderParameters ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String archiveName = "<STR_LIT>" ; deploy ( archiveName ) ; try { GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; MarkupResponse res = producer . getMarkup ( gm ) ; String markupString = res . getMarkupContext ( ) . getItemString ( ) ; String julienLink = extractLink ( markupString , <NUM_LIT:0> ) ; WSRPPortletURL julienURL = WSRPPortletURL . create ( julienLink ) ; ExtendedAssert . assertString1ContainsString2 ( markupString , "<STR_LIT>" ) ; ExtendedAssert . assertString1ContainsString2 ( markupString , "<STR_LIT>" ) ; ExtendedAssert . assertTrue ( julienURL instanceof WSRPRenderURL ) ; WSRPRenderURL julienRender = ( WSRPRenderURL ) julienURL ; NavigationalContext navigationalContext = WSRPTypeFactory . createNavigationalContext ( julienRender . getNavigationalState ( ) . getStringValue ( ) , null ) ; gm . getMarkupParams ( ) . setNavigationalContext ( navigationalContext ) ; res = producer . getMarkup ( gm ) ; markupString = res . getMarkupContext ( ) . getItemString ( ) ; ExtendedAssert . assertString1ContainsString2 ( markupString , "<STR_LIT>" ) ; WSRPPortletURL incrementURL = WSRPPortletURL . create ( extractLink ( markupString , julienLink . length ( ) * <NUM_LIT:2> ) ) ; ExtendedAssert . assertTrue ( incrementURL instanceof WSRPActionURL ) ; WSRPActionURL incrementAction = ( WSRPActionURL ) incrementURL ; PerformBlockingInteraction performBlockingInteraction = createDefaultPerformBlockingInteraction ( getHandleForCurrentlyDeployedArchive ( ) ) ; InteractionParams interactionParams = performBlockingInteraction . getInteractionParams ( ) ; interactionParams . setInteractionState ( incrementAction . getInteractionState ( ) . getStringValue ( ) ) ; producer . performBlockingInteraction ( performBlockingInteraction ) ; res = producer . getMarkup ( gm ) ; markupString = res . getMarkupContext ( ) . getItemString ( ) ; ExtendedAssert . assertString1ContainsString2 ( markupString , "<STR_LIT>" ) ; } finally { undeploy ( archiveName ) ; } } private String extractLink ( String markupString , int fromIndex ) { int urlStartIndex = markupString . indexOf ( "<STR_LIT>" , fromIndex ) ; int urlEndIndex = markupString . indexOf ( "<STR_LIT>" , urlStartIndex ) ; return markupString . substring ( urlStartIndex + <NUM_LIT:2> , urlEndIndex ) ; } @ Test public void testGetMarkupSession ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String sessionPortletArchive = "<STR_LIT>" ; deploy ( sessionPortletArchive ) ; try { GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponseWithSession ( response , <NUM_LIT:0> ) ; response = producer . getMarkup ( getMarkup ) ; checkMarkupResponseWithSession ( response , <NUM_LIT:1> ) ; } finally { undeploy ( sessionPortletArchive ) ; } } @ Test public void testPerformBlockingInteractionNoRedirect ( ) throws Exception { checkPBIAndGetNavigationalState ( "<STR_LIT>" ) ; } @ Test public void testPerformBlockingInteractionRedirect ( ) throws Exception { PerformBlockingInteraction performBlockingInteraction = createDefaultPerformBlockingInteraction ( getDefaultHandle ( ) ) ; InteractionParams interactionParams = performBlockingInteraction . getInteractionParams ( ) ; NamedString namedString = WSRPTypeFactory . createNamedString ( "<STR_LIT>" , "<STR_LIT>" ) ; interactionParams . getFormParameters ( ) . add ( namedString ) ; BlockingInteractionResponse response = producer . performBlockingInteraction ( performBlockingInteraction ) ; ExtendedAssert . assertNotNull ( response ) ; String redirectURL = response . getRedirectURL ( ) ; ExtendedAssert . assertNotNull ( redirectURL ) ; ExtendedAssert . assertEquals ( "<STR_LIT>" , redirectURL ) ; UpdateResponse updateResponse = response . getUpdateResponse ( ) ; ExtendedAssert . assertNull ( updateResponse ) ; } @ Test public void testPerformBlockingInteractionWithExtensions ( ) throws Exception { InvocationHandlerDelegate . registerProducerDelegate ( new InvocationHandlerDelegate ( ) { private boolean success ; @ Override public void processInvocation ( PortletInvocation invocation ) { final List < UnmarshalledExtension > extensions = ExtensionAccess . getProducerExtensionAccessor ( ) . getRequestExtensionsFor ( InteractionParams . class ) ; assertEquals ( <NUM_LIT:1> , extensions . size ( ) ) ; assertEquals ( "<STR_LIT:foo>" , extensions . get ( <NUM_LIT:0> ) . getValue ( ) ) ; success = true ; } @ Override public void processInvocationResponse ( PortletInvocationResponse response , PortletInvocation invocation ) { if ( success ) { ExtensionAccess . getProducerExtensionAccessor ( ) . addResponseExtension ( BlockingInteractionResponse . class , "<STR_LIT:bar>" ) ; } } } ) ; try { PerformBlockingInteraction performBlockingInteraction = createDefaultPerformBlockingInteraction ( getDefaultHandle ( ) ) ; InteractionParams interactionParams = performBlockingInteraction . getInteractionParams ( ) ; interactionParams . getExtensions ( ) . add ( WSRPTypeFactory . createExtension ( PayloadUtils . marshallExtension ( "<STR_LIT:foo>" ) ) ) ; NamedString namedString = WSRPTypeFactory . createNamedString ( "<STR_LIT>" , "<STR_LIT>" ) ; interactionParams . getFormParameters ( ) . add ( namedString ) ; final BlockingInteractionResponse interactionResponse = producer . performBlockingInteraction ( performBlockingInteraction ) ; assertNotNull ( interactionResponse ) ; final List < Extension > responseExtensions = interactionResponse . getExtensions ( ) ; assertEquals ( <NUM_LIT:1> , responseExtensions . size ( ) ) ; assertEquals ( "<STR_LIT:bar>" , PayloadUtils . unmarshallExtension ( responseExtensions . get ( <NUM_LIT:0> ) . getAny ( ) ) . getValue ( ) ) ; } catch ( Exception e ) { System . out . println ( "<STR_LIT>" ) ; e . printStackTrace ( ) ; throw e ; } finally { InvocationHandlerDelegate . registerProducerDelegate ( null ) ; } } @ Test public void testGMAndPBIInteraction ( ) throws Exception { testGetMarkupViewNoSession ( ) ; String symbol = "<STR_LIT>" ; String navigationalState = checkPBIAndGetNavigationalState ( symbol ) ; GetMarkup getMarkup = createMarkupRequest ( ) ; NavigationalContext navigationalContext = WSRPTypeFactory . createNavigationalContextOrNull ( StateString . create ( navigationalState ) , null ) ; getMarkup . getMarkupParams ( ) . setNavigationalContext ( navigationalContext ) ; MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , "<STR_LIT>" + symbol + "<STR_LIT>" ) ; } @ Test public void testPBIWithSessionID ( ) throws Exception { String portletHandle = getDefaultHandle ( ) ; PerformBlockingInteraction performBlockingInteraction = createDefaultPerformBlockingInteraction ( portletHandle ) ; RuntimeContext runtimeContext = performBlockingInteraction . getRuntimeContext ( ) ; SessionParams sessionParams = WSRPTypeFactory . createSessionParams ( "<STR_LIT>" ) ; runtimeContext . setSessionParams ( sessionParams ) ; try { producer . performBlockingInteraction ( performBlockingInteraction ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( OperationFailed expected ) { } } @ Test public void testMarkupCaching ( ) throws Exception { GetMarkup getMarkup = createMarkupRequest ( ) ; MarkupResponse response = producer . getMarkup ( getMarkup ) ; CacheControl cacheControl = response . getMarkupContext ( ) . getCacheControl ( ) ; ExtendedAssert . assertNotNull ( cacheControl ) ; ExtendedAssert . assertEquals ( WSRPConstants . CACHE_PER_USER , cacheControl . getUserScope ( ) ) ; ExtendedAssert . assertEquals ( <NUM_LIT:15> , cacheControl . getExpires ( ) ) ; undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String sessionPortletArchive = "<STR_LIT>" ; 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 = "<STR_LIT>" ; deploy ( dispatcherPortletArchive ) ; try { GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , "<STR_LIT:test>" ) ; } finally { undeploy ( dispatcherPortletArchive ) ; } } @ Test public void testGetMarkupWithNoContent ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String basicPortletArchive = "<STR_LIT>" ; deploy ( basicPortletArchive ) ; try { GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , "<STR_LIT>" ) ; } finally { undeploy ( basicPortletArchive ) ; } } @ Test public void testGetMarkupWithNonStandardLocalesStrictMode ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String getLocalesPortletArchive = "<STR_LIT>" ; deploy ( getLocalesPortletArchive ) ; GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; getMarkup . getMarkupParams ( ) . getLocales ( ) . clear ( ) ; getMarkup . getMarkupParams ( ) . getLocales ( ) . add ( "<STR_LIT>" ) ; try { producer . getMarkup ( getMarkup ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( UnsupportedLocale expected ) { } finally { undeploy ( getLocalesPortletArchive ) ; } } @ Test public void testGetMarkupWithNonStandardLocalesLenientMode ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String getLocalesPortletArchive = "<STR_LIT>" ; deploy ( getLocalesPortletArchive ) ; GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; getMarkup . getMarkupParams ( ) . getLocales ( ) . clear ( ) ; getMarkup . getMarkupParams ( ) . getLocales ( ) . add ( "<STR_LIT>" ) ; producer . usingStrictModeChangedTo ( false ) ; checkMarkupResponse ( producer . getMarkup ( getMarkup ) , Locale . US . getDisplayName ( ) ) ; undeploy ( getLocalesPortletArchive ) ; } @ Test public void testGetMarkupWithoutDeclaredLocale ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String getLocalesPortletArchive = "<STR_LIT>" ; deploy ( getLocalesPortletArchive ) ; GetMarkup getMarkup = createMarkupRequest ( getPortletHandleFrom ( "<STR_LIT>" ) ) ; try { checkMarkupResponse ( producer . getMarkup ( getMarkup ) , Locale . getDefault ( ) . getDisplayName ( ) ) ; } finally { undeploy ( getLocalesPortletArchive ) ; } } @ Test public void testGetMarkupLocales ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String getLocalesPortletArchive = "<STR_LIT>" ; deploy ( getLocalesPortletArchive ) ; GetMarkup getMarkup = createMarkupRequest ( getPortletHandleFrom ( "<STR_LIT>" ) ) ; try { List < String > locales = getMarkup . getMarkupParams ( ) . getLocales ( ) ; locales . clear ( ) ; locales . add ( "<STR_LIT:en>" ) ; locales . add ( "<STR_LIT>" ) ; MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , Locale . ENGLISH . getDisplayName ( ) ) ; locales . clear ( ) ; locales . add ( "<STR_LIT>" ) ; locales . add ( "<STR_LIT:en>" ) ; response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , Locale . FRENCH . getDisplayName ( ) ) ; locales . clear ( ) ; locales . add ( "<STR_LIT>" ) ; locales . add ( "<STR_LIT: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 = "<STR_LIT>" ; deploy ( encodeURLPortletArchive ) ; try { GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , "<STR_LIT>" + "<STR_LIT>" ) ; } finally { undeploy ( encodeURLPortletArchive ) ; } } @ Test public void testGetMarkupWithUserContext ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String userContextPortletArchive = "<STR_LIT>" ; deploy ( userContextPortletArchive ) ; try { GetMarkup getMarkup = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; getMarkup . setUserContext ( WSRPTypeFactory . createUserContext ( "<STR_LIT>" ) ) ; MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , "<STR_LIT>" ) ; } finally { undeploy ( userContextPortletArchive ) ; } } @ Test public void testGetMarkupMultiValuedFormParams ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String multiValuedPortletArchive = "<STR_LIT>" ; deploy ( multiValuedPortletArchive ) ; NamedString namedString = createNamedString ( "<STR_LIT>" , "<STR_LIT:value1>" ) ; try { PerformBlockingInteraction action = createDefaultPerformBlockingInteraction ( getHandleForCurrentlyDeployedArchive ( ) ) ; List < NamedString > formParameters = action . getInteractionParams ( ) . getFormParameters ( ) ; formParameters . add ( namedString ) ; BlockingInteractionResponse actionResponse = producer . performBlockingInteraction ( action ) ; GetMarkup markupRequest = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; markupRequest . getMarkupParams ( ) . setNavigationalContext ( actionResponse . getUpdateResponse ( ) . getNavigationalContext ( ) ) ; MarkupResponse response = producer . getMarkup ( markupRequest ) ; checkMarkupResponse ( response , "<STR_LIT>" ) ; formParameters . clear ( ) ; formParameters . add ( namedString ) ; formParameters . add ( createNamedString ( "<STR_LIT>" , "<STR_LIT>" ) ) ; actionResponse = producer . performBlockingInteraction ( action ) ; markupRequest = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; markupRequest . getMarkupParams ( ) . setNavigationalContext ( actionResponse . getUpdateResponse ( ) . getNavigationalContext ( ) ) ; response = producer . getMarkup ( markupRequest ) ; checkMarkupResponse ( response , "<STR_LIT>" ) ; formParameters . clear ( ) ; formParameters . add ( WSRPTypeFactory . createNamedString ( "<STR_LIT:test>" , null ) ) ; actionResponse = producer . performBlockingInteraction ( action ) ; markupRequest = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; markupRequest . getMarkupParams ( ) . setNavigationalContext ( actionResponse . getUpdateResponse ( ) . getNavigationalContext ( ) ) ; response = producer . getMarkup ( markupRequest ) ; checkMarkupResponse ( response , "<STR_LIT>" ) ; } finally { undeploy ( multiValuedPortletArchive ) ; } } @ Test public void testImplicitCloning ( ) throws Exception { try { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String archiveName = "<STR_LIT>" ; deploy ( archiveName ) ; try { GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; MarkupResponse res = producer . getMarkup ( gm ) ; String markupString = res . getMarkupContext ( ) . getItemString ( ) ; ExtendedAssert . assertEquals ( "<STR_LIT>" , markupString ) ; PerformBlockingInteraction pbi = createDefaultPerformBlockingInteraction ( getHandleForCurrentlyDeployedArchive ( ) ) ; pbi . getInteractionParams ( ) . setPortletStateChange ( StateChange . CLONE_BEFORE_WRITE ) ; String value = "<STR_LIT>" ; pbi . getInteractionParams ( ) . getFormParameters ( ) . add ( createNamedString ( "<STR_LIT:value>" , value ) ) ; BlockingInteractionResponse response = producer . performBlockingInteraction ( pbi ) ; ExtendedAssert . assertNotNull ( response ) ; PortletContext pc = response . getUpdateResponse ( ) . getPortletContext ( ) ; ExtendedAssert . assertNotNull ( pc ) ; res = producer . getMarkup ( gm ) ; markupString = res . getMarkupContext ( ) . getItemString ( ) ; ExtendedAssert . assertEquals ( "<STR_LIT>" , markupString ) ; gm . setPortletContext ( pc ) ; res = producer . getMarkup ( gm ) ; markupString = res . getMarkupContext ( ) . getItemString ( ) ; ExtendedAssert . assertEquals ( value , markupString ) ; } finally { undeploy ( archiveName ) ; } } catch ( Exception e ) { System . out . println ( "<STR_LIT>" + this . getClass ( ) + "<STR_LIT>" ) ; e . printStackTrace ( ) ; throw new Exception ( e ) ; } } @ Test public void testGetMarkupWithResource ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String archive = "<STR_LIT>" ; deploy ( archive ) ; try { GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; MarkupResponse res = producer . getMarkup ( gm ) ; String markupString = res . getMarkupContext ( ) . getItemString ( ) ; String markupStart = "<STR_LIT>" ; String markupEnd = "<STR_LIT>" ; String localhostMarkup = markupStart + "<STR_LIT:localhost>" + markupEnd ; String homeIPMarkup = markupStart + "<STR_LIT:127.0.0.1>" + markupEnd ; boolean result = localhostMarkup . equals ( markupString ) || homeIPMarkup . equals ( markupString ) ; ExtendedAssert . assertTrue ( "<STR_LIT>" + localhostMarkup + "<STR_LIT>" + homeIPMarkup + "<STR_LIT>" + markupString + "<STR_LIT>" , result ) ; } finally { undeploy ( archive ) ; } } @ Test public void testGetMarkupWithNonURLEncodedResource ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String archive = "<STR_LIT>" ; deploy ( archive ) ; try { GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet ( ) ; MarkupResponse res = producer . getMarkup ( gm ) ; String markupString = res . getMarkupContext ( ) . getItemString ( ) ; String markupStart = "<STR_LIT>" ; String markupEnd = "<STR_LIT>" ; String localhostMarkup = markupStart + "<STR_LIT:localhost>" + markupEnd ; String homeIPMarkup = markupStart + "<STR_LIT:127.0.0.1>" + markupEnd ; boolean result = localhostMarkup . equals ( markupString ) || homeIPMarkup . equals ( markupString ) ; ExtendedAssert . assertTrue ( "<STR_LIT>" + localhostMarkup + "<STR_LIT>" + homeIPMarkup + "<STR_LIT>" + markupString + "<STR_LIT>" , result ) ; } finally { undeploy ( archive ) ; } } @ Test public void testApplicationScopeVariableHandling ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String archive = "<STR_LIT>" ; deploy ( archive ) ; try { PerformBlockingInteraction pbi = createDefaultPerformBlockingInteraction ( getPortletHandleFrom ( "<STR_LIT>" ) ) ; pbi . getInteractionParams ( ) . getFormParameters ( ) . add ( createNamedString ( "<STR_LIT>" , "<STR_LIT:value>" ) ) ; producer . performBlockingInteraction ( pbi ) ; GetMarkup gm = createMarkupRequest ( getPortletHandleFrom ( "<STR_LIT>" ) ) ; MarkupResponse res = producer . getMarkup ( gm ) ; checkMarkupResponse ( res , "<STR_LIT>" ) ; } finally { undeploy ( archive ) ; } } @ Test public void testGetMarkupWithSimpleEvent ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String archive = "<STR_LIT>" ; deploy ( archive ) ; NamedString namedString = createNamedString ( "<STR_LIT>" , "<STR_LIT>" ) ; try { List < String > handles = getHandlesForCurrentlyDeployedArchive ( ) ; String generatorHandle = null ; String consumerHandle = null ; for ( String portletHandle : handles ) { if ( portletHandle . contains ( "<STR_LIT>" ) ) { generatorHandle = portletHandle ; } else if ( portletHandle . contains ( "<STR_LIT>" ) ) { consumerHandle = portletHandle ; } } PerformBlockingInteraction action = createDefaultPerformBlockingInteraction ( generatorHandle ) ; List < NamedString > formParameters = action . getInteractionParams ( ) . getFormParameters ( ) ; formParameters . add ( namedString ) ; BlockingInteractionResponse actionResponse = producer . performBlockingInteraction ( action ) ; List < Event > events = actionResponse . getUpdateResponse ( ) . getEvents ( ) ; assertNotNull ( events ) ; assertEquals ( <NUM_LIT:1> , events . size ( ) ) ; Event event = events . get ( <NUM_LIT:0> ) ; assertEquals ( new QName ( "<STR_LIT>" , "<STR_LIT>" ) , event . getName ( ) ) ; assertEquals ( WSRPConstants . XSD_STRING , event . getType ( ) ) ; Serializable serializable = PayloadUtils . getPayloadAsSerializable ( event ) ; assertTrue ( serializable instanceof SerializableSimplePayload ) ; assertEquals ( "<STR_LIT>" , ( ( SerializableSimplePayload ) serializable ) . getPayload ( ) ) ; HandleEvents handleEvents = WSRPTypeFactory . createHandleEvents ( null , WSRPTypeFactory . createPortletContext ( consumerHandle ) , createDefaultRuntimeContext ( ) , null , createDefaultMarkupParams ( ) , WSRPTypeFactory . createEventParams ( events , StateChange . READ_ONLY ) ) ; HandleEventsResponse handleEventsResponse = producer . handleEvents ( handleEvents ) ; List < HandleEventsFailed > failedEvents = handleEventsResponse . getFailedEvents ( ) ; assertEquals ( <NUM_LIT:0> , failedEvents . size ( ) ) ; GetMarkup markupRequestConsumer = createMarkupRequest ( consumerHandle ) ; markupRequestConsumer . getMarkupParams ( ) . setNavigationalContext ( handleEventsResponse . getUpdateResponse ( ) . getNavigationalContext ( ) ) ; MarkupResponse response = producer . getMarkup ( markupRequestConsumer ) ; checkMarkupResponse ( response , "<STR_LIT>" , false , true ) ; } finally { undeploy ( archive ) ; } } @ Test public void testGetMarkupWithPublicRenderParameter ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String archive = "<STR_LIT>" ; deploy ( archive ) ; NamedString namedString = createNamedString ( "<STR_LIT>" , "<STR_LIT>" ) ; try { List < String > handles = getHandlesForCurrentlyDeployedArchive ( ) ; String generatorHandle = null ; String consumerHandle = null ; for ( String portletHandle : handles ) { if ( portletHandle . contains ( "<STR_LIT>" ) ) { generatorHandle = portletHandle ; } else if ( portletHandle . contains ( "<STR_LIT>" ) ) { consumerHandle = portletHandle ; } } PerformBlockingInteraction action = createDefaultPerformBlockingInteraction ( generatorHandle ) ; List < NamedString > formParameters = action . getInteractionParams ( ) . getFormParameters ( ) ; formParameters . add ( namedString ) ; BlockingInteractionResponse actionResponse = producer . performBlockingInteraction ( action ) ; GetMarkup markupRequestConsumer = createMarkupRequest ( consumerHandle ) ; markupRequestConsumer . getMarkupParams ( ) . setNavigationalContext ( actionResponse . getUpdateResponse ( ) . getNavigationalContext ( ) ) ; MarkupResponse response = producer . getMarkup ( markupRequestConsumer ) ; checkMarkupResponse ( response , "<STR_LIT>" , false , true ) ; } finally { undeploy ( archive ) ; } } @ Test public void testGetMarkupWithDefaultPortletModes ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String archive = "<STR_LIT>" ; deploy ( archive ) ; try { GetMarkup getMarkup = createMarkupRequest ( ) ; getMarkup . getMarkupParams ( ) . setMode ( WSRPConstants . EDIT_MODE ) ; assertEquals ( WSRPConstants . EDIT_MODE , getMarkup . getMarkupParams ( ) . getMode ( ) ) ; MarkupResponse responseEdit = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( responseEdit , "<STR_LIT>" , false , true ) ; getMarkup . getMarkupParams ( ) . setMode ( WSRPConstants . VIEW_MODE ) ; assertEquals ( WSRPConstants . VIEW_MODE , getMarkup . getMarkupParams ( ) . getMode ( ) ) ; MarkupResponse responseView = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( responseView , "<STR_LIT>" , false , true ) ; getMarkup . getMarkupParams ( ) . setMode ( WSRPConstants . HELP_MODE ) ; assertEquals ( WSRPConstants . HELP_MODE , getMarkup . getMarkupParams ( ) . getMode ( ) ) ; MarkupResponse responseHelp = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( responseHelp , "<STR_LIT>" , false , true ) ; } finally { undeploy ( archive ) ; } } @ Test public void testGetMarkupWithCustomPortletMode ( ) throws Exception { undeploy ( DEFAULT_MARKUP_PORTLET_WAR ) ; String archive = "<STR_LIT>" ; deploy ( archive ) ; try { GetMarkup getMarkup = createMarkupRequest ( ) ; getMarkup . getMarkupParams ( ) . setMode ( "<STR_LIT>" ) ; assertEquals ( "<STR_LIT>" , getMarkup . getMarkupParams ( ) . getMode ( ) ) ; MarkupResponse response = producer . getMarkup ( getMarkup ) ; checkMarkupResponse ( response , "<STR_LIT>" , false , true ) ; } finally { undeploy ( archive ) ; } } @ Test public void testGetMarkupNoRegistrationWhenRegistrationRequired ( ) throws Exception { configureRegistrationSettings ( true , false ) ; GetMarkup gm = createMarkupRequest ( ) ; try { producer . getMarkup ( gm ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( InvalidRegistration invalidRegistration ) { } catch ( Exception e ) { ExtendedAssert . fail ( e . getMessage ( ) ) ; } } @ Test public void testPerformBlockingInteractionNoRegistrationWhenRegistrationRequired ( ) throws Exception { configureRegistrationSettings ( true , false ) ; PerformBlockingInteraction pbi = createDefaultPerformBlockingInteraction ( getHandleForCurrentlyDeployedArchive ( ) ) ; try { producer . performBlockingInteraction ( pbi ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( InvalidRegistration invalidRegistration ) { } catch ( Exception e ) { ExtendedAssert . fail ( e . getMessage ( ) ) ; } } @ Test public void testInitCookieNoRegistrationWhenRegistrationRequired ( ) throws Exception { configureRegistrationSettings ( true , false ) ; InitCookie initCookie = WSRPTypeFactory . createInitCookie ( null ) ; try { producer . initCookie ( initCookie ) ; ExtendedAssert . fail ( "<STR_LIT>" ) ; } catch ( InvalidRegistration invalidRegistration ) { } catch ( Exception e ) { ExtendedAssert . fail ( e . getMessage ( ) ) ; } } private String checkPBIAndGetNavigationalState ( String symbol ) throws Exception { PerformBlockingInteraction performBlockingInteraction = createDefaultPerformBlockingInteraction ( getDefaultHandle ( ) ) ; InteractionParams interactionParams = performBlockingInteraction . getInteractionParams ( ) ; interactionParams . getFormParameters ( ) . add ( createNamedString ( "<STR_LIT>" , symbol ) ) ; BlockingInteractionResponse response = producer . performBlockingInteraction ( performBlockingInteraction ) ; ExtendedAssert . assertNotNull ( response ) ; ExtendedAssert . assertNull ( response . getRedirectURL ( ) ) ; UpdateResponse updateResponse = response . getUpdateResponse ( ) ; ExtendedAssert . assertNotNull ( updateResponse ) ; ExtendedAssert . assertNull ( updateResponse . getPortletContext ( ) ) ; ExtendedAssert . assertNull ( updateResponse . getSessionContext ( ) ) ; String navigationalState = updateResponse . getNavigationalContext ( ) . getOpaqueValue ( ) ; ExtendedAssert . assertNotNull ( navigationalState ) ; ExtendedAssert . assertEquals ( updateResponse . getNewMode ( ) , WSRPConstants . VIEW_MODE ) ; MarkupContext markupContext = updateResponse . getMarkupContext ( ) ; ExtendedAssert . assertNull ( markupContext ) ; return navigationalState ; } private void checkMarkupResponseWithSession ( MarkupResponse response , int count ) throws RemoteException , InvalidRegistration , OperationFailed { ExtendedAssert . assertNotNull ( response ) ; MarkupContext markupContext = response . getMarkupContext ( ) ; ExtendedAssert . assertNotNull ( markupContext ) ; String markupString = markupContext . getItemString ( ) ; ExtendedAssert . assertString1ContainsString2 ( markupString , "<STR_LIT>" + count ) ; ExtendedAssert . assertString1ContainsString2 ( markupString , "<STR_LIT>" ) ; checkSessionForCurrentlyDeployedPortlet ( response ) ; } private MarkupContext checkMarkupResponse ( MarkupResponse response , String markupString ) { return checkMarkupResponse ( response , markupString , true , false ) ; } private MarkupContext checkMarkupResponse ( MarkupResponse response , String markupString , boolean checkTitle , boolean partialMarkupMatch ) { assertNotNull ( response ) ; MarkupContext markupContext = response . getMarkupContext ( ) ; assertNotNull ( markupContext ) ; assertEquals ( "<STR_LIT:text/html>" , markupContext . getMimeType ( ) ) ; if ( checkTitle ) { assertEquals ( "<STR_LIT:title>" , markupContext . getPreferredTitle ( ) ) ; } if ( ! ParameterValidation . isNullOrEmpty ( markupString ) ) { assertTrue ( markupContext . isRequiresRewriting ( ) ) ; } else { assertFalse ( markupContext . isRequiresRewriting ( ) ) ; } if ( ! partialMarkupMatch ) { assertEquals ( markupString , markupContext . getItemString ( ) ) ; } else { assertTrue ( markupContext . getItemString ( ) . contains ( markupString ) ) ; } SessionContext sessionContext = response . getSessionContext ( ) ; assertNull ( sessionContext ) ; return markupContext ; } private NamedString createNamedString ( String name , String value ) { NamedString namedString = WSRPTypeFactory . createNamedString ( name , value ) ; return namedString ; } protected String getMostUsedPortletWARFileName ( ) { return DEFAULT_MARKUP_PORTLET_WAR ; } } </s>
<s> package org . gatein . wsrp . protocol . v2 ; import com . google . common . base . Function ; import org . apache . catalina . connector . Request ; import org . apache . catalina . connector . RequestFacade ; import org . gatein . common . util . ParameterValidation ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . api . servlet . ServletAccess ; import org . gatein . wsrp . portlet . utils . MockRequest ; import org . gatein . wsrp . spec . v2 . WSRP2Constants ; import org . gatein . wsrp . test . ExtendedAssert ; import org . gatein . wsrp . test . support . MockHttpServletRequest ; import org . gatein . wsrp . test . support . MockHttpServletResponse ; import org . jboss . arquillian . container . test . api . Deployment ; import org . jboss . arquillian . container . test . api . OverProtocol ; import org . jboss . arquillian . junit . Arquillian ; import org . jboss . shrinkwrap . api . Archive ; 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 . v2 . EventDescription ; import org . oasis . wsrp . v2 . GetServiceDescription ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . ParameterDescription ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . ServiceDescription ; import javax . xml . namespace . QName ; import java . util . ArrayList ; import java . util . List ; @ RunWith ( Arquillian . class ) public class ServiceDescriptionTestCase extends V2ProducerBaseTest { public ServiceDescriptionTestCase ( ) throws Exception { super ( ServiceDescriptionTestCase . class . getSimpleName ( ) ) ; } @ Deployment @ OverProtocol ( "<STR_LIT>" ) public static Archive createDeployment ( ) { return V2ProducerBaseTest . createDeployment ( ) ; } @ Override protected boolean removeCurrent ( String archiveName ) { return true ; } @ Before public void setUp ( ) throws Exception { super . setUp ( ) ; Request request = new MockRequest ( ) ; request . setCoyoteRequest ( new org . apache . coyote . Request ( ) ) ; RequestFacade requestFacade = new RequestFacade ( request ) ; ServletAccess . setRequestAndResponse ( requestFacade , MockHttpServletResponse . createMockResponse ( ) ) ; } @ After public void tearDown ( ) throws Exception { super . tearDown ( ) ; } @ Test public void testServiceDescriptionFilteringEmptyHandleList ( ) throws OperationFailed , ResourceSuspended , ModifyRegistrationRequired , InvalidRegistration { GetServiceDescription gsd = getNoRegistrationServiceDescriptionRequest ( ) ; ServiceDescription original = producer . getServiceDescription ( gsd ) ; gsd . getPortletHandles ( ) . clear ( ) ; assertEquals ( original . getOfferedPortlets ( ) , producer . getServiceDescription ( gsd ) . getOfferedPortlets ( ) ) ; } @ Test public void testServiceDescriptionFilterInexistentFilter ( ) throws Exception { GetServiceDescription gsd = getNoRegistrationServiceDescriptionRequest ( ) ; gsd . getPortletHandles ( ) . add ( "<STR_LIT>" ) ; try { deploy ( "<STR_LIT>" ) ; deploy ( "<STR_LIT>" ) ; deploy ( "<STR_LIT>" ) ; ServiceDescription sd = producer . getServiceDescription ( gsd ) ; assertEquals ( <NUM_LIT:0> , sd . getOfferedPortlets ( ) . size ( ) ) ; } finally { undeploy ( "<STR_LIT>" ) ; undeploy ( "<STR_LIT>" ) ; undeploy ( "<STR_LIT>" ) ; } } @ Test public void testServiceDescriptionFiltering ( ) throws Exception { try { GetServiceDescription gsd = getNoRegistrationServiceDescriptionRequest ( ) ; deploy ( "<STR_LIT>" ) ; deploy ( "<STR_LIT>" ) ; deploy ( "<STR_LIT>" ) ; ServiceDescription sd = producer . getServiceDescription ( gsd ) ; assertEquals ( <NUM_LIT:3> , sd . getOfferedPortlets ( ) . size ( ) ) ; List < String > handles = WSRPUtils . transform ( sd . getOfferedPortlets ( ) , new Function < PortletDescription , String > ( ) { public String apply ( PortletDescription from ) { return from . getPortletHandle ( ) ; } } ) ; String filter = null ; List < String > filteredHandles = new ArrayList < String > ( <NUM_LIT:2> ) ; for ( String handle : handles ) { if ( handle . contains ( "<STR_LIT>" ) ) { filter = handle ; } else { filteredHandles . add ( handle ) ; } } gsd . getPortletHandles ( ) . add ( filter ) ; sd = producer . getServiceDescription ( gsd ) ; assertEquals ( <NUM_LIT:1> , sd . getOfferedPortlets ( ) . size ( ) ) ; assertEquals ( filter , sd . getOfferedPortlets ( ) . get ( <NUM_LIT:0> ) . getPortletHandle ( ) ) ; undeploy ( "<STR_LIT>" ) ; sd = producer . getServiceDescription ( gsd ) ; assertTrue ( sd . getOfferedPortlets ( ) . isEmpty ( ) ) ; gsd . getPortletHandles ( ) . clear ( ) ; sd = producer . getServiceDescription ( gsd ) ; List < PortletDescription > offeredPortlets = sd . getOfferedPortlets ( ) ; assertEquals ( <NUM_LIT:2> , offeredPortlets . size ( ) ) ; assertTrue ( ( offeredPortlets . get ( <NUM_LIT:0> ) . getPortletHandle ( ) . contains ( filteredHandles . get ( <NUM_LIT:0> ) ) && offeredPortlets . get ( <NUM_LIT:1> ) . getPortletHandle ( ) . equals ( filteredHandles . get ( <NUM_LIT:1> ) ) ) || ( offeredPortlets . get ( <NUM_LIT:1> ) . getPortletHandle ( ) . equals ( filteredHandles . get ( <NUM_LIT:0> ) ) && offeredPortlets . get ( <NUM_LIT:0> ) . getPortletHandle ( ) . equals ( filteredHandles . get ( <NUM_LIT:1> ) ) ) ) ; } finally { undeploy ( "<STR_LIT>" ) ; undeploy ( "<STR_LIT>" ) ; undeploy ( "<STR_LIT>" ) ; } } @ Test public void testSupportedOptions ( ) throws OperationFailed , InvalidRegistration , ResourceSuspended , ModifyRegistrationRequired { ServiceDescription description = producer . getServiceDescription ( getNoRegistrationServiceDescriptionRequest ( ) ) ; ExtendedAssert . assertNotNull ( description ) ; List < String > options = description . getSupportedOptions ( ) ; ExtendedAssert . assertTrue ( ParameterValidation . existsAndIsNotEmpty ( options ) ) ; ExtendedAssert . assertTrue ( options . contains ( WSRP2Constants . OPTIONS_EVENTS ) ) ; ExtendedAssert . assertTrue ( options . contains ( WSRP2Constants . OPTIONS_IMPORT ) ) ; ExtendedAssert . assertTrue ( options . contains ( WSRP2Constants . OPTIONS_EXPORT ) ) ; ExtendedAssert . assertTrue ( options . contains ( WSRP2Constants . OPTIONS_COPYPORTLETS ) ) ; } @ Test public void testEventDescriptions ( ) throws Exception { try { deploy ( "<STR_LIT>" ) ; ServiceDescription description = producer . getServiceDescription ( getNoRegistrationServiceDescriptionRequest ( ) ) ; List < EventDescription > eventDescriptions = description . getEventDescriptions ( ) ; ExtendedAssert . assertNotNull ( eventDescriptions ) ; ExtendedAssert . assertEquals ( <NUM_LIT:1> , eventDescriptions . size ( ) ) ; QName zip = new QName ( "<STR_LIT>" , "<STR_LIT>" ) ; EventDescription event = eventDescriptions . get ( <NUM_LIT:0> ) ; ExtendedAssert . assertEquals ( zip , event . getName ( ) ) ; ExtendedAssert . assertTrue ( event . getAliases ( ) . isEmpty ( ) ) ; ExtendedAssert . assertTrue ( event . getLabel ( ) . getValue ( ) . contains ( zip . toString ( ) ) ) ; List < PortletDescription > portlets = description . getOfferedPortlets ( ) ; ExtendedAssert . assertEquals ( <NUM_LIT:2> , portlets . size ( ) ) ; for ( PortletDescription portlet : portlets ) { if ( portlet . getPortletHandle ( ) . contains ( "<STR_LIT>" ) ) { List < QName > publishedEvents = portlet . getPublishedEvents ( ) ; ExtendedAssert . assertEquals ( <NUM_LIT:1> , publishedEvents . size ( ) ) ; ExtendedAssert . assertEquals ( zip , publishedEvents . get ( <NUM_LIT:0> ) ) ; ExtendedAssert . assertTrue ( portlet . getHandledEvents ( ) . isEmpty ( ) ) ; } } deploy ( "<STR_LIT>" ) ; description = producer . getServiceDescription ( getNoRegistrationServiceDescriptionRequest ( ) ) ; eventDescriptions = description . getEventDescriptions ( ) ; portlets = description . getOfferedPortlets ( ) ; QName foo = new QName ( "<STR_LIT>" , "<STR_LIT:foo>" ) ; ExtendedAssert . assertEquals ( <NUM_LIT:2> , eventDescriptions . size ( ) ) ; for ( EventDescription eventDesc : eventDescriptions ) { QName name = eventDesc . getName ( ) ; boolean isZip = zip . equals ( name ) ; boolean isFoo = foo . equals ( name ) ; if ( isZip || isFoo ) { if ( isFoo ) { ExtendedAssert . assertEquals ( foo , eventDesc . getName ( ) ) ; ExtendedAssert . assertTrue ( eventDesc . getLabel ( ) . getValue ( ) . contains ( foo . toString ( ) ) ) ; List < QName > aliases = eventDesc . getAliases ( ) ; ExtendedAssert . assertEquals ( <NUM_LIT:2> , aliases . size ( ) ) ; ExtendedAssert . assertTrue ( aliases . contains ( new QName ( "<STR_LIT>" , "<STR_LIT:bar>" ) ) ) ; ExtendedAssert . assertTrue ( aliases . contains ( new QName ( "<STR_LIT>" , "<STR_LIT:baz>" ) ) ) ; } } else { ExtendedAssert . fail ( "<STR_LIT>" ) ; } } for ( PortletDescription portlet : portlets ) { if ( portlet . getPortletHandle ( ) . contains ( "<STR_LIT>" ) ) { List < QName > events = portlet . getPublishedEvents ( ) ; ExtendedAssert . assertEquals ( <NUM_LIT:2> , events . size ( ) ) ; ExtendedAssert . assertTrue ( events . contains ( zip ) ) ; ExtendedAssert . assertTrue ( events . contains ( foo ) ) ; events = portlet . getHandledEvents ( ) ; ExtendedAssert . assertEquals ( <NUM_LIT:1> , events . size ( ) ) ; ExtendedAssert . assertTrue ( events . contains ( zip ) ) ; } } } finally { undeploy ( "<STR_LIT>" ) ; undeploy ( "<STR_LIT>" ) ; } } @ Test public void testParameterDescriptions ( ) throws Exception { try { deploy ( "<STR_LIT>" ) ; ServiceDescription description = producer . getServiceDescription ( getNoRegistrationServiceDescriptionRequest ( ) ) ; List < PortletDescription > portlets = description . getOfferedPortlets ( ) ; ExtendedAssert . assertEquals ( <NUM_LIT:1> , portlets . size ( ) ) ; PortletDescription portlet = portlets . get ( <NUM_LIT:0> ) ; QName fooparam = new QName ( "<STR_LIT>" , "<STR_LIT>" ) ; QName zipcode = new QName ( "<STR_LIT>" , "<STR_LIT>" ) ; List < ParameterDescription > publicValueDescriptions = portlet . getNavigationalPublicValueDescriptions ( ) ; ExtendedAssert . assertNotNull ( publicValueDescriptions ) ; ExtendedAssert . assertEquals ( <NUM_LIT:2> , publicValueDescriptions . size ( ) ) ; for ( ParameterDescription param : publicValueDescriptions ) { String identifier = param . getIdentifier ( ) ; if ( "<STR_LIT:foo>" . equals ( identifier ) ) { List < QName > names = param . getNames ( ) ; ExtendedAssert . assertTrue ( names . contains ( fooparam ) ) ; ExtendedAssert . assertTrue ( names . contains ( new QName ( "<STR_LIT>" , "<STR_LIT>" ) ) ) ; ExtendedAssert . assertTrue ( names . contains ( new QName ( "<STR_LIT>" , "<STR_LIT>" ) ) ) ; ExtendedAssert . assertEquals ( identifier , param . getLabel ( ) . getValue ( ) ) ; ExtendedAssert . assertEquals ( "<STR_LIT>" , param . getDescription ( ) . getValue ( ) ) ; } else if ( "<STR_LIT>" . equals ( identifier ) ) { List < QName > names = param . getNames ( ) ; ExtendedAssert . assertEquals ( <NUM_LIT:1> , names . size ( ) ) ; ExtendedAssert . assertTrue ( names . contains ( zipcode ) ) ; } else { ExtendedAssert . fail ( "<STR_LIT>" + identifier ) ; } } } finally { undeploy ( "<STR_LIT>" ) ; } } } </s>
<s> package org . gatein . wsrp . protocol . v2 ; import com . google . common . base . Function ; import com . google . common . collect . Collections2 ; 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 . WSRPTypeFactory ; import org . gatein . wsrp . producer . ProducerHolder ; import org . gatein . wsrp . producer . WSRPProducer ; import org . gatein . wsrp . producer . WSRPProducerBaseTest ; import org . gatein . wsrp . producer . config . ProducerRegistrationRequirements ; import org . gatein . wsrp . producer . handlers . processors . ProducerHelper ; import org . gatein . wsrp . producer . v2 . WSRP2Producer ; import org . gatein . wsrp . registration . RegistrationPropertyDescription ; import org . gatein . wsrp . test . ExtendedAssert ; import org . jboss . shrinkwrap . api . Archive ; import org . jboss . shrinkwrap . api . ShrinkWrap ; import org . jboss . shrinkwrap . api . importer . ExplodedImporter ; import org . jboss . shrinkwrap . api . spec . EnterpriseArchive ; import org . jboss . shrinkwrap . api . spec . JavaArchive ; import org . jboss . shrinkwrap . api . spec . WebArchive ; import org . oasis . wsrp . v2 . GetServiceDescription ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . ServiceDescription ; import javax . xml . namespace . QName ; import java . io . File ; import java . util . Collection ; import java . util . List ; public abstract class V2ProducerBaseTest extends WSRPProducerBaseTest { private static final Function < PortletDescription , String > PORTLET_DESCRIPTION_TO_HANDLE = new Function < PortletDescription , String > ( ) { public String apply ( PortletDescription from ) { return from . getPortletHandle ( ) ; } } ; protected WSRP2Producer producer = ProducerHolder . getProducer ( true ) ; private static final String CONSUMER = "<STR_LIT>" ; public V2ProducerBaseTest ( ) throws Exception { this ( "<STR_LIT>" ) ; } protected V2ProducerBaseTest ( String name ) throws Exception { super ( name ) ; } @ Override protected WSRPProducer getProducer ( ) { return producer ; } @ Override protected ProducerHelper getProducerHelper ( ) { return ( ProducerHelper ) producer ; } @ Override protected Collection < String > getPortletHandles ( ) throws Exception { GetServiceDescription getServiceDescription = WSRPTypeFactory . createGetServiceDescription ( null , null ) ; ServiceDescription serviceDescription = producer . getServiceDescription ( getServiceDescription ) ; List < PortletDescription > offered = serviceDescription . getOfferedPortlets ( ) ; return Collections2 . transform ( offered , PORTLET_DESCRIPTION_TO_HANDLE ) ; } protected GetServiceDescription getNoRegistrationServiceDescriptionRequest ( ) { GetServiceDescription gs = WSRPTypeFactory . createGetServiceDescription ( null , null ) ; gs . getDesiredLocales ( ) . add ( "<STR_LIT>" ) ; gs . getDesiredLocales ( ) . add ( "<STR_LIT:en>" ) ; return gs ; } protected RegistrationPropertyDescription configureRegistrationSettings ( boolean requiresRegistration , boolean provideUnregisteredFullDescription ) { ProducerRegistrationRequirements registrationRequirements = producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) ; registrationRequirements . setRegistrationRequired ( requiresRegistration ) ; registrationRequirements . setRegistrationRequiredForFullDescription ( ! provideUnregisteredFullDescription ) ; if ( requiresRegistration ) { RegistrationPropertyDescription regProp = new RegistrationPropertyDescription ( "<STR_LIT>" , new QName ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ) ; regProp . setDefaultLabel ( "<STR_LIT>" ) ; registrationRequirements . addRegistrationProperty ( regProp ) ; DefaultRegistrationPolicy defaultRegistrationPolicy = new DefaultRegistrationPolicy ( ) ; defaultRegistrationPolicy . setValidator ( new DefaultRegistrationPropertyValidator ( ) ) ; registrationRequirements . setPolicy ( defaultRegistrationPolicy ) ; RegistrationManager registrationManager = producer . getRegistrationManager ( ) ; registrationManager . setPolicy ( defaultRegistrationPolicy ) ; registrationRequirements . addRegistrationPropertyChangeListener ( registrationManager ) ; try { registrationManager . createConsumer ( CONSUMER ) ; } catch ( RegistrationException e ) { ExtendedAssert . fail ( "<STR_LIT>" + e . getLocalizedMessage ( ) ) ; } return regProp ; } else { return null ; } } protected static Archive createDeployment ( ) { EnterpriseArchive archive = ShrinkWrap . createFromZipFile ( EnterpriseArchive . class , new File ( "<STR_LIT>" ) ) ; JavaArchive testJar = ShrinkWrap . create ( JavaArchive . class , "<STR_LIT>" ) . addClasses ( V2ProducerBaseTest . class , WSRPProducerBaseTest . class ) ; testJar = testJar . addClasses ( MarkupTestCase . class , NeedPortletHandleTest . class , PortletManagementTestCase . class , ServiceDescriptionTestCase . class ) ; archive = archive . addAsLibraries ( testJar ) ; WebArchive pcWebArchive = ShrinkWrap . create ( WebArchive . class , "<STR_LIT>" ) ; pcWebArchive . merge ( ShrinkWrap . create ( WebArchive . class ) . as ( ExplodedImporter . class ) . importDirectory ( "<STR_LIT>" ) . as ( WebArchive . class ) ) ; archive . addAsModule ( pcWebArchive ) ; return archive ; } } </s>
<s> package org . gatein . wsrp . protocol . v2 ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . WSRPTypeFactory ; import org . oasis . wsrp . v2 . GetMarkup ; import org . oasis . wsrp . v2 . GetServiceDescription ; import org . oasis . wsrp . v2 . InteractionParams ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . MarkupParams ; import org . oasis . wsrp . v2 . MarkupResponse ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PerformBlockingInteraction ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . RuntimeContext ; import org . oasis . wsrp . v2 . ServiceDescription ; import org . oasis . wsrp . v2 . StateChange ; import java . rmi . RemoteException ; import java . util . ArrayList ; import java . util . Collection ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; public abstract class NeedPortletHandleTest extends V2ProducerBaseTest { private String mostUsedPortletWARFileName ; public NeedPortletHandleTest ( String portletWARFileName ) throws Exception { this ( "<STR_LIT>" , portletWARFileName ) ; this . mostUsedPortletWARFileName = portletWARFileName ; } protected NeedPortletHandleTest ( String name , String portletWARFileName ) throws Exception { super ( name ) ; this . mostUsedPortletWARFileName = portletWARFileName ; } protected String getDefaultHandle ( ) { return getFirstHandleFor ( mostUsedPortletWARFileName ) ; } private String getFirstHandleFor ( String archiveName ) { return war2Handles . get ( archiveName ) . get ( <NUM_LIT:0> ) ; } protected String getHandleForCurrentlyDeployedArchive ( ) { return getFirstHandleFor ( currentlyDeployedArchiveName ) ; } protected List < String > getHandlesForCurrentlyDeployedArchive ( ) { return war2Handles . get ( currentlyDeployedArchiveName ) ; } @ Override protected boolean removeCurrent ( String archiveName ) { return ! mostUsedPortletWARFileName . equals ( archiveName ) ; } public void setUp ( ) throws Exception { super . setUp ( ) ; this . mostUsedPortletWARFileName = getMostUsedPortletWARFileName ( ) ; deploy ( mostUsedPortletWARFileName ) ; producer . usingStrictModeChangedTo ( true ) ; } protected abstract String getMostUsedPortletWARFileName ( ) ; public void tearDown ( ) throws Exception { undeploy ( mostUsedPortletWARFileName ) ; super . tearDown ( ) ; } protected GetMarkup createMarkupRequestForCurrentlyDeployedPortlet ( ) throws Exception { return createMarkupRequest ( getHandleForCurrentlyDeployedArchive ( ) ) ; } protected GetMarkup createMarkupRequest ( String handle ) throws RemoteException , InvalidRegistration , OperationFailed { GetMarkup getMarkup = createDefaultGetMarkup ( handle ) ; getMarkup . getMarkupParams ( ) . getMarkupCharacterSets ( ) . add ( WSRPConstants . DEFAULT_CHARACTER_SET ) ; return getMarkup ; } protected GetMarkup createDefaultGetMarkup ( String handle ) { PortletContext portletContext = WSRPTypeFactory . createPortletContext ( handle ) ; RuntimeContext runtimeContext = createDefaultRuntimeContext ( ) ; return WSRPTypeFactory . createGetMarkup ( null , portletContext , runtimeContext , null , createDefaultMarkupParams ( ) ) ; } protected PerformBlockingInteraction createDefaultPerformBlockingInteraction ( String handle ) { PortletContext portletContext = WSRPTypeFactory . createPortletContext ( handle ) ; return WSRPTypeFactory . createPerformBlockingInteraction ( null , portletContext , createDefaultRuntimeContext ( ) , null , createDefaultMarkupParams ( ) , createDefaultInteractionParams ( ) ) ; } protected InteractionParams createDefaultInteractionParams ( ) { return WSRPTypeFactory . createInteractionParams ( StateChange . READ_ONLY ) ; } protected RuntimeContext createDefaultRuntimeContext ( ) { return WSRPTypeFactory . createRuntimeContext ( WSRPConstants . NONE_USER_AUTHENTICATION , "<STR_LIT:foo>" , "<STR_LIT>" ) ; } protected MarkupParams createDefaultMarkupParams ( ) { return WSRPTypeFactory . createMarkupParams ( false , WSRPConstants . getDefaultLocales ( ) , WSRPConstants . getDefaultMimeTypes ( ) , WSRPConstants . VIEW_MODE , WSRPConstants . NORMAL_WINDOW_STATE ) ; } protected String getPortletHandleFrom ( String partialHandle ) { List < String > handles = getHandlesForCurrentlyDeployedArchive ( ) ; for ( String handle : handles ) { if ( handle . contains ( partialHandle ) ) { return handle ; } } throw new IllegalArgumentException ( "<STR_LIT>" + partialHandle + "<STR_LIT>" + currentlyDeployedArchiveName ) ; } protected GetMarkup createMarkupRequest ( ) throws Exception { return createMarkupRequestForCurrentlyDeployedPortlet ( ) ; } protected void checkSessionForCurrentlyDeployedPortlet ( MarkupResponse response ) throws RemoteException , InvalidRegistration , OperationFailed { } } </s>
<s> package org . gatein . wsrp . protocol . v2 ; import org . apache . catalina . connector . Request ; import org . apache . catalina . connector . RequestFacade ; import org . gatein . exports . ExportManager ; import org . gatein . exports . data . ExportContext ; import org . gatein . exports . data . ExportPortletData ; import org . gatein . exports . data . PersistedExportData ; import org . gatein . exports . impl . ExportManagerImpl ; import org . gatein . pc . api . PortletStateType ; import org . gatein . pc . api . state . PropertyMap ; import org . gatein . pc . portlet . impl . state . StateConverterV0 ; import org . gatein . pc . portlet . state . SimplePropertyMap ; import org . gatein . pc . portlet . state . StateConverter ; import org . gatein . pc . portlet . state . producer . PortletState ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . api . servlet . ServletAccess ; import org . gatein . wsrp . portlet . utils . MockRequest ; import org . gatein . wsrp . support . TestMockExportPersistenceManager ; import org . gatein . wsrp . test . support . MockHttpServletRequest ; import org . gatein . wsrp . test . support . MockHttpServletResponse ; import org . jboss . arquillian . container . test . api . Deployment ; import org . jboss . arquillian . container . test . api . OverProtocol ; import org . jboss . arquillian . junit . Arquillian ; import org . jboss . shrinkwrap . api . Archive ; 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 . v2 . BlockingInteractionResponse ; import org . oasis . wsrp . v2 . ClonePortlet ; import org . oasis . wsrp . v2 . CopiedPortlet ; import org . oasis . wsrp . v2 . CopyPortlets ; import org . oasis . wsrp . v2 . CopyPortletsResponse ; import org . oasis . wsrp . v2 . ExportPortlets ; import org . oasis . wsrp . v2 . ExportPortletsResponse ; import org . oasis . wsrp . v2 . ExportedPortlet ; import org . oasis . wsrp . v2 . FailedPortlets ; import org . oasis . wsrp . v2 . GetMarkup ; import org . oasis . wsrp . v2 . ImportPortlet ; import org . oasis . wsrp . v2 . ImportPortlets ; import org . oasis . wsrp . v2 . ImportPortletsResponse ; import org . oasis . wsrp . v2 . ImportedPortlet ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . Lifetime ; import org . oasis . wsrp . v2 . MarkupContext ; import org . oasis . wsrp . v2 . MarkupResponse ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . NamedString ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . PerformBlockingInteraction ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . RegistrationData ; import org . oasis . wsrp . v2 . ReleaseExport ; import org . oasis . wsrp . v2 . SetExportLifetime ; import org . oasis . wsrp . v2 . StateChange ; import org . oasis . wsrp . v2 . UserContext ; import java . io . IOException ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; @ RunWith ( Arquillian . class ) public class PortletManagementTestCase extends NeedPortletHandleTest { private static final String TEST_BASIC_PORTLET_WAR = "<STR_LIT>" ; public PortletManagementTestCase ( ) throws Exception { super ( "<STR_LIT>" , TEST_BASIC_PORTLET_WAR ) ; } @ Deployment @ OverProtocol ( "<STR_LIT>" ) public static Archive createDeployment ( ) { return V2ProducerBaseTest . createDeployment ( ) ; } @ Before public void setUp ( ) throws Exception { super . setUp ( ) ; Request request = new MockRequest ( ) ; request . setCoyoteRequest ( new org . apache . coyote . Request ( ) ) ; RequestFacade requestFacade = new RequestFacade ( request ) ; ServletAccess . setRequestAndResponse ( requestFacade , MockHttpServletResponse . createMockResponse ( ) ) ; } @ After public void tearDown ( ) throws Exception { super . tearDown ( ) ; } @ Test public void testExport ( ) throws Exception { try { String handle = getDefaultHandle ( ) ; List < PortletContext > portletContexts = createPortletContextList ( handle ) ; ExportPortlets exportPortlets = createSimpleExportPortlets ( portletContexts ) ; ExportPortletsResponse response = producer . exportPortlets ( exportPortlets ) ; checkValidHandle ( response , handle ) ; } catch ( Exception e ) { System . out . println ( "<STR_LIT>" ) ; e . printStackTrace ( ) ; throw new Exception ( e ) ; } } @ Test public void testExportNonExistentHandle ( ) throws Exception { String nonExistentHandle = "<STR_LIT>" ; List < PortletContext > portletContexts = createPortletContextList ( nonExistentHandle ) ; ExportPortlets exportPortlets = createSimpleExportPortlets ( portletContexts ) ; ExportPortletsResponse response = producer . exportPortlets ( exportPortlets ) ; checkInvalidHandle ( response , nonExistentHandle ) ; } @ Test public void testExportNoRegistrationWhenRequired ( ) throws Exception { producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( true ) ; String handle = getDefaultHandle ( ) ; List < PortletContext > portletContexts = createPortletContextList ( handle ) ; ExportPortlets exportPortlets = createSimpleExportPortlets ( portletContexts ) ; try { ExportPortletsResponse response = producer . exportPortlets ( exportPortlets ) ; fail ( "<STR_LIT>" ) ; } catch ( InvalidRegistration e ) { } } @ Test public void testExportBadRegistrationHandle ( ) throws Exception { producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( true ) ; RegistrationContext registrationContext = WSRPTypeFactory . createRegistrationContext ( "<STR_LIT>" ) ; List < PortletContext > portletContexts = createPortletContextList ( getDefaultHandle ( ) ) ; boolean exportByValueRequired = true ; Lifetime lifetime = null ; UserContext userContext = null ; ExportPortlets exportPortlets = WSRPTypeFactory . createExportPortlets ( registrationContext , portletContexts , userContext , lifetime , exportByValueRequired ) ; try { ExportPortletsResponse response = producer . exportPortlets ( exportPortlets ) ; fail ( "<STR_LIT>" ) ; } catch ( InvalidRegistration e ) { } } @ Test public void testExportRegistrationRequired ( ) throws Exception { try { producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( true ) ; RegistrationData registrationData = WSRPTypeFactory . createRegistrationData ( "<STR_LIT>" , "<STR_LIT>" , true ) ; RegistrationContext registrationContext = producer . register ( registrationData ) ; List < PortletContext > portletContexts = createPortletContextList ( getDefaultHandle ( ) ) ; boolean exportByValueRequired = true ; Lifetime lifetime = null ; UserContext userContext = null ; ExportPortlets exportPortlets = WSRPTypeFactory . createExportPortlets ( registrationContext , portletContexts , userContext , lifetime , exportByValueRequired ) ; ExportPortletsResponse response = producer . exportPortlets ( exportPortlets ) ; checkValidHandle ( response , getDefaultHandle ( ) ) ; } catch ( Exception e ) { System . out . println ( "<STR_LIT>" + this . getClass ( ) + "<STR_LIT>" ) ; e . printStackTrace ( ) ; throw new Exception ( e ) ; } } @ Test public void testExportNullExportContext ( ) throws Exception { ExportPortlets exportPortlets = new ExportPortlets ( ) ; try { ExportPortletsResponse response = producer . exportPortlets ( exportPortlets ) ; fail ( "<STR_LIT>" ) ; } catch ( MissingParameters e ) { } } @ Test public void testExportNullExportPortlets ( ) throws Exception { try { ExportPortletsResponse response = producer . exportPortlets ( null ) ; fail ( "<STR_LIT>" ) ; } catch ( MissingParameters e ) { } } @ Test public void testExports ( ) throws Exception { String nonExistentHandle = "<STR_LIT>" ; String handle = getDefaultHandle ( ) ; List < PortletContext > portletContexts = createPortletContextList ( nonExistentHandle , handle ) ; ExportPortlets exportPortlets = createSimpleExportPortlets ( portletContexts ) ; ExportPortletsResponse response = producer . exportPortlets ( exportPortlets ) ; assertNotNull ( response . getExportContext ( ) ) ; assertNull ( response . getLifetime ( ) ) ; assertFalse ( response . getExportedPortlet ( ) . isEmpty ( ) ) ; assertFalse ( response . getFailedPortlets ( ) . isEmpty ( ) ) ; assertEquals ( <NUM_LIT:1> , response . getExportedPortlet ( ) . size ( ) ) ; assertEquals ( <NUM_LIT:1> , response . getFailedPortlets ( ) . size ( ) ) ; ExportedPortlet exportPortlet = response . getExportedPortlet ( ) . get ( <NUM_LIT:0> ) ; assertEquals ( handle , exportPortlet . getPortletHandle ( ) ) ; FailedPortlets failedPortlets = response . getFailedPortlets ( ) . get ( <NUM_LIT:0> ) ; assertEquals ( "<STR_LIT>" , failedPortlets . getErrorCode ( ) . getLocalPart ( ) ) ; assertEquals ( <NUM_LIT:1> , failedPortlets . getPortletHandles ( ) . size ( ) ) ; assertTrue ( failedPortlets . getPortletHandles ( ) . contains ( nonExistentHandle ) ) ; } protected void checkInvalidHandle ( ExportPortletsResponse response , String handle ) throws Exception { assertNotNull ( response . getExportContext ( ) ) ; assertNull ( response . getLifetime ( ) ) ; assertTrue ( response . getExportedPortlet ( ) . isEmpty ( ) ) ; assertEquals ( <NUM_LIT:1> , response . getFailedPortlets ( ) . size ( ) ) ; FailedPortlets failedPortlet = response . getFailedPortlets ( ) . get ( <NUM_LIT:0> ) ; assertTrue ( failedPortlet . getPortletHandles ( ) . contains ( handle ) ) ; assertEquals ( "<STR_LIT>" , failedPortlet . getErrorCode ( ) . getLocalPart ( ) ) ; } protected void checkValidHandle ( ExportPortletsResponse response , String handle ) throws Exception { assertNotNull ( response . getExportContext ( ) ) ; assertNull ( response . getLifetime ( ) ) ; assertTrue ( response . getFailedPortlets ( ) . isEmpty ( ) ) ; assertEquals ( <NUM_LIT:1> , response . getExportedPortlet ( ) . size ( ) ) ; ExportedPortlet exportPortlet = response . getExportedPortlet ( ) . get ( <NUM_LIT:0> ) ; assertEquals ( handle , exportPortlet . getPortletHandle ( ) ) ; } protected List < PortletContext > createPortletContextList ( String ... portletHandles ) { List < PortletContext > portletContexts = new ArrayList < PortletContext > ( ) ; for ( String portletHandle : portletHandles ) { PortletContext portletContext = WSRPTypeFactory . createPortletContext ( portletHandle ) ; portletContexts . add ( portletContext ) ; } return portletContexts ; } protected ExportPortlets createSimpleExportPortlets ( List < PortletContext > portletContexts ) { boolean exportByValueRequired = true ; Lifetime lifetime = null ; UserContext userContext = null ; RegistrationContext registrationContext = null ; return WSRPTypeFactory . createExportPortlets ( registrationContext , portletContexts , userContext , lifetime , exportByValueRequired ) ; } @ Test public void testImport ( ) throws Exception { String importID = "<STR_LIT:foo>" ; List < String > portletList = new ArrayList < String > ( ) ; portletList . add ( getDefaultHandle ( ) ) ; byte [ ] importContext = new ExportContext ( ) . encodeAsBytes ( ) ; ImportPortlet importPortlet = createSimpleImportPortlet ( importID , getDefaultHandle ( ) ) ; List < ImportPortlet > importPortletsList = createImportPortletList ( importPortlet ) ; ImportPortlets importPortlets = createSimpleImportPortlets ( importContext , importPortletsList ) ; ImportPortletsResponse response = producer . importPortlets ( importPortlets ) ; assertEquals ( <NUM_LIT:1> , response . getImportedPortlets ( ) . size ( ) ) ; ImportedPortlet portlet = response . getImportedPortlets ( ) . get ( <NUM_LIT:0> ) ; assertEquals ( importID , portlet . getImportID ( ) ) ; PortletContext portletContext = portlet . getNewPortletContext ( ) ; GetMarkup markup = createMarkupRequest ( portletContext . getPortletHandle ( ) ) ; MarkupResponse markupResponse = producer . getMarkup ( markup ) ; assertNotNull ( markupResponse . getMarkupContext ( ) ) ; assertEquals ( "<STR_LIT>" , new String ( markupResponse . getMarkupContext ( ) . getItemString ( ) ) ) ; } @ Test public void testImportNoRegistrationWhenRequired ( ) throws Exception { producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( true ) ; String importID = "<STR_LIT:foo>" ; List < String > portletList = new ArrayList < String > ( ) ; portletList . add ( getDefaultHandle ( ) ) ; byte [ ] importContext = new ExportContext ( ) . encodeAsBytes ( ) ; ImportPortlet importPortlet = createSimpleImportPortlet ( importID , getDefaultHandle ( ) ) ; List < ImportPortlet > importPortletsList = createImportPortletList ( importPortlet ) ; ImportPortlets importPortlets = createSimpleImportPortlets ( importContext , importPortletsList ) ; try { ImportPortletsResponse response = producer . importPortlets ( importPortlets ) ; fail ( "<STR_LIT>" ) ; } catch ( InvalidRegistration e ) { } } @ Test public void testImportRegistrationRequired ( ) throws Exception { try { producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( true ) ; RegistrationData registrationData = WSRPTypeFactory . createRegistrationData ( "<STR_LIT>" , "<STR_LIT>" , true ) ; RegistrationContext registrationContext = producer . register ( registrationData ) ; String importID = "<STR_LIT:foo>" ; Lifetime lifetime = null ; UserContext userContext = null ; List < String > portletList = new ArrayList < String > ( ) ; portletList . add ( getDefaultHandle ( ) ) ; ExportContext exportContextData = new ExportContext ( ) ; byte [ ] importContext = exportContextData . encodeAsBytes ( ) ; ImportPortlet importPortlet = createSimpleImportPortlet ( importID , getDefaultHandle ( ) ) ; List < ImportPortlet > importPortletsList = createImportPortletList ( importPortlet ) ; ImportPortlets importPortlets = WSRPTypeFactory . createImportPortlets ( registrationContext , importContext , importPortletsList , userContext , lifetime ) ; ImportPortletsResponse response = producer . importPortlets ( importPortlets ) ; assertEquals ( <NUM_LIT:1> , response . getImportedPortlets ( ) . size ( ) ) ; ImportedPortlet portlet = response . getImportedPortlets ( ) . get ( <NUM_LIT:0> ) ; assertEquals ( importID , portlet . getImportID ( ) ) ; PortletContext portletContext = portlet . getNewPortletContext ( ) ; GetMarkup markup = createMarkupRequest ( portletContext . getPortletHandle ( ) ) ; markup . setRegistrationContext ( registrationContext ) ; MarkupResponse markupResponse = producer . getMarkup ( markup ) ; assertNotNull ( markupResponse . getMarkupContext ( ) ) ; assertEquals ( "<STR_LIT>" , new String ( markupResponse . getMarkupContext ( ) . getItemString ( ) ) ) ; } catch ( Exception e ) { System . out . println ( "<STR_LIT>" + this . getClass ( ) + "<STR_LIT>" ) ; e . printStackTrace ( ) ; throw new Exception ( e ) ; } } @ Test public void testImportBadRegistration ( ) throws Exception { producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( true ) ; RegistrationContext registrationContext = WSRPTypeFactory . createRegistrationContext ( "<STR_LIT>" ) ; String importID = "<STR_LIT:foo>" ; Lifetime lifetime = null ; UserContext userContext = null ; List < String > portletList = new ArrayList < String > ( ) ; portletList . add ( getDefaultHandle ( ) ) ; ExportContext exportContextData = new ExportContext ( ) ; byte [ ] importContext = exportContextData . encodeAsBytes ( ) ; ImportPortlet importPortlet = createSimpleImportPortlet ( importID , getDefaultHandle ( ) ) ; List < ImportPortlet > importPortletsList = createImportPortletList ( importPortlet ) ; ImportPortlets importPortlets = WSRPTypeFactory . createImportPortlets ( registrationContext , importContext , importPortletsList , userContext , lifetime ) ; try { ImportPortletsResponse response = producer . importPortlets ( importPortlets ) ; fail ( "<STR_LIT>" ) ; } catch ( InvalidRegistration e ) { } } @ Test public void testImportNullImportContext ( ) throws Exception { String importId = "<STR_LIT>" ; ImportPortlet importPortlet = createSimpleImportPortlet ( importId , getDefaultHandle ( ) ) ; byte [ ] importContext = null ; List < ImportPortlet > importPortletsList = createImportPortletList ( importPortlet ) ; ImportPortlets importPortlets = createSimpleImportPortlets ( importContext , importPortletsList ) ; try { producer . importPortlets ( importPortlets ) ; fail ( "<STR_LIT>" ) ; } catch ( OperationFailed e ) { } } @ Test public void testImportInvalidImportContext ( ) throws Exception { String importId = "<STR_LIT>" ; ImportPortlet importPortlet = createSimpleImportPortlet ( importId , getDefaultHandle ( ) ) ; byte [ ] importContext = new byte [ ] { <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , '<CHAR_LIT>' , '<CHAR_LIT:a>' , '<CHAR_LIT>' , '<CHAR_LIT:e>' } ; List < ImportPortlet > importPortletsList = createImportPortletList ( importPortlet ) ; ImportPortlets importPortlets = createSimpleImportPortlets ( importContext , importPortletsList ) ; try { producer . importPortlets ( importPortlets ) ; fail ( "<STR_LIT>" ) ; } catch ( OperationFailed e ) { } } @ Test public void testImportNullExportData ( ) throws Exception { String importId = "<STR_LIT>" ; ImportPortlet importPortlet = new ImportPortlet ( ) ; importPortlet . setExportData ( null ) ; importPortlet . setImportID ( importId ) ; List < ImportPortlet > importPortletsList = createImportPortletList ( importPortlet ) ; byte [ ] importContext = new ExportContext ( ) . encodeAsBytes ( ) ; ImportPortlets importPortlets = createSimpleImportPortlets ( importContext , importPortletsList ) ; ImportPortletsResponse response = producer . importPortlets ( importPortlets ) ; assertNotNull ( response . getImportFailed ( ) ) ; assertEquals ( <NUM_LIT:1> , response . getImportFailed ( ) . size ( ) ) ; assertEquals ( importId , response . getImportFailed ( ) . get ( <NUM_LIT:0> ) . getImportID ( ) . get ( <NUM_LIT:0> ) ) ; assertEquals ( "<STR_LIT>" , response . getImportFailed ( ) . get ( <NUM_LIT:0> ) . getErrorCode ( ) . getLocalPart ( ) ) ; } @ Test public void testImportInvalidExportData ( ) throws Exception { String importId = "<STR_LIT>" ; ImportPortlet importPortlet = new ImportPortlet ( ) ; importPortlet . setExportData ( "<STR_LIT>" . getBytes ( ) ) ; importPortlet . setImportID ( importId ) ; List < ImportPortlet > importPortletsList = createImportPortletList ( importPortlet ) ; ExportContext exportContextData = new ExportContext ( ) ; byte [ ] importContext = exportContextData . encodeAsBytes ( ) ; ImportPortlets importPortlets = createSimpleImportPortlets ( importContext , importPortletsList ) ; ImportPortletsResponse response = producer . importPortlets ( importPortlets ) ; assertNotNull ( response . getImportFailed ( ) ) ; assertEquals ( <NUM_LIT:1> , response . getImportFailed ( ) . size ( ) ) ; assertEquals ( importId , response . getImportFailed ( ) . get ( <NUM_LIT:0> ) . getImportID ( ) . get ( <NUM_LIT:0> ) ) ; assertEquals ( "<STR_LIT>" , response . getImportFailed ( ) . get ( <NUM_LIT:0> ) . getErrorCode ( ) . getLocalPart ( ) ) ; } @ Test public void testImportNonExistantPortletData ( ) throws Exception { String importId = "<STR_LIT>" ; ExportManager exportManager = new ExportManagerImpl ( ) ; ExportPortletData exportPortletData = exportManager . createExportPortletData ( null , "<STR_LIT>" , null ) ; byte [ ] exportData = exportPortletData . encodeAsBytes ( ) ; ImportPortlet importPortlet = WSRPTypeFactory . createImportPortlet ( importId , exportData ) ; List < ImportPortlet > importPortletsList = createImportPortletList ( importPortlet ) ; ExportContext exportContextData = new ExportContext ( ) ; byte [ ] importContext = exportContextData . encodeAsBytes ( ) ; ImportPortlets importPortlets = createSimpleImportPortlets ( importContext , importPortletsList ) ; ImportPortletsResponse response = producer . importPortlets ( importPortlets ) ; assertNotNull ( response . getImportFailed ( ) ) ; assertEquals ( <NUM_LIT:1> , response . getImportFailed ( ) . size ( ) ) ; assertEquals ( importId , response . getImportFailed ( ) . get ( <NUM_LIT:0> ) . getImportID ( ) . get ( <NUM_LIT:0> ) ) ; assertEquals ( "<STR_LIT>" , response . getImportFailed ( ) . get ( <NUM_LIT:0> ) . getErrorCode ( ) . getLocalPart ( ) ) ; } @ Test public void testImports ( ) throws Exception { String importID = "<STR_LIT:foo>" ; String nullImportID = "<STR_LIT:null>" ; String invalidImportID = "<STR_LIT>" ; ExportManager exportManager = new ExportManagerImpl ( ) ; ExportPortletData exportPortletData = exportManager . createExportPortletData ( null , getDefaultHandle ( ) , null ) ; byte [ ] exportData = exportPortletData . encodeAsBytes ( ) ; byte [ ] nullExportData = null ; ExportPortletData invalidExportPortletData = exportManager . createExportPortletData ( null , "<STR_LIT>" , null ) ; byte [ ] invalidExportData = invalidExportPortletData . encodeAsBytes ( ) ; Lifetime lifetime = null ; UserContext userContext = null ; RegistrationContext registrationContext = null ; List < String > portletList = new ArrayList < String > ( ) ; portletList . add ( getDefaultHandle ( ) ) ; ExportContext exportContextData = new ExportContext ( ) ; byte [ ] importContext = exportContextData . encodeAsBytes ( ) ; ImportPortlet nullPortlet = new ImportPortlet ( ) ; nullPortlet . setImportID ( nullImportID ) ; nullPortlet . setExportData ( nullExportData ) ; ImportPortlet importPortlet = WSRPTypeFactory . createImportPortlet ( importID , exportData ) ; ImportPortlet invalidPortlet = WSRPTypeFactory . createImportPortlet ( invalidImportID , invalidExportData ) ; List < ImportPortlet > importPortletsList = new ArrayList < ImportPortlet > ( ) ; importPortletsList . add ( invalidPortlet ) ; importPortletsList . add ( importPortlet ) ; importPortletsList . add ( nullPortlet ) ; ImportPortlets importPortlets = WSRPTypeFactory . createImportPortlets ( registrationContext , importContext , importPortletsList , userContext , lifetime ) ; ImportPortletsResponse response = producer . importPortlets ( importPortlets ) ; assertEquals ( <NUM_LIT:2> , response . getImportFailed ( ) . size ( ) ) ; assertEquals ( <NUM_LIT:1> , response . getImportedPortlets ( ) . size ( ) ) ; ImportedPortlet portlet = response . getImportedPortlets ( ) . get ( <NUM_LIT:0> ) ; assertEquals ( importID , portlet . getImportID ( ) ) ; PortletContext portletContext = portlet . getNewPortletContext ( ) ; GetMarkup markup = createMarkupRequest ( portletContext . getPortletHandle ( ) ) ; MarkupResponse markupResponse = producer . getMarkup ( markup ) ; assertNotNull ( markupResponse . getMarkupContext ( ) ) ; assertEquals ( "<STR_LIT>" , markupResponse . getMarkupContext ( ) . getItemString ( ) ) ; } @ Test public void testExportWithState ( ) throws Exception { try { undeploy ( TEST_BASIC_PORTLET_WAR ) ; String sessionPortletArchive = "<STR_LIT>" ; deploy ( sessionPortletArchive ) ; try { String originalHandle = getHandleForCurrentlyDeployedArchive ( ) ; checkStatePortlet ( originalHandle , "<STR_LIT>" ) ; PortletContext portletContext = performBlockingInteractionOnSessionPortlet ( originalHandle , "<STR_LIT>" , StateChange . CLONE_BEFORE_WRITE ) ; assertFalse ( originalHandle . equals ( portletContext . getPortletHandle ( ) ) ) ; checkStatePortlet ( portletContext . getPortletHandle ( ) , "<STR_LIT>" ) ; List < PortletContext > portletContexts = createPortletContextList ( portletContext . getPortletHandle ( ) ) ; ExportPortlets exportPortlets = createSimpleExportPortlets ( portletContexts ) ; ExportPortletsResponse response = producer . exportPortlets ( exportPortlets ) ; assertFalse ( response . getExportedPortlet ( ) . isEmpty ( ) ) ; List < PortletContext > portletContextsFromExport = getPortletContext ( response ) ; assertNotNull ( portletContextsFromExport . isEmpty ( ) ) ; assertEquals ( <NUM_LIT:1> , portletContexts . size ( ) ) ; PortletContext portletContextFromExport = portletContextsFromExport . get ( <NUM_LIT:0> ) ; assertEquals ( originalHandle , portletContextFromExport . getPortletHandle ( ) ) ; assertNotNull ( portletContextFromExport . getPortletState ( ) ) ; ImportPortletsResponse importResponse = createImportPortletsResponse ( "<STR_LIT:foo>" , portletContextFromExport ) ; assertEquals ( <NUM_LIT:1> , importResponse . getImportedPortlets ( ) . size ( ) ) ; checkStatePortlet ( importResponse . getImportedPortlets ( ) . get ( <NUM_LIT:0> ) . getNewPortletContext ( ) . getPortletHandle ( ) , "<STR_LIT>" ) ; } finally { undeploy ( sessionPortletArchive ) ; } } catch ( Exception e ) { System . out . println ( "<STR_LIT>" + this . getClass ( ) + "<STR_LIT>" ) ; e . printStackTrace ( ) ; throw e ; } } @ Test public void testImportWithState ( ) throws Exception { undeploy ( TEST_BASIC_PORTLET_WAR ) ; String sessionPortletArchive = "<STR_LIT>" ; deploy ( sessionPortletArchive ) ; try { String importStringValue = "<STR_LIT>" ; byte [ ] portletState = createSessionByteValue ( getHandleForCurrentlyDeployedArchive ( ) , importStringValue ) ; String importID = "<STR_LIT:foo>" ; List < String > portletList = new ArrayList < String > ( ) ; portletList . add ( getDefaultHandle ( ) ) ; byte [ ] importContext = new ExportContext ( ) . encodeAsBytes ( ) ; ExportPortletData exportPortletData = new ExportPortletData ( getHandleForCurrentlyDeployedArchive ( ) , portletState ) ; byte [ ] exportData = exportPortletData . encodeAsBytes ( ) ; ImportPortlet importPortlet = WSRPTypeFactory . createImportPortlet ( importID , exportData ) ; List < ImportPortlet > importPortletsList = createImportPortletList ( importPortlet ) ; ImportPortlets importPortlets = createSimpleImportPortlets ( importContext , importPortletsList ) ; ImportPortletsResponse response = producer . importPortlets ( importPortlets ) ; ImportedPortlet importedPortlet = response . getImportedPortlets ( ) . get ( <NUM_LIT:0> ) ; assertNotSame ( getHandleForCurrentlyDeployedArchive ( ) , importedPortlet . getNewPortletContext ( ) . getPortletHandle ( ) ) ; assertNull ( importedPortlet . getNewPortletContext ( ) . getPortletState ( ) ) ; checkStatePortlet ( importedPortlet . getNewPortletContext ( ) . getPortletHandle ( ) , importStringValue ) ; } finally { undeploy ( sessionPortletArchive ) ; } } protected ImportPortletsResponse createImportPortletsResponse ( String importID , PortletContext portletContext ) throws Exception { byte [ ] importContext = new ExportContext ( ) . encodeAsBytes ( ) ; ExportPortletData exportPortletData = new ExportPortletData ( portletContext . getPortletHandle ( ) , portletContext . getPortletState ( ) ) ; byte [ ] exportData = exportPortletData . encodeAsBytes ( ) ; ImportPortlet importPortlet = WSRPTypeFactory . createImportPortlet ( importID , exportData ) ; List < ImportPortlet > importPortletsList = createImportPortletList ( importPortlet ) ; ImportPortlets importPortlets = createSimpleImportPortlets ( importContext , importPortletsList ) ; return producer . importPortlets ( importPortlets ) ; } protected byte [ ] createSessionByteValue ( String portletHandle , String value ) throws Exception { Map < String , List < String > > properties = new HashMap < String , List < String > > ( ) ; List < String > values = new ArrayList < String > ( ) ; values . add ( value ) ; properties . put ( "<STR_LIT:name>" , values ) ; PropertyMap property = new SimplePropertyMap ( properties ) ; PortletState sstate = new PortletState ( portletHandle , property ) ; StateConverter stateConverter = new StateConverterV0 ( ) ; return stateConverter . marshall ( PortletStateType . OPAQUE , sstate ) ; } @ Test public void testExportWithoutSession ( ) throws Exception { undeploy ( TEST_BASIC_PORTLET_WAR ) ; String sessionPortletArchive = "<STR_LIT>" ; deploy ( sessionPortletArchive ) ; try { String originalHandle = getHandleForCurrentlyDeployedArchive ( ) ; checkStatePortlet ( originalHandle , "<STR_LIT>" ) ; List < PortletContext > portletContexts = createPortletContextList ( originalHandle ) ; ExportPortlets exportPortlets = createSimpleExportPortlets ( portletContexts ) ; ExportPortletsResponse response = producer . exportPortlets ( exportPortlets ) ; assertFalse ( response . getExportedPortlet ( ) . isEmpty ( ) ) ; List < PortletContext > portletContextsFromExport = getPortletContext ( response ) ; assertNotNull ( portletContextsFromExport . isEmpty ( ) ) ; assertEquals ( <NUM_LIT:1> , portletContexts . size ( ) ) ; PortletContext portletContextFromExport = portletContextsFromExport . get ( <NUM_LIT:0> ) ; assertEquals ( originalHandle , portletContextFromExport . getPortletHandle ( ) ) ; } finally { undeploy ( sessionPortletArchive ) ; } } @ Test public void testReleaseExportsThrowsNoErrors ( ) throws Exception { producer . releaseExport ( null ) ; ReleaseExport releaseExport = new ReleaseExport ( ) ; producer . releaseExport ( releaseExport ) ; releaseExport = new ReleaseExport ( ) ; releaseExport . setExportContext ( new byte [ ] { - <NUM_LIT:12> , <NUM_LIT:12> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ) ; producer . releaseExport ( releaseExport ) ; releaseExport = new ReleaseExport ( ) ; RegistrationContext registrationContext = new RegistrationContext ( ) ; registrationContext . setRegistrationHandle ( "<STR_LIT>" ) ; releaseExport . setRegistrationContext ( registrationContext ) ; producer . releaseExport ( releaseExport ) ; releaseExport = new ReleaseExport ( ) ; UserContext userContext = new UserContext ( ) ; userContext . setUserContextKey ( "<STR_LIT>" ) ; releaseExport . setUserContext ( userContext ) ; producer . releaseExport ( releaseExport ) ; } @ Test public void testReleaseExportsNoErrorsRequiresRegistraion ( ) throws Exception { producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( true ) ; this . testReleaseExportsThrowsNoErrors ( ) ; } @ Test public void testExportPortletPM ( ) throws Exception { exportPortletToPM ( ) ; } @ Test public void testReleaseExportPM ( ) throws Exception { ExportPortletsResponse response = exportPortletToPM ( ) ; ReleaseExport releaseExport = WSRPTypeFactory . createReleaseExport ( null , response . getExportContext ( ) , null ) ; producer . releaseExport ( releaseExport ) ; TestMockExportPersistenceManager persistenceManager = ( TestMockExportPersistenceManager ) producer . getExportManager ( ) . getPersistenceManager ( ) ; assertEquals ( <NUM_LIT:0> , persistenceManager . getExportContextKeys ( ) . size ( ) ) ; assertEquals ( <NUM_LIT:0> , persistenceManager . getExportPortletsKeys ( ) . size ( ) ) ; } @ Test public void testImportPortletPM ( ) throws Exception { ExportPortletsResponse response = exportPortletToPM ( ) ; String importID = "<STR_LIT:foo>" ; ImportPortlet importPortlet = WSRPTypeFactory . createImportPortlet ( importID , response . getExportedPortlet ( ) . get ( <NUM_LIT:0> ) . getExportData ( ) ) ; List < ImportPortlet > importPortletsList = createImportPortletList ( importPortlet ) ; ImportPortlets importPortlets = createSimpleImportPortlets ( response . getExportContext ( ) , importPortletsList ) ; ImportPortletsResponse importResponse = producer . importPortlets ( importPortlets ) ; assertEquals ( <NUM_LIT:1> , importResponse . getImportedPortlets ( ) . size ( ) ) ; assertEquals ( importID , importResponse . getImportedPortlets ( ) . get ( <NUM_LIT:0> ) . getImportID ( ) ) ; assertNotNull ( importResponse . getImportedPortlets ( ) . get ( <NUM_LIT:0> ) . getNewPortletContext ( ) . getPortletHandle ( ) ) ; } protected ExportPortletsResponse exportPortletToPM ( ) throws Exception { TestMockExportPersistenceManager persistenceManager = new TestMockExportPersistenceManager ( ) ; producer . getExportManager ( ) . setPersistenceManager ( persistenceManager ) ; ( ( ExportManagerImpl ) producer . getExportManager ( ) ) . setPreferExportByValue ( false ) ; String handle = getDefaultHandle ( ) ; List < PortletContext > portletContexts = createPortletContextList ( handle ) ; ExportPortlets exportPortlets = createSimpleExportPortlets ( portletContexts ) ; exportPortlets . setExportByValueRequired ( false ) ; assertEquals ( <NUM_LIT:0> , persistenceManager . getExportContextKeys ( ) . size ( ) ) ; assertEquals ( <NUM_LIT:0> , persistenceManager . getExportPortletsKeys ( ) . size ( ) ) ; ExportPortletsResponse response = producer . exportPortlets ( exportPortlets ) ; assertEquals ( <NUM_LIT:1> , persistenceManager . getExportContextKeys ( ) . size ( ) ) ; assertEquals ( <NUM_LIT:1> , persistenceManager . getExportPortletsKeys ( ) . size ( ) ) ; return response ; } @ Test public void testSetExportLifetimeNull ( ) throws Exception { try { producer . setExportLifetime ( null ) ; fail ( ) ; } catch ( OperationFailed e ) { } } @ Test public void testSetExportLifetimeInvalidExportContext ( ) throws Exception { try { SetExportLifetime setExportLifetime = WSRPTypeFactory . createSetExportLifetime ( null , new byte [ ] { - <NUM_LIT:10> , <NUM_LIT:24> , <NUM_LIT:24> , <NUM_LIT> , '<CHAR_LIT:a>' , '<CHAR_LIT>' , '<CHAR_LIT>' } , null , null ) ; producer . setExportLifetime ( setExportLifetime ) ; fail ( ) ; } catch ( OperationFailed e ) { } } @ Test public void testSetExport ( ) throws Exception { String handle = getDefaultHandle ( ) ; List < PortletContext > portletContexts = createPortletContextList ( handle ) ; ExportPortlets exportPortlets = createSimpleExportPortlets ( portletContexts ) ; ExportPortletsResponse response = producer . exportPortlets ( exportPortlets ) ; try { PersistedExportData exportData = new PersistedExportData ( "<STR_LIT:foo>" , "<STR_LIT:bar>" ) ; SetExportLifetime setExportLifetime = WSRPTypeFactory . createSetExportLifetime ( null , exportData . encodeAsBytes ( ) , null , null ) ; producer . setExportLifetime ( setExportLifetime ) ; fail ( ) ; } catch ( OperationFailed e ) { } } protected List < PortletContext > getPortletContext ( ExportPortletsResponse exportPortletsResponse ) throws Exception { List < PortletContext > portletContexts = new ArrayList < PortletContext > ( ) ; ExportManager exportManager = new ExportManagerImpl ( ) ; ExportContext exportContext = exportManager . createExportContext ( exportPortletsResponse . getExportContext ( ) ) ; List < ExportedPortlet > exportedPortlets = exportPortletsResponse . getExportedPortlet ( ) ; for ( ExportedPortlet exportPortlet : exportedPortlets ) { ExportPortletData exportPortletData ; Lifetime lifetime = exportPortletsResponse . getLifetime ( ) ; if ( lifetime != null ) { long currentTime = lifetime . getCurrentTime ( ) . toGregorianCalendar ( ) . getTime ( ) . getTime ( ) ; long terminationTime = lifetime . getTerminationTime ( ) . toGregorianCalendar ( ) . getTime ( ) . getTime ( ) ; long refreshDuration = lifetime . getRefreshDuration ( ) . getTimeInMillis ( lifetime . getCurrentTime ( ) . toGregorianCalendar ( ) ) ; exportPortletData = exportManager . createExportPortletData ( exportContext , currentTime , terminationTime , refreshDuration , exportPortlet . getExportData ( ) ) ; } else { exportPortletData = exportManager . createExportPortletData ( exportContext , - <NUM_LIT:1> , - <NUM_LIT:1> , - <NUM_LIT:1> , exportPortlet . getExportData ( ) ) ; } String portletHandle = exportPortletData . getPortletHandle ( ) ; byte [ ] portletState = exportPortletData . getPortletState ( ) ; portletContexts . add ( WSRPTypeFactory . createPortletContext ( portletHandle , portletState ) ) ; } return portletContexts ; } protected void checkStatePortlet ( String handle , String expectedValue ) throws Exception { GetMarkup getMarkupOriginalStateless = createMarkupRequest ( handle ) ; MarkupResponse responseOriginalStateless = producer . getMarkup ( getMarkupOriginalStateless ) ; assertEquals ( expectedValue , responseOriginalStateless . getMarkupContext ( ) . getItemString ( ) ) ; } protected PortletContext performBlockingInteractionOnSessionPortlet ( String handle , String value , StateChange stateChange ) throws Exception { PerformBlockingInteraction pbi = createDefaultPerformBlockingInteraction ( handle ) ; pbi . getInteractionParams ( ) . setPortletStateChange ( stateChange ) ; NamedString namedString = WSRPTypeFactory . createNamedString ( "<STR_LIT:value>" , value ) ; pbi . getInteractionParams ( ) . getFormParameters ( ) . add ( namedString ) ; BlockingInteractionResponse response = producer . performBlockingInteraction ( pbi ) ; PortletContext portletContext = response . getUpdateResponse ( ) . getPortletContext ( ) ; return portletContext ; } protected ImportPortlet createSimpleImportPortlet ( String importId , String handle ) throws IOException { ExportPortletData exportPortletData = new ExportPortletData ( handle , null ) ; byte [ ] exportData = exportPortletData . encodeAsBytes ( ) ; return WSRPTypeFactory . createImportPortlet ( importId , exportData ) ; } protected List < ImportPortlet > createImportPortletList ( ImportPortlet ... importPortlets ) { List < ImportPortlet > importPortletList = new ArrayList < ImportPortlet > ( ) ; for ( ImportPortlet importPortlet : importPortlets ) { importPortletList . add ( importPortlet ) ; } return importPortletList ; } protected ImportPortlets createSimpleImportPortlets ( byte [ ] importContext , List < ImportPortlet > importPortletsList ) { Lifetime lifetime = null ; UserContext userContext = null ; RegistrationContext registrationContext = null ; return WSRPTypeFactory . createImportPortlets ( registrationContext , importContext , importPortletsList , userContext , lifetime ) ; } @ Test public void testSimpleCopyPortletNullRegistrations ( ) throws Exception { String handle = getDefaultHandle ( ) ; List < PortletContext > portletContexts = createPortletContextList ( handle ) ; CopyPortlets copyPortlets = createSimpleCopyPortlets ( portletContexts ) ; CopyPortletsResponse response = producer . copyPortlets ( copyPortlets ) ; checkSimpleCopyPortletsResponse ( response , createStringList ( handle ) , createStringList ( ) ) ; checkDefaultMarkup ( response . getCopiedPortlets ( ) . get ( <NUM_LIT:0> ) . getNewPortletContext ( ) . getPortletHandle ( ) , null ) ; } @ Test public void testSimpleCopyPortletFromRegistrationNull ( ) throws Exception { try { RegistrationData toRegistrationData = WSRPTypeFactory . createRegistrationData ( "<STR_LIT>" , "<STR_LIT>" , true ) ; RegistrationContext toRegistrationContext = producer . register ( toRegistrationData ) ; String handle = getDefaultHandle ( ) ; List < PortletContext > portletContexts = createPortletContextList ( handle ) ; CopyPortlets copyPortlets = createSimpleCopyPortlets ( portletContexts ) ; copyPortlets . setToRegistrationContext ( toRegistrationContext ) ; CopyPortletsResponse response = producer . copyPortlets ( copyPortlets ) ; checkSimpleCopyPortletsResponse ( response , createStringList ( handle ) , createStringList ( ) ) ; checkDefaultMarkup ( response . getCopiedPortlets ( ) . get ( <NUM_LIT:0> ) . getNewPortletContext ( ) . getPortletHandle ( ) , toRegistrationContext ) ; try { checkDefaultMarkup ( response . getCopiedPortlets ( ) . get ( <NUM_LIT:0> ) . getNewPortletContext ( ) . getPortletHandle ( ) , null ) ; fail ( "<STR_LIT>" ) ; } catch ( InvalidHandle e ) { } } catch ( Exception e ) { System . out . println ( "<STR_LIT>" ) ; e . printStackTrace ( ) ; throw new Exception ( e ) ; } } @ Test public void testSimpleCopyPortletToRegistrationNull ( ) throws Exception { RegistrationData fromRegistrationData = WSRPTypeFactory . createRegistrationData ( "<STR_LIT>" , "<STR_LIT>" , true ) ; RegistrationContext fromRegistrationContext = producer . register ( fromRegistrationData ) ; String handle = getDefaultHandle ( ) ; List < PortletContext > portletContexts = createPortletContextList ( handle ) ; CopyPortlets copyPortlets = createSimpleCopyPortlets ( portletContexts ) ; copyPortlets . setFromRegistrationContext ( fromRegistrationContext ) ; CopyPortletsResponse response = producer . copyPortlets ( copyPortlets ) ; checkSimpleCopyPortletsResponse ( response , createStringList ( handle ) , createStringList ( ) ) ; checkDefaultMarkup ( response . getCopiedPortlets ( ) . get ( <NUM_LIT:0> ) . getNewPortletContext ( ) . getPortletHandle ( ) , fromRegistrationContext ) ; try { checkDefaultMarkup ( response . getCopiedPortlets ( ) . get ( <NUM_LIT:0> ) . getNewPortletContext ( ) . getPortletHandle ( ) , null ) ; fail ( "<STR_LIT>" ) ; } catch ( InvalidHandle e ) { } } @ Test public void testSimpleCopyPortletWithRegistrations ( ) throws Exception { RegistrationData fromRegistrationData = WSRPTypeFactory . createRegistrationData ( "<STR_LIT>" , "<STR_LIT>" , true ) ; RegistrationContext fromRegistrationContext = producer . register ( fromRegistrationData ) ; RegistrationData toRegistrationData = WSRPTypeFactory . createRegistrationData ( "<STR_LIT>" , "<STR_LIT>" , true ) ; RegistrationContext toRegistrationContext = producer . register ( toRegistrationData ) ; String handle = getDefaultHandle ( ) ; List < PortletContext > portletContexts = createPortletContextList ( handle ) ; CopyPortlets copyPortlets = createSimpleCopyPortlets ( portletContexts ) ; copyPortlets . setFromRegistrationContext ( fromRegistrationContext ) ; copyPortlets . setToRegistrationContext ( toRegistrationContext ) ; CopyPortletsResponse response = producer . copyPortlets ( copyPortlets ) ; checkSimpleCopyPortletsResponse ( response , createStringList ( handle ) , createStringList ( ) ) ; String portletHandle = response . getCopiedPortlets ( ) . get ( <NUM_LIT:0> ) . getNewPortletContext ( ) . getPortletHandle ( ) ; checkDefaultMarkup ( portletHandle , toRegistrationContext ) ; try { checkDefaultMarkup ( portletHandle , fromRegistrationContext ) ; fail ( "<STR_LIT>" ) ; } catch ( InvalidHandle e ) { } try { checkDefaultMarkup ( portletHandle , null ) ; fail ( "<STR_LIT>" ) ; } catch ( InvalidHandle e ) { } } @ Test public void testCopyPortletNullRegistrationWithRR ( ) throws Exception { producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( true ) ; List < PortletContext > portletContexts = createPortletContextList ( getDefaultHandle ( ) ) ; CopyPortlets copyPortlets = createSimpleCopyPortlets ( portletContexts ) ; try { producer . copyPortlets ( copyPortlets ) ; fail ( "<STR_LIT>" ) ; } catch ( InvalidRegistration e ) { } } @ Test public void testCopyPortletNonRegisteredToRegistration ( ) throws Exception { RegistrationContext invalidRegistrationContext = WSRPTypeFactory . createRegistrationContext ( "<STR_LIT>" ) ; List < PortletContext > portletContexts = createPortletContextList ( getDefaultHandle ( ) ) ; CopyPortlets copyPortlets = createSimpleCopyPortlets ( portletContexts ) ; copyPortlets . setToRegistrationContext ( invalidRegistrationContext ) ; try { producer . copyPortlets ( copyPortlets ) ; fail ( ) ; } catch ( InvalidRegistration e ) { } } @ Test public void testCopyPortletNonRegisteredFromRegistration ( ) throws Exception { RegistrationContext invalidRegistrationContext = WSRPTypeFactory . createRegistrationContext ( "<STR_LIT>" ) ; List < PortletContext > portletContexts = createPortletContextList ( getDefaultHandle ( ) ) ; CopyPortlets copyPortlets = createSimpleCopyPortlets ( portletContexts ) ; copyPortlets . setFromRegistrationContext ( invalidRegistrationContext ) ; try { producer . copyPortlets ( copyPortlets ) ; fail ( ) ; } catch ( InvalidRegistration e ) { } } @ Test public void testCopyPortletNullPortletContexts ( ) throws Exception { List < PortletContext > portletContexts = null ; CopyPortlets copyPortlets = new CopyPortlets ( ) ; try { producer . copyPortlets ( copyPortlets ) ; fail ( ) ; } catch ( MissingParameters e ) { } } @ Test public void testCopyPortletsEmptyPortletContexts ( ) throws Exception { List < PortletContext > portletContexts = new ArrayList < PortletContext > ( ) ; CopyPortlets copyPortlets = new CopyPortlets ( ) ; copyPortlets . getFromPortletContexts ( ) . addAll ( portletContexts ) ; try { producer . copyPortlets ( copyPortlets ) ; fail ( ) ; } catch ( MissingParameters e ) { } } @ Test public void testCopyPortletsInvalidPortletContexts ( ) throws Exception { String fakePortletContext1 = "<STR_LIT>" ; String fakePortletContext2 = "<STR_LIT>" ; List < PortletContext > portletContexts = createPortletContextList ( fakePortletContext1 , fakePortletContext2 ) ; CopyPortlets copyPortlets = createSimpleCopyPortlets ( portletContexts ) ; CopyPortletsResponse response = producer . copyPortlets ( copyPortlets ) ; assertEquals ( <NUM_LIT:0> , response . getCopiedPortlets ( ) . size ( ) ) ; assertEquals ( <NUM_LIT:1> , response . getFailedPortlets ( ) . size ( ) ) ; final FailedPortlets failedPortlets = response . getFailedPortlets ( ) . get ( <NUM_LIT:0> ) ; assertTrue ( failedPortlets . getPortletHandles ( ) . contains ( fakePortletContext1 ) ) ; assertTrue ( failedPortlets . getPortletHandles ( ) . contains ( fakePortletContext2 ) ) ; assertTrue ( failedPortlets . getErrorCode ( ) . getLocalPart ( ) . contains ( "<STR_LIT>" ) ) ; } @ Test public void testCopyPortletsMixedPortletContexts ( ) throws Exception { String fakePortletContext1 = "<STR_LIT>" ; String fakePortletContext2 = "<STR_LIT>" ; List < PortletContext > portletContexts = createPortletContextList ( fakePortletContext1 , getDefaultHandle ( ) , fakePortletContext2 ) ; CopyPortlets copyPortlets = createSimpleCopyPortlets ( portletContexts ) ; CopyPortletsResponse response = producer . copyPortlets ( copyPortlets ) ; assertEquals ( <NUM_LIT:1> , response . getFailedPortlets ( ) . size ( ) ) ; FailedPortlets failedPortlets = response . getFailedPortlets ( ) . get ( <NUM_LIT:0> ) ; assertTrue ( failedPortlets . getPortletHandles ( ) . contains ( fakePortletContext1 ) ) ; assertTrue ( failedPortlets . getPortletHandles ( ) . contains ( fakePortletContext2 ) ) ; assertTrue ( failedPortlets . getErrorCode ( ) . getLocalPart ( ) . contains ( "<STR_LIT>" ) ) ; assertEquals ( <NUM_LIT:1> , response . getCopiedPortlets ( ) . size ( ) ) ; assertEquals ( getDefaultHandle ( ) , response . getCopiedPortlets ( ) . get ( <NUM_LIT:0> ) . getFromPortletHandle ( ) ) ; assertFalse ( response . getCopiedPortlets ( ) . get ( <NUM_LIT:0> ) . getNewPortletContext ( ) . getPortletHandle ( ) . equals ( getDefaultHandle ( ) ) ) ; } protected CopyPortlets createSimpleCopyPortlets ( List < PortletContext > portletContexts ) { RegistrationContext toRegistrationContext = null ; UserContext toUserContext = null ; RegistrationContext fromRegistrationContext = null ; UserContext fromUserContext = null ; return WSRPTypeFactory . createCopyPortlets ( toRegistrationContext , toUserContext , fromRegistrationContext , fromUserContext , portletContexts ) ; } protected void checkSimpleCopyPortletsResponse ( CopyPortletsResponse response , List < String > success , List < String > failure ) { assertEquals ( success . size ( ) , response . getCopiedPortlets ( ) . size ( ) ) ; for ( CopiedPortlet copiedPortlet : response . getCopiedPortlets ( ) ) { assertTrue ( success . contains ( copiedPortlet . getFromPortletHandle ( ) ) ) ; } assertEquals ( failure . size ( ) , response . getFailedPortlets ( ) . size ( ) ) ; for ( FailedPortlets failedPortlet : response . getFailedPortlets ( ) ) { assertTrue ( failure . containsAll ( failedPortlet . getPortletHandles ( ) ) ) ; } for ( CopiedPortlet copiedPortlet : response . getCopiedPortlets ( ) ) { assertFalse ( copiedPortlet . getFromPortletHandle ( ) . equals ( copiedPortlet . getNewPortletContext ( ) . getPortletHandle ( ) ) ) ; } } protected void checkDefaultMarkup ( String portletHandle , RegistrationContext registrationContext ) throws Exception { GetMarkup getMarkup = createDefaultGetMarkup ( portletHandle ) ; getMarkup . setRegistrationContext ( registrationContext ) ; MarkupResponse response = producer . getMarkup ( getMarkup ) ; String defaultMarkup = "<STR_LIT>" ; MarkupContext markupContext = response . getMarkupContext ( ) ; assertNotNull ( markupContext ) ; assertEquals ( "<STR_LIT:text/html>" , markupContext . getMimeType ( ) ) ; assertTrue ( markupContext . getItemString ( ) . contains ( defaultMarkup ) ) ; } protected List < String > createStringList ( String ... names ) { List < String > list = new ArrayList < String > ( names . length ) ; for ( int i = <NUM_LIT:0> ; i < names . length ; i ++ ) { list . add ( names [ i ] ) ; } return list ; } @ Test public void testClonePortletAvailabilityRR ( ) throws Exception { producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( true ) ; checkClonePortletAvailability ( ) ; } @ Test public void testClonePortletAvailabilityNRR ( ) throws Exception { producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( false ) ; checkClonePortletAvailability ( ) ; } public void checkClonePortletAvailability ( ) throws Exception { RegistrationData registrationDataA = WSRPTypeFactory . createRegistrationData ( "<STR_LIT>" , "<STR_LIT>" , true ) ; RegistrationContext registrationContextA = producer . register ( registrationDataA ) ; RegistrationData registrationDataB = WSRPTypeFactory . createRegistrationData ( "<STR_LIT>" , "<STR_LIT>" , true ) ; RegistrationContext registrationContextB = producer . register ( registrationDataB ) ; checkClonePortletAvailability ( registrationContextA , registrationContextB ) ; } public void checkClonePortletAvailability ( RegistrationContext registrationContextA , RegistrationContext registrationContextB ) throws Exception { PortletContext portletContext = WSRPTypeFactory . createPortletContext ( getDefaultHandle ( ) ) ; ClonePortlet clonePortlet = WSRPTypeFactory . createClonePortlet ( registrationContextA , portletContext , null ) ; PortletContext clonedPortletContext = producer . clonePortlet ( clonePortlet ) ; assertFalse ( portletContext . getPortletHandle ( ) . equals ( clonedPortletContext . getPortletHandle ( ) ) ) ; GetMarkup getMarkupA = createDefaultGetMarkup ( clonedPortletContext . getPortletHandle ( ) ) ; getMarkupA . setRegistrationContext ( registrationContextA ) ; producer . getMarkup ( getMarkupA ) ; try { GetMarkup getMarkupB = createDefaultGetMarkup ( clonedPortletContext . getPortletHandle ( ) ) ; getMarkupB . setRegistrationContext ( registrationContextB ) ; producer . getMarkup ( getMarkupB ) ; fail ( "<STR_LIT>" ) ; } catch ( InvalidHandle e ) { } } @ Test public void testClonePortletAvailabilityNonRegisteredA ( ) throws Exception { producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( false ) ; RegistrationData registrationDataA = WSRPTypeFactory . createRegistrationData ( "<STR_LIT>" , "<STR_LIT>" , true ) ; RegistrationContext registrationContextA = producer . register ( registrationDataA ) ; checkClonePortletAvailability ( registrationContextA , null ) ; } @ Test public void testClonePortletAvailabilityNonRegisteredB ( ) throws Exception { producer . getConfigurationService ( ) . getConfiguration ( ) . getRegistrationRequirements ( ) . setRegistrationRequired ( false ) ; RegistrationData registrationDataB = WSRPTypeFactory . createRegistrationData ( "<STR_LIT>" , "<STR_LIT>" , true ) ; RegistrationContext registrationContextB = producer . register ( registrationDataB ) ; checkClonePortletAvailability ( null , registrationContextB ) ; } @ Test public void testClonePortletAvailabilityNullRegistered ( ) throws Exception { RegistrationContext registrationContextA = null ; RegistrationContext registrationContextB = null ; String handle = getDefaultHandle ( ) ; PortletContext portletContext = WSRPTypeFactory . createPortletContext ( getDefaultHandle ( ) ) ; ClonePortlet clonePortlet = WSRPTypeFactory . createClonePortlet ( registrationContextA , portletContext , null ) ; PortletContext clonedPortletContext = producer . clonePortlet ( clonePortlet ) ; assertFalse ( portletContext . getPortletHandle ( ) . equals ( clonedPortletContext . getPortletHandle ( ) ) ) ; GetMarkup getMarkupA = createDefaultGetMarkup ( clonedPortletContext . getPortletHandle ( ) ) ; getMarkupA . setRegistrationContext ( registrationContextA ) ; producer . getMarkup ( getMarkupA ) ; GetMarkup getMarkupB = createDefaultGetMarkup ( clonedPortletContext . getPortletHandle ( ) ) ; getMarkupB . setRegistrationContext ( registrationContextB ) ; producer . getMarkup ( getMarkupB ) ; } protected String getMostUsedPortletWARFileName ( ) { return TEST_BASIC_PORTLET_WAR ; } } </s>
<s> 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 ; public class ApplicationScopeSetPortlet extends GenericPortlet { public void processAction ( ActionRequest actionRequest , ActionResponse actionResponse ) throws PortletException , PortletSecurityException , IOException { PortletSession session = actionRequest . getPortletSession ( ) ; session . setAttribute ( "<STR_LIT>" , actionRequest . getParameter ( "<STR_LIT>" ) , PortletSession . APPLICATION_SCOPE ) ; } } </s>
<s> package org . gatein . wsrp . portlet . utils ; import javax . servlet . http . HttpSession ; import org . apache . catalina . connector . Request ; import org . gatein . wsrp . test . support . MockHttpSession ; public class MockRequest extends Request { HttpSession session ; public MockRequest ( ) { super ( ) ; this . session = MockHttpSession . createMockSession ( ) ; } @ Override public String getMethod ( ) { return "<STR_LIT:GET>" ; } @ Override public HttpSession getSession ( ) { return this . session ; } @ Override public HttpSession getSession ( boolean create ) { if ( session == null && create ) { session = MockHttpSession . createMockSession ( ) ; } return session ; } @ Override public String getScheme ( ) { return "<STR_LIT:http>" ; } @ Override public String getServerName ( ) { return "<STR_LIT:localhost>" ; } @ Override public int getServerPort ( ) { return <NUM_LIT> ; } } </s>
<s> package org . gatein . wsrp . portlet . utils ; import java . io . Serializable ; import javax . xml . bind . annotation . XmlRootElement ; @ XmlRootElement public class TestObject implements Serializable { private static final long serialVersionUID = <NUM_LIT:1L> ; private String firstName ; private String lastName ; private String username ; private Integer employeeNumber ; private String email ; public TestObject ( ) { } public TestObject ( String firstName , String lastName , String username , Integer employeeNumber , String email ) { this . firstName = firstName ; this . lastName = lastName ; this . username = username ; this . employeeNumber = employeeNumber ; this . email = email ; } public TestObject ( TestObject object ) { this . firstName = object . getFirstName ( ) ; this . lastName = object . getLastName ( ) ; this . username = object . getUsername ( ) ; this . employeeNumber = object . getEmployeeNumber ( ) ; this . email = object . getEmail ( ) ; } public String getFirstName ( ) { return firstName ; } public void setFirstName ( String firstName ) { this . firstName = firstName ; } public String getLastName ( ) { return lastName ; } public void setLastName ( String lastName ) { this . lastName = lastName ; } public String getUsername ( ) { return username ; } public void setUsername ( String username ) { this . username = username ; } public Integer getEmployeeNumber ( ) { return employeeNumber ; } public void setEmployeeNumber ( Integer employeeNumber ) { this . employeeNumber = employeeNumber ; } public String getEmail ( ) { return email ; } public void setEmail ( String email ) { this . email = email ; } @ Override public boolean equals ( Object obj ) { if ( obj instanceof TestObject ) { TestObject object = ( TestObject ) obj ; if ( this . getUsername ( ) . equals ( object . getUsername ( ) ) ) return true ; } return false ; } @ Override public int hashCode ( ) { return super . hashCode ( ) + this . getUsername ( ) . hashCode ( ) ; } @ Override public String toString ( ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( "<STR_LIT>" ) ; builder . append ( firstName ) ; builder . append ( "<STR_LIT:U+002CU+0020>" ) ; builder . append ( lastName ) ; builder . append ( "<STR_LIT:U+002CU+0020>" ) ; builder . append ( username ) ; builder . append ( "<STR_LIT:U+002CU+0020>" ) ; builder . append ( employeeNumber ) ; builder . append ( "<STR_LIT:U+002CU+0020>" ) ; builder . append ( email ) ; builder . append ( "<STR_LIT:.>" ) ; return builder . toString ( ) ; } } </s>
<s> 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 ; public class ResourcePortlet extends GenericPortlet { protected void doView ( RenderRequest request , RenderResponse response ) throws PortletException , PortletSecurityException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; Writer writer = response . getWriter ( ) ; writer . write ( "<STR_LIT>" + response . encodeURL ( request . getContextPath ( ) + "<STR_LIT>" ) + "<STR_LIT>" ) ; } } </s>
<s> 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 ; public class EncodeURLPortlet extends GenericPortlet { protected void doView ( RenderRequest request , RenderResponse response ) throws PortletException , PortletSecurityException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; Writer writer = response . getWriter ( ) ; writer . write ( response . encodeURL ( response . createActionURL ( ) . toString ( ) ) ) ; writer . write ( "<STR_LIT:n>" ) ; writer . write ( response . encodeURL ( response . createRenderURL ( ) . toString ( ) ) ) ; } } </s>
<s> 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 ; public class MarkupPortlet extends GenericPortlet { private final String SYMBOL = "<STR_LIT>" ; private final String VALUE = "<STR_LIT:value>" ; private final String RHAT = "<STR_LIT>" ; private final String AAPL = "<STR_LIT>" ; private final String HELP = "<STR_LIT>" ; private final String RHAT_VALUE = "<STR_LIT>" ; private final String AAPL_VALUE = "<STR_LIT>" ; public void processAction ( ActionRequest req , ActionResponse resp ) throws PortletModeException , IOException { String symbol = req . getParameter ( SYMBOL ) ; if ( HELP . equalsIgnoreCase ( symbol ) ) { resp . sendRedirect ( "<STR_LIT>" ) ; 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 , "<STR_LIT>" ) ; } resp . setPortletMode ( PortletMode . VIEW ) ; } protected void doView ( RenderRequest request , RenderResponse response ) throws IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; Writer writer = response . getWriter ( ) ; writer . write ( "<STR_LIT>" ) ; writer . write ( getSymbol ( request ) ) ; writer . write ( "<STR_LIT>" ) ; writer . write ( getValue ( request ) ) ; writer . write ( "<STR_LIT>" ) ; } private String getValue ( RenderRequest request ) { String value = request . getParameter ( VALUE ) ; return value == null ? "<STR_LIT>" : value ; } private String getSymbol ( RenderRequest request ) { String symbol = request . getParameter ( SYMBOL ) ; return symbol == null ? "<STR_LIT>" : symbol ; } protected void doEdit ( RenderRequest request , RenderResponse response ) throws PortletException , PortletSecurityException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; Writer writer = response . getWriter ( ) ; StringBuffer sb = new StringBuffer ( <NUM_LIT> ) ; sb . append ( "<STR_LIT>" ) . append ( response . createActionURL ( ) ) . append ( "<STR_LIT>" ) . append ( response . getNamespace ( ) ) . append ( "<STR_LIT>" ) . append ( SYMBOL ) . append ( "<STR_LIT>" ) ; writer . write ( sb . toString ( ) ) ; } } </s>
<s> package org . gatein . wsrp . portlet ; 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 ; public class SessionPortlet extends GenericPortlet { private static final String COUNT = "<STR_LIT:count>" ; protected void doView ( RenderRequest req , RenderResponse resp ) throws PortletException , PortletSecurityException , IOException { resp . setContentType ( "<STR_LIT:text/html>" ) ; PrintWriter writer = resp . getWriter ( ) ; PortletSession session = req . getPortletSession ( ) ; int count = <NUM_LIT:0> ; if ( session . getAttribute ( COUNT ) != null ) { count = ( ( Integer ) session . getAttribute ( COUNT ) ) . intValue ( ) + <NUM_LIT:1> ; } session . setAttribute ( COUNT , new Integer ( count ) ) ; writer . write ( "<STR_LIT>" + session . getId ( ) + "<STR_LIT>" ) ; writer . write ( "<STR_LIT>" + count + "<STR_LIT>" ) ; writer . write ( "<STR_LIT>" + resp . createRenderURL ( ) + "<STR_LIT>" ) ; writer . close ( ) ; } } </s>
<s> 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 ; public class ResourceNoEncodeURLPortlet extends GenericPortlet { protected void doView ( RenderRequest request , RenderResponse response ) throws PortletException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; Writer writer = response . getWriter ( ) ; writer . write ( "<STR_LIT>" + request . getContextPath ( ) + "<STR_LIT>" ) ; } } </s>
<s> package org . gatein . wsrp . portlet ; import java . io . IOException ; import javax . portlet . EventRequest ; import javax . portlet . EventResponse ; import javax . portlet . GenericPortlet ; import javax . portlet . PortletException ; import javax . portlet . PortletRequestDispatcher ; import javax . portlet . RenderRequest ; import javax . portlet . RenderResponse ; public class EventConsumerPortlet extends GenericPortlet { @ Override public void doView ( RenderRequest request , RenderResponse response ) throws PortletException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; String param = request . getParameter ( "<STR_LIT>" ) ; request . setAttribute ( "<STR_LIT>" , param ) ; PortletRequestDispatcher dispatcher = getPortletContext ( ) . getRequestDispatcher ( "<STR_LIT>" ) ; dispatcher . include ( request , response ) ; } @ Override public void processEvent ( EventRequest request , EventResponse response ) throws PortletException , IOException { String param = ( String ) request . getEvent ( ) . getValue ( ) ; response . setRenderParameter ( "<STR_LIT>" , param ) ; } } </s>
<s> 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 ; public class ApplicationScopeGetPortlet extends GenericPortlet { protected void doView ( RenderRequest renderRequest , RenderResponse renderResponse ) throws PortletException , PortletSecurityException , IOException { renderResponse . setContentType ( "<STR_LIT:text/html>" ) ; Writer writer = renderResponse . getWriter ( ) ; writer . write ( "<STR_LIT>" + renderRequest . getPortletSession ( ) . getAttribute ( "<STR_LIT>" , PortletSession . APPLICATION_SCOPE ) ) ; } } </s>
<s> package org . gatein . wsrp . portlet ; import java . io . IOException ; 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 . PortletURL ; import javax . portlet . RenderRequest ; import javax . portlet . RenderResponse ; public class StateCountingPortlet extends GenericPortlet { public void processAction ( ActionRequest request , ActionResponse response ) throws PortletException , PortletSecurityException , IOException { PortletPreferences pp = request . getPreferences ( ) ; String counter = pp . getValue ( "<STR_LIT>" , "<STR_LIT:0>" ) ; int count = Integer . parseInt ( counter ) ; count ++ ; pp . setValue ( "<STR_LIT>" , "<STR_LIT>" + count ) ; pp . store ( ) ; } protected void doView ( RenderRequest request , RenderResponse response ) throws PortletException , PortletSecurityException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; PortletPreferences pp = request . getPreferences ( ) ; String count = pp . getValue ( "<STR_LIT>" , "<STR_LIT:0>" ) ; response . getWriter ( ) . write ( "<STR_LIT>" + count ) ; PortletURL actionURL = response . createActionURL ( ) ; response . getWriter ( ) . write ( "<STR_LIT>" + actionURL + "<STR_LIT>" ) ; } } </s>
<s> package org . gatein . wsrp . portlet ; import java . io . IOException ; import javax . portlet . ActionRequest ; import javax . portlet . ActionResponse ; import javax . portlet . GenericPortlet ; import javax . portlet . PortletException ; import javax . portlet . PortletRequestDispatcher ; import javax . portlet . RenderRequest ; import javax . portlet . RenderResponse ; import javax . xml . namespace . QName ; public class EventGeneratorPortlet extends GenericPortlet { @ Override public void doView ( RenderRequest request , RenderResponse response ) throws PortletException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; PortletRequestDispatcher dispatcher = getPortletContext ( ) . getRequestDispatcher ( "<STR_LIT>" ) ; dispatcher . include ( request , response ) ; } @ Override public void processAction ( ActionRequest request , ActionResponse response ) throws PortletException , IOException { String param = request . getParameter ( "<STR_LIT>" ) ; response . setEvent ( new QName ( "<STR_LIT>" , "<STR_LIT>" ) , param ) ; } } </s>
<s> package org . gatein . wsrp . portlet ; import org . gatein . wsrp . WSRPConstants ; import javax . portlet . EventRequest ; import javax . portlet . EventResponse ; import javax . portlet . GenericPortlet ; import javax . portlet . PortletException ; import javax . portlet . PortletSecurityException ; import javax . portlet . RenderRequest ; import javax . portlet . RenderResponse ; import java . io . IOException ; public class BasicPortlet extends GenericPortlet { protected void doView ( RenderRequest request , RenderResponse response ) throws PortletException , PortletSecurityException , IOException { if ( ! Boolean . TRUE . equals ( request . getAttribute ( WSRPConstants . FROM_WSRP_ATTRIBUTE_NAME ) ) ) { throw new IllegalStateException ( "<STR_LIT>" ) ; } System . out . println ( "<STR_LIT>" ) ; } @ Override public void processEvent ( EventRequest request , EventResponse response ) throws PortletException , IOException { System . out . println ( "<STR_LIT>" + request . getEvent ( ) . getValue ( ) ) ; } } </s>
<s> package org . gatein . wsrp . portlet ; import java . io . IOException ; import java . util . ArrayList ; import java . util . List ; import javax . portlet . ActionRequest ; import javax . portlet . ActionResponse ; import javax . portlet . GenericPortlet ; import javax . portlet . PortletException ; import javax . portlet . PortletRequestDispatcher ; import javax . portlet . RenderRequest ; import javax . portlet . RenderResponse ; import javax . xml . namespace . QName ; import org . gatein . wsrp . portlet . utils . TestObject ; public class EventObjectGeneratorPortlet extends GenericPortlet { private List < TestObject > objects ; @ Override public void init ( ) throws PortletException { super . init ( ) ; objects = new ArrayList < TestObject > ( ) ; objects . add ( new TestObject ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT> , "<STR_LIT>" ) ) ; objects . add ( new TestObject ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT> , "<STR_LIT>" ) ) ; objects . add ( new TestObject ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT> , "<STR_LIT>" ) ) ; objects . add ( new TestObject ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT> , "<STR_LIT>" ) ) ; } public TestObject getTestObjectByUserName ( String username ) { for ( TestObject object : objects ) { if ( object . getUsername ( ) . equals ( username ) ) { return object ; } } return null ; } @ Override public void doView ( RenderRequest request , RenderResponse response ) throws PortletException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; request . setAttribute ( "<STR_LIT>" , objects ) ; PortletRequestDispatcher dispatcher = getPortletContext ( ) . getRequestDispatcher ( "<STR_LIT>" ) ; dispatcher . include ( request , response ) ; } @ Override public void processAction ( ActionRequest request , ActionResponse response ) throws PortletException , IOException { String username = request . getParameter ( "<STR_LIT:username>" ) ; response . setEvent ( new QName ( "<STR_LIT>" , "<STR_LIT>" ) , getTestObjectByUserName ( username ) ) ; } } </s>
<s> package org . gatein . wsrp . portlet ; import java . io . IOException ; import javax . portlet . GenericPortlet ; import javax . portlet . PortletException ; import javax . portlet . RenderRequest ; import javax . portlet . RenderResponse ; import javax . portlet . WindowState ; public class WindowStatesPortlet extends GenericPortlet { @ Override public void doView ( RenderRequest request , RenderResponse response ) throws PortletException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; StringBuffer sb = new StringBuffer ( ) ; sb . append ( "<STR_LIT>" ) ; sb . append ( "<STR_LIT>" ) ; WindowState state = request . getWindowState ( ) ; response . getWriter ( ) . print ( sb . toString ( ) . replace ( "<STR_LIT>" , state . toString ( ) ) ) ; } } </s>
<s> package org . gatein . wsrp . portlet ; import java . io . IOException ; import javax . portlet . GenericPortlet ; import javax . portlet . PortletException ; import javax . portlet . PortletRequestDispatcher ; import javax . portlet . RenderMode ; import javax . portlet . RenderRequest ; import javax . portlet . RenderResponse ; public class PortletModesPortlet extends GenericPortlet { @ Override public void doView ( RenderRequest request , RenderResponse response ) throws PortletException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; PortletRequestDispatcher dispatcher = getPortletContext ( ) . getRequestDispatcher ( "<STR_LIT>" ) ; dispatcher . include ( request , response ) ; } @ Override public void doHelp ( RenderRequest request , RenderResponse response ) throws PortletException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; PortletRequestDispatcher dispatcher = getPortletContext ( ) . getRequestDispatcher ( "<STR_LIT>" ) ; dispatcher . include ( request , response ) ; } @ Override public void doEdit ( RenderRequest request , RenderResponse response ) throws PortletException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; PortletRequestDispatcher dispatcher = getPortletContext ( ) . getRequestDispatcher ( "<STR_LIT>" ) ; dispatcher . include ( request , response ) ; } @ RenderMode ( name = "<STR_LIT>" ) public void doTestMode ( RenderRequest request , RenderResponse response ) throws PortletException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; PortletRequestDispatcher dispatcher = getPortletContext ( ) . getRequestDispatcher ( "<STR_LIT>" ) ; dispatcher . include ( request , response ) ; } } </s>
<s> 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 ; public class MultiValuedPortlet extends GenericPortlet { private static final String MULTI = "<STR_LIT>" ; 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 ( "<STR_LIT:text/html>" ) ; Writer writer = response . getWriter ( ) ; writer . write ( "<STR_LIT>" ) ; String [ ] values = request . getParameterValues ( MULTI ) ; if ( values != null ) { StringBuffer sb = new StringBuffer ( <NUM_LIT:32> ) ; for ( int i = <NUM_LIT:0> ; i < values . length ; i ++ ) { sb . append ( values [ i ] ) ; if ( i != values . length - <NUM_LIT:1> ) { sb . append ( "<STR_LIT:U+002CU+0020>" ) ; } } writer . write ( sb . toString ( ) ) ; } } } </s>
<s> package org . gatein . wsrp . portlet ; import java . io . IOException ; import javax . portlet . ActionRequest ; import javax . portlet . ActionResponse ; import javax . portlet . EventRequest ; import javax . portlet . EventResponse ; import javax . portlet . GenericPortlet ; import javax . portlet . PortletException ; import javax . portlet . PortletRequestDispatcher ; import javax . portlet . RenderRequest ; import javax . portlet . RenderResponse ; import org . gatein . wsrp . portlet . utils . TestObject ; public class EventObjectConsumerPortlet extends GenericPortlet { @ Override public void doView ( RenderRequest request , RenderResponse response ) throws PortletException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; TestObject object = ( TestObject ) request . getPortletSession ( ) . getAttribute ( "<STR_LIT>" ) ; request . setAttribute ( "<STR_LIT>" , object ) ; PortletRequestDispatcher dispatcher = getPortletContext ( ) . getRequestDispatcher ( "<STR_LIT>" ) ; dispatcher . include ( request , response ) ; } @ Override public void processEvent ( EventRequest request , EventResponse response ) throws PortletException , IOException { TestObject object = ( TestObject ) request . getEvent ( ) . getValue ( ) ; request . getPortletSession ( ) . setAttribute ( "<STR_LIT>" , object ) ; } @ Override public void processAction ( ActionRequest request , ActionResponse response ) throws PortletException , IOException { request . getPortletSession ( ) . removeAttribute ( "<STR_LIT>" ) ; } } </s>
<s> package org . gatein . wsrp . portlet ; import java . io . BufferedInputStream ; import java . io . File ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . OutputStream ; import javax . portlet . GenericPortlet ; import javax . portlet . PortletException ; import javax . portlet . PortletRequestDispatcher ; import javax . portlet . RenderRequest ; import javax . portlet . RenderResponse ; import javax . portlet . ResourceRequest ; import javax . portlet . ResourceResponse ; public class ResourceServingPortlet extends GenericPortlet { @ Override public void doView ( RenderRequest request , RenderResponse response ) throws PortletException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; String imageHash = "<STR_LIT>" ; request . setAttribute ( "<STR_LIT>" , imageHash ) ; String imageWidth = "<STR_LIT>" ; String imageHeight = "<STR_LIT>" ; request . setAttribute ( "<STR_LIT>" , imageWidth ) ; request . setAttribute ( "<STR_LIT>" , imageHeight ) ; PortletRequestDispatcher dispatcher = getPortletContext ( ) . getRequestDispatcher ( "<STR_LIT>" ) ; dispatcher . include ( request , response ) ; } @ Override public void serveResource ( ResourceRequest request , ResourceResponse response ) throws PortletException , IOException { response . setContentType ( "<STR_LIT>" ) ; OutputStream out = response . getPortletOutputStream ( ) ; File image = new File ( getPortletContext ( ) . getRealPath ( "<STR_LIT>" ) ) ; BufferedInputStream bis = new BufferedInputStream ( new FileInputStream ( image ) ) ; long length = image . length ( ) ; byte [ ] bytes = new byte [ ( int ) length ] ; bis . read ( bytes , <NUM_LIT:0> , ( int ) length ) ; out . write ( bytes ) ; } } </s>
<s> package org . gatein . wsrp . portlet ; import java . io . IOException ; import javax . portlet . GenericPortlet ; import javax . portlet . PortletException ; import javax . portlet . PortletRequestDispatcher ; import javax . portlet . RenderRequest ; import javax . portlet . RenderResponse ; public class PRPConsumerPortlet extends GenericPortlet { @ Override public void doView ( RenderRequest request , RenderResponse response ) throws PortletException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; String param = request . getParameter ( "<STR_LIT>" ) ; request . setAttribute ( "<STR_LIT>" , param ) ; PortletRequestDispatcher dispatcher = getPortletContext ( ) . getRequestDispatcher ( "<STR_LIT>" ) ; dispatcher . include ( request , response ) ; } } </s>
<s> package org . gatein . wsrp . portlet ; import java . io . IOException ; import javax . portlet . ActionRequest ; import javax . portlet . ActionResponse ; import javax . portlet . GenericPortlet ; import javax . portlet . PortletException ; import javax . portlet . PortletRequestDispatcher ; import javax . portlet . RenderRequest ; import javax . portlet . RenderResponse ; public class PRPGeneratorPortlet extends GenericPortlet { @ Override public void doView ( RenderRequest request , RenderResponse response ) throws PortletException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; PortletRequestDispatcher dispatcher = getPortletContext ( ) . getRequestDispatcher ( "<STR_LIT>" ) ; dispatcher . include ( request , response ) ; } @ Override public void processAction ( ActionRequest request , ActionResponse response ) throws PortletException , IOException { String param = request . getParameter ( "<STR_LIT>" ) ; response . setRenderParameter ( "<STR_LIT>" , param ) ; } } </s>
<s> 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 ; public class GetLocalesPortlet extends GenericPortlet { protected void doView ( RenderRequest request , RenderResponse response ) throws PortletException , PortletSecurityException , IOException { System . out . println ( "<STR_LIT>" ) ; Locale locale = request . getLocale ( ) ; response . setContentType ( "<STR_LIT:text/html>" ) ; PrintWriter writer = response . getWriter ( ) ; writer . print ( locale . getDisplayName ( ) ) ; writer . close ( ) ; } } </s>
<s> 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 ; public class RenderParamPortlet extends GenericPortlet { private static final String NAME = "<STR_LIT:name>" ; private int count = <NUM_LIT:0> ; private static final String OP = "<STR_LIT>" ; private static final String INC = "<STR_LIT>" ; private static final String DEC = "<STR_LIT:-->" ; 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 ( "<STR_LIT>" ) ; } } public void render ( RenderRequest request , RenderResponse response ) throws PortletException , PortletSecurityException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; PrintWriter writer = response . getWriter ( ) ; String name = request . getParameter ( NAME ) ; if ( name == null ) { name = "<STR_LIT>" ; } writer . println ( "<STR_LIT>" + name + "<STR_LIT:!>" ) ; writer . println ( "<STR_LIT>" + count ) ; PortletURL url = response . createRenderURL ( ) ; url . setParameter ( NAME , "<STR_LIT>" ) ; writer . println ( "<STR_LIT>" + url + "<STR_LIT>" ) ; url . setParameter ( NAME , "<STR_LIT>" ) ; writer . println ( "<STR_LIT>" + url + "<STR_LIT>" ) ; url = response . createActionURL ( ) ; url . setParameter ( OP , INC ) ; writer . println ( "<STR_LIT>" + url + "<STR_LIT>" ) ; url . setParameter ( OP , DEC ) ; writer . println ( "<STR_LIT>" + url + "<STR_LIT>" ) ; } } </s>
<s> 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 ; public class ImplicitCloningPortlet extends GenericPortlet { public void processAction ( ActionRequest request , ActionResponse response ) throws PortletException , PortletSecurityException , IOException { String value = request . getParameter ( "<STR_LIT:value>" ) ; if ( value == null ) { value = "<STR_LIT:default>" ; } PortletPreferences pp = request . getPreferences ( ) ; pp . setValue ( "<STR_LIT:name>" , value ) ; pp . store ( ) ; } protected void doView ( RenderRequest request , RenderResponse response ) throws PortletException , PortletSecurityException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; PortletPreferences pp = request . getPreferences ( ) ; String value = pp . getValue ( "<STR_LIT:name>" , "<STR_LIT:default>" ) ; response . getWriter ( ) . write ( value ) ; } } </s>
<s> 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 . PortletPreferences ; import javax . portlet . PortletSecurityException ; import javax . portlet . RenderRequest ; import javax . portlet . RenderResponse ; public class StatePortlet extends GenericPortlet { private static final String COUNT = "<STR_LIT:count>" ; public void processAction ( ActionRequest request , ActionResponse response ) throws PortletException , PortletSecurityException , IOException { String value = request . getParameter ( "<STR_LIT:value>" ) ; if ( value == null ) { value = "<STR_LIT:default>" ; } PortletPreferences pp = request . getPreferences ( ) ; pp . setValue ( "<STR_LIT:name>" , value ) ; pp . store ( ) ; } protected void doView ( RenderRequest req , RenderResponse resp ) throws PortletException , PortletSecurityException , IOException { resp . setContentType ( "<STR_LIT:text/html>" ) ; PortletPreferences pp = req . getPreferences ( ) ; String value = pp . getValue ( "<STR_LIT:name>" , "<STR_LIT:default>" ) ; resp . getWriter ( ) . write ( value ) ; } } </s>
<s> 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 ; public class DispatcherPortlet extends GenericPortlet { protected void doView ( RenderRequest request , RenderResponse response ) throws PortletException , PortletSecurityException , IOException { System . out . println ( "<STR_LIT>" ) ; response . setContentType ( "<STR_LIT:text/html>" ) ; PortletRequestDispatcher rd = getPortletContext ( ) . getRequestDispatcher ( "<STR_LIT>" ) ; rd . include ( request , response ) ; System . out . println ( "<STR_LIT>" ) ; } } </s>
<s> 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 ; public class UserContextPortlet extends GenericPortlet { protected void doView ( RenderRequest request , RenderResponse response ) throws PortletException , PortletSecurityException , IOException { response . setContentType ( "<STR_LIT:text/html>" ) ; Writer writer = response . getWriter ( ) ; writer . write ( "<STR_LIT>" + request . getRemoteUser ( ) ) ; } } </s>
<s> package org . gatein . wsrp . support ; import org . gatein . exports . ExportPersistenceManager ; import org . gatein . exports . data . ExportContext ; import org . gatein . exports . data . ExportPortletData ; import org . gatein . exports . data . PersistedExportData ; import java . io . IOException ; import java . io . UnsupportedEncodingException ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . Set ; import java . util . UUID ; public class TestMockExportPersistenceManager implements ExportPersistenceManager { public static final String PEC_TYPE = "<STR_LIT>" ; public static final double PEC_VERSION = <NUM_LIT:1.0> ; public static final String PED_TYPE = "<STR_LIT>" ; public static final double PED_VERSION = <NUM_LIT:1.0> ; Map < String , ExportContext > exportContexts = new HashMap < String , ExportContext > ( ) ; Map < String , ExportPortletData > exportPortletDatas = new HashMap < String , ExportPortletData > ( ) ; public ExportContext getExportContext ( String refId ) { return exportContexts . get ( refId ) ; } public ExportPortletData getExportPortletData ( String exportContextId , String portletDataID ) { ExportContext exportContext = exportContexts . get ( exportContextId ) ; if ( exportContext . getPortlets ( ) . contains ( portletDataID ) ) { return exportPortletDatas . get ( portletDataID ) ; } else { return null ; } } public Set < String > getExportContextKeys ( ) { return exportContexts . keySet ( ) ; } public Set < String > getExportPortletsKeys ( ) { return exportPortletDatas . keySet ( ) ; } public String getExportReferenceId ( String type , double version , byte [ ] bytes ) throws UnsupportedEncodingException { if ( supports ( type , version ) ) { PersistedExportData persistedExportData = PersistedExportData . create ( bytes ) ; return persistedExportData . getRefId ( ) ; } else { return null ; } } public boolean removeExportContext ( String refId ) { if ( exportContexts . containsKey ( refId ) ) { List < String > portlets = exportContexts . get ( refId ) . getPortlets ( ) ; for ( String portlet : portlets ) { exportPortletDatas . remove ( portlet ) ; } exportContexts . remove ( refId ) ; return true ; } else { return false ; } } public boolean removeExportPortletData ( String exportContextId , String exportDataId ) { if ( exportContexts . containsKey ( exportDataId ) ) { List < String > portlets = exportContexts . get ( exportDataId ) . getPortlets ( ) ; if ( portlets . contains ( exportDataId ) ) { portlets . remove ( exportContextId ) ; exportPortletDatas . remove ( exportDataId ) ; return true ; } } return false ; } public boolean supports ( String type , double version ) { return ( type . equals ( PEC_TYPE ) && ( version == PEC_VERSION ) ) || ( ( type . equals ( PED_TYPE ) && ( version == PED_VERSION ) ) ) ; } public ExportContext updateExportContext ( String refId , ExportContext updatedExportContext ) { if ( updatedExportContext != null && refId != null && exportContexts . containsKey ( refId ) ) { exportContexts . put ( refId , updatedExportContext ) ; return updatedExportContext ; } else { return null ; } } public ExportPortletData updateExportPortletData ( String exportContextId , String exportPortletId , ExportPortletData updatedPortletData ) { if ( updatedPortletData != null && exportPortletId != null && exportContextId != null && exportContexts . containsKey ( exportContextId ) ) { exportPortletDatas . put ( exportPortletId , updatedPortletData ) ; return updatedPortletData ; } else { return null ; } } public byte [ ] encodeExportContext ( String refId ) throws IOException { PersistedExportData persistedExportData = new PersistedExportData ( PEC_TYPE , refId ) ; return persistedExportData . encodeAsBytes ( ) ; } public byte [ ] encodeExportPortletData ( String exportDataRefId ) throws IOException { PersistedExportData persistedExportData = new PersistedExportData ( PED_TYPE , exportDataRefId ) ; return persistedExportData . encodeAsBytes ( ) ; } public String storeExportContext ( ExportContext exportContext ) { if ( exportContext != null ) { String refId = UUID . randomUUID ( ) . toString ( ) ; exportContexts . put ( refId , exportContext ) ; return refId ; } else { return null ; } } public String storeExportPortletData ( ExportContext exportContext , ExportPortletData exportPortletData ) { if ( exportPortletData != null && exportContext != null ) { String refId = UUID . randomUUID ( ) . toString ( ) ; exportContext . addPortlet ( refId ) ; exportPortletDatas . put ( refId , exportPortletData ) ; return refId ; } else { return null ; } } } </s>
<s> package org . gatein . wsrp . config . wci ; import org . gatein . pc . portlet . impl . deployment . DeploymentException ; import org . gatein . pc . portlet . impl . deployment . PortletApplicationDeployer ; import org . gatein . wci . ServletContainerFactory ; import org . gatein . wci . WebAppEvent ; import org . gatein . wci . WebAppLifeCycleEvent ; import org . gatein . wci . WebAppListener ; public class TestWebAppListener implements WebAppListener { protected PortletApplicationDeployer portletApplicationDeployer ; public TestWebAppListener ( ) { ServletContainerFactory . getServletContainer ( ) . addWebAppListener ( this ) ; } public void setPortletApplicationDeployer ( PortletApplicationDeployer portletApplicationDeployer ) { this . portletApplicationDeployer = portletApplicationDeployer ; } @ Override public void onEvent ( WebAppEvent event ) { if ( portletApplicationDeployer != null ) { if ( event instanceof WebAppLifeCycleEvent ) { WebAppLifeCycleEvent lifeCycleEvent = ( WebAppLifeCycleEvent ) event ; int type = lifeCycleEvent . getType ( ) ; if ( type == WebAppLifeCycleEvent . ADDED ) { try { portletApplicationDeployer . add ( lifeCycleEvent . getWebApp ( ) . getServletContext ( ) ) ; } catch ( DeploymentException e ) { e . printStackTrace ( ) ; } } else if ( type == WebAppLifeCycleEvent . REMOVED ) { portletApplicationDeployer . remove ( lifeCycleEvent . getWebApp ( ) . getServletContext ( ) ) ; } } } } } </s>